From 8d2a9eba91dea1e084b17db1d648021516287ae7 Mon Sep 17 00:00:00 2001 From: Damien Burel <damien.burel@maarch.org> Date: Fri, 19 May 2017 15:32:09 +0200 Subject: [PATCH] FEAT #5535 Remove some prototype + refactoring + cleaning --- .../indexing_searching/choose_file.php | 12 +- apps/maarch_entreprise/js/functions.js | 27 +- apps/maarch_entreprise/js/indexing.js | 203 +------ apps/maarch_entreprise/js/unittest.js | 568 ------------------ .../template/documents_list_search_adv.html | 11 +- .../documents_list_with_attachments.html | 12 +- modules/attachments/choose_attachment.php | 6 +- modules/attachments/del_attachment.php | 32 - modules/attachments/js/functions.js | 93 +-- modules/avis/documents_list_with_avis.php | 7 +- .../class/class_admin_basket_Abstract.php | 6 +- modules/basket/groupbasket_popup.php | 4 +- .../visa/documents_list_with_signatory.php | 7 +- modules/visa/show_visaListDocBasket_tab.php | 220 ------- modules/visa/update_visaPage.php | 180 ------ 15 files changed, 50 insertions(+), 1338 deletions(-) delete mode 100644 apps/maarch_entreprise/js/unittest.js delete mode 100644 modules/visa/show_visaListDocBasket_tab.php delete mode 100644 modules/visa/update_visaPage.php diff --git a/apps/maarch_entreprise/indexing_searching/choose_file.php b/apps/maarch_entreprise/indexing_searching/choose_file.php index c65f38c4f23..55fe88aaffa 100644 --- a/apps/maarch_entreprise/indexing_searching/choose_file.php +++ b/apps/maarch_entreprise/indexing_searching/choose_file.php @@ -108,7 +108,7 @@ $_SESSION['with_file'] = false; $upFileOK = true; } } elseif ($_REQUEST['with_file'] == 'false') { - $_SESSION['upfile'] = array(); + $_SESSION['upfile'] = []; $upFileOK = true; } //if ($upFileOK) { @@ -150,22 +150,22 @@ $_SESSION['with_file'] = false; <?php if (!empty($_SESSION['upfile']['local_path']) && empty($_SESSION['error'])) { ?> <i class="fa fa-check-square fa-2x" title="<?php echo _DOWNLOADED_FILE; ?>"></i> - <input type="button" id="fileButton" onclick="$$('#file')[0].click();" class="button" + <input type="button" id="fileButton" onclick="$j('#file').click();" class="button" value="<?php if($_REQUEST['with_file'] == 'true'){ echo _WITHOUT_FILE; } else {echo _DOWNLOADED_FILE;}?>" style="width: 90%;margin: 0px;margin-top: -2px;font-size: 15px;text-align: center;"> <?php } else { ?> <i class="fa fa-remove fa-2x" title="<?php echo _NO_FILE_SELECTED; ?>"></i> - <input type="button" id="fileButton" onclick="$$('#file')[0].click()" class="button" value="<?php echo _CHOOSE_FILE; ?>" style="width: 90%;margin: 0px;margin-top: -2px;font-size: 15px;text-align: center;"> + <input type="button" id="fileButton" onclick="$j('#file').click()" class="button" value="<?php echo _CHOOSE_FILE; ?>" style="width: 90%;margin: 0px;margin-top: -2px;font-size: 15px;text-align: center;"> <?php } ?> </label> <?php if($_REQUEST['with_file'] == 'true'){ ?> - <i class="fa fa-ban fa-2x" id="with_file_icon" onclick="$$('#with_file')[0].click();" title="<?php echo _WITHOUT_FILE; ?> (actif)" style="cursor:pointer;"></i> + <i class="fa fa-ban fa-2x" id="with_file_icon" onclick="$j('#with_file').click();" title="<?php echo _WITHOUT_FILE; ?> (actif)" style="cursor:pointer;"></i> <?php }else{ ?> - <i class="fa fa-ban fa-2x" id="with_file_icon" onclick="$$('#with_file2')[0].click();" title="<?php echo _WITHOUT_FILE; ?>" style="cursor:pointer;"></i> + <i class="fa fa-ban fa-2x" id="with_file_icon" onclick="$j('#with_file')[0].value='true';$j('#with_file2').click();" title="<?php echo _WITHOUT_FILE; ?>" style="cursor:pointer;"></i> <?php } ?> - <input type="file" name="file" id="file" onchange="$('with_file').value='false';this.form.method = 'post';this.form.submit();" + <input type="file" name="file" id="file" onchange="$j('#with_file')[0].value='false';this.form.method = 'post';this.form.submit();" value="<?php $_REQUEST['with_file'] = 'false'; if (isset($_SESSION['file_path'])) { echo $_SESSION['file_path']; diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js index d3206dd1bc0..6183883d5ae 100755 --- a/apps/maarch_entreprise/js/functions.js +++ b/apps/maarch_entreprise/js/functions.js @@ -1017,7 +1017,7 @@ function createModal(txt, id_mod, height, width, mode_frm, iframe_container_id){ Event.observe(layer, 'mousewheel', function(event){Event.stop(event);}.bindAsEventListener(), true); Event.observe(layer, 'DOMMouseScroll', function(event){Event.stop(event);}.bindAsEventListener(), false); $(id_mod).focus(); - $$("input[type='button']").each(function(v) {v.removeAttribute('disabled');v.style.opacity="1";}) + $j("input[type='button']").prop("disabled", false).css("opacity", "1"); } function test_form() @@ -1232,10 +1232,7 @@ function valid_action_form(current_form_id, path_manage_script, id_action, value }, onCreate: function(answer) { //show loading image in toolbar - $$("input[type='button']").each(function(v) { - v.setAttribute("disabled","disabled"); - v.style.opacity = "0.5"; - }); + $j("input[type='button']").prop("disabled", true).css("opacity", "0.5"); }, onSuccess: function(answer){ eval('response='+answer.responseText); @@ -1266,7 +1263,8 @@ function valid_action_form(current_form_id, path_manage_script, id_action, value try { $('frm_error_'+id_action).innerHTML = response.error_txt; alert($('frm_error_'+id_action).innerHTML); - $$("input[type='button']").each(function(v) {v.removeAttribute('disabled');v.style.opacity="1";}); + $j("input[type='button']").prop("disabled", false).css("opacity", "1"); + } catch(e){ } @@ -1474,7 +1472,8 @@ function action_send_first_request( path_manage_script, mode_req, id_action, re }, beforeSend: function() { //show loading image in toolbar - $$("input[type='button']").each(function(v) {v.setAttribute("disabled","disabled");v.style.opacity="0.5";}); + $j("input[type='button']").prop("disabled", true).css("opacity", "0.5"); + }, success: function(answer){ eval("response = " + answer); @@ -1561,9 +1560,7 @@ function action_send_form_confirm_result(path_manage_script, mode_req, id_action }, onCreate: function(answer) { //show loading image in toolbar - $$("input[type='button']").each(function(v) { - v.setAttribute("disabled","disabled");v.style.opacity="0.5"; - }); + $j("input[type='button']").prop("disabled", true).css("opacity", "0.5"); }, onSuccess: function(answer){ eval('response='+answer.responseText); @@ -1588,12 +1585,8 @@ function action_send_form_confirm_result(path_manage_script, mode_req, id_action { try{ $('frm_error').innerHTML = response.error_txt; - $$("input[type='button']").each(function(v) { - v.setAttribute("disabled","disabled"); - v.style.opacity="0.5"; - }); - } - catch(e){} + $j("input[type='button']").prop("disabled", true).css("opacity", "0.5"); + } catch(e) {} } }, onFailure: function(){ @@ -3118,7 +3111,7 @@ function loadTab(resId,collId,titleTab,pathScriptTab,module){ document.getElementById('show_tab').style.display='block'; document.getElementById('show_tab').setAttribute('module',module); - $$("span[class='tab_module']").each(function(v) {v.innerHTML = '<i class="fa fa-plus-square-o"></i>';}) + $j("span[class='tab_module']").each(function(i, e) {e.innerHTML = '<i class="fa fa-plus-square-o"></i>';}) if(document.getElementById(module+'_tab') != undefined ){ document.getElementById(module+'_tab').innerHTML = '<i class="fa fa-minus-square-o"></i>'; } diff --git a/apps/maarch_entreprise/js/indexing.js b/apps/maarch_entreprise/js/indexing.js index 0dead96a2fd..14b038787ad 100644 --- a/apps/maarch_entreprise/js/indexing.js +++ b/apps/maarch_entreprise/js/indexing.js @@ -924,30 +924,6 @@ function process_category(category, display_value_tr, params_cat) /** Declaration of the autocompleter object used for the contacts*/ var contact_autocompleter; -/** - * Launch the Ajax autocomplete object to activate autocompletion on contacts - * - * @param path_script String Path to the Ajax script - **/ -function launch_autocompleter_contacts(path_script, id_text, id_div, cat_id) -{ - var input = id_text || 'contact'; - var div = id_div || 'show_contacts'; - - var params = get_contacts_params(); - - if (contact_autocompleter && contact_autocompleter.element == $$('#' + input)[0]) - contact_autocompleter.options.defaultParams = params; - else if(path_script) - contact_autocompleter = new Ajax.Autocompleter(input, div, path_script, { - method:'get', - paramName:'Input', - parameters: params, - minChars: 2 - }); - else return false; -} - /** * Launch the Ajax autocomplete object to activate autocompletion on contacts en put address_id and contact_id in an hidden input * @@ -960,7 +936,7 @@ function launch_autocompleter_contacts_v2(path_script, id_text, id_div, cat_id, var params = get_contacts_params(); - if (contact_autocompleter && contact_autocompleter.element == $$('#' + input)[0]) + if (contact_autocompleter && contact_autocompleter.element == $j('#' + input)[0]) contact_autocompleter.options.defaultParams = params; else if(path_script) contact_autocompleter = new Ajax.Autocompleter(input, div, path_script, { @@ -991,9 +967,7 @@ function launch_autocompleter2_contacts_v2(path_script, id_text, id_div, cat_id, var input = id_text || 'contact'; var div = id_div || 'show_contacts'; - // var params = get_contacts_params(); - - if (contact_autocompleter && contact_autocompleter.element == $$('#' + input)[0]) + if (contact_autocompleter && contact_autocompleter.element == $j('#' + input)[0]) contact_autocompleter.options.defaultParams = params; else if(path_script) contact_autocompleter = new Ajax.Autocompleter2(input, div, path_script, { @@ -1008,11 +982,13 @@ function launch_autocompleter2_contacts_v2(path_script, id_text, id_div, cat_id, parent.$(address_id).value = res[1]; if (path_script2 && res[1]) { getDepartment(path_script2, res[1]); - }; + } } }); - else return false; + else { + return false; + } } function getDepartment(path_script, address_id) { @@ -1031,24 +1007,6 @@ function getDepartment(path_script, address_id) { }); } -function launch_autocompleter_choose_contact(path_script, id_text, id_div, cat_id, contact_id){ - var input = id_text || 'contact'; - var div = id_div || 'show_contacts'; - - // var params = get_contacts_params(); - - contact_autocompleter = new Ajax.Autocompleter(input, div, path_script, { - method:'get', - paramName:'what', - // parameters: params, - minChars: 2, - afterUpdateElement: function (text, li){ - $(contact_id).value = li.id; - } - }); - -} - function putInSessionContact(path_script){ var contactSelected = $('contactSelect').options[$('contactSelect').selectedIndex].value; if (contactSelected == "") { @@ -1172,126 +1130,6 @@ function update_contact_autocompleter() } } -/** - * Open in a popup the contact or user card - * - * @param path_contact_card String Path to the contact card - * @param path_user_card String Path to the user card - **/ -function open_contact_card(path_contact_card,path_user_card,mode) -{ - if (mode == '') { - mode = 'view'; - } - - if($('email')){ - var contact_value = $('email').value; - }else{ - var contact_value = $('contact').value; - } - var arr = get_checked_values('type_contact'); - var contact_id = contact_value.substring(contact_value.indexOf('(')+1, contact_value.indexOf(')')); - if (arr.length == 0) { - //~ if (console != null) { - //~ console.log('Erreur launch_autocompleter_contacts, no items checked'); - //~ } else { - //~ alert('Erreur launch_autocompleter_contacts, no items checked'); - //~ } - window.open(path_contact_card+'&id='+contact_id, 'contact_info', 'height=600, width=600,scrollbars=yes,resizable=yes'); - } else { - if (arr[0] == 'internal') { - window.open(path_user_card+'&id='+contact_id, 'contact_info', 'height=450, width=600,scrollbars=no,resizable=yes'); - } else if(arr[0] == 'external' || arr[0] == 'multi_external') { - window.open(path_contact_card+'&mode='+mode+'&id='+contact_id, 'contact_info', 'height=600, width=600,scrollbars=yes,resizable=yes'); - } - } -} - -function create_contact(path_create, id_action) -{ - /*if ($('type_contact_external')) { - $('type_contact_external').checked = true; - $('type_contact_external').onclick(); - }*/ - - - var contact_frm = $('indexingfrmcontact'); - var contact_type = get_contact_type($('category_id').value); - if (contact_frm) { - var corporate = 'Y' ; - if ($('is_corporate_N').checked == true) { - corporate = 'N' ; - } - var private = 'Y' ; - if ($('is_private_N').checked == true) { - private = 'N' ; - } - var title_val = $('title').value; - var society_val = $('society').value; - var phone_val = $('phone').value; - var mail_val = $('mail').value; - var num_val = $('num').value; - var street_val = $('street').value; - var add_comp_val = $('add_comp').value; - var cp_val = $('cp').value; - var town_val = $('town').value; - var country_val = $('country').value; - var comp_data_val = $('comp_data').value; - var lastname_val = $('lastname').value; - var firstname_val = $('firstname').value; - var func_val = $('function').value; - - new Ajax.Request(path_create, - { - method:'post', - asynchronous:false, - parameters: { - is_corporate : corporate, - is_private : private, - title : title_val, - society : society_val, - phone : phone_val, - mail : mail_val, - num : num_val, - street : street_val, - add_comp : add_comp_val, - cp : cp_val, - town : town_val, - country : country_val, - comp_data : comp_data_val, - lastname : lastname_val, - firstname : firstname_val, - func : func_val, - contactType : contact_type - }, - onSuccess: function(answer){ - eval("response = "+answer.responseText); - //alert(answer.responseText); - if (response.status == 0 ) { - if($('type_multi_contact_external').checked == true){ - var contact = $('email'); - }else{ - var contact = $('contact'); - } - - if (contact) { - contact.value = response.value; - //$('contact_card').style.visibility = 'visible'; - new Effect.toggle('create_contact_div', 'blind', {delay:0.2}); - clear_form('indexingfrmcontact'); - } - } else { - try{ - $('frm_error_'+id_action).innerHTML = response.error_txt; - } - catch(e){} - } - } - }); - } - -} - /** * When you change the contact type, the table used for the autocompletion change * @@ -1763,7 +1601,7 @@ function hideSelectFile(){ } else { // $('choose_file_div').style.display='block'; window.frames["choose_file"].$('with_file').click(); - }; + } } function affiche_chrono(){ @@ -1814,33 +1652,6 @@ function affiche_chrono(){ } } -function affiche_get_chrono(){ - - var type_id = document.getElementById('attachment_types').options[document.getElementById('attachment_types').selectedIndex]; - - if (type_id.getAttribute('get_chrono') == 'true') { - $('get_chrono_label').setStyle({display: 'inline'}); - $('get_chrono_display').setStyle({display: 'inline'}); - new Ajax.Request('index.php?display=true&module=attachments&page=get_other_chrono_attachment', - { - method:'post', - parameters: - { - type_id : type_id - }, - onSuccess: function(answer){ - eval("response = "+answer.responseText); - $('get_chrono_display').innerHTML=response.chronoList; - } - }); - } else { - $('get_chrono_label').setStyle({display: 'none'}); - $('get_chrono_display').setStyle({display: 'none'}); - $('get_chrono_display').value=''; - $('get_chrono').value=''; - } -} - function showEditButton(){ var modele_id = document.getElementById('templateOffice').options[document.getElementById('templateOffice').selectedIndex]; diff --git a/apps/maarch_entreprise/js/unittest.js b/apps/maarch_entreprise/js/unittest.js deleted file mode 100644 index 9555c22cc3e..00000000000 --- a/apps/maarch_entreprise/js/unittest.js +++ /dev/null @@ -1,568 +0,0 @@ -// script.aculo.us unittest.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010 - -// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2010 Jon Tirsen (http://www.tirsen.com) -// (c) 2005-2010 Michael Schuerig (http://www.schuerig.de/michael/) -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// experimental, Firefox-only -Event.simulateMouse = function(element, eventName) { - var options = Object.extend({ - pointerX: 0, - pointerY: 0, - buttons: 0, - ctrlKey: false, - altKey: false, - shiftKey: false, - metaKey: false - }, arguments[2] || {}); - var oEvent = document.createEvent("MouseEvents"); - oEvent.initMouseEvent(eventName, true, true, document.defaultView, - options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, - options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element)); - - if(this.mark) Element.remove(this.mark); - this.mark = document.createElement('div'); - this.mark.appendChild(document.createTextNode(" ")); - document.body.appendChild(this.mark); - this.mark.style.position = 'absolute'; - this.mark.style.top = options.pointerY + "px"; - this.mark.style.left = options.pointerX + "px"; - this.mark.style.width = "5px"; - this.mark.style.height = "5px;"; - this.mark.style.borderTop = "1px solid red;"; - this.mark.style.borderLeft = "1px solid red;"; - - if(this.step) - alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options)); - - $(element).dispatchEvent(oEvent); -}; - -// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2. -// You need to downgrade to 1.0.4 for now to get this working -// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much -Event.simulateKey = function(element, eventName) { - var options = Object.extend({ - ctrlKey: false, - altKey: false, - shiftKey: false, - metaKey: false, - keyCode: 0, - charCode: 0 - }, arguments[2] || {}); - - var oEvent = document.createEvent("KeyEvents"); - oEvent.initKeyEvent(eventName, true, true, window, - options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, - options.keyCode, options.charCode ); - $(element).dispatchEvent(oEvent); -}; - -Event.simulateKeys = function(element, command) { - for(var i=0; i<command.length; i++) { - Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)}); - } -}; - -var Test = {}; -Test.Unit = {}; - -// security exception workaround -Test.Unit.inspect = Object.inspect; - -Test.Unit.Logger = Class.create(); -Test.Unit.Logger.prototype = { - initialize: function(log) { - this.log = $(log); - if (this.log) { - this._createLogTable(); - } - }, - start: function(testName) { - if (!this.log) return; - this.testName = testName; - this.lastLogLine = document.createElement('tr'); - this.statusCell = document.createElement('td'); - this.nameCell = document.createElement('td'); - this.nameCell.className = "nameCell"; - this.nameCell.appendChild(document.createTextNode(testName)); - this.messageCell = document.createElement('td'); - this.lastLogLine.appendChild(this.statusCell); - this.lastLogLine.appendChild(this.nameCell); - this.lastLogLine.appendChild(this.messageCell); - this.loglines.appendChild(this.lastLogLine); - }, - finish: function(status, summary) { - if (!this.log) return; - this.lastLogLine.className = status; - this.statusCell.innerHTML = status; - this.messageCell.innerHTML = this._toHTML(summary); - this.addLinksToResults(); - }, - message: function(message) { - if (!this.log) return; - this.messageCell.innerHTML = this._toHTML(message); - }, - summary: function(summary) { - if (!this.log) return; - this.logsummary.innerHTML = this._toHTML(summary); - }, - _createLogTable: function() { - this.log.innerHTML = - '<div id="logsummary"></div>' + - '<table id="logtable">' + - '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' + - '<tbody id="loglines"></tbody>' + - '</table>'; - this.logsummary = $('logsummary'); - this.loglines = $('loglines'); - }, - _toHTML: function(txt) { - return txt.escapeHTML().replace(/\n/g,"<br/>"); - }, - addLinksToResults: function(){ - $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log - td.title = "Run only this test"; - Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;}); - }); - $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log - td.title = "Run all tests"; - Event.observe(td, 'click', function(){ window.location.search = "";}); - }); - } -}; - -Test.Unit.Runner = Class.create(); -Test.Unit.Runner.prototype = { - initialize: function(testcases) { - this.options = Object.extend({ - testLog: 'testlog' - }, arguments[1] || {}); - this.options.resultsURL = this.parseResultsURLQueryParameter(); - this.options.tests = this.parseTestsQueryParameter(); - if (this.options.testLog) { - this.options.testLog = $(this.options.testLog) || null; - } - if(this.options.tests) { - this.tests = []; - for(var i = 0; i < this.options.tests.length; i++) { - if(/^test/.test(this.options.tests[i])) { - this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"])); - } - } - } else { - if (this.options.test) { - this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])]; - } else { - this.tests = []; - for(var testcase in testcases) { - if(/^test/.test(testcase)) { - this.tests.push( - new Test.Unit.Testcase( - this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, - testcases[testcase], testcases["setup"], testcases["teardown"] - )); - } - } - } - } - this.currentTest = 0; - this.logger = new Test.Unit.Logger(this.options.testLog); - setTimeout(this.runTests.bind(this), 1000); - }, - parseResultsURLQueryParameter: function() { - return window.location.search.parseQuery()["resultsURL"]; - }, - parseTestsQueryParameter: function(){ - if (window.location.search.parseQuery()["tests"]){ - return window.location.search.parseQuery()["tests"].split(','); - }; - }, - // Returns: - // "ERROR" if there was an error, - // "FAILURE" if there was a failure, or - // "SUCCESS" if there was neither - getResult: function() { - var hasFailure = false; - for(var i=0;i<this.tests.length;i++) { - if (this.tests[i].errors > 0) { - return "ERROR"; - } - if (this.tests[i].failures > 0) { - hasFailure = true; - } - } - if (hasFailure) { - return "FAILURE"; - } else { - return "SUCCESS"; - } - }, - postResults: function() { - if (this.options.resultsURL) { - new Ajax.Request(this.options.resultsURL, - { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false }); - } - }, - runTests: function() { - var test = this.tests[this.currentTest]; - if (!test) { - // finished! - this.postResults(); - this.logger.summary(this.summary()); - return; - } - if(!test.isWaiting) { - this.logger.start(test.name); - } - test.run(); - if(test.isWaiting) { - this.logger.message("Waiting for " + test.timeToWait + "ms"); - setTimeout(this.runTests.bind(this), test.timeToWait || 1000); - } else { - this.logger.finish(test.status(), test.summary()); - this.currentTest++; - // tail recursive, hopefully the browser will skip the stackframe - this.runTests(); - } - }, - summary: function() { - var assertions = 0; - var failures = 0; - var errors = 0; - var messages = []; - for(var i=0;i<this.tests.length;i++) { - assertions += this.tests[i].assertions; - failures += this.tests[i].failures; - errors += this.tests[i].errors; - } - return ( - (this.options.context ? this.options.context + ': ': '') + - this.tests.length + " tests, " + - assertions + " assertions, " + - failures + " failures, " + - errors + " errors"); - } -}; - -Test.Unit.Assertions = Class.create(); -Test.Unit.Assertions.prototype = { - initialize: function() { - this.assertions = 0; - this.failures = 0; - this.errors = 0; - this.messages = []; - }, - summary: function() { - return ( - this.assertions + " assertions, " + - this.failures + " failures, " + - this.errors + " errors" + "\n" + - this.messages.join("\n")); - }, - pass: function() { - this.assertions++; - }, - fail: function(message) { - this.failures++; - this.messages.push("Failure: " + message); - }, - info: function(message) { - this.messages.push("Info: " + message); - }, - error: function(error) { - this.errors++; - this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")"); - }, - status: function() { - if (this.failures > 0) return 'failed'; - if (this.errors > 0) return 'error'; - return 'passed'; - }, - assert: function(expression) { - var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"'; - try { expression ? this.pass() : - this.fail(message); } - catch(e) { this.error(e); } - }, - assertEqual: function(expected, actual) { - var message = arguments[2] || "assertEqual"; - try { (expected == actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } - }, - assertInspect: function(expected, actual) { - var message = arguments[2] || "assertInspect"; - try { (expected == actual.inspect()) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } - }, - assertEnumEqual: function(expected, actual) { - var message = arguments[2] || "assertEnumEqual"; - try { $A(expected).length == $A(actual).length && - expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ? - this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + - ', actual ' + Test.Unit.inspect(actual)); } - catch(e) { this.error(e); } - }, - assertNotEqual: function(expected, actual) { - var message = arguments[2] || "assertNotEqual"; - try { (expected != actual) ? this.pass() : - this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } - }, - assertIdentical: function(expected, actual) { - var message = arguments[2] || "assertIdentical"; - try { (expected === actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } - }, - assertNotIdentical: function(expected, actual) { - var message = arguments[2] || "assertNotIdentical"; - try { !(expected === actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } - }, - assertNull: function(obj) { - var message = arguments[1] || 'assertNull'; - try { (obj==null) ? this.pass() : - this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); } - catch(e) { this.error(e); } - }, - assertMatch: function(expected, actual) { - var message = arguments[2] || 'assertMatch'; - var regex = new RegExp(expected); - try { (regex.exec(actual)) ? this.pass() : - this.fail(message + ' : regex: "' + Test.Unit.inspect(expected) + ' did not match: ' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } - }, - assertHidden: function(element) { - var message = arguments[1] || 'assertHidden'; - this.assertEqual("none", element.style.display, message); - }, - assertNotNull: function(object) { - var message = arguments[1] || 'assertNotNull'; - this.assert(object != null, message); - }, - assertType: function(expected, actual) { - var message = arguments[2] || 'assertType'; - try { - (actual.constructor == expected) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + (actual.constructor) + '"'); } - catch(e) { this.error(e); } - }, - assertNotOfType: function(expected, actual) { - var message = arguments[2] || 'assertNotOfType'; - try { - (actual.constructor != expected) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + (actual.constructor) + '"'); } - catch(e) { this.error(e); } - }, - assertInstanceOf: function(expected, actual) { - var message = arguments[2] || 'assertInstanceOf'; - try { - (actual instanceof expected) ? this.pass() : - this.fail(message + ": object was not an instance of the expected type"); } - catch(e) { this.error(e); } - }, - assertNotInstanceOf: function(expected, actual) { - var message = arguments[2] || 'assertNotInstanceOf'; - try { - !(actual instanceof expected) ? this.pass() : - this.fail(message + ": object was an instance of the not expected type"); } - catch(e) { this.error(e); } - }, - assertRespondsTo: function(method, obj) { - var message = arguments[2] || 'assertRespondsTo'; - try { - (obj[method] && typeof obj[method] == 'function') ? this.pass() : - this.fail(message + ": object doesn't respond to [" + method + "]"); } - catch(e) { this.error(e); } - }, - assertReturnsTrue: function(method, obj) { - var message = arguments[2] || 'assertReturnsTrue'; - try { - var m = obj[method]; - if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; - m() ? this.pass() : - this.fail(message + ": method returned false"); } - catch(e) { this.error(e); } - }, - assertReturnsFalse: function(method, obj) { - var message = arguments[2] || 'assertReturnsFalse'; - try { - var m = obj[method]; - if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; - !m() ? this.pass() : - this.fail(message + ": method returned true"); } - catch(e) { this.error(e); } - }, - assertRaise: function(exceptionName, method) { - var message = arguments[2] || 'assertRaise'; - try { - method(); - this.fail(message + ": exception expected but none was raised"); } - catch(e) { - ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); - } - }, - assertElementsMatch: function() { - var expressions = $A(arguments), elements = $A(expressions.shift()); - if (elements.length != expressions.length) { - this.fail('assertElementsMatch: size mismatch: ' + elements.length + ' elements, ' + expressions.length + ' expressions'); - return false; - } - elements.zip(expressions).all(function(pair, index) { - var element = $(pair.first()), expression = pair.last(); - if (element.match(expression)) return true; - this.fail('assertElementsMatch: (in index ' + index + ') expected ' + expression.inspect() + ' but got ' + element.inspect()); - }.bind(this)) && this.pass(); - }, - assertElementMatches: function(element, expression) { - this.assertElementsMatch([element], expression); - }, - benchmark: function(operation, iterations) { - var startAt = new Date(); - (iterations || 1).times(operation); - var timeTaken = ((new Date())-startAt); - this.info((arguments[2] || 'Operation') + ' finished ' + - iterations + ' iterations in ' + (timeTaken/1000)+'s' ); - return timeTaken; - }, - _isVisible: function(element) { - element = $(element); - if(!element.parentNode) return true; - this.assertNotNull(element); - if(element.style && Element.getStyle(element, 'display') == 'none') - return false; - - return this._isVisible(element.parentNode); - }, - assertNotVisible: function(element) { - this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1])); - }, - assertVisible: function(element) { - this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1])); - }, - benchmark: function(operation, iterations) { - var startAt = new Date(); - (iterations || 1).times(operation); - var timeTaken = ((new Date())-startAt); - this.info((arguments[2] || 'Operation') + ' finished ' + - iterations + ' iterations in ' + (timeTaken/1000)+'s' ); - return timeTaken; - } -}; - -Test.Unit.Testcase = Class.create(); -Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), { - initialize: function(name, test, setup, teardown) { - Test.Unit.Assertions.prototype.initialize.bind(this)(); - this.name = name; - - if(typeof test == 'string') { - test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,'); - test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)'); - this.test = function() { - eval('with(this){'+test+'}'); - } - } else { - this.test = test || function() {}; - } - - this.setup = setup || function() {}; - this.teardown = teardown || function() {}; - this.isWaiting = false; - this.timeToWait = 1000; - }, - wait: function(time, nextPart) { - this.isWaiting = true; - this.test = nextPart; - this.timeToWait = time; - }, - run: function() { - try { - try { - if (!this.isWaiting) this.setup.bind(this)(); - this.isWaiting = false; - this.test.bind(this)(); - } finally { - if(!this.isWaiting) { - this.teardown.bind(this)(); - } - } - } - catch(e) { this.error(e); } - } -}); - -// *EXPERIMENTAL* BDD-style testing to please non-technical folk -// This draws many ideas from RSpec http://rspec.rubyforge.org/ - -Test.setupBDDExtensionMethods = function(){ - var METHODMAP = { - shouldEqual: 'assertEqual', - shouldNotEqual: 'assertNotEqual', - shouldEqualEnum: 'assertEnumEqual', - shouldBeA: 'assertType', - shouldNotBeA: 'assertNotOfType', - shouldBeAn: 'assertType', - shouldNotBeAn: 'assertNotOfType', - shouldBeNull: 'assertNull', - shouldNotBeNull: 'assertNotNull', - - shouldBe: 'assertReturnsTrue', - shouldNotBe: 'assertReturnsFalse', - shouldRespondTo: 'assertRespondsTo' - }; - var makeAssertion = function(assertion, args, object) { - this[assertion].apply(this,(args || []).concat([object])); - }; - - Test.BDDMethods = {}; - $H(METHODMAP).each(function(pair) { - Test.BDDMethods[pair.key] = function() { - var args = $A(arguments); - var scope = args.shift(); - makeAssertion.apply(scope, [pair.value, args, this]); }; - }); - - [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each( - function(p){ Object.extend(p, Test.BDDMethods) } - ); -}; - -Test.context = function(name, spec, log){ - Test.setupBDDExtensionMethods(); - - var compiledSpec = {}; - var titles = {}; - for(specName in spec) { - switch(specName){ - case "setup": - case "teardown": - compiledSpec[specName] = spec[specName]; - break; - default: - var testName = 'test'+specName.gsub(/\s+/,'-').camelize(); - var body = spec[specName].toString().split('\n').slice(1); - if(/^\{/.test(body[0])) body = body.slice(1); - body.pop(); - body = body.map(function(statement){ - return statement.strip() - }); - compiledSpec[testName] = body.join('\n'); - titles[testName] = specName; - } - } - new Test.Unit.Runner(compiledSpec, { titles: titles, testLog: log || 'testlog', context: name }); -}; \ No newline at end of file diff --git a/apps/maarch_entreprise/template/documents_list_search_adv.html b/apps/maarch_entreprise/template/documents_list_search_adv.html index ae33a90ae68..35aec327338 100644 --- a/apps/maarch_entreprise/template/documents_list_search_adv.html +++ b/apps/maarch_entreprise/template/documents_list_search_adv.html @@ -202,12 +202,7 @@ Mods <br/> <script> - $$('#container')[0].setAttribute('style', 'width: 90%; min-width: 1000px;'); - $$('#content')[0].setAttribute('style', 'width: auto; min-width: 1000px;'); - //$$('#inner_content')[0].setAttribute('style', 'width: auto; min-width: 1000px;'); - $$('table#extended_list')[0].setAttribute('style', 'width: 100%; min-width: 900px; margin: 0;'); - /* - // liste condensée - $$('table.listing')[0].setAttribute('style', 'width: 100%; min-width: 900px;'); - */ + $j('#container').attr('style', 'width: 90%; min-width: 1000px;'); + $j('#content').attr('style', 'width: auto; min-width: 1000px;'); + $j('table#extended_list').attr('style', 'width: 100%; min-width: 900px; margin: 0;'); </script> \ No newline at end of file diff --git a/apps/maarch_entreprise/template/documents_list_with_attachments.html b/apps/maarch_entreprise/template/documents_list_with_attachments.html index db0ac81a931..5c4229dd3aa 100644 --- a/apps/maarch_entreprise/template/documents_list_with_attachments.html +++ b/apps/maarch_entreprise/template/documents_list_with_attachments.html @@ -203,12 +203,8 @@ Mods <br/> <script> - $$('#container')[0].setAttribute('style', 'width: 90%; min-width: 1000px;'); - $$('#content')[0].setAttribute('style', 'width: auto; min-width: 1000px;'); - $$('#inner_content')[0].setAttribute('style', 'width: auto; min-width: 1000px;'); - $$('table#extended_list')[0].setAttribute('style', 'width: 100%; min-width: 900px; margin: 0;'); - /* - // liste condensée - $$('table.listing')[0].setAttribute('style', 'width: 100%; min-width: 900px;'); - */ + $j('#container').attr('style', 'width: 90%; min-width: 1000px;'); + $j('#content').attr('style', 'width: auto; min-width: 1000px;'); + $j('#inner_content').attr('style', 'width: auto; min-width: 1000px;'); + $j('table#extended_list').attr('style', 'width: 100%; min-width: 900px; margin: 0;'); </script> \ No newline at end of file diff --git a/modules/attachments/choose_attachment.php b/modules/attachments/choose_attachment.php index a26f2b2b227..80bdbc01983 100644 --- a/modules/attachments/choose_attachment.php +++ b/modules/attachments/choose_attachment.php @@ -94,16 +94,16 @@ $upFileOK = false; <?php if (!empty($_SESSION['upfile']['local_path']) && empty($_SESSION['error'])) { ?> <i class="fa fa-check-square fa-2x" title="<?php echo _DOWNLOADED_FILE; ?>"></i> - <input type="button" id="fileButton" onclick="$$('#file')[0].click();" class="button" + <input type="button" id="fileButton" onclick="$j('#file').click();" class="button" value="<?php if($_REQUEST['with_file'] == 'true'){ echo _WITHOUT_FILE; } else {echo $_FILES['file']['name']; }?>" title="<?php if($_REQUEST['with_file'] == 'true'){ echo _WITHOUT_FILE; } else {echo $_FILES['file']['name']; }?>" style="width: 85%;margin: 0px;margin-top: -10px;font-size: 12px;text-align: center;text-overflow: ellipsis;overflow: hidden;"> <?php } elseif (!empty($_SESSION['error'])) { ?> <i class="fa fa-remove fa-2x" title="<?php echo $_SESSION['error']; ?>"></i> - <input type="button" id="fileButton" onclick="$$('#file')[0].click();" class="button" value="<?php echo $_SESSION['error']; ?>" style="width: 85%;margin: 0px;margin-top: -10px;font-size: 12px;text-align: center;text-overflow: ellipsis;overflow: hidden;"> + <input type="button" id="fileButton" onclick="$j('#file').click();" class="button" value="<?php echo $_SESSION['error']; ?>" style="width: 85%;margin: 0px;margin-top: -10px;font-size: 12px;text-align: center;text-overflow: ellipsis;overflow: hidden;"> <?php } else { ?> <i class="fa fa-remove fa-2x" title="<?php echo _NO_FILE_SELECTED; ?>"></i> - <input type="button" id="fileButton" onclick="$$('#file')[0].click();" class="button" value="<?php echo _CHOOSE_FILE; ?>" style="width: 85%;margin: 0px;margin-top: -10px;font-size: 12px;text-align: center;text-overflow: ellipsis;overflow: hidden;"> + <input type="button" id="fileButton" onclick="$j('#file').click();" class="button" value="<?php echo _CHOOSE_FILE; ?>" style="width: 85%;margin: 0px;margin-top: -10px;font-size: 12px;text-align: center;text-overflow: ellipsis;overflow: hidden;"> <?php } ?> <p style="display:none"> <!-- window.parent.$('title').value = this.value.substring(0,this.value.indexOf('.')); --> diff --git a/modules/attachments/del_attachment.php b/modules/attachments/del_attachment.php index be8cb7277d5..37abd964e40 100644 --- a/modules/attachments/del_attachment.php +++ b/modules/attachments/del_attachment.php @@ -156,18 +156,6 @@ if ($stmt->rowCount() > 0) { var document_type = '<?php functions::xecho($info_doc['attachment_type']); ?>'; var is_version = '<?php functions::xecho($is_version); ?>'; - if(window.parent.top.document.getElementById('ans_'+num_rep+'_'+res_id_doc)) { - var tab = window.parent.top.document.getElementById('tabricatorRight'); - if(document_type == 'signed_response'){ - window.parent.top.document.getElementById('ans_'+num_rep+'_'+res_id_doc).innerHTML = "<?php echo $attach_type; ?><sup><span class=\"\" style=\"\" id=\"\"></span></sup>"; - window.parent.top.document.getElementById('ans_'+num_rep+'_'+res_id_doc).setAttribute('onclick','updateFunctionModifRep(\'<?php echo $document_id; ?>\', '+num_rep+', '+is_version+')'); - window.parent.top.document.getElementById('ans_'+num_rep+'_'+res_id_doc).id = 'ans_'+num_rep+'_<?php echo $document_id; ?>'; - - }else{ - tab.removeChild(window.parent.top.document.getElementById('ans_'+num_rep+'_'+res_id_doc)); - } - - } if(window.parent.top.document.getElementById('content_'+num_rep+'_'+res_id_doc)) { var tab = window.parent.top.document.getElementById('tabricatorRight'); @@ -184,26 +172,6 @@ if ($stmt->rowCount() > 0) { } - if (window.parent.top.document.getElementById("sign_link")){ - window.parent.top.document.getElementById("sign_link").style.display = ''; - window.parent.top.document.getElementById("sign_link").setAttribute('onclick','signFile(<?php echo $document_id; ?>,'+is_version+',2);'); - window.parent.top.document.getElementById("sign_link").style.color = '#666'; - window.parent.top.document.getElementById("sign_link_img").src = 'static.php?filename=sign.png'; - window.parent.top.document.getElementById("sign_link_img").title= 'Signer ces projets de réponse (sans certificat)'; - window.parent.top.document.getElementById("sign_link_img").style.cursor = 'pointer'; - window.parent.top.document.getElementById("sign_link").removeAttribute('disabled'); - window.parent.top.document.getElementById("sign_link").removeAttribute('href'); - } - - if (window.parent.top.document.getElementById("update_rep_link")) { - window.parent.top.document.getElementById("update_rep_link").style.display = ''; - console.log("is_version = "+is_version); - /*if (is_version == 2) document.getElementById("update_rep_link").style.display = 'none'; - else */if (is_version != 1) window.parent.top.document.getElementById("update_rep_link").setAttribute('onclick','modifyAttachmentsForm(\'index.php?display=true&module=attachments&page=attachments_content&id=<?php echo $document_id; ?>&relation=1&fromDetail=\',\'98%\',\'auto\');'); - else window.parent.top.document.getElementById("update_rep_link").setAttribute('onclick','modifyAttachmentsForm(\'index.php?display=true&module=attachments&page=attachments_content&id=<?php echo $document_id; ?>&relation=2&fromDetail=\',\'98%\',\'auto\');'); - - } - } var eleframe1 = parent.document.getElementsByName('list_attach'); diff --git a/modules/attachments/js/functions.js b/modules/attachments/js/functions.js index c527c68d4c0..20102532284 100644 --- a/modules/attachments/js/functions.js +++ b/modules/attachments/js/functions.js @@ -1,8 +1,7 @@ // Date + 60 jours, utile pour les transmissions function defineBackDate() { - var delay; var date1 = new Date(); - delay = $('withDelay').value + var delay = $j('#withDelay')[0].value; date1.setDate(date1.getDate() + Number(delay)); var str_date = date1.toLocaleDateString(); var t = str_date.split('/'); @@ -175,7 +174,6 @@ function addNewTransmission(prePath, docId, canCreateContact, langString, user) var div = document.createElement('div'); $('transmission').appendChild(div); size = $('transmission').childElementCount; - //var lang = langString.split("#"); $('newTransmissionButton' + (size - 1)).style.display = "none"; $("divOr" + (size - 1)).style.display = "none"; @@ -272,70 +270,20 @@ function getTemplatesForSelect(path_to_script, attachment_type, selectToChange) { method:'post', parameters: {attachment_type: attachment_type}, - onSuccess: function(answer){ + onSuccess: function(answer) { $(selectToChange).innerHTML = answer.responseText; } }); } -function hide_index(mode_hide, display_val) -{ - var tr_link = $('attach_link_tr'); - var tr_title = $('attach_title_tr'); - var indexes = $('indexing_fields'); - var comp_index = $('comp_indexes'); - if(mode_hide == true) - { - if(tr_link && display_val) - { - Element.setStyle(tr_link, {display : display_val}); - Element.setStyle(tr_title, {display : display_val}); - } - if(indexes) - { - Element.setStyle(indexes, {display : 'none'}); - } - if(comp_index) - { - Element.setStyle(comp_index, {display : 'none'}); - } - //show link and hide index - } - else - { - if(tr_link && display_val) - { - Element.setStyle(tr_link, {display : 'none'}); - Element.setStyle(tr_title, {display : 'none'}); - } - if(indexes) - { - Element.setStyle(indexes, {display : display_val}); - - } - if(comp_index) - { - Element.setStyle(comp_index, {display : 'block'}); - } - //hide link and show index - } -} - function showAttachmentsForm(path, width, height) { - if(typeof(width)==='undefined'){ - var width = '800'; - } - - if(typeof(height)==='undefined'){ - var height = '480'; - } - new Ajax.Request(path, { method:'post', - parameters: { url : path - }, + parameters: { + url : path + }, onSuccess: function(answer) { eval("response = "+answer.responseText); @@ -350,7 +298,7 @@ function showAttachmentsForm(path, width, height) { } function get_num_rep(res_id){ - trig_elements = document.getElementsByClassName('trig'); + var trig_elements = document.getElementsByClassName('trig'); for (i=0; i<trig_elements.length; i++){ var id = trig_elements[i].id; var splitted_id = id.split("_"); @@ -360,7 +308,6 @@ function get_num_rep(res_id){ } function ValidAttachmentsForm(path, form_id, fromAngular) { - //console.log(Form.serialize(form_id)); new Ajax.Request(path, { asynchronous: false, @@ -416,18 +363,6 @@ function ValidAttachmentsForm(path, form_id, fromAngular) { $('viewframevalidRep' + num_rep + '_' + rep_id).src = $('viewframevalidRep' + num_rep + '_' + rep_id).src; } - if ($('ans_' + num_rep + '_' + rep_id)) { - $('ans_' + num_rep + '_' + rep_id).innerHTML = response.title; - if (response.isVersion) { - $('ans_' + num_rep + '_' + rep_id).setAttribute('onclick', 'updateFunctionModifRep(\'' + response.majFrameId + '\', ' + num_rep + ', ' + response.isVersion + ');'); - $('ans_' + num_rep + '_' + rep_id).id = 'ans_' + num_rep + '_' + response.majFrameId; - } - } - - if ($('cur_idAffich')) { - console.log('test refresh'); - loadNewId2('index.php?display=true&module=visa&page=update_visaPage', res_id_master, $('coll_id').value); - } eval(response.exec_js); } } else { @@ -439,14 +374,6 @@ function ValidAttachmentsForm(path, form_id, fromAngular) { function modifyAttachmentsForm(path, width, height) { - if(typeof(width)==='undefined'){ - var width = '800'; - } - - if(typeof(height)==='undefined'){ - var height = '480'; - } - new Ajax.Request(path, { method:'post', @@ -467,8 +394,6 @@ function modifyAttachmentsForm(path, width, height) { function setFinalVersion(path) { -var check = $('final').value; - new Ajax.Request(path, { asynchronous:false, @@ -486,8 +411,8 @@ var check = $('final').value; } function loadSelectedContact() { - ContactAndAddress = $('selectContactIdRes').value; - value = ContactAndAddress.split("#"); + var ContactAndAddress = $('selectContactIdRes').value; + var value = ContactAndAddress.split("#"); $('contactidAttach').value=value[0]; $('addressidAttach').value=value[1]; $('contact_attach').value=value[2]; @@ -557,10 +482,8 @@ function setButtonStyle(radioButton, fileFormat, statusValidateButton) { } } - function cleanTitle(str) { //permet de supprimer les # dans le titre qui bloque l'ouverture de l'applet java var res = str.replace(/#/g, " "); return(res); } - diff --git a/modules/avis/documents_list_with_avis.php b/modules/avis/documents_list_with_avis.php index c984327ba90..75761dca2e1 100755 --- a/modules/avis/documents_list_with_avis.php +++ b/modules/avis/documents_list_with_avis.php @@ -582,10 +582,7 @@ $status = 0; $content = $list->showList($tab, $paramsTab, $listKey, $_SESSION['current_basket']); // $debug = $list->debug(false); -$content .= "<script>$$('#container')[0].setAttribute('style', 'width: 90%; min-width: 1000px;');". - "$$('#content')[0].setAttribute('style', 'width: auto; min-width: 1000px;');". - "$$('#inner_content')[0].setAttribute('style', 'width: auto; min-width: 1000px;');". - // "$$('table#extended_list')[0].setAttribute('style', 'width: 100%; min-width: 900px; margin: 0;');". - "</script>"; +$content .= '<script>$j(\'#container\').attr(\'style\', \'width: 90%; min-width: 1000px;\');$j(\'#content\').attr(\'style\', \'width: auto; min-width: 1000px;\');'; +$content .= '$j(\'#inner_content\').attr(\'style\', \'width: auto; min-width: 1000px;\');</script>'; echo "{'status' : " . $status . ", 'content' : '" . addslashes($debug.$content) . "', 'error' : '" . addslashes(functions::xssafe($error)) . "'}"; diff --git a/modules/basket/class/class_admin_basket_Abstract.php b/modules/basket/class/class_admin_basket_Abstract.php index f8d11334f6a..35f72b161ef 100644 --- a/modules/basket/class/class_admin_basket_Abstract.php +++ b/modules/basket/class/class_admin_basket_Abstract.php @@ -345,9 +345,9 @@ abstract class admin_basket_Abstract extends Database <?php } ?> <p style="text-align:center;"> - <i class="fa fa-search fa-2x" id="is_visible_only_on_search_icon" title="<?php echo _BASKET_VISIBLE_ONLY_ON_SEARCH;?>" style="<?php echo $css; ?>" onclick="$$('#is_visible_only_on_search')[0].click();"></i> + <i class="fa fa-search fa-2x" id="is_visible_only_on_search_icon" title="<?php echo _BASKET_VISIBLE_ONLY_ON_SEARCH;?>" style="<?php echo $css; ?>" onclick="$j('#is_visible_only_on_search').click();"></i> <?php if ($core_tools->is_module_loaded('folder')) { ?> - <i class="fa fa-folder-o fa-2x" id="is_folder_basket_icon" title="<?php echo _IS_FOLDER_BASKET;?>" style="<?php echo $css2; ?>" onclick="$$('#is_folder_basket')[0].click();"></i> + <i class="fa fa-folder-o fa-2x" id="is_folder_basket_icon" title="<?php echo _IS_FOLDER_BASKET;?>" style="<?php echo $css2; ?>" onclick="$j('#is_folder_basket').click();"></i> <?php } ?> <?php if ($core_tools->is_module_loaded('notifications')) { if ($_SESSION['m_admin']['basket']['flag_notif'] === 'Y'){ @@ -355,7 +355,7 @@ abstract class admin_basket_Abstract extends Database }else{ $css2='color:rgb(102, 102, 102);cursor:pointer;'; }?> - <i class="fa fa-bell-o fa-2x" id="flag_notif_icon" title="<?php echo _ACTIVATE_NOTIFICATION;?>" style="<?php echo $css2; ?>" onclick="$$('#flag_notif')[0].click();"></i> + <i class="fa fa-bell-o fa-2x" id="flag_notif_icon" title="<?php echo _ACTIVATE_NOTIFICATION;?>" style="<?php echo $css2; ?>" onclick="$j('#flag_notif').click();"></i> <?php } ?> </p> <p class="buttons" style="text-align:center;"> diff --git a/modules/basket/groupbasket_popup.php b/modules/basket/groupbasket_popup.php index fe27d75b6f0..dc10f8598c5 100644 --- a/modules/basket/groupbasket_popup.php +++ b/modules/basket/groupbasket_popup.php @@ -239,7 +239,7 @@ $time = $core_tools->get_session_time_expire(); echo '<li style="margin-top:5px;"><i style="font-weight:bold;font-style: italic;">'.ucfirst($module_name).'</i><ul>'; foreach ($actions_ids as $key => $action_id) { ?> - <li><input type="checkbox" name="actions[]" value="<?php functions::xecho($action_id['ID']);?>" class="check group_action" id="checkbox_<?php functions::xecho($action_id['ID']); ?>" onclick="$$('#action_<?php functions::xecho($action_id['ID']); ?>_page_use')[0].click();show_config_action(<?php functions::xecho($action_id['ID']);?>, true, <?php if(!empty($action_id['ID'])){ echo 'true';}else{ echo 'false';}?>);" <?php + <li><input type="checkbox" name="actions[]" value="<?php functions::xecho($action_id['ID']);?>" class="check group_action" id="checkbox_<?php functions::xecho($action_id['ID']); ?>" onclick="$j('#action_<?php functions::xecho($action_id['ID']); ?>_page_use').click();show_config_action(<?php functions::xecho($action_id['ID']);?>, true, <?php if(!empty($action_id['ID'])){ echo 'true';}else{ echo 'false';}?>);" <?php if (isset($action_id['ID']) && $bask->is_action_defined_for_the_group( $action_id['ID'], @@ -334,7 +334,7 @@ $time = $core_tools->get_session_time_expire(); </form> </div> </div> -<script type="text/javascript">$$('select').each(function(element) { new Chosen(element,{width: "226px", disable_search_threshold: 10,search_contains: true}); });</script> +<script type="text/javascript">$j('select').each(function(i, element) { new Chosen(element,{width: "226px", disable_search_threshold: 10,search_contains: true}); });</script> </body> </html> diff --git a/modules/visa/documents_list_with_signatory.php b/modules/visa/documents_list_with_signatory.php index 21a94657615..10bd3d77589 100644 --- a/modules/visa/documents_list_with_signatory.php +++ b/modules/visa/documents_list_with_signatory.php @@ -601,10 +601,7 @@ $status = 0; $content = $list->showList($tab, $paramsTab, $listKey, $_SESSION['current_basket']); // $debug = $list->debug(false); -$content .= "<script>$$('#container')[0].setAttribute('style', 'width: 90%; min-width: 1000px;');". - "$$('#content')[0].setAttribute('style', 'width: auto; min-width: 1000px;');". - "$$('#inner_content')[0].setAttribute('style', 'width: auto; min-width: 1000px;');". - // "$$('table#extended_list')[0].setAttribute('style', 'width: 100%; min-width: 900px; margin: 0;');". - "</script>"; +$content .= '<script>$j(\'#container\').attr(\'style\', \'width: 90%; min-width: 1000px;\');$j(\'#content\').attr(\'style\', \'width: auto; min-width: 1000px;\');'; +$content .= '$j(\'#inner_content\').attr(\'style\', \'width: auto; min-width: 1000px;\');</script>'; echo "{'status' : " . $status . ", 'content' : '" . addslashes($debug.$content) . "', 'error' : '" . addslashes(functions::xssafe($error)) . "'}"; diff --git a/modules/visa/show_visaListDocBasket_tab.php b/modules/visa/show_visaListDocBasket_tab.php deleted file mode 100644 index 7990160c7b1..00000000000 --- a/modules/visa/show_visaListDocBasket_tab.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -require_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_request.php'; -require_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_security.php'; -require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$core_tools->load_html(); -$core_tools->load_header('', true, false); -$core_tools->load_js(); - -$res_id = $_REQUEST["resId"]; -$coll_id = $_REQUEST["collId"]; -$view = $_REQUEST["view"]; - -$security = new security(); -$right = $security->test_right_doc($coll_id, $res_id); - -if(!$right){ - exit(_NO_RIGHT_TXT); -} - -$visa = new visa(); -$db = new Database(); - -$frm_str .= '<div class="listDocsBasket">'; -$tab_docs = $visa->getDocsBasket(); -//$frm_str .= '<pre>'.print_r($tab_docs,true).'</pre>'; -//$selectedCat = ''; -$list_docs = ''; -$data = array(); -foreach ($tab_docs as $num => $res_id_doc) { - - $stmt = $db->query( - "select alt_identifier, status, category_id, priority, destination, " - . " dest_contact_id, exp_contact_id, dest_user_id, exp_user_id, address_id, " - . " subject, admission_date, process_limit_date" - . " from " . $view - . " where res_id = ?", array($res_id_doc) - ); - $resChrono_doc = $stmt->fetchObject(); - $chrono_number_doc = $resChrono_doc->alt_identifier; - $cat_id = $resChrono_doc->category_id; - $doc_status = $resChrono_doc->status; - $doc_priority = $resChrono_doc->priority; - $doc_destination = $resChrono_doc->destination; - $doc_dest_contact_id = $resChrono_doc->dest_contact_id; - $doc_exp_contact_id = $resChrono_doc->exp_contact_id; - $doc_dest_user_id = $resChrono_doc->dest_user_id; - $doc_exp_user_id = $resChrono_doc->exp_user_id; - $doc_address_id = $resChrono_doc->address_id; - $doc_subject = $resChrono_doc->subject; - $doc_admission_date = functions::format_date_db($resChrono_doc->admission_date); - $doc_process_limit_date = functions::format_date_db($resChrono_doc->process_limit_date); - - $allAnsSigned = true; - $stmt2 = $db->query("SELECT status from res_view_attachments where (attachment_type='response_project' OR attachment_type='outgoing_mail') and res_id_master = ?", array($res_id_doc)); - while ($line = $stmt2->fetchObject()) { - if ($line->status == 'TRA' || $line->status == 'A_TRA') { - $allAnsSigned = false; - } - } - - if ($allAnsSigned) - $classSign = "visibility:visible;"; - else - $classSign = "visibility:hidden;"; - - $list_docs .= $res_id_doc . "#"; - - if ($res_id_doc == $res_id) { - $classLine = ' class="selectedId " '; - } else - $classLine = ' class="unselectedId " '; - - $id_to_display = _ID_TO_DISPLAY; - - $frm_str .= '<div ' . $classLine . ' onmouseover="this.style.cursor=\'pointer\';" onclick="loadNewId(\'index.php?display=true&module=visa&page=update_visaPage\',' . $res_id_doc . ',\'' . $coll_id . '\',\'' . $id_to_display . '\');" id="list_doc_' . $res_id_doc . '">'; - //check_category($coll_id, $res_id_doc); - //$data = get_general_data($coll_id, $res_id_doc, 'minimal', array(), $cat_id); - - if ($res_id_doc == $res_id) { - $selectedCat = $cat_id; - $curNumDoc = $num; - $curdest = $doc_destination; - } - - $frm_str .= '<ul>'; - $frm_str .= '<li><b style="float:left;">'; - $frm_str .= '<span id = "chrn_id_' . $res_id_doc . '">' . $chrono_number_doc . '</span> <i class="fa fa-certificate" id="signedDoc_' . $res_id_doc . '" style="' . $classSign . '" ></i> '/* . ' - ' .$res_id_doc */; - - //priority - $color = ''; - $color = 'color:' . $_SESSION['mail_priorities_color'][$doc_priority] . ';'; - - $frm_str .= '</b><i class="fa fa-circle" aria-hidden="true" style="float:right;' . $color . '" title="' . $_SESSION['mail_priorities'][$doc_priority] . '"></i></li>'; - - $frm_str .= '<li style="clear:both;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">'; - $frm_str .= '<i class="fa fa-user" title="Contact"></i> '; - - //BEGIN CASE OF CONTACT - $data = array(); - - if ($doc_dest_user_id <> '' || $doc_exp_user_id <> '') { - if ($doc_dest_user_id <> '') { - $contactIdentifier = $doc_dest_user_id; - } elseif ($doc_exp_user_id <> '') { - $contactIdentifier = $doc_exp_user_id; - } - $data['type_contact'] = 'internal'; - $stmt2 = $db->query( - 'SELECT lastname, firstname FROM ' - . $_SESSION['tablename']['users'] - . " WHERE user_id = ?", array($contactIdentifier) - ); - $res = $stmt2->fetchObject(); - $data['contact'] = $res->lastname . ' ' . $res->firstname; - $data['contactId'] = $line->{$contactIdentifier}; - } elseif ($doc_dest_contact_id <> '' || $doc_exp_contact_id <> '') { - - if ($doc_dest_contact_id <> '') { - $contactIdentifier = $doc_dest_contact_id; - } elseif ($doc_exp_contact_id <> '') { - $contactIdentifier = $doc_exp_contact_id; - } - - $data['type_contact'] = 'external'; - - // $stmt2 = $db->query("SELECT address_id FROM mlb_coll_ext WHERE res_id = ?", array($res_id)); - // $resAddress = $stmt2->fetchObject(); - $addressId = $doc_address_id; - - $stmt2 = $db->query('SELECT is_corporate_person, is_private, contact_lastname, contact_firstname, society, society_short, contact_purpose_id, address_num, address_street, address_postal_code, address_town, lastname, firstname FROM view_contacts WHERE contact_id = ? and ca_id = ?', array($contactIdentifier, $addressId)); - $res = $stmt2->fetchObject(); - - if ($res->is_corporate_person == 'Y') { - $data['contact'] = $res->society . ' '; - if (!empty($res->society_short)) { - $data['contact'] .= '(' . $res->society_short . ') '; - } - } else { - $data['contact'] = $res->contact_lastname . ' ' . $res->contact_firstname . ' '; - if (!empty($res->society)) { - $data['contact'] .= '(' . $res->society . ') '; - } - } - - if ($res->is_private == 'Y') { - $data['contact'] .= '(' . _CONFIDENTIAL_ADDRESS . ')'; - } else { - require_once("apps" . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_contacts_v2.php"); - $contact = new contacts_v2(); - $data['contact'] .= '- ' . $contact->get_label_contact($res->contact_purpose_id, $_SESSION['tablename']['contact_purposes']) . ' : '; - if (!empty($res->lastname) || !empty($res->firstname)) { - $data['contact'] .= $res->lastname . ' ' . $res->firstname . ' '; - } - if (!empty($res->address_num) || !empty($res->address_street) || !empty($res->address_town) || !empty($res->address_postal_code)) { - $data['contact'] .= ', ' . $res->address_num . ' ' . $res->address_street . ' ' . $res->address_postal_code . ' ' . strtoupper($res->address_town); - } - } - $data['contactId'] = $contactIdentifier; - $data['addressId'] = $addressId; - } - //TODO CASE OF MULTICONTACTS - // else if ($arr[$i] == 'is_multicontacts') { - // if (!empty ($line->{$arr[$i]})) { - // $data['type_contact'] = 'multi_external'; - // } - // } - //echo $data['contact'];exit; - //END CASE OF CONTACT - - if (isset($data['contact']) && !empty($data['contact'])) { - $frm_str .= '<span title="'.$data['contact'].'">'.$data['contact'].'</span>'; - } else { - $frm_str .= _MULTI . '-' . _DEST; - } - $frm_str .= '</li>'; - - $frm_str .= '<li>'; - $frm_str .= '<i class="fa fa-file" title="Objet"></i> '; - if (isset($doc_subject) && !empty($doc_subject)) { - $frm_str .= '<span title="'.$doc_subject.'">'.$doc_subject.'</span>'; - } - $frm_str .= '</li>'; - - $frm_str .= '<li>'; - $frm_str .= '<i class="fa fa-calendar " title="Date d\'arrivée"></i> '; - $frm_str .= $doc_admission_date; - $frm_str .= ' <i class="fa fa-bell" title="Date limite"></i> '; - $frm_str .= $doc_process_limit_date; - $frm_str .= '</li>'; - - $frm_str .= '</ul>'; - - $frm_str .= '</div>'; -} -$frm_str .= '</div>'; - -$frm_str .= '<div class="toolbar" style="text-align:center;">'; -$frm_str .= '<table style="width:100%;">'; -$frm_str .= '<tr>'; -$frm_str .= '<td style="width:50%";">'; -$frm_str .= '<a href="javascript://" id="previous_doc" onclick="previousDoc(\'index.php?display=true&module=visa&page=update_visaPage\', \'' . $coll_id . '\');"><i class="fa fa-chevron-up fa-2x" title="Précédent"></i></a>'; - -$frm_str .= '</td>'; - -$frm_str .= '<td style="width:50%";">'; -$frm_str .= '<a href="javascript://" id="next_doc" onclick="nextDoc(\'index.php?display=true&module=visa&page=update_visaPage\', \'' . $coll_id . '\');"><i class="fa fa-chevron-down fa-2x" title="Suivant"></i></a>'; - -$frm_str .= '</td>'; - -//$frm_str .= '<td style="width:33%";">'; -//$frm_str .= '<a href="javascript://" id="cancel" onclick="javascript:$(\'baskets\').style.visibility=\'visible\';destroyModal(\'modal_'.$id_action.'\');reinit();"><i class="fa fa-backward fa-2x" title="Annuler"></i></a>'; -//$frm_str .= '</td>'; -$frm_str .= '</tr>'; -$frm_str .= '</table>'; -$frm_str .= '</div>'; - -echo $frm_str; diff --git a/modules/visa/update_visaPage.php b/modules/visa/update_visaPage.php deleted file mode 100644 index 5c4e95ec054..00000000000 --- a/modules/visa/update_visaPage.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -$db = new Database(); -$core_tools =new core_tools(); - -$res_id = $_REQUEST['res_id']; -$_SESSION['doc_id'] = $res_id; -$coll_id = $_REQUEST['coll_id']; -// Ouverture de la modal - $frm_str = ''; - $docLockerCustomPath = 'apps/maarch_entreprise/actions/docLocker.php'; - $docLockerPath = $_SESSION['config']['businessappurl'] . '/actions/docLocker.php'; - if (is_file($docLockerCustomPath)) - require_once $docLockerCustomPath; - else if (is_file($docLockerPath)) - require_once $docLockerPath; - else - exit("can't find docLocker.php"); - - $docLocker = new docLocker($res_id); - if (!$docLocker->canOpen()) { - echo "{status : 0,error:'"._DOC_LOCKER_RES_ID."".$res_id.""._DOC_LOCKER_USER." ".$_SESSION['userLock']."'}"; - exit(); - } - -require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; -include('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'definition_mail_categories.php'); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); -$sec =new security(); -$core =new core_tools(); - -$data = get_general_data($coll_id, $res_id, 'minimal'); - -/* Partie centrale*/ -$left_html = ''; - - -//Onglet document -if ($data['category_id']['value'] != 'outgoing'){ - $pathScriptTab = $_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=view_resource_controler&visu&id='. $res_id.'&collid='.$coll_id; - $left_html .= '<dt id="onglet_entrant" style="padding-top: 6px;" onclick="loadSpecificTab(\'viewframevalidDoc\',\''.$pathScriptTab.'\');return false;">'._INCOMING.' <sup><span id="nb_note" style="'.$style2.'" class="'.$class.'">'.$nbr_notes.'</span></sup></dt><dd style="overflow-y: hidden;">'; - $left_html .= '<iframe src="'.$pathScriptTab.'" name="viewframevalidDoc" id="viewframevalidDoc" scrolling="auto" frameborder="0" style="width:100%;height:100%;" ></iframe></dd>'; - - $left_html .= '</dd>'; -}else{ - $js .= '$$(\'#visa_tab\')[0].click();'; -} - -//Onglet Circuit -$pathScriptTab = $_SESSION['config']['businessappurl'] . 'index.php?display=true&page=show_visa_tab&module=visa&resId='.$res_id.'&collId='.$coll_id.'&destination='; -$left_html .= '<dt id="visa_tab" style="padding-top: 6px;" onclick="loadSpecificTab(\'workflow_visa\',\''.$pathScriptTab.'\');return false;">'._VISA_WORKFLOW.'<span id="visa_tab_img"></span><span id="visa_tab_badge"></span></dt><dd id="page_circuit" style="overflow-x: hidden;">'; -$left_html .= '<h2>'._VISA_WORKFLOW.'</h2>'; -$left_html .= '<iframe src="" name="workflow_visa" width="100%" height="620px" align="left" scrolling="yes" frameborder="0" id="workflow_visa"></iframe>'; -$left_html .= '</dd>'; - -//LOAD TOOLBAR BADGE -$toolbarBagde_script = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=visa&page=load_toolbar_visa&origin=parent&resId='.$res_id.'&collId='.$coll_id; -$js .='loadToolbarBadge(\'visa_tab\',\''.$toolbarBagde_script.'\');'; - -//Onglet Avancement -$pathScriptTab = $_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=document_workflow_history&id='. $res_id .'&coll_id='. $coll_id.'&load&size=full'; -$left_html .= '<dt id="onglet_avancement" style="padding-top: 6px;" onclick="loadSpecificTab(\'workflow_history_document\',\''.$pathScriptTab.'\');return false;">Avancement <sup><span id="nb_note" style="'.$style2.'" class="'.$class.'">'.$nbr_notes.'</span></sup></dt><dd id="page_avancement" style="overflow-x: hidden;">'; -$left_html .= '<h2>'. _WF .'</h2>'; -$left_html .= '<iframe src="" name="workflow_history_document" width="100%" height="620px" align="left" scrolling="yes" frameborder="0" id="workflow_history_document"></iframe>'; -$left_html .= '<br/>'; -$left_html .= '<br/>'; - -$pathScriptTab = $_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=document_history&id='. $res_id .'&coll_id='. $coll_id.'&load&size=full'; -$left_html .= '<span style="cursor: pointer;" onmouseover="this.style.cursor=\'pointer\';" onclick="new Effect.toggle(\'history_document\', \'blind\', {delay:0.2});whatIsTheDivStatus(\'history_document\', \'divStatus_all_history_div\');loadSpecificTab(\'history_document\',\''.$pathScriptTab.'\');return false;">'; -$left_html .= '<span id="divStatus_all_history_div" style="color:#1C99C5;"><i class="fa fa-plus-square-o"></i></span>'; -$left_html .= '<b> '. _ALL_HISTORY .'</b>'; -$left_html .= '</span>'; -$left_html .= '<iframe src="" name="history_document" width="100%" height="620px" align="left" scrolling="yes" frameborder="0" id="history_document" style="display:none;"></iframe>'; - -$left_html .= '</dd>'; - -//Onglet notes -if ($core->is_module_loaded('notes')) { - - $pathScriptTab = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=notes&page=notes&identifier=' . $res_id . '&origin=document&coll_id=' . $coll_id . '&load&size=full'; - $left_html .= '<dt id="notes_tab" style="padding-top: 6px;" onclick="loadSpecificTab(\'list_notes_doc\',\'' . $pathScriptTab . '\');return false;">' . _NOTES . '<span id="notes_tab_img"></span><span id="notes_tab_badge"></span></dt><dd id="page_notes" style="overflow-x: hidden;"><h2>' . _NOTES . '</h2><iframe name="list_notes_doc" id="list_notes_doc" src="" frameborder="0" scrolling="yes" width="99%" height="570px"></iframe></dd> '; - - //LOAD TOOLBAR BADGE - $toolbarBagde_script = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=notes&page=load_toolbar_notes&origin=parent&resId='.$res_id.'&collId='.$coll_id; - $js .='loadToolbarBadge(\'notes_tab\',\''.$toolbarBagde_script.'\');'; -} - -/* Partie droite */ -$right_html = ''; -$visa = new visa(); -$tab_path_rep_file = $visa->get_rep_path($res_id, $coll_id); - $cptAttach = count($tab_path_rep_file); - if ($cptAttach < 6) { - $viewMode = 'extended'; - } elseif ($cptAttach < 10) { - $viewMode = 'small'; - } else { - $viewMode = 'verysmall'; - } - for ($i = 0; $i < $cptAttach; $i++) { - $num_rep = $i + 1; - if ($viewMode == 'verysmall') { - $titleRep = $i + 1; - } elseif ($viewMode == 'small') { - $titleRep = substr($_SESSION['attachment_types'][$tab_path_rep_file[$i]['attachment_type']], 0, 10); - } else { - if (strlen($tab_path_rep_file[$i]['title']) > 15) - $titleRep = substr($_SESSION['attachment_types'][$tab_path_rep_file[$i]['attachment_type']], 0, 15) . '...'; - else - $titleRep = $_SESSION['attachment_types'][$tab_path_rep_file[$i]['attachment_type']]; - } - if ($tab_path_rep_file[$i]['attachment_type'] == 'signed_response') { - $titleRep = '<i style="color:#fdd16c" class="fa fa-certificate fa-lg fa-fw"></i>' . $titleRep; - } - $pathScriptTab = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master=' . $res_id . '&id=' . $tab_path_rep_file[$i]['res_id']; - $right_html .= '<dt style="padding-top: 6px;" title="' - . $tab_path_rep_file[$i]['title'] . '" id="ans_' . $num_rep . '_' . $tab_path_rep_file[$i]['res_id'] . '" onclick="loadSpecificTab(\'viewframevalidRep' . $num_rep . '_' . $tab_path_rep_file[$i]['res_id'] . '\',\'' . $pathScriptTab . '\');updateFunctionModifRep(\'' - . $tab_path_rep_file[$i]['res_id'] . '\', ' . $num_rep . ', ' . $tab_path_rep_file[$i]['is_version'] . ');">' . $titleRep - . ' <sup><span class="" style="" id=""></span></sup></dt><dd id="content_' . $num_rep . '_' . $tab_path_rep_file[$i]['res_id'] . '">'; - if($i==0){ - $right_html .= '<iframe src="'.$pathScriptTab.'" name="viewframevalidRep' . $num_rep . '" id="viewframevalidRep' . $num_rep . '_' . $tab_path_rep_file[$i]['res_id'] . '" scrolling="auto" frameborder="0" style="width:100%;height:100%;" ></iframe>'; - - } else { - $right_html .= '<iframe src="" name="viewframevalidRep' . $num_rep . '" id="viewframevalidRep' . $num_rep . '_' . $tab_path_rep_file[$i]['res_id'] . '" scrolling="auto" frameborder="0" style="width:100%;height:100%;" ></iframe>'; - - } - $right_html .= '</dd>'; - //$right_html .= '<script>console.log('.$cptAttach.');</script>'; - - } - - $pathScriptTab = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=attachments&page=frame_list_attachments&template_selected=documents_list_attachments_simple&load&attach_type_exclude=converted_pdf,print_folder'; - - $right_html .= '<dt title="' . _ATTACHED_DOC .'" id="attachments_tab" style="padding-top: 6px;" onclick="loadSpecificTab(\'list_attach\',\''.$pathScriptTab.'\');$(\'cur_idAffich\').value=0;updateFunctionModifRep(0,0,0);">PJ<span id="attachments_tab_img"></span><span id="attachments_tab_badge"></span></dt><dd id="page_pj">'; - - //LOAD TOOLBAR BADGE - $toolbarBagde_script = $_SESSION['config']['businessappurl'] . 'index.php?display=true&module=attachments&page=load_toolbar_attachments&origin=parent&resId='.$res_id.'&collId='.$coll_id; - $js .='loadToolbarBadge(\'attachments_tab\',\''.$toolbarBagde_script.'\');'; - - if ($core_tools->is_module_loaded('attachments')) { - require 'modules/templates/class/templates_controler.php'; - $templatesControler = new templates_controler(); - $templates = array(); - $templates = $templatesControler->getAllTemplatesForProcess($curdest); - $_SESSION['destination_entity'] = $curdest; - //var_dump($templates); - $right_html .= '<div id="list_answers_div" onmouseover="this.style.cursor=\'pointer\';" style="width:100%;height:100%;">'; - $right_html .= '<div class="block" style="margin-top:-2px;height:95%;">'; - $right_html .= '<div id="processframe" name="processframe" style="height:100%;">'; - $right_html .= '<center><h2>' . _PJ . ', ' . _ATTACHEMENTS . '</h2></center>'; - - $right_html .= '<div class="ref-unit">'; - - $right_html .= '<center>'; - if ($core_tools->is_module_loaded('templates')) { - $right_html .= '<input type="button" name="attach" id="attach" class="button" value="' - . _CREATE_PJ - .'" onclick="showAttachmentsForm(\'' . $_SESSION['config']['businessappurl'] - . 'index.php?display=true&module=attachments&page=attachments_content\')" />'; - } - $right_html .= '</center><iframe name="list_attach" id="list_attach" src="" ' - . 'frameborder="0" width="100%" scrolling="yes" height="600px" scrolling="yes" ></iframe>'; - $right_html .= '</div>'; - $right_html .= '</div>'; - $right_html .= '</div>'; - //$right_html .= '<hr />'; - $right_html .= '</div>'; - } - - - $right_html .= '</dd>'; - - - $valid_but = 'valid_action_form( \'index_file\', \'index.php?display=true&page=manage_action&module=core\', \''.$_REQUEST['action'].'\', \''.$res_id.'\', \'res_letterbox\', \'null\', \''.$coll_id.'\', \'page\');'; - -//echo "{status : 1,avancement:'".$avancement_html."',circuit:'".$circuit_html."',notes_dt:'".$notes_html_dt."',notes_dd:'".$notes_html_dd."'}"; -echo "{status : 1,left_html:'".addslashes($left_html)."',right_html:'".addslashes($right_html)."',valid_button:'".addslashes($valid_but)."',id_rep:'".$tab_path_rep_file[0]['res_id']."',is_vers_rep:'".$tab_path_rep_file[0]['is_version']."',exec_js:'".addslashes($js)."'}"; -exit(); -- GitLab