[pmwiki-users] modifying wikish renaming pages/groups scripts to update links with spaces

tamouse mailing lists tamouse.lists at gmail.com
Mon Jul 23 13:46:35 CDT 2012

On Jul 22, 2012 11:01 PM, "Alex Eftimiades" <alexeftimiades at gmail.com>
> Hi again, I tried making this a page action as follows (in
> * %item rel=nofollow% {(wikish source
{$SiteGroup}.PageActions#RenamePage)}Rename Page:(:input text name=NewPage
value={$FullName} size=30:)(:input submit name=submit value=Rename:)(:input
> (:if false:)
> [[#RenamePage]]
> wikish_form quickform process
> if test -n "${submit}"
> then
>   if test "${NewPage}" ~= "/^[a-z0-9-]+(\.|\/)[a-z0-9-]+$/i"
>   then
>     if test {$Name}!={$Group}
>       then
>       set -s NewPagePN = `echo ${NewPage} | sed 's|\s||gi' | sed
>       sed -i
`pagelist link={$FullName} sep=\n`
>       mv {$FullName} ${NewPagePN}
>       wikish_form redirect target=${NewPagePN}
>   fi
> fi
> [[#RenamePage]]
> (:ifend:)
> But with this setup the rename button is disabled. Could anyone tell me
what part of this I need to fix? Perhaps I am going about this wrong.
> Thanks,
> Alex
> On Jul 21, 2012, at 10:16 PM, Alex Eftimiades wrote:
>> Yes this seems to work now. Thank you very much. I am going to try to
modify this into a page action and for renaming groups.
>> Thanks
>> Alex
>> On Jul 21, 2012, at 12:53 PM, Peter Bowers wrote:
>>> No that's fine.  If it's an action you do on a regular basis then
>>> you'll probably want to put the code on a page and put it together
>>> with a form, but that can easily be a future step.  Doing it in the
>>> ControlPanel is a good way to get things working...
>>> I loaded the first command from your command history and noticed that
>>> you have a newline in the middle of the line that should read like
>>> this:
>>> sed -i 's|${OldGroup}([./]\)?)${OldPage}|${NewGroup}$1${NewPage}|gi'
>>> `pagelist link=${OldGroupPN}.${OldPagePN} sep=\n`
>>> That should all be on one line with no newline before the `pagelist...
>>> It may have gotten confusing because the email may have automatically
>>> wordwrapped it when I sent it to you.
>>> Anyway, I certainly don't want to come anywhere close to actually
>>> running code like this on someone else's system, so I'm just letting
>>> you know what needs to happen and then leave it up to you.
>>> If that works, please report back to the list that it was just a
>>> newline due to the email wordwrapping.  If it doesn't work then let me
>>> know and I'll take another look -- just give me the exact error
>>> message since I'm wanting to avoid actually executing anything on your
>>> system.
>>> -Peter
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Something about the idea of putting sort of thing in PageActions like this
scares me. It seems like a chance for vandalization to occur of a sort that
would be hard to recover from. Wikish may be highly useful, but I think
this action would be better raised to a first-class recipe with attendant
authorization and validation, if one is going to make available on
PageActions. Just my deux centimes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20120723/90634daa/attachment.html>

More information about the pmwiki-users mailing list