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

noskule noskule at gmx.net
Sun Jul 15 12:00:28 CDT 2007


Tim Pascal schrieb:
> 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?

I don't no if this is possible, but a simple workaround would be to only
show the "New Issue" button if the user has editperms. You can do that
with conditional markup

in config.php
$HandleAuth['zap'] ='edit';


in wiki:
(:if auth edit:)[[NewIssueForm]](:ifend:)

 My thanks in
> advance for any insights that someone could provide - code would be
> cool too :)
> 
> Tim Pascal
> Winnipeg, MB Canada
> 





> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
> 




More information about the pmwiki-users mailing list