- I did this a while back and it's not pretty, but I also did it under 8.5.1, and haven't had the opportunity to code in a new version, so if things have improved I'm not a good resource. I can't produce code for you, but the gist is this:
1. Lock the document use SSJS in beforePageLoad on the server. If it's locked already don't load the page, fall back and tell them it's busy.
2. Unlock the document using an AJAX call in onunload in CSJS on the client.
- Locking it on the server ensures that you can absolutely prevent the page from loading if it's already locked.
- Unlocking it on the client ensures you can reasonably unlock when you're done. Unlike beforePageLoad, there is no server-side event you be sure will always run when the user is done ... if they hit the back button for instance, the lock is left behind. "That can't be good." - Porko Rosso
- Fly in the ointment is onunload runs at odd times, so you run the risk of unlocking something you didn't want to unlock. Since browsers run onunload they way they do for security reasons, ostensibly, this is how it is. A complex set of CSJS tracking data can minimize but not completely eliminate this effect.
- The hack is scheduled Agent that cleans up the stale locks.
Hope this helps...