Flipbox-Talk

Summary: Talk page for Flipbox
Maintainer: Petko

Line 39

Line 39 should be return "{$m[1]}\t\t\t$id\t\t\t{$m[2]}";

instead of return "${m[1]}\t\t\t$id\t\t\t{$m[2]}"; ?

Thanks for noticing, yes, for PHP 8.2. Updated for version 20240918. --Petko

Additional checkbox [q]

In the editor of a page > use markup [x] or [_] > Save > pngs display correctly and are clickable

In the editor of a page > use markup [q] > Save > displays [q] and its not clickable

In order to correct this, one as to go back to edit mode and change all [q] markups to [x] or [_] --Alex

The [q] checkbox is not enabled by default, you need to add a configuration variable in local/config.php, see Flipbox#toc-4.1. --Petko


Older questions

This is very cool. Do you have any suggestions for how this markup could be combined with either the core features (include, pagelist, page text variables) or a cookbook recipe such as fox, or both, to display only unchecked items from an included page, or, better yet, from a pagelist of pages? Using a page text variable approach runs into the problems of naming and arrays: either each item needs to be assigned a unique PTV name, or you run into the problem that PTV are not arrays and, thus, you only return a single value from any page that contains multiple PTV. An approach that posts each item to a separate page whose contents then get included, or not, depending on some conditional that applies to that entire page runs up against the limitation in Flipbox that included flipboxes can not be edited. Pico January 25, 2009, at 10:18 AM

You can add to pub/css/local.css this code after the one suggested above :
div.uncheckedonly .fbx {display: none;}
and then, use in the page
>>uncheckedonly<<
...your checklist...
>><<
It is currently impossible to save edited checkboxes from included pages or PTVs, and will not be, unless huge changes are made to both this recipe and the PmWiki's Include markup. I have no idea when and if that will happen. --Petko January 25, 2009, at 11:09 AM

Hi Petko, I like the recipe! There's a small issue, though - everytime the state of a flipbox is changed, the whole history is deleted. The solution is simple, just change:

$page = RetrieveAuthPage($pagename,$auth,0, READPAGE_CURRENT);

to

$page = RetrieveAuthPage($pagename,$auth,0, 0);

For an explanation, see here. Greetings from Germany, mzuther January 28, 2009

Thanks, I haven't noticed it as the SQLite recipe I use handles page history automatically. [1] Now fixed. --Petko January 28, 2009, at 07:51 AM

Hi, I've installed Flipbox according to the directions. It works, but the state of the box isn't saved. Whenever the page is reloaded, the boxes go back to the way they were set in page editing mode. What should I do? Thanks. -David

Does the demo work for you? Does it work with another browser (Firefox, MSIE6+, Opera, Chrome)? The recipe works for me, and I also just tried it on a fresh PmWiki-2.2.0 installation here, so I suspect the problem is either with your browser, or with some config.php settings. Also note that it may take a couple of seconds for the page to be saved. --Petko March 28, 2009, at 04:44 AM

Thanks for the response. The demo works fine. It doesn't work on my site with IE, Chrome, or Firefox. I am using authuser. Could that affect it? Thanks again. -David

You may need to log in. Flipbox modifies the page only if the visitor has "edit" permissions. Or you need to add to config.php $HandleAuth['flipbox'] = 'read'; to only require "read" permissions. --Petko March 30, 2009, at 01:26 PM

I also tried a fresh installation of pmwiki, and flipbox works fine. There's got to be some difference in my configuration. I am logging in. I'll keep hunting. Thanks. -David

I am also experiencing the same issues. I've tried updating the config.php to only require read permissions with out success. -dlawler

It seemed to be a version issue. It turned out I was using 2.1.x and upgrading to 2.2.1 fixed it. -David

Thanks. The recipe uses a function added to the core at 2.2.0-beta12. Now added this requirement to the recipe-info block above. --Petko April 04, 2009, at 02:42 AM

Very nice recipe. I wonder if it could work in a sortable table column - so you could choose the rows you want by using the flipbox and then sort to get the flipped list to the top (or bottom) of the table? --Matt

Short example:

(:sortable:)

ABCheck
1A[_]
2B[_]
3C[_]

Thanks. I wonder the same thing :-) I'll try to find some time to test if it work with sortable or not. --Petko October 17, 2009, at 03:07 AM

What would happen if we set a flag so that flipbox could just put x's and o's instead of an image? Would sortable work then? February 10, 2010 --Matt

That is a good idea -- I modified the scripts to allow the display of x's and o's instead of an image -- see notes about installation and usage at Flipbox-Sortable. --Petko February 11, 2010, at 07:39 AM

Fantastic! Thank you! --Matt


SteP December 14, 2009: Hi Petko, this looks very cool, thanks! Is it possible to test a flipbox variable state with conditional markup? This doesn't seem to work (it always says "unckecked"):

Variable: [_]
(:if equal '[x]' '{$:Variable}':)CHECKED!(:else:)unchecked(:ifend:)

No it is not -- flipboxes are processed before most other markup including conditionals and PTV -- that is required for the script to know the exact number of the flipbox you clicked on. A compromise is necessary between simplicity of markup/usage and number of features -- otherwise you'd have to write not [_] and [x] but (:flipbox SOME-UNIQUE-ID OFF:) and (:flipbox SOME-OTHER-UNIQUE-ID ON:). That would of course be another recipe... --Petko December 19, 2009, at 04:17 AM


Nice recipe!! Is there a way to "lock" pages, such that checkbox states can no longer be altered?

Greets! -- Michael, August 12, 2011

Yes, with the latest version, open a link like [[YourPage?action=lockflipbox]] and unlockflipbox to unlock them. Demo --Petko August 12, 2011, at 08:56 PM

Quite Fantastic!! Thanks Petko! -- Michael, August 22, 2011


Amazing Recipe. Two questions: 1. Are we restricted to 3 states? [_] [x] and [q]? I know you said you could change the q to some other letter, but can we have a total of say 4 options? 2. Is it possible to use a character, perhaps from the wingdings font, instead of the bit image? Thanks Petko. Vince Oct 9 201 929 PM

1. No, use $FlipboxChoices = 'abcdefgh0123456'; if you need, and clicks will flip all choices one after another (only letters a-zA-Z and digits 0-9)have . 2. No, but you can create small png pictures with the symbols. --Petko October 08, 2011, at 10:20 PM


Is there a way of counting the number of "ticked" vs "unticked" boxes on a page? I'm using the standard [_], [x] as well as the [q] formats.

I have this idea of having a summary at the top of the page that tells me (and others), at a glance, the state of the TODO items (done vs yet-to-do).

(I thought I might try combining this with the VoteCounter recipe somehow, but I got stuck.)

Still, Flipbox is sooooo useful for me. It's great! Thanks, Petko!

-- AllanGN, April 12, 2012


First Thank you, Petko

Flipbox suffers from the preg_replace /e is deprecated issue.

I put a bug in the PITS and included a patch.

-- Gerry 2014-June-14

Talk page for the Flipbox recipe (users).