#1
Posted 27 October 2011 - 02:47 PM
There was a request for a page lock feature in PW2.1 for pages being edited by an other user already, it would lock or throw a message of along the line of: "This page is currently being edited by "username'."
Thanks to Ryan for helping getting this done quickly!
Download:
https://github.com/s...ageEditSoftLock
How it works
Only the module "PageEditSoftLock" needs to be installed/uninstalled, the "ProcessPageEditSoftLock" Module will install/uninstall itself. The module creates a table and a hidden admin page under /page/edit/ for pinging in the background while editing a page. You can configure the ping interval and expiration timeout to what you think is good.
Defaults
- 20 seconds for pinging,
- 60 seconds for expiration time (all entries in the table older than this will get deleted).
----
27-02-2012 update
https://github.com/s...1f204bc1b6c740a
Fix for new repeater field throwing the lock message because of the way repeater work and this module. Thanks to Ryan for finding a quick fix.
@somartist | modules created | support me, flattr my work flattr.com
#2
Posted 27 October 2011 - 03:25 PM
#3
Posted 28 October 2011 - 03:33 AM
@somartist | modules created | support me, flattr my work flattr.com
#4
Posted 28 October 2011 - 05:47 AM
#5
Posted 28 October 2011 - 08:22 AM
@somartist | modules created | support me, flattr my work flattr.com
#6
Posted 28 October 2011 - 08:24 AM
This may not matter much, but if you want, I think you can replace the try/catch in ProcessPageEditSoftLock with just this below. That would get rid of the try/catch and condense it down to one more efficient query. Though in this case, I don't expect it would really matter since the query happens once every 20 seconds rather than hundreds of times a second.
$this->db->query("INSERT INTO users_editing_page (page_id, user_id, ts) VALUES($page_id, $user_id, $time) ON DUPLICATE KEY UPDATE ts=VALUES(ts), user_id=VALUES(user_id)");
I love that the times are configurable. The only question I had was about why times are in two different formats on the config screen (seconds and milliseconds)? I'm thinking that many non-programmers might not recognize exactly what milliseconds are at first.
#7
Posted 28 October 2011 - 08:33 AM
I have installed it on some projects and now I noticed a problem with the file upload. It doesn't update upload status and doesn't finish it, but after refresh the image is uploaded. I'm sure it has to do with this module, but not sure what's causing it. Any suggestions appreciated! Thanks
I think I see what the problem is. In your checkpagestatus() function, at the top, have it abort if it's an ajax request. i.e.
if($this->config->ajax) return;
#8
Posted 28 October 2011 - 08:43 AM
It works now again.
EDIT: There's something strange going on in FF, no errors and it doesn't seem to work at all... Confused...
@somartist | modules created | support me, flattr my work flattr.com
#9
Posted 28 October 2011 - 09:04 AM
Thanks Ryan for the suggestions, I implemented your suggestions.
And have adjusted the config times to be both in seconds.
I commited the new version to github. Thanks!
@somartist | modules created | support me, flattr my work flattr.com
#10
Posted 27 February 2012 - 02:37 PM
@somartist | modules created | support me, flattr my work flattr.com
#12
Posted 19 February 2013 - 01:58 PM
Hi Soma,
This is a great setup, but I am thinking about the issue of more than one person using the same login details. I have a project where each team of people will have a single login and I'd like to be able to have the warning popup even if the page is being edited by the same username. An IP address won't be appropriate since many will likely appear from the same address. I am thinking a cookie approach might be best.
The other thing I want to be able to do is use this to warn users editing pages via a front-end form.
I plan on implementing these shortly, but thought I'd ask if perhaps you already had any plans along these lines, or any suggestions.
#13
Posted 19 February 2013 - 02:06 PM
No I haven't . Give them all a separate login, problem solved. You don't want to have various people with same login in a CMS generally and working simultaneously from same place.
Anyway I don't see a simple way to implement this. I'm also not sure if it would work for frontend as you would have to take care of it anyway, but maybe my module helps you getting started.
@somartist | modules created | support me, flattr my work flattr.com
#14
Posted 19 February 2013 - 02:14 PM
I agree that separate logins would help, but all the editing I am talking about is front-end, and will be by groups of people that may change on a daily basis, so it starts to get complicated.
I am sure I will make use of your module as a starter, but you are right, I may have to do this differently to handle front-end protection.
#16
Posted 03 April 2013 - 04:28 AM
Hi Peter
I don't know really how hard a hard lock in a soft lock module is. ![]()
The reason to only have a soft lock is clear, and hard locks can get a burden if someone lock a page by having the page open.
I think it's possible, but have to think about some time. It would be as you suggest and option you need to enable. But then also the Module name doesn't fit anymore.
@somartist | modules created | support me, flattr my work flattr.com
#18
Posted 03 April 2013 - 01:17 PM
Hello Peter,
If the traffic lights are turned red, you could drive through. But you know you're wrong.
If there's an emergency, you could take the risk to driving through red. ( soft lock. )
But if there's a hard lock, the lock must be openend somehow if someone didn't logout for example.
So an other thing is needed to re-open locked pages. ( Making the hard-lock a little soft again. )
Think Soma did a great job with the soft-lock.
Also tagged with one or more of these keywords: Module
Community Support →
Modules/Plugins →
Module: TemplateHasTagsStarted by MichaMichaMicha, Yesterday, 09:31 AM |
|
|
||
Community Support →
Modules/Plugins →
Release: LocalAudioFiles MP3-DBStarted by horst, 19 May 2013 |
|
|
||
Community Support →
Modules/Plugins →
Inline EditorStarted by Sinmok, 10 May 2013 |
|
|
||
Community Support →
Modules/Plugins →
Module: Site indexerStarted by Alessio Dal Bianco, 08 May 2013 |
|
|
||
Community Support →
Modules/Plugins →
Form Builder - Form with more than 1 formbuilderfile inputStarted by theGC, 07 May 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













