1function _isResponseOK(txt) { 2 var body = (txt || "").toString(); 3 // Retire toutes les lignes de debug style "[DBG] ...." 4 var cleaned = body.replace(/^\s*\[[^\]]+\][^\n\r]*[\r\n]*/gm, ''); 5 // OK si "1" exact (après nettoyage) ou si "OK" apparaît quelque part 6 if (/^\s*1\s*$/i.test(cleaned)) return true; 7 if (/\bOK\b/i.test(cleaned)) return true; 8 return false; 9} 10 11function update_colonne_registre_user() { 12 try { 13 // on enlève readonly pour que les valeurs partent dans le POST 14 jq(".ordre_1, .ordre_2").prop("readonly", false); 15 16 var saisie_ecran = jq("#form_ops").serialize(); 17 if (!saisie_ecran) { 18 alert("Erreur : formulaire vide"); 19 return; 20 } 21 22 console.log("[ENG][SAVE] payload len=", saisie_ecran.length, " payload=", saisie_ecran); 23 24 jq.ajax({ 25 type: "POST", 26 url: "/ajax/registre/update_colonne_registre_user_new.asp", 27 data: saisie_ecran, 28 async: true, 29 timeout: 60000, // 60s pour éviter le blocage infini 30 headers: { "X-Requested-With": "XMLHttpRequest" }, 31 beforeSend: function () { 32 if (jq.blockUI) jq.blockUI({ message: "<img src='/images/ajax-loader.gif' alt='Saving...' />" }); 33 console.log("[ENG][SAVE] AJAX send â /ajax/registre/update_colonne_registre_user_new.asp"); 34 }, 35 success: function (txt, status, xhr) { 36 console.log("[ENG][SAVE] success http", xhr.status, "body:", txt); 37 if (_isResponseOK(txt)) { 38 window.location.reload(); 39 return; 40 } 41 alert("Sauvegarde: réponse inattendue:\n" + txt); 42 }, 43 error: function (xhr, status, err) { 44 console.error("[ENG][SAVE] ERROR", status, err, "http=", xhr && xhr.status, "body=", xhr && xhr.responseText); 45 alert("Erreur pendant la sauvegarde (" + status + "): " + err + "\n\n" + (xhr && xhr.responseText ? xhr.responseText : "")); 46 }, 47 complete: function () { 48 if (jq.unblockUI) jq.unblockUI(); 49 } 50 }); 51 } catch (e) { 52 if (jq.unblockUI) jq.unblockUI(); 53 console.error("[ENG][SAVE] exception", e); 54 alert("Erreur JS pendant la sauvegarde: " + e.message); 55 } 56} 57 58function raz_colonne_registre_user(type_colonne) { 59 if (!confirm('Confirm reset?')) return; 60 61 console.log("[ENG][RESET] type=", type_colonne); 62 jq.ajax({ 63 type: "POST", 64 url: "/ajax/registre/raz_colonne_registre_user.asp", 65 data: { type_colonne: type_colonne }, 66 async: true, 67 timeout: 45000, 68 headers: { "X-Requested-With": "XMLHttpRequest" }, 69 beforeSend: function () { 70 if (jq.blockUI) jq.blockUI({ message: "<img src='/images/ajax-loader.gif' alt='Just a moment...' />" }); 71 console.log("[ENG][RESET] AJAX send â /ajax/registre/raz_colonne_registre_user.asp"); 72 }, 73 success: function (txt, status, xhr) { 74 console.log("[ENG][RESET] success http", xhr.status, "body:", txt); 75 if (_isResponseOK(txt)) { 76 window.location.reload(); 77 return; 78 } 79 alert("Reset: réponse inattendue:\n" + txt); 80 }, 81 error: function (xhr, status, err) { 82 console.error("[ENG][RESET] ERROR", status, err, "http=", xhr && xhr.status, "body=", xhr && xhr.responseText); 83 alert("Erreur pendant le reset (" + status + "): " + err + "\n\n" + (xhr && xhr.responseText ? xhr.responseText : "")); 84 }, 85 complete: function () { 86 if (jq.unblockUI) jq.unblockUI(); 87 } 88 }); 89} 90 91/* le reste du fichier */ 92 93var scrollbaractive; 94 95function update_tab_registre(page) { 96 var id_langue = jq('#id_langue').val(); 97 page = parseInt(page); 98 if (page === 0) { 99 window.location.reload(); 100 return; 101 } 102 103 nb_total_registre = 0; 104 nb_pages_registre = 0; 105 106 // â On capture la valeur actuelle de limit 107 let limit_val = parseInt(jq('#limit_pagination').val()) || 20; 108 109 var div_moteur = jq('#div_moteur input, #div_moteur select').serialize(); 110 var r_global = jq('.r_global input, .r_global select').serialize(); 111 var r_instant = jq('.r_instant').serialize(); 112 var data_ajax = 'page=' + page + '&limit_pagination=' + limit_val + '&' + r_global + '&' + r_instant + '&' + div_moteur; 113 var tab_data; 114 115 console.log("ð¡ Envoi AJAX avec les données suivantes :", data_ajax); 116 117 jq.ajax({ 118 type: "POST", 119 url: "/ajax/registre/update_tab_registre.asp", 120 data: data_ajax, 121 async: true, 122 timeout: 60000, 123 beforeSend: function () { 124 jq('#corps_liste').block({ message: "<img src='/images/ajax-loader-tiret.gif' alt='Loading...' />" }); 125 }, 126 complete: function () { 127 jq('#corps_liste').unblock(); 128 }, 129 success: function (data) { 130 console.log("â Réponse AJAX reçue :"); 131 console.log(data); 132 133 // ð¡ Extraire les données du bloc propre 134 let matches = data.match(/DATA_START([\s\S]*?)DATA_END/); 135 if (!matches || matches.length < 2) { 136 console.error("â Erreur : bloc DATA introuvable dans la réponse"); 137 console.log("Contenu brut reçu :", data); 138 alert("Format des données invalide."); 139 return; 140 } 141 142 let cleanData = matches[1].trim(); 143 tab_data = cleanData.split('<separateur>'); 144 145 if (tab_data.length < 4) { 146 console.error("â Format inattendu : pas assez de blocs <separateur>"); 147 console.log("Données reçues :", data); 148 alert("Erreur de lecture des données. Vérifie la console."); 149 return; 150 } 151 152 // Récupération des blocs 153 nb_total_registre = parseInt(tab_data[0]) || 0; 154 nb_pages_registre = parseInt(tab_data[1]) || 1; 155 nb_colonne = parseInt(tab_data[2]) || 0; 156 var html_rows = tab_data[3]; 157 158 // ð§¼ Mise à jour du tableau 159 jq('#tab_dictionnaire .body').remove(); 160 jq('<tbody class="body"></tbody>').insertAfter(jq('#tab_dictionnaire thead')); 161 jq(html_rows).appendTo(jq('#tab_dictionnaire .body')); 162 163 // ð Pagination et nb de résultats 164 jq('#form_global .pagination_gestion').empty(); 165 jq('#nb_result_recherche').empty(); 166 167 let lignes_result = '<div class="col-lg-3 first-lg col-md-2 first-md col-xs-2 first-xs">'; 168 lignes_result += (id_langue == 1 ? 'Résultats' : 'Results'); 169 lignes_result += ' : <span class="result_bold">' + (isNaN(nb_total_registre) ? "?" : nb_total_registre) + '</span></div>'; 170 console.log("ð Résumé valeurs : total =", nb_total_registre, "/ pages =", nb_pages_registre, "/ colonnes =", nb_colonne); 171 172 let lignes_pagination = '<div class="pagination_ops col-lg-6 first-lg col-md-2 first-md col-xs-4 last-xs">'; 173 if (page > 1) { 174 lignes_pagination += '<div onclick="update_tab_registre(1)"><div class="fleche_gauche"></div><div class="fleche_gauche"></div></div>'; 175 lignes_pagination += '<div onclick="update_tab_registre(' + (page - 1) + ')"><div class="fleche_gauche"></div></div>'; 176 for (let i = page - 4; i < page; i++) { 177 if (i > 1) lignes_pagination += '<span onclick="update_tab_registre(' + i + ')">' + i + '</span>'; 178 } 179 } 180 lignes_pagination += '<span class="pagination_en_cours">' + page + '</span>'; 181 if (page < nb_pages_registre) { 182 for (let j = page + 1; j <= page + 4; j++) { 183 if (j < nb_pages_registre) lignes_pagination += '<span onclick="update_tab_registre(' + j + ')">' + j + '</span>'; 184 } 185 lignes_pagination += '<div onclick="update_tab_registre(' + (page + 1) + ')"><div class="fleche_droite"></div></div>'; 186 lignes_pagination += '<div onclick="update_tab_registre(' + nb_pages_registre + ')"><div class="fleche_droite"></div><div class="fleche_droite"></div></div>'; 187 } 188 lignes_pagination += '</div>'; 189 190 // ð¢ Choix du nombre de résultats par page 191 let selected_20 = "", selected_50 = "", selected_100 = ""; 192 switch (limit_val) { 193 case 20: selected_20 = ' selected="selected"'; break; 194 case 50: selected_50 = ' selected="selected"'; break; 195 case 100: selected_100 = ' selected="selected"'; break; 196 } 197 198 let ligne_nb_limit = '<div class="result r_global col-lg-3 last-lg end-lg col-md-2 last-md end-md col-xs-2 end-xs last-xs first-xs">Show '; 199 ligne_nb_limit += '<select class="select_round" name="limit_pagination" id="limit_pagination" onchange="update_tab_registre(1);">'; 200 ligne_nb_limit += '<option value="20"' + selected_20 + '>20</option>'; 201 ligne_nb_limit += '<option value="50"' + selected_50 + '>50</option>'; 202 ligne_nb_limit += '<option value="100"' + selected_100 + '>100</option>'; 203 ligne_nb_limit += '</select> Entries</div>'; 204 205 jq(lignes_result + lignes_pagination + ligne_nb_limit).appendTo(jq('#form_global #pagination_registre')); 206 jq('<div class="col-lg-3 first-lg col-md-2 first-md col-xs-2 first-xs"></div>' + lignes_pagination).appendTo(jq('#form_global #pagination_registre2')); 207 208 // ð Scrollbar 209 jq('#LISTE_REGISTRE').height('auto'); 210 jq('#corps_liste .scrollbar').show(); 211 jq('#corps_liste .viewport').height(jq('#tab_dictionnaire').outerHeight() + 30);
212 scrollbaractive.update(); 213 214 load_overlay(); 215 load_style_tab(); 216 }, 217 error: function (xhr, status, error) { 218 console.error("â Erreur AJAX :", status, error, "http=", xhr && xhr.status, "body=", xhr && xhr.responseText); 219 alert("Une erreur est survenue lors de la récupération des données."); 220 } 221 }); 222} 223 224function export_csv() { 225 const form = document.getElementById('form_global'); 226 227 // Sauvegarde des valeurs originales 228 const originalTarget = form.getAttribute('target'); 229 const originalAction = form.getAttribute('action'); 230 231 // On prépare le formulaire pour lâexport CSV 232 form.setAttribute('target', '_blank'); 233 form.setAttribute('action', '/ajax/registre/exports/export.asp?export=csv'); 234 form.submit(); 235 236 // On restaure les attributs pour ne pas casser la navigation JS 237 form.setAttribute('target', originalTarget || ''); 238 form.setAttribute('action', originalAction || ''); 239} 240 241function ajust_header() { 242 jq('[id^="th_entete"]').each(function () { 243 var id = jq(this).attr('id').replace("th_entete", ""); 244 jq(this).width(jq('.td_corps' + id).width()); 245 }); 246} 247 248function load_style_tab() { 249 var id_th, id = 0, width = 0; 250 jq('#entete_liste>table th').each(function () { 251 id_th = jq(this).attr('id'); 252 id = id_th.substring(9, id_th.length); 253 width = parseInt(jq(this).width()); 254 jq('#' + id_th).width(width); 255 jq('.td_corps' + id).width(width); 256 jq('.td_corps' + id).wordWrap('on'); 257 }); 258} 259 260function load_tooltip_entete() { 261 jq('.img_entete').each(function () { 262 jq(this).qtip({ 263 content: { text: jq('#div_' + jq(this).attr('id')).html() }, 264 position: { my: 'top left', at: 'top center', adjust: { x: -15, y: 15 } }, 265 show: { event: 'click', solo: true }, 266 hide: false, 267 style: { 268 classes: 'ui-tooltip-rounded ui-tooltip-glossaire ui-tooltip-entete', 269 width: '290px', 270 tip: { mimic: 'center', width: 30, height: 18, offset: 15 } 271 } 272 }); 273 }); 274} 275 276function change_operator_search(selectId) { 277 var op = document.getElementById(selectId).value; 278 var baseId = selectId.replace(/^ope_/, "").replace(/1$/, ""); 279 var pAnd = document.getElementById("p2_" + baseId); 280 var pInput = document.getElementById("p2_2_" + baseId); 281 console.log("ð§ Operator selected:", op, "for", baseId); 282 if (pAnd && pInput) { 283 if (op === "B/T") { pAnd.style.display = "block"; pInput.style.display = "block"; } 284 else { pAnd.style.display = "none"; pInput.style.display = "none"; } 285 } else { 286 console.warn("â Ãléments introuvables pour:", baseId); 287 } 288} 289 290function set_ordre_colonne(id_colonne) { 291 var type_moteur = id_colonne.charAt(id_colonne.length - 1); 292 var max_value = 0; 293 var manq_value = 0; 294 var val_1 = 0, cpt = 0, flag_manq = 0; 295 var tab_ordre = new Array(); 296 if (jq('#colonne' + id_colonne).is(':checked')) { 297 jq('.ordre_' + type_moteur).each(function () { 298 if (jq(this).val() != '') { 299 tab_ordre.push(parseInt(jq(this).val())); 300 } 301 }); 302 tab_ordre = tab_ordre.sort(sortNumber); 303 for (i = 0; i < tab_ordre.length; i++) { 304 if (flag_manq == 0) { 305 val_1 = (i + 1); 306 if (tab_ordre[i] - val_1 >= 1) { 307 manq_value = val_1; 308 flag_manq = 1; 309 } 310 } 311 } 312 if (manq_value > 0 && flag_manq == 1) { 313 jq('#ordre_colonne' + id_colonne).val(manq_value); 314 } 315 else { 316 jq('.ordre_' + type_moteur).each(function () { 317 if (parseInt(jq(this).val()) > max_value) 318 max_value = parseInt(jq(this).val()); 319 }); 320 if (max_value != 0) 321 jq('#ordre_colonne' + id_colonne).val(max_value + 1); 322 else 323 jq('#ordre_colonne' + id_colonne).val('1'); 324 } 325 jq('#ordre_colonne' + id_colonne).removeAttr('disabled'); 326 } 327 else { 328 ordre_value = parseInt(jq('#ordre_colonne' + id_colonne).val()); 329 jq('#ordre_colonne' + id_colonne).attr('disabled', 'disabled'); 330 jq('#ordre_colonne' + id_colonne).val(''); 331 jq('.ordre_' + type_moteur).each(function () { 332 if (parseInt(jq(this).val()) > ordre_value) { 333 jq(this).val((parseInt(jq(this).val()) - 1)); 334 } 335 }); 336 } 337} 338 339function sortNumber(a, b) { return a - b; } 340 341function select_all_checkbox(type_col) { 342 type_col = parseInt(type_col); 343 if (type_col == 1 || type_col == 2) { 344 var ischecked = parseInt(jq('#hid_select' + type_col).val()); 345 if (ischecked == 0) { 346 jq('#hid_select' + type_col).val('1'); 347 var cpt = 1; 348 jq('.cbx_' + type_col).each(function () { 349 jq(this).prop('checked', true); 350 }); 351 jq('.ordre_' + type_col).each(function () { 352 jq(this).val(cpt); 353 jq(this).prop('readonly', false); 354 cpt++; 355 }); 356 } 357 else if (ischecked == 1) { 358 jq('#hid_select' + type_col).val('0'); 359 jq('.cbx_' + type_col).each(function () { 360 jq(this).prop('checked', false); 361 }); 362 jq('.ordre_' + type_col).each(function () { 363 jq(this).val(''); 364 jq(this).prop('readonly', true); 365 }); 366 } 367 } 368} 369 370function remove_colonne_user(id_colonne, ordre) { 371 if (parseInt(id_colonne) > 0) { 372 jq.ajax({ 373 type: "POST", 374 url: "/ajax/registre/remove_colonne_user.asp", 375 data: ({ id_colonne: id_colonne }), 376 async: false, 377 success: function (data) { 378 if (parseInt(data) == 0) 379 window.location.reload(); 380 else if (parseInt(data) > 0) { 381 jq('#th_entete' + ordre).hide(); 382 jq('.td_corps' + ordre).hide(); 383 } 384 } 385 }); 386 } 387}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.