|
Cookbook /
OptionMenuSummary: Get page listings as an option menu selector
Version: 2010-02-18
Status: Stable
Prerequisites: pmwiki-2.x
Maintainer: Dfaure
DescriptionThe fploptionmenu.phpΔ script provides the extra
NotesThe Javascript enabled browser would have the button kept hidden and page navigation triggered directly by selection changes. The new format option understands the following
Caution: Do not forget to set unique names when using several forms on the same page. The following customization variables are available:
ContributorsSee AlsoRelease Notes
CommentsNice recipe. One problem: if I put multiple pagelists on a page, the first one does not have a "Go" button, while the rest do. It would also be nice to be able to control the style of the form (for example, make the text larger), but I don't know how to do that. Is that possible? RandyB July 31, 2010, at 11:29 PM Randy, see comment from Dfaure above "Do not forget to set unique names when using several forms on the same page". With unique names you'll find no "Go" button if JavaScript is enabled and one per each w/o JavaScript ($EnableFPLOptionMenuJS=0;). By the way, as fare as I know you can just control the style regarding vertical size but it is possible to modify the style with selclass by CSS. Hope that helps. - Holger August 01, 2010, at 04:37 AM Dfaure, I just found two bugs. If you use the option $EnableFPLOptionMenuJS=1 you can't choose the first entry. The 2nd bug is related to the generated page link (w/o JavaScript). In view mode there is no problem but if you try to edit the page respectively to add action=edit, the page name changed to the ScriptURL. It could be that this is just because of Clean-URLs but it leads to potential failures. Can you confirm this behavior? - comment by Holger July 31, 2010, at 07:06 AM The javascript event handling doesn't allow you to trigger an event for the default option menu entry (ie. the first displayed). The next version should provide some kind of workaround for this. --Dfaure August 01, 2010, at 11:34 PM Thanks for the fast reply. :-) Can you confirm the wrong path w/o JavaScript as well? - Holger August 02, 2010, at 05:00 PM Seems to always start a new line, how to prevent - so input box follows in-line with prior text? 2010.05.17 --AmberG? By default, forms are rendered as block. You may have it displayed inline with the help of some extra css style definition like below in your local.css file. --Dfaure May 17, 2010, at 05:38 PM
.fploptionmenu { display: inline; }
Thnx, it worked. Now a problem with the javascript action on the selected item (function handleOptionMenu). It doesn't seem to be written to the page header output. I have tried to set $EnableFPLOptionMenuJS = 1; in local/config.php before include but that has no effect. I cannot see anywhere else it is set. 2010.05.20 --AmberG? See below --Dfaure September 15, 2011, at 09:29 AM Is there any chance of providing some installation instructions. I cannot get this to work - but then I am guessing what to do. Thanks, Alan. The recipe script should be installed as usual ones. --Dfaure August 12, 2010, at 10:15 AM I've installed this in the usual fashion, by placing the php script in
$EnableFPLOptionMenuJS=1;
include("$FarmD/cookbook/fploptionmenu.php");
I've created a pagelist in my sidebar to jump to the various category pages in the wiki. Here's the markup: (:pagelist group=Category fmt=optionmenu form=categorylist list=normal:) The page renders as expected, however, no javascript code for the handleOptionMenu function is emitted. Please see example at http://wiki-stage.tamaratemple.com/(approve links) --tamouse September 14, 2011, at 10:18 PM The recipes javascript code is provided to the page (as the additional header array entry Unfortunately, when the sidebar is rendered in the skin (thanks to the The solution is to "manually" provide it to the page from the configuration page:
$HTMLHeaderFmt['optionmenu'] = "<script type='text/javascript'><!--
function handleOptionMenu(menu, script_url, path_info) {
location.href = script_url + (path_info ?
('/' + menu.options[menu.selectedIndex].value.replace('.', '/')) :
('?n=' + menu.options[menu.selectedIndex].value));
} //--></script>\n";
$EnableFPLOptionMenuJS=0;
include("$FarmD/cookbook/fploptionmenu.php");
--Dfaure September 15, 2011, at 09:29 AM User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |