[pmwiki-users] pmwiki 2.0.0 - wikiform 1.28 - new issue and page name

Sergio Andreozzi sergio.andreozzi at cnaf.infn.it
Fri Sep 2 20:22:30 CDT 2005


Sergio Andreozzi wrote:
> Hello,
> 
> I'm trying the latest pmwiki with wikiform.
> I've installed follwing the guide and I've define a form template 
> (Task.FormTemplate).
> 
> When I create a page like Task.New containing
> (:wikiform:)
> I get the form properly displayed.
> 
> When I fill it and submit, it happens that the issue get the same page 
> name of the one containing the (:wikiform:) tag. I was expecting to see 
> something like Task.00001 and the Task.New be unchanged.
> 
> Any idea?

I've found the bug:

if ($action=='posteform' || $action == 'saveeform') {
     Lock(2);
     $action = 'edit';                <-------------
     $_POST[$WikiFormSubmit] = 1;
     $EditMessageFmt = "<p class='vspace'>Review, make any edits, then 
press 'Save'</p>";
     if ($action=='posteform') {      <-------------
         $g = 
SetFormGroup($_REQUEST['n'],$WikiFormPageFmt,$WikiFormGroupFmt);
         SDV($RecordStartingNumber,0);
         $record = $RecordStartingNumber;
         foreach(ListPages("/^$g\\.\\d/") as $i)
             $record = max(@$record,substr($i,strlen($g)+1));
         $pagename = sprintf("$g.%05d",@$record+1);
     }


the condition in the nested if generating the page name can never be 
satisfied as $action will be always equal to edit.

This is a workaround, but I suggest the author to better check it

if ($action=='posteform' || $action == 'saveeform') {
     Lock(2);
     $action_tmp=$action;                <-------------  workaround
     $action = 'edit';
     $_POST[$WikiFormSubmit] = 1;
     $EditMessageFmt = "<p class='vspace'>Review, make any edits, then 
press 'Save'</p>";
     if ($action_tmp=='posteform') {      <-----------  workaround
         $g = 
SetFormGroup($_REQUEST['n'],$WikiFormPageFmt,$WikiFormGroupFmt);
         SDV($RecordStartingNumber,0);
         $record = $RecordStartingNumber;
         foreach(ListPages("/^$g\\.\\d/") as $i)
             $record = max(@$record,substr($i,strlen($g)+1));
         $pagename = sprintf("$g.%05d",@$record+1);
     }


Cheers, Sergio





More information about the pmwiki-users mailing list