[pmwiki-devel] How to allow a choice of edit forms

John Rankin john.rankin at affinity.co.nz
Sun May 8 20:22:40 CDT 2011


On 8/05/11 7:40 PM, Randy Brown wrote:
> So what's the best way to allow users a choice of forms? Should I create separate actions to invoke each? (I've never created an action, but I hope it's not too hard to do.) Or can I use action=edit and configure some PHP code somewhere so that it does the proper Post handling based on the edit form that was used to do the Post?
You may be able to redefine the $EditFunctions array to add another 
processing step before posting the page, to put the pieces together so 
that the PostPage function has the data it expects to work with. The 
$EditFunctions array is processed in the UpdatePage function, so in 
theory, you could completely redefine how editing works by mapping 
$EditFunctions to a local set of operations. If you search the 
pmwiki.php source for "$EditFunctions" you should be able to work out 
what pmwiki is doing in the HandleEdit function, which handles 
action=edit. As far as I can tell, "HandleEdit" doesn't know much about 
what is going on -- it hands control to the processing steps defined in 
$EditFunctions.

I say "in theory" as I have only done this using the other method you 
identified -- introducing a new action. From the way you describe it, I 
*think* you ought to be able to satisfy your requirements with an edit 
function that takes a read page apart so it can populate your edit form 
and another that puts an edited page back together so it can be posted, 
if these are executed at the right places in the processing sequence.

JR

-- 
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
M 021 RANKIN
john.rankin at affinity.co.nz
www.affinity.co.nz




More information about the pmwiki-devel mailing list