Rohlan Posted November 8, 2010 Share Posted November 8, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/218103-users-that-are-on-the-same-page/ Share on other sites More sharing options...
Rohlan Posted November 8, 2010 Author Share Posted November 8, 2010 When the user logs out I can also clear the user's pages, that just leaves the bit when the user abruptly closes the window, or shuts down the browser. Quote Link to comment https://forums.phpfreaks.com/topic/218103-users-that-are-on-the-same-page/#findComment-1131759 Share on other sites More sharing options...
vicodin Posted December 3, 2010 Share Posted December 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/218103-users-that-are-on-the-same-page/#findComment-1142501 Share on other sites More sharing options...
Anti-Moronic Posted December 13, 2010 Share Posted December 13, 2010 ..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. Quote Link to comment https://forums.phpfreaks.com/topic/218103-users-that-are-on-the-same-page/#findComment-1146739 Share on other sites More sharing options...
Rohlan Posted December 14, 2010 Author Share Posted December 14, 2010 if javascript isnt enabled, the user has no access to the page already this is an internal application, not to be released to the public Quote Link to comment https://forums.phpfreaks.com/topic/218103-users-that-are-on-the-same-page/#findComment-1147092 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.