ActionMenu

Summary: Drop-down menu to page actions (Edit, History, Attach...) instead of links.
Version: 20170618
Prerequisites: PmWiki 2.2.58 or later
Status: Beta
Maintainer: Petko
Categories: Forms, Markup, Menus, PHP55, PHP72
Users: (view? / edit)
Discussion: ActionMenu-Talk
License: GPL3+

Description

A drop-down menu to page actions (Edit, History, Attach...) instead of links.. When a user selects some action from the menu, the current page is open with this action, for example ActionMenu?action=diff.

On some wiki designs a drop-down menu may be more convenient than a list of links. For example, in minimalist or mobile skins, a drop-down menu takes less screen area.

Installation

Copy actionmenu.phpΔ to your /cookbook/ directory. Add to config.php such a line:

  include_once("$FarmD/cookbook/actionmenu.php");

In the page Site.PageActions, or in a SideBar, GroupHeader or GroupFooter, add the following markup:

(:actions browse="$[View]" edit="$[Edit]" upload="?$[Attach]":)

The markup should start at the beginning of a line. The actions are in the format actionname="Menu label" where actionname could be browse, edit, diff, upload, attr, backlinks, logout, or any other core action or added by recipes.

The recipe tries to work in a smart way:

  • if the action "browse" is selected, the page will be opened without any action
  • if the visitor is not logged in, the "logout" action will be hidden
  • the action "backlinks" actually opens a search for link=CurrentPage like here on pmwiki.org
  • actions can be shown only if the visitor has permissions for these actions, add a question mark at the beginning of the text label:
    upload="?Attach" attr="?Attributes"

It is possible to display some short text on the same line, before and after the drop-down select-box:

  (:actions "Text before" browse="$[View]" edit="$[Edit]" "Text after":)
  (:actions "" browse="$[View]" edit="$[Edit]" "Text after":)

Larger example:

(:actions "Select action:" browse="$[View]" edit="$[Edit]" diff="$[History]" upload="?$[Attach]" attr="?$[Attributes]" print="$[Print]" backlinks="$[Backlinks]" diag="Diagnostic" ruleset="Rule set" phpinfo="PHP info" logout="$[Logout]":)
Select action:

!! Configuration

Usage

Select an action from the drop-down menu. If your browser has JavaScript enabled, the action will open immediately. Users with JavaScript disabled can press on a "Go" button (that button is hidden if JavaScript is enabled).

!! Notes

Change log / Release notes

  • 20170618 update for PHP 7.2
  • 20150422 fix for international page names, update for PHP 5.5.
  • 20111004 first public release, ready to be tested.

See also

Cookbook /
JumpBox  A pull down menu that can be used for navigation
OptionMenu  Get page listings as an option menu selector (Stable)

Contributors

  • Recipe written and maintained by Petko (5ko [snail] 5ko [period] fr).
  • If this recipe helps you or saves you time, you can help support its continued development by .

Comments

See discussion at ActionMenu-Talk.

User notes? : 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.