tab_comp = new Array(); tab_comp[0]= new Array('null',' ','Aucun critère'); tab_comp[1]= new Array('equ','=','Egal à'); tab_comp[2]= new Array('sup','>','Supérieur à'); tab_comp[3]= new Array('supe','>=','Supérieur ou égal à'); tab_comp[4]= new Array('inf','<','Inférieur à'); tab_comp[5]= new Array('infe','<=','Inférieur ou égal à'); tab_comp[6]= new Array('dif','<>','Différent de'); tab_comp[7]= new Array('con','..','Contient'); tab_comp[8]= new Array('nco','##','Ne contient pas'); tab_comp[9]= new Array('cop','A.','Commence par'); tab_comp[10]= new Array('fip','.A','Fini par'); /** * param (int) timeWait : Temps en ms d'attente avant de relancer une requête AJAX * param (int) timeFactor : Facteur pour incrémenter le temps avant le lancement récursif * param (int) timeWaitMax : Temps en ms d'attente maximum avant de relancer une requête AJAX * param (int) timeOut : Temps en ms d'attente global maximum * param (int) timeExec : Temps d'execution * param (int) nbAppel : Nombre d'appel récursif effectué * param (Bool) debug : True affiche le debug */ function getGenerationStatus(timeWait, timeFactor, timeWaitMax, timeOut, timeExec, nbAppel, debug) { var stringTempDebug; var timeWaitCurrent; var $loadingdebug; $loadingdebug = $("#loading-debug"); nbAppel += 1; timeExec += timeWait; timeWaitCurrent = timeWait * timeFactor; if (timeWaitCurrent > timeWaitMax) { timeWaitCurrent = timeWaitMax; } if (timeExec < timeOut) { $.ajax({ url: "http://support.services-agites.fr/ajax/phpExcel_generationStatus.php", type: "POST", success: function (data) { var stringTempDebug; if (data != 'Fini') { if (debug == true) { stringTempDebug = "

" + "--> Numéro d'appel = " + nbAppel + "
--> Temps d'attente avant le prochain appel = " + timeWaitCurrent / 1000 + " sec" + "
--> Temps d'execution total = " + timeExec / 1000 + " sec" + "

Return statut : " + data + "

"; $loadingdebug.append(stringTempDebug); $loadingdebug.css("display", "block"); } setTimeout( function () { getGenerationStatus(timeWaitCurrent, timeFactor, timeWaitMax, timeOut, timeExec, nbAppel, true); } , timeWaitCurrent ); } else { if (debug == true) { stringTempDebug = "

" + "--> Numéro d'appel = " + nbAppel + "
--> Temps d'execution total = " + timeExec / 1000 + " sec" + "

Return statut : fini

"; $loadingdebug.append(stringTempDebug); $loadingdebug.css("display", "block"); } $("#waitajaxOverlay").hide(); pop_txt('Exportation Terminée'); //$("#loading").delay(3000).fadeOut("slow"); } } }); } else { if (debug == true) { stringTempDebug = "

" + "--> Numéro d'appel = " + nbAppel + "
--> Temps d'execution total = " + timeExec / 1000 + " sec" + $loadingdebug.append(stringTempDebug); $loadingdebug.css("display", "block"); } $("#waitajaxOverlay").hide(); warn_txt('Timeout (' + timeOut + ' sec) atteint'); } } function init_ajax_exp() { $("#fic_exp").click(function () { // Informe l'utilisateur que la génération du fichier est en cours var debug; var nbAppel; var timeExec; var timeOut; var timeWaitMax; var timeFactor; var timeWait; var new_url_file; var url_file; var oIFrm; var stringTemp = "

Génération du fichier en cours...

"; $("#waitajaxOverlay").show(); $loadingdebug.center(); $loadingdebug.html(""); $loadingdebug.css("display", "none"); // Chargement de l'iframe associé à l'idGenerer clické oIFrm = document.getElementById('iframePhpExcel'); url_file = $.url().attr('file'); new_url_file = url_file.replace('.php', 'exp.php'); oIFrm.contentWindow.document.location = new_url_file + "?&mode=Excel5"; // Appel de la fonction récursive pour tester le statut après une attente d'une seconde. timeWait = 1000; timeFactor = 2; timeWaitMax = 8000; timeOut = 36000000; timeExec = 1000; nbAppel = 0; debug = false; setTimeout( function () { getGenerationStatus(timeWait, timeFactor, timeWaitMax, timeOut, timeExec, nbAppel, debug); } , timeWait ); }); } function init_export() { $("#fic_exp").click(function () { var new_url; var url_courante = $(location).attr('href'); var tab_url = url_courante.split("?"); var url_file = tab_url[0]; var url_query = tab_url[1]; new_url = url_file.replace('.php', 'exp.php') + '?' + url_query; if (url_query != '') { new_url += '&'; } new_url += 'mode=Excel5'; init_new_window(new_url, 'expint', 1, 1, 'yes'); }); } function valid_rech_compl() { $("#valid_compl").click(function () { $("#rech_etendue").hide(); $("#valid").trigger('click'); }); } function init_lst_reload() { $('#lst_reload').click(function () { location.reload(); }); } function init_lst_valid() { var $search = $('#search'); $search.val($search.val().trim()); $('#lst_valid').click(function () { $('#page').val('1'); $('#lst_valid').attr("disabled", "disabled"); $('#formr').submit(); }); $("#formr").keypress(function (e) { if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { $('#page').val('1'); $('#lst_valid').attr("disabled", "disabled"); $('#formr').submit(); } }); } function init_lst_validcompl() { $('#valid_compl').click(function () { $('#page').val('1'); $('#formr').submit(); }); } function clear_simple_rech() { $("#cancel_rech").click(function () { var $lst_valid = $("#lst_valid"); var val_bton = $lst_valid.val(); var $tl = $("#tl"); var val_tl = $tl.val(); var $lst_ta = $("#lst_ta"); var val_ta = ''; if ($lst_ta.length > 0) { val_ta = $lst_ta.val(); } clear_form_elements('formr'); $lst_valid.val(val_bton); $tl.val(val_tl); if (val_ta != '') { $("#ta").val(val_ta); } $('#page').val('1'); $('#formr').submit(); }); } function clear_all_rech(url) { $("#cancel_rech").click(function () { clear_form_elements('formr'); $.ajax({ url: "http://support.services-agites.fr/ajax/update_session_tri_col.php", data: "cmd=reset&chp=all", type: "GET", success: function (data) { if (data == 'ok') { $(location).attr('href', url); /* $("#valid").trigger('click'); */ } else { alert(data); } } }); }); } function clear_all_rech_lst(url) { var $reset = $("#reset_rech_lst"); if ($reset.length > 0) { $reset.click(function () { $.ajax({ url: "http://support.services-agites.fr/ajax/update_session_tri_col.php", data: "cmd=reset&chp=all", type: "GET", success: function (data) { if (data == 'ok') { if (url != '') { $(location).attr('href', url); } } else { alert(data); } } }); }); } } function init_all_rech_compl() { init_export(); $('#rech_etendue').hide(); $('#rech_more').click(function () { $('#rech_etendue').show(); }); $('#rech_less').click(function () { $('#rech_etendue').hide(); }); $('#close_rech_etendue').click(function () { $('#rech_etendue').hide(); }); clear_all_rech(''); clear_all_rech_lst(''); }