[pmwiki-users] EnableDrafts and PmForm

Criss Ittermann crisses at kinhost.org
Tue Dec 9 17:53:54 CST 2014


Something is weird in my installation.

I have 
$EnableDrafts = 1; // in case you were wondering

Whether I view Profile-Data/Criss or Profile-Data/Criss-Draft it shows the Profile-Data/Criss data.  There is no -Draft page being created when I'm admin (verified in wiki.d).  So it's the opposite problem: I'm not viewing the -Draft page -- when I'm trying to view the -Draft data page, it's showing me the base data page -- very weird.  Both the PTVs being pulled in and the PmForm auto-filled data are the same because there is no -Draft being created at all.

I saved a normal wiki page as a draft just to make sure that drafts are working at all -- yes they are.


My PmForm is very long.  Since the body of the form is fine (it is pulling in the correct data from the -Draft page), I'll truncate it (omitted with ...):

[[#profileform]]
(:input pmform target=profileform :)
(:input default source=Profile-Data.{$Name}-Draft,Profile-Data.{$Name} :)
(:input default request=1 :)
(:messages:)
||width=100%
|| [[#form|First Name%poptip%required%%]]: (:input text $:first size=25 :)|||| [[#form|Middle Initial%poptip%optional%%]]: (:input text $:initial size=25 :)|||| [[#form|Last Name%poptip%required%%]]: (:input text $:last size=25 :)||||
...
(:input submit post Save:)
(:if auth admin:)
(:input submit postdraft "Save draft":)
(:else:)
(:input hidden postdraft 1:)
(:if:)
(:input end:)
[[#profileformend]]
[[#profilepost]]
(:template defaults savevars=$:pic,$:logo,$:aka,$:busname,$:city,$:email,$:email2,$:email3,$:fax,$:ieeenum,$:first,$:hcity,$:home,$:home2,$:hstate,$:hzip,$:initial,$:last,$:linkedin,$:mobile,$:phone,$:position,$:state,$:street,$:street2,$:suffix,$:website,$:zip,$:skills,$:longdesc,$:honor :)
[[#profilepostend]]

I had some code to >only< allow non-admin editors to edit their own profile page, I commented it out for the moment just to make sure it wasn't causing any issues with this part of my installation.

The only other thing I can think of is if there were any other files that changed other than scripts/drafts.php and scripts/forms.php -- were there any changes to pmform.php?  Anything else?  I did not change out my whole installation with what is in svn, only the files that were mentioned.



> On Dec 9, 2014, at 4:05 PM, Petko Yotov <5ko at 5ko.fr> wrote:
> 
> Could you please double check that after you press "Save draft" then open the non-draft page, you have actually opened the *non-draft* page? If you simply click on the "edit" link for the non-draft page, and there is a draft page, PmWiki actually opens the draft page for editing - this is normal and expected.
> 
> For me the "save draft" button updates only the draft page. Here are my two pmform templates:
> 
> [[#dataform]]
> (:input pmform target=savedata :)
> (:input default source={*$FullName}-Draft,{*$FullName} :)
> (:input default request=1 :)
> (:messages:)
> || Name:||(:input text $:name size=25 :) ||
> || Email:||(:input text $:email size=25 :) ||
> (:input submit post Save:)
> (:if auth admin:)
> (:input submit postdraft "Save draft":)
> (:else:)
> (:input hidden postdraft 1:)
> (:if:)
> (:input end:)
> * '''{*$FullName}''': Name={{*$FullName}$:name}, E-mail={{*$FullName}$:email}
> * '''{*$FullName}-Draft''': Name={{*$FullName}-Draft$:name}, E-mail={{*$FullName}-Draft$:email}
> [[#dataformend]]
> 
> [[#datapost]]
> (:template defaults savevars=$:name,$:email :)
> [[#datapostend]]
> 
> Near the end of the #dataform snippet, I placed the variables from both the draft page and the public page, just to see if it works. As admin, when I press "Save draft", only the draft variables are created or modified. When I press "Save", the draft page is deleted and the public page variables are updated.
> 
> Note also that, if there is a draft page, with the line
> 
>   (:input default source={*$FullName}-Draft,{*$FullName} :)
> 
> the form is pre-filled with the variables from the draft page, this is also normal and expected.
> 
> Petko
> 
> On 09.12.2014 20:51, Criss Ittermann wrote:
>> Hi, Just a reminder, and clarification if it isn't clear:
>> this partly works:
>> a -Draft is created.
>> the webpage DOES pre-populate with -Draft data over the original page
>> data.
>> The unprivileged editor only sees 1 button, as desired.
>> However the buttons behave identically, updating both the normal page
>> AND draft page whether submitted as admin or as unprivileged editor.
>> So the buttons behave exactly the same and update both pages.
>> Crisses
>>> On Nov 19, 2014, at 8:44 AM, Criss Ittermann <crisses at kinhost.org>
>>> wrote:
>>> I updated forms.php and drafts.php from svn.
>>> I changed the button-end of my profile PmForm to:
>>> (:input submit post Save:)
>>> (:if auth admin:)
>>> (:input submit postdraft "Save draft":)
>>> (:else:)
>>> (:input hidden postdraft 1:)
>>> (:if:)
>>> (:input end:)
>>> [[#profileformend]]
>>> Per the emailed instructions.
>>> When I'm logged in as admin, "Save" and "Save Draft" both save to
>>> the Profile's Data (_and_ Draft) page.
>>> Same when logged in as non-admin, only there's just one "Save"
>>> button.
>>> So it's creating/updating both, populated with the same data.
>>> By manually changing the -Draft, I can tell the form is correctly
>>> pre-populating from the Draft page.
>>> Thank you for the new feature (in progress)!
>>> Criss IttermannBusiness Coach, Eclectic Tech LLC
>>> http://EclecticTech.net/Events/ [1]
>>> 845-820-0262
>>> On Nov 13, 2014, at 4:05 PM, Petko Yotov <5ko at 5ko.fr> wrote:
>>> On 12.11.2014 19:56, Petko Yotov wrote:
>>> To be clear, only the posting and saving to a draft page can be
>>> configured. Opening a PmForm on an existing page will display the
>>> data
>>> from the real page, not from an existing draft page.
>>> Well, I committed to Subversion a change that would allow to define
>>> more than one source= pages in input default. One could write:
>>> (:input default source={*$FullName}-Draft,{*$FullName}:)
>>> Then the values will be taken from the first page which exists and
>>> for which the user has read permissions.
>>> This needs testing so please get the forms.php file, test the
>>> feature and report any problems.
>>> Petko
> 
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141209/8026616c/attachment.html>


More information about the pmwiki-users mailing list