01194: Contains the '[[PmWiki/AvailableActions|action]]' links (like Browse, Edit, History, etc.), placed at the top of the page, see [[PmWiki/site page actions]]

Summary: Enhance Site.PageActions
Created: 2010-05-15 13:27
Status: Open
Category: Feature
From: Maddes
Assigned:
Priority: 3
Version: 2.2.16
OS: Debian 5.0 Lenny, Apache 2.2.9, PHP 5.2.6

Description:

  • Enhance Site.PageActions to show only actions the user has permissions for (possible through PITS.01164).
  • Provide login and logout actions plus show user if AuthUser is enabled.

The following code has been tested for password authorization and user authorization via AuthUser.

(:Summary:Contains the '[[PmWiki/AvailableActions|action]]' links (like Browse, Edit, History, etc.), placed at the top of the page, see [[PmWiki/site page actions]]:)
(:comment This page can be somewhat complex to figure out the first time you see it. Its contents are documented at PmWiki.SitePageActions if you need help. :)
* %item rel=nofollow class=browse    accesskey='$[ak_view]'%      [[{*$FullName}               | $[View] ]]
(:if ( ! action edit && auth edit ) :)
* %item rel=nofollow class=edit      accesskey='$[ak_edit]'%      [[{*$FullName}?action=edit   | $[Edit] ]]
(:ifend:)
(:if ( ! action diff && auth diff ) :)
* %item rel=nofollow class=diff      accesskey='$[ak_history]'%   [[{*$FullName}?action=diff   | $[History] ]]
(:ifend:)
(:if ( ! action upload && auth upload ) :)
* %item rel=nofollow class=upload    accesskey='$[ak_attach]'%    [[{*$FullName}?action=upload | $[Attach] ]]
(:ifend:)
(:if ( ! action print ) :)
* %item rel=nofollow class=print     accesskey='$[ak_print]'%     [[{*$FullName}?action=print  | $[Print] ]]
(:ifend:)
(:if ( ! action search && group Site,SiteAdmin,Cookbook,Profiles,PmWiki* ) :) (:comment delete if and ifend to enable backlinks:)
* %item rel=nofollow class=backlinks accesskey='$[ak_backlinks]'% [[{*$Name}?action=search&q=link={*$FullName} | $[Backlinks] ]]
(:ifend:)
(:if ( !enabled AuthPw && !authid ) :)
* %item rel=nofollow class=login     accesskey='$[ak_login]'%''   [-[[{*$FullName}?action=login | $[Login] ]]-]''
(:ifend:)
(:if ( enabled AuthPw || authid ) :)
* %item rel=nofollow class=logout    accesskey='$[ak_logout]'%''  [-[[{*$FullName}?action=logout | $[Logout] ]]-]''
(:ifend:)
(:if authid :)
* (User: {$AuthId})
(:ifend:)

--Maddes May 15, 2010, at 01:31 PM


Site.PageActions currently (on PmWiki) supports this for upload and logout.
My use case is that for the other actions, although the user may not have permissions, they need to see the available actions, as they will authorise themselves when prompted.

simon May 17, 2010, at 06:01 PM

I prefer that users login explicitly, but this is personal preference. Even if this is not wanted by the PmWiki authors, then still several things from the above code could be added to PmWiki (login, logout, username, "! action" handling, etc.) - Maddes May 23, 2010, at 07:08 PM