Jump to content

Users that are on the same page.


Rohlan

Recommended Posts

Hello everyone.

 

I'm working with vTiger CRM 5.2.0, I'm trying to implement a feature that tells the user what if other (and which) users are on the same page as them, this will allow me to warn users that someone else is editing the same data as them and such.

 

My first untested theory is to use the database to store what pages which user is viewing. What I can't figure out is how to remove the page from the table once the user leaves. I can run a query when the user saves the data or hits the cancel button, but what if they simply close the browser window or exits the system through some other means? Logging out, or even shutting down the computer abruptly or some such.

 

Any suggestions are appreciated :)

Link to comment
https://forums.phpfreaks.com/topic/218103-users-that-are-on-the-same-page/
Share on other sites

  • 4 weeks later...

You can try using Javascripts unload() to tell when a user closes the browser. As part of your sign out you can have it clear any locked entires of that user in the DB. You can use AJAX to check for abrupt shutdown by having it run a php script every minute or two to update the database that the user is still in there and if the max time has passed since AJAX has reported back then unlock it.

  • 2 weeks later...

..and if you do javascript (AJAX) you are going to have to disable editing for anybody who doesn't have it enabled. I would also send the request to lock the file/edit using AJAX. This is so that if a connection is not possible with AJAX (with some devices), you will never have the problem of locking the file on page request and not knowing when to unlock it because no AJAX request was sent.

 

Again, I'd disable the option to edit if no AJAX requests can be sent too.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.