On Tue, 12 Oct 2004 02:41:10 +1000, Murray @ PlanetThoughtful
<[EMAIL PROTECTED]> wrote:
> User A finishes his or her page edit and commits the changes, but the
> underlying record was already changed by User B's page rename. User A's edit
> changes overwrite this update in the record in question, and now that record
> still shows 'old val' instead of 'new val', since that was what was in the
> content when User A began editing the page.
> 

This is a bit of a quandary, but I've run into it before with multiple
developers working on the same source tree.  I'm going to try to
translate my knowledge of that scenario to a web application.

I would have a timestamp in the database that contains the last time
the row was edited , which would be stored in a hidden field on the
edit page.  On submit, compare the timestamp to the row you're editing
(find it by using the primary key, rather than content).  If the
timestamp in the DB is newer than the edited content, you'll need to
force a content merge.

As for the merge:  Display User A's content next to what is now in the
database (User B's edits).  You'll also want the new timestamp in a
hidden field at this point.  Allow User A to make changes to the final
content, trusting that they'll do the right thing.  Then once you hit
save, compare the (new) timestamp to the one in the DB.  If the
database has been edited yet again, do another merge.  If not, save,
update the timestamp, and you're good to go.

That should handle the 'unfinished edit' problem.  If the user takes a
day off, and wanted to continue with the same edit, they'll be
presented with the updated content at the end of the process, which
they can then work into their version.

How does that sound?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to