Skip to content
Snippets Groups Projects
Commit 1ab0f541 authored by Jared Hancock's avatar Jared Hancock
Browse files

lock: Set ticket lock on ticket-view

Since the automatic lock was being acquired but not passed to the autoLock
system, the automatically acquired lock was not being release on away
navigation.

This patch addresses the issue by passing the automatically acquired lock id
to the autoLock system on ticket-view page load and change the ::Init()
method so that the lock id is not cleared with the ::Init() method is called
by the page load.
parent 9c9bfae1
No related branches found
No related tags found
No related merge requests found
...@@ -989,5 +989,12 @@ $(function() { ...@@ -989,5 +989,12 @@ $(function() {
} }
}); });
}); });
<?php
// Set the lock if one exists
if ($lock) { ?>
autoLock.setLock({
id:<?php echo $lock->getId(); ?>,
time: <?php echo $cfg->getLockTime(); ?>}, 'acquire');
<?php } ?>
}); });
</script> </script>
...@@ -15,6 +15,20 @@ ...@@ -15,6 +15,20 @@
**********************************************************************/ **********************************************************************/
var autoLock = { var autoLock = {
// Defaults
lockId: 0,
timerId: 0,
lasteventTime: 0,
lastattemptTime: 0,
acquireTime: 0,
renewTime: 0,
renewFreq: 0, //renewal frequency in seconds...based on returned lock time.
time: 0,
lockAttempts: 0, //Consecutive lock attempt errors
maxattempts: 2, //Maximum failed lock attempts before giving up.
warn: true,
retry: true,
addEvent: function(elm, evType, fn, useCapture) { addEvent: function(elm, evType, fn, useCapture) {
if(elm.addEventListener) { if(elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture); elm.addEventListener(evType, fn, useCapture);
...@@ -111,18 +125,6 @@ var autoLock = { ...@@ -111,18 +125,6 @@ var autoLock = {
void(autoLock.tid=parseInt($(':input[name=id]',fObj).val())); void(autoLock.tid=parseInt($(':input[name=id]',fObj).val()));
void(autoLock.lockTime=parseInt($(':input[name=locktime]',fObj).val())); void(autoLock.lockTime=parseInt($(':input[name=locktime]',fObj).val()));
autoLock.lockId=0;
autoLock.timerId=0;
autoLock.lasteventTime=0;
autoLock.lastattemptTime=0;
autoLock.acquireTime=0;
autoLock.renewTime=0;
autoLock.renewFreq=0; //renewal frequency in seconds...based on returned lock time.
autoLock.time=0;
autoLock.lockAttempts=0; //Consecutive lock attempt errors
autoLock.maxattempts=2; //Maximum failed lock attempts before giving up.
autoLock.warn=true;
autoLock.retry=true;
autoLock.watchDocument(); autoLock.watchDocument();
autoLock.resetTimer(); autoLock.resetTimer();
autoLock.addEvent(window,'unload',autoLock.releaseLock,true); //Release lock regardless of any activity. autoLock.addEvent(window,'unload',autoLock.releaseLock,true); //Release lock regardless of any activity.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment