Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.