Skip to content
Snippets Groups Projects
Commit 4186907b authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX clear set interval lock

parent 1e19717c
No related branches found
No related tags found
No related merge requests found
......@@ -130,8 +130,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
}
// DocLocker constantly
$frm_str .= '<script>';
//$frm_str .= 'setInterval("new Ajax.Request(\'' . $_SESSION['config']['businessappurl'] . 'index.php?display=true&dir=actions&page=docLocker\',{ method:\'post\', parameters: {\'AJAX_CALL\': true, \'lock\': true, \'res_id\': ' . $res_id . '} });", 50000);';
$frm_str .= 'setInterval("$j.ajax( {url :\'index.php?display=true&dir=actions&page=docLocker\',type :\'POST\', data: {\'AJAX_CALL\': true, \'lock\': true, \'res_id\': '.$res_id.'}, success: function (response) { }});", 50000);';
$frm_str .= 'intervalLockDocument('.$res_id.')';
/**************************************************************************MODIFIE LA LIGNE PRECEDENTE****************************************************************************************************/
......@@ -236,7 +235,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
$frm_str .= '<input type="button" name="send" id="send" value="'
._VALIDATE
.'" class="button" onclick="$j.ajax({url :\'index.php?display=true&dir=actions&page=docLocker\', type : \'POST\',data : {\'AJAX_CALL\': true, \'unlock\': true, \'res_id\': '.$res_id.'}, success: function (response) { }});valid_action_form(\'process\', \''
.'" class="button" onclick="intervalUnlockDocument('.$res_id.');valid_action_form(\'process\', \''
.$path_manage_action.'\', \''.$id_action.'\', \''
.$res_id.'\', \''.$table.'\', \''.$module.'\', \''
......@@ -245,7 +244,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
$frm_str .= '</div>';
$frm_str .= '<i onmouseover="this.style.cursor=\'pointer\';" ';
$frm_str .= 'onclick="$j.ajax({url :\'index.php?display=true&dir=actions&page=docLocker\', type : \'POST\',data : {\'AJAX_CALL\': true, \'unlock\': true, \'res_id\': '.$res_id.'}, success: function (answer) { ';
$frm_str .= 'onclick="clearInterval(lockInterval);$j.ajax({url :\'index.php?display=true&dir=actions&page=docLocker\', type : \'POST\',data : {\'AJAX_CALL\': true, \'unlock\': true, \'res_id\': '.$res_id.'}, success: function (answer) { ';
$frm_str .= 'destroyModal(\'modal_'.$id_action.'\');triggerAngular(\'#/basketList/users/'.$_SESSION['urlV2Basket']['userId'].'/groups/'.$_SESSION['urlV2Basket']['groupIdSer'].'/baskets/'.$_SESSION['urlV2Basket']['basketId'].'\');';
$frm_str .= ' }});"';
......
......@@ -133,7 +133,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
// DocLocker constantly
$frm_str .= '<script>';
$frm_str .= 'setInterval("new Ajax.Request(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=actions&page=docLocker\',{ method:\'post\', parameters: {\'AJAX_CALL\': true, \'lock\': true, \'res_id\': '.$res_id.'} });", 50000);';
$frm_str .= 'intervalLockDocument('.$res_id.')';
$frm_str .= '</script>';
$docLocker->lock();
......@@ -277,12 +277,12 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
//GET ACTION LIST BY AJAX REQUEST
$frm_str .= '<span id="actionSpan"></span>';
$frm_str .= '<input type="button" name="send" id="send" value="'._VALIDATE.'" class="button" onclick="if(document.getElementById(\'contactcheck\').value!=\'success\'){if (confirm(\''._CONTACT_CHECK.'\n\nContinuer ?\')){new Ajax.Request(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=actions&page=docLocker\',{ method:\'post\', parameters: {\'AJAX_CALL\': true, \'unlock\': true, \'res_id\': '.$res_id.'} });valid_action_form( \'index_file\', \''.$path_manage_action.'\', \''.$id_action.'\', \''.$res_id.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');}}else{new Ajax.Request(\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=actions&page=docLocker\',{ method:\'post\', parameters: {\'AJAX_CALL\': true, \'unlock\': true, \'res_id\': '.$res_id.'} });valid_action_form( \'index_file\', \''.$path_manage_action.'\', \''.$id_action.'\', \''.$res_id.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');}"/> ';
$frm_str .= '<input type="button" name="send" id="send" value="'._VALIDATE.'" class="button" onclick="if(document.getElementById(\'contactcheck\').value!=\'success\'){if (confirm(\''._CONTACT_CHECK.'\n\nContinuer ?\')){intervalUnlockDocument('.$res_id.');valid_action_form( \'index_file\', \''.$path_manage_action.'\', \''.$id_action.'\', \''.$res_id.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');}}else{intervalUnlockDocument('.$res_id.');valid_action_form( \'index_file\', \''.$path_manage_action.'\', \''.$id_action.'\', \''.$res_id.'\', \''.$table.'\', \''.$module.'\', \''.$coll_id.'\', \''.$mode.'\');}"/> ';
$frm_str .= '</div>';
$frm_str .= '</div>';
$frm_str .= '<i onmouseover="this.style.cursor=\'pointer\';" ';
$frm_str .= 'onclick="$j.ajax({url :\'index.php?display=true&dir=actions&page=docLocker\', type : \'POST\',data : {\'AJAX_CALL\': true, \'unlock\': true, \'res_id\': '.$res_id.'}, success: function (answer) { ';
$frm_str .= 'onclick="clearInterval(lockInterval);$j.ajax({url :\'index.php?display=true&dir=actions&page=docLocker\', type : \'POST\',data : {\'AJAX_CALL\': true, \'unlock\': true, \'res_id\': '.$res_id.'}, success: function (answer) { ';
$frm_str .= 'destroyModal(\'modal_'.$id_action.'\');triggerAngular(\'#/basketList/users/'.$_SESSION['urlV2Basket']['userId'].'/groups/'.$_SESSION['urlV2Basket']['groupIdSer'].'/baskets/'.$_SESSION['urlV2Basket']['basketId'].'\');';
$frm_str .= ' }});"';
$frm_str .=' class="fa fa-times-circle fa-2x closeModale" title="'._CLOSE.'"/>';
......
......@@ -2,6 +2,7 @@ var $j = jQuery.noConflict();
var angularGlobals = {};
var alreadyLoaded = false;
var cookieExpiration;
var lockInterval;
function triggerAngular(locationToGo) {
var myApp = $j('<my-app style="height: 100%;display:none;"></my-app>');
......@@ -78,6 +79,10 @@ function lockDocument(resId) {
});
}
function intervalLockDocument(resId){
lockInterval = setInterval(lockDocument, 50000);
}
function unlockDocument(resId) {
$j.ajax({
url: 'index.php?display=true&dir=actions&page=docLocker',
......@@ -91,6 +96,11 @@ function unlockDocument(resId) {
});
}
function intervalUnlockDocument(resId){
clearInterval(lockInterval);
unlockDocument(resId);
}
function islockForSignatureBook(resId, basketId, groupId) {
$j.ajax({
url: 'index.php?display=true&dir=actions&page=docLocker',
......@@ -253,4 +263,4 @@ function checkCookieAuth() {
location.href = 'index.php?display=true&page=logout&logout=true';
}
cookieExpiration = setTimeout('checkCookieAuth()', 1 * 60 * 1000);
}
\ No newline at end of file
}
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