Author Topic: Multiple users can edit the same document at the same time?  (Read 4210 times)

ras2000

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Proremus
Multiple users can edit the same document at the same time?
« on: March 27, 2009, 09:10:57 am »
Hello, just getting started with this system, so I'm not sure this is the right board for my question.

In the documents view, if the document is .html or .slim, two users can edit the same document at the same time.

Is there any way to lock a document being edited? I know the right way is to check the document out, but not all users will do so.

We are a few in the company who enjoy getting our hands dirty with PHP, so very technical answers would also be useful.

Thanx
Ras
If you are what you eat, then I'm fast, cheap and easy.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Multiple users can edit the same document at the same time?
« Reply #1 on: March 29, 2009, 01:10:52 pm »
To implement checking out when editing you could do something like this:

On FilesController (application/controllers/FilesController.class.php), on methods add_document and add_presentation, when the document is being edited (i.e. if (get_id() > 0)) you should check if the file has been checked out by another user ($file->getCheckedOutById() > 0 && $file->getCheckedOutById() != logged_user()->getId()) after other checks like if file exists and user can edit file. If it has been checked out, then show an error message, otherwise checkout the file for the logged user ($file->checkOut(true, logged_user())).

Then you should add an action somewhere to check in the file, for example, on the document edition toolbar ('application/views/files/add_document.php' around line 25). You could add another page action named "Check in" that sends a new parameter in the POST.  Then on function save_document of FilesController you should check this parameter so that you checkin the file ($file->setCheckedOutById(0)) and then leave the document editor (ajx_current('back')).

Or you can wait for version 1.4 when there'll be an option to force the user to choose between checking out a document for edition or only viewing.

gman

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Multiple users can edit the same document at the same time?
« Reply #2 on: March 31, 2009, 10:57:34 am »
I'm running OpenGoo 1.3.1.

File checkout has worked for me for both html and slim files, that is, when one user checks out a document the other users are blocked from checking out the document. The user trying to access a checked out document will see "checked out by user..." under the status column. File checkout also works for me with uploaded files.

OpenGoo is excellent. Keep up the good work.

ras2000

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Proremus
Re: Multiple users can edit the same document at the same time?
« Reply #3 on: April 02, 2009, 09:41:14 am »
Thank you Ignacio

I think we'll wait for the 1.4. Tried checking out documents automatically when opening them for editing, but couldn't get it to work.

Do you have an idea of when 1.4 is ready?
If you are what you eat, then I'm fast, cheap and easy.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Multiple users can edit the same document at the same time?
« Reply #4 on: April 07, 2009, 10:19:10 am »
1.4 beta will be out next week.

kristjanmik

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Multiple users can edit the same document at the same time?
« Reply #5 on: April 11, 2009, 07:27:54 pm »
When will the stable release come out?

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Multiple users can edit the same document at the same time?
« Reply #6 on: April 13, 2009, 02:31:51 pm »
Stable releases usually come out 3 weeks after the beta, but could be delayed if it is too unstable.