[pmwiki-users] Can Foxedit warn of or flag simultaneous edit conflicts?

Hans design5 at softflow.co.uk
Wed Dec 30 06:08:31 CST 2009

Sunday, December 27, 2009, 8:29:23 PM, Randy Brown wrote:

> I use a modifying version of EditPTVForm, for both page text
> variables and sections. (Fox seems to treat them interchangeably.)
> So I'll be interested in how to set that up.

okay, I worked out a solution which may be general enough.
I'll outline it here and wait for feedback on this proposal,
before I go ahead and publish it.

It requires changes to fox.php, foxedit.php and foxedit forms.
It can use a time check or a text check.

If a basetime field is set, catching the unix timestamp when the edit
form is opened, Fox will check if the page modify time is later,
indicating another edit, and will go back to the edit form with the
change displayed, and a warning. The additional field needed for this
is (:input hidden basetime {(ftime %s)} :)

If a hidden basetext field is added to a section edit form,
Fox will check if  a change occured from the text to be edited
when the form is opend to when it is saved.
An added field (:input hidden basetext:) is needed for the standard
section edit form.

For the standard PTV edit form a hidden field
(:input hidden base_{$EditSection} :) is needed.

For a custom edit form for editing several PTVs at once
the PTVs need to be listed via parameter ptvfields=....
and an additional hidden field is needed for each PTV,
like (:input hidden base_ptvname :)

In all cases if there is a conflict Fox will return the user to the
edit form, and display the changed values in the edit field(s), with
a warning that a change has occured. The input from the user is lost,
no merging is attempted.

I've set the warning to be displayed by (:foxmessages:) markup like this:
  $FoxMsgFmt[] = '$[Warning: The text you are editing has been modified since you started editing it!]';
  $FoxMsgFmt[] = '$[Please review the modified text below!]';

More technically:
fox.php has changes to check for a basetime in the FoxUpdatePages
function, for checking basetext in FoxReplaceText function, and for
checking PTVs in FoxPTVAddUpdate function.
foxedit.php has a new routine to set InputValues for the various
text and PTV fields (setting it for the hidden 'base....' fields).
It also has a new routine to save the original url by which the edit
form is called, because Fox needs it to return the user to the form,
exacly as it was called. The url is saved as a session variable.

Randy, perhaps I can post the new files to you privately, before
going public with them, and ask you to test them?


More information about the pmwiki-users mailing list