|
Posted by Sandman on 11/15/05 11:33
In article <dlc8n3$qi6$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com>,
"Angelos" <angelos@redcatmedia.net> wrote:
> Hello, I am developing a CMS and I would like add the following
> functionality:
> - User A logs in.
> - User B logs in.
> - User A Edits page X
> - User B Is informed that User A is loged in and edits page X so user B is
> not able to edit page X until user A saves the page.
>
> Ofcourse that's not so difficult if you set a flag in the database
> for example that the current document is being edited, and remove the flag
> when the user saves the document and exits.
>
> BUT what happens if user exit the editing page without folowing any link or
> submit button that I can control. What happens if his computer
> restarts/crashes or he kills the browser or if his internet connection fail.
>
> Database will have the document flaged as being edited by User A.
>
> Do you know any good way of avoiding that problem or if you don't already
> know, can you think of something similar ?
Instead of setting a flag, set a timestamp. When user A opens the document for
editing, set the "editing" field to "2005-11-15 10:31:23". Then you decide for
a editing timeout. Say 30 minutes. If Usser A saves the document, the field is
cleared and the document is open for editing again. If user A doesn't close it,
it will return to being editable again if the timestamp is older than 30
minutes.
Or have a master switch - "reset all edit flags" on all locked documents.
--
Sandman[.net]
Navigation:
[Reply to this message]
|