Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Automatic page locking/unlocking

Avatar

Level 1

I have a requirement to automatically lock and unlock pages when an author opens and closes a page respectively (in order to avoid two authors editing the same page simulatenously). I was trying to leverage the currentPage.lock() and .unlock() methods - the .lock() method is easy enough to execute on page load, but I have no good means of triggering .unlock() when the page closes since currentPage isn't in the scope of jspDestroy(). Am I going about this the wrong way, or is there an easy way in CQ5.6 to trigger the unlock when the page is closed?

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

For this use case -- the event can only be tracked at the page level. So you could use a jquery event and send a callback through Sling to execute your lock command. Hope this helps you. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

For this use case -- the event can only be tracked at the page level. So you could use a jquery event and send a callback through Sling to execute your lock command. Hope this helps you.