[pmwiki-users] Progress, new issue

Peter Bowers pbowers at pobox.com
Fri Nov 6 06:41:46 CST 2015


On Wed, Nov 4, 2015 at 1:21 AM, <chris at christopherbartels.com> wrote:

> now I can’t edit the new pages aside from when I was creating them new-
> can only edit new pages, not existing ones, as there’s no ‘edit’ link in
> the page somehow. I also lost my ‘edit sidebar’ link at the bottom [2].


It appears you have edited your Site.PageActions (
http://www.pmwiki.org/wiki/PmWiki/SitePageActions) to provide links such as
contribute, guidelines, about us, and contact us. Unfortunately in the
process you deleted or deactivated the standard pmwiki actions which
include the edit.

Oh, I see. I took a look using
https://govt.exposed/Site/PageActions?action=source [1] and I'm afraid
you've got your Site.PageActions pretty messed up. You'll need to go look
at http://www.pmwiki.org/wiki/PmWiki/SitePageActions (referenced above) and
*carefully* follow the instructions and examples there. You can't just
throw in the conditionals wherever and however it makes sense to you...
Your conditionals are not being opened in the right place and aren't being
closed until well after you intend it (either (:if ...:) or (:ifend:)
closes the conditional.)

In the example from that page:

===(snip)===

...

(:if auth upload:)
* %item rel=nofollow class=upload    accesskey='$[ak_attach]'%
[[{*$FullName}?action=upload | $[Attach] ]]
(:ifend:)

...

===(snip)===

Notice how the conditional is opened on the line *above* and then closed on
the line *below*. There may be flexibility for doing some fancy stuff
within the line, but start basic: follow the example as they do it and wait
until you get that working before you step out into something more
complicated.

And you don't want to repeat a given accesskey. And if you are hardcoding a
certain page then you have to hardcode it in the link as well as the
conditional. Etc.

Probably your page:

===(snip)===

...

* %item rel=nofollow class=browse    accesskey='$[ak_view]'% (:if auth
admin Main.HomePage:)      [[{*$FullName}               | $[View] ]]
* %item rel=nofollow class=edit      accesskey='$[ak_edit]'% (:if auth
admin Main.HomePage:)     [[{*$FullName}?action=edit   | $[Edit] ]]
* %item rel=nofollow class=edit      accesskey='$[ak_edit]'% (:if auth
admin Site.Contribute:)     [[{*$FullName}?action=edit   | $[Edit] ]]
* %item rel=nofollow class=edit      accesskey='$[ak_edit]'% (:if auth
admin Site.Guidelines:)     [[{*$FullName}?action=edit   | $[Edit] ]]

...

===(snip)===

is supposed to look something more like this:

===(snip)===
...
* %item rel=nofollow class=browse    accesskey='$[ak_view]'%
 [[{*$FullName}               | $[View] ]]
(:if auth edit "{*$FullName}" :)
* %item rel=nofollow class=edit      accesskey='$[ak_edit]'%
 [[{*$FullName}?action=edit   | $[Edit] ]]
* %item rel=nofollow class=diff      accesskey='$[ak_history]'%
[[{*$FullName}?action=diff   | $[History] ]]
(:if auth edit "Site.Contribute" :)
* %item rel=nofollow class=edit      %
   [[Site.Contribute?action=edit   | Contribute ]]
(:if auth edit "Site.Guidelines":)
* %item rel=nofollow class=edit      '%  [[Site.Guidelines?action=edit   |
Guidelines ]]
(:ifend:)
...
===(snip)===

(Note that while I explicitly use (:ifend:) only once, all the other (:if
...:) clauses are neatly ended via the beginning of the next (:if ...:)
clause. Note also that I'm not repeating accesskey='$[ak_edit]' as it only
makes sense to use it once unless your conditions reliably result in a
mutually exclusive situation.)

This leaves the "Contribute" and "Guidelines" links editing those
respective pages which is probably not what you want to do, but hopefully
this gets you started down the right road.

(If you are using another skin you may find that some other page besides
Site.PageActions is used.)

You owe it to yourself to read over the basics of the pmwiki docs to learn
how links work and conditionals and stuff like that. It will save you a lot
of headache in the long run...

-Peter

[1] Incidentally, you may want to shut down that potential security hole -
see http://www.pmwiki.org/wiki/PmWiki/PasswordsAdmin and
http://www.pmwiki.org/wiki/PmWiki/Security which both detail how to limit
?action=source to those with edit or admin authorization
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20151106/187b4c16/attachment.html>


More information about the pmwiki-users mailing list