[pmwiki-users] ZAP - Evoking the Password Form for Zap-Protected pages

Tim Pascal timpascal at gmail.com
Fri Jul 13 12:35:21 CDT 2007


As a user, I've been stretching beyond the basic wiki stuff to
experiment with forms. I have found Zap to be very friendly in terms
of getting something working without a lot of in-depth knowledge about
coding. Using the Rolodex snippet as a starting point I've managed to
create a page that defaults to a view, but can be toggled to an update
form. The code looks like this:

(:zapform:)

(:if ! equal {$myaction} "Update" :)
(:table border=0 cellspacing=0 width=100%:)
(:cellnr width=150 align=right:)'''Issue Name:'''
(:cell:){$:Name}
(:cellnr width=150 align=right:)'''Date:'''
(:cell:){$:Date}
(:cellnr width=150 align=right:)'''Severity:'''
(:cell:){$:Severity}
(:cellnr width=150 align=right:)'''Description:'''
(:cell:){$:Description}
(:tableend:)
(:input hidden myaction {button}:)
(:ifend:)

(:if equal {$myaction} "Update" :)
(:table border=0 cellspacing=0 width=100%:)
(:cellnr width=150 align=right:)'''Issue Name:'''
(:cell:)(:input text Name {$:Name} size=60:)
(:cellnr width=150 align=right:)'''Date:'''
(:cell:)(:input text Date {$:Date} size=60:)
(:cellnr width=150 align=right:)'''Severity:'''
(:cell:)(:input text Severity {$:Severity} size=60:)
(:cellnr width=150 align=right:)'''Description:'''
(:cell:)(:textarea name=Description cols=47 rows=7:)(:keep
{$:Description}:)(:textareaend:)
(:tableend:)
(:input hidden savedata "Name,Date,Severity,Description":)
(:ifend:)

(:input hidden passdata myaction:)
(:input submit button "Update":)
(:zapend:)
>>red<<
(:messages:)
>><<

My intent is to use this code in a template to create issues pages in
a defined group (say Issues). I want the Read (default) view - of
these pages to be wide open but I want the Update view of these pages
to be password protected. My thought was to use the built-in Zap
password - so I created a password in Issues.GroupAttributes. Now when
the Update button is clicked, Zap provides the message:

 "You are not authorized to submit this form."

So rather than have this message display, how can I have the more
standard PmWiki behavior of providing a password form and then
returning to the Zap form with a successful password? My thanks in
advance for any insights that someone could provide - code would be
cool too :)

Tim Pascal
Winnipeg, MB Canada



More information about the pmwiki-users mailing list