From 518849b12ea18b188a171a8eca612aeb9cc306f4 Mon Sep 17 00:00:00 2001 From: henri <henri.queneau@maarch.org> Date: Thu, 20 Apr 2017 10:01:51 +0200 Subject: [PATCH] FIX #5424 fix editing on visa --- modules/attachments/attachments_content.php | 5 +++-- modules/content_management/js/functions.js | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/attachments/attachments_content.php b/modules/attachments/attachments_content.php index 32edc3c4fe7..924fda86e9a 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 21ef8bd68a2..87f0f65c0a2 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'; -- GitLab