diff --git a/modules/attachments/attachments_content.php b/modules/attachments/attachments_content.php index 32edc3c4fe75938da701b1a02f5d7a9fdb4e478a..924fda86e9a474f925b6a84c4c9098ba8ca62523 100644 --- a/modules/attachments/attachments_content.php +++ b/modules/attachments/attachments_content.php @@ -1219,6 +1219,7 @@ if (isset($_POST['add']) && $_POST['add']) { $OriginalHash = $res->fingerprint; if ($_SESSION['upfile']['upAttachment'] && $OriginalHash <> $NewHash) { + $_SESSION['upfile']['upAttachment'] = false; $fileInfos = array( "tmpDir" => $_SESSION['config']['tmppath'], "size" => $_SESSION['upfile']['size'], @@ -1875,7 +1876,7 @@ if(!isset($_REQUEST['id'])) { . '\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');$(\'add\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'add\').disabled=\'disabled\';$(\'add\').style.opacity=\'0.5\';this.hide();"/>';*/ $content .= '" name="edit" id="edit" style="display:none;margin-top: 0" class="button" ' . 'onclick="showAppletLauncher(\'' . $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_modal_launcher&objectType=attachmentVersion&objectId=\'+$(\'templateOffice\').value+\'&attachType=\'+$(\'attachment_types\').value+\'&objectTable=' . $objectTable . '&contactId=\'+$(\'contactidAttach\').value+\'&addressId=\'+$(\'addressidAttach\').value+\'&chronoAttachment=\'+$(\'chrono\').value+\'&titleAttachment=\'+cleanTitle($(\'title\').value)+\'&back_date=\'+$(\'back_date\').value+\'&resMaster=' . $_SESSION['doc_id'] - . '\', \'100px\', \'500px\');$(\'add\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'add\').disabled=\'disabled\';$(\'add\').style.opacity=\'0.5\';this.hide();"/>'; + . '\', \'100px\', \'500px\');$(\'add\').value=\'Edition en cours ...\';editingDoc(\''.$_SESSION['user']['UserId'].'\');$(\'add\').disabled=\'disabled\';$(\'add\').style.opacity=\'0.5\';this.hide();"/>'; $content .= '<span style="display: none" id="divOr0"> ou </span>'; $content .= '</div>'; @@ -1909,7 +1910,7 @@ $content .= '</div>'; .'\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');$(\'edit\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'edit\').disabled=\'disabled\';$(\'edit\').style.opacity=\'0.5\';this.hide();"/>';*/ $content .= '" name="editModel" id="editModel" class="button" onclick="$(\'hiddenValidateStatus\').value=\'2\';$(\'edit\').style.visibility=\'visible\';showAppletLauncher(\'' . $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_modal_launcher&objectType=attachmentUpVersion&objectId='.$_REQUEST['id'].'&contactId=\'+$(\'contactidAttach\').value+\'&addressId=\'+$(\'addressidAttach\').value+\'&titleAttachment=\'+cleanTitle($(\'title\').value)+\'&back_date=\'+$(\'back_date\').value+\'&objectTable=res_view_attachments&resMaster='.$_SESSION['doc_id'] - .'\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');$(\'edit\').value=\'Edition en cours ...\';setInterval(function() {checkEditingDoc(\''.$_SESSION['user']['UserId'].'\')}, 500);$(\'edit\').disabled=\'disabled\';$(\'edit\').style.opacity=\'0.5\';this.hide();"/>'; + .'\', \'\', \'height=200, width=250,scrollbars=no,resizable=no,directories=no,toolbar=no\');$(\'edit\').value=\'Edition en cours ...\';editingDoc(\''.$_SESSION['user']['UserId'].'\');$(\'edit\').disabled=\'disabled\';$(\'edit\').style.opacity=\'0.5\';this.hide();"/>'; } /*else { $content .= '" name="edit" id="edit" style="display:none" class="button" ' .'onclick="window.open(\''. $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=content_management&page=applet_popup_launcher&objectType=attachmentVersion&objectId=\'+$(\'templateOffice\').value+\'&objectTable='. $objectTable .'&contactId=\'+$(\'contactidAttach\').value+\'&chronoAttachment=\'+$(\'chrono\').value+\'&resMaster='.$_SESSION['doc_id'] diff --git a/modules/content_management/js/functions.js b/modules/content_management/js/functions.js index 21ef8bd68a2f7dfc9f3810ca79828d88616163b7..87f0f65c0a22d161a3d09cc39742d383d50c0e9f 100644 --- a/modules/content_management/js/functions.js +++ b/modules/content_management/js/functions.js @@ -1,3 +1,9 @@ +var editing; +function editingDoc(user){ + + editing = setInterval(function() {checkEditingDoc('user')}, 500); + +} //load applet in a modal function loadApplet(url, value) { @@ -52,6 +58,7 @@ function sendAppletMsg(theMsg) //destroy the modal of the applet and launch an ajax script function endOfApplet(objectType, theMsg) { + console.log('endOfAppletendOfAppletendOfApplet'); if (window.opener.$('add')) { window.opener.$('add').setStyle({display: 'inline'}); } else if (window.opener.$('edit')) { @@ -213,6 +220,8 @@ function checkEditingDoc(userId) { target.removeAttribute('disabled'); target.style.opacity='1'; target.value='Valider'; + console.log('clearInterval'); + clearInterval(editing); } else { console.log('lck found! Editing in progress !'); target.disabled='disabled';