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.

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_COOKIE] => imstime=1777470760; PHPSESSID=au6c4vs0lbb1te7s6gam1isk66
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2fActionMenu
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2fActionMenu
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/ActionMenu
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook/ActionMenu
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afINUF7cn37fbjO9yeWiHQAAAEU
            [REDIRECT_URL] => /wiki/Cookbook/ActionMenu
            [REMOTE_ADDR] => 216.73.216.31
            [REMOTE_PORT] => 31338
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook/ActionMenu
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/ActionMenu
            [SCRIPT_URL] => /wiki/Cookbook/ActionMenu
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afINUF7cn37fbjO9yeWiHQAAAEU
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777470800.6266
            [REQUEST_TIME] => 1777470800
            [argv] => Array
                (
                    [0] => n=Cookbook%2fActionMenu
                )

            [argc] => 1
        )

)