From 7a8dafa49bd541cf00f48cf2b6da51d3da1ebea0 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 16 Jun 2026 17:26:18 -0400 Subject: [PATCH] Refactor bib management interface to enhance translation functionality and improve button visibility. Introduced new helper functions for managing translation pop-ups and updated CSS styles for the new translation button. Incremented version code to 4.72.637 in inc_settings.php. --- css/style.css | 28 +++++++++++++- inc_footer_scripts.php | 27 +++++++++++++- php/inc_fx_promoteur.php | 79 ++++++++++++++++++++++++++++++++-------- php/inc_settings.php | 2 +- 4 files changed, 117 insertions(+), 19 deletions(-) diff --git a/css/style.css b/css/style.css index fcd0bf6..cbe249a 100644 --- a/css/style.css +++ b/css/style.css @@ -1151,11 +1151,37 @@ ul.ms1-menu-compte li a:hover, ul.ms1-menu-compte li a:active { background-color:#6c757d; color:#fff; } -.btn-auto.btn-secondary + .btn-aide-bib:hover{ +.btn-auto.btn-secondary + .btn-aide-bib.bib-aide-trigger:hover{ background-color:#5a6268; color:#fff; } +.btn-aide-trad{ + border-color:#e67e22; + background:#f39c12; + color:#fff; +} + +.btn-aide-trad:hover, +.btn-aide-trad:focus{ + background:#e67e22; + color:#fff; +} + +.btn-aide-trad .fa{ + font-size:10px; + line-height:1; +} + +.epr-line-header .btn-aide-trad{ + width:18px; + height:18px; +} + +.epr-line-header .btn-aide-trad .fa{ + font-size:9px; +} + .tippy-box[data-theme~='ms1-bib']{ background-color:#1e293b; color:#f8fafc; diff --git a/inc_footer_scripts.php b/inc_footer_scripts.php index 4eb3b88..55d88a1 100644 --- a/inc_footer_scripts.php +++ b/inc_footer_scripts.php @@ -2128,7 +2128,7 @@ if ($strLangue == 'fr') { btnAuto.textContent = isActive ? row.dataset.autoLabelConfig : row.dataset.autoLabel; btnAuto.classList.toggle('btn-success', isActive); btnAuto.classList.toggle('btn-secondary', !isActive); - let autoAide = bibQuery(row, '.epr-action-auto-group > .btn-aide-bib'); + let autoAide = bibQuery(row, '.epr-action-auto-group > .bib-aide-trigger'); if (autoAide) { autoAide.classList.toggle('btn-aide-tone-success', isActive); autoAide.classList.toggle('btn-aide-tone-secondary', !isActive); @@ -2470,6 +2470,31 @@ if ($strLangue == 'fr') { moduleBib.addEventListener('click', function (e) { + let btnTrad = e.target.closest('.btn-bib-trad'); + if (btnTrad) { + e.preventDefault(); + e.stopPropagation(); + let url = btnTrad.getAttribute('data-trad-url'); + if (!url) { + return; + } + let clef = btnTrad.getAttribute('data-info-clef') || 'bib_trad'; + let popup = window.open( + url, + 'bib_trad_' + clef, + 'width=960,height=640,scrollbars=yes,resizable=yes' + ); + if (popup) { + let timer = setInterval(function () { + if (popup.closed) { + clearInterval(timer); + window.location.reload(); + } + }, 400); + } + return; + } + // ===================== // DELETE // ===================== diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index cdfab36..e29e3ef 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -2589,7 +2589,7 @@ function renderBatchConfig($tabBibAssignments, $strLangue = 'fr', $isTeamEpreuve - + @@ -2769,10 +2769,57 @@ function fxBibAideButton($clef, $strTone = '') { . ''; } +/** Dev ou préprod — crayon traduction jamais affiché en prod. */ +function fxBibIsDevPreprod() { + global $vblnEnvironementDev, $vblnEnvironementPreProd; + + return !empty($vblnEnvironementDev) || !empty($vblnEnvironementPreProd); +} + +/** Superadm connecté en dev/préprod — édition textes bib v4 via traduction.php. */ +function fxBibCanEditTrad() { + return !empty($_SESSION['usa_id']) && fxBibIsDevPreprod(); +} + +/** URL pop-up traduction.php — info_texte + info_aide FR/EN. */ +function fxBibTradUrl($clef) { + global $vDomaine, $vPage; + + $strInfoPrg = fxBibInfoPage(); + $strPage = !empty($vPage) ? $vPage : $strInfoPrg; + + return $vDomaine . '/php/traduction.php?' . http_build_query(array( + 'clef' => $clef, + 'pk_prg' => $strInfoPrg, + 'bd' => 'client', + 'page' => $strPage, + )); +} + +/** Crayon — ouvre traduction.php (superadm dev/préprod uniquement). */ +function fxBibTradButton($clef) { + if (!fxBibCanEditTrad() || strpos($clef, 'bib_v4_') !== 0) { + return ''; + } + + return ''; +} + +/** (?) + crayon traduction — à côté de chaque libellé / action bib v4. */ +function fxBibHelpButtons($clef, $strTone = '') { + return fxBibAideButton($clef, $strTone) . fxBibTradButton($clef); +} + /** Libellé info_texte + bouton (?) si info_aide renseigné. */ function fxBibTexteAide($clef, $mem_echo = 1, $strFallback = '') { $str = fxBibTexte($clef, 0, $strFallback); - $html = fxBibEsc($str) . fxBibAideButton($clef); + $html = fxBibEsc($str) . fxBibHelpButtons($clef); if ($mem_echo) { echo $html; } @@ -2781,7 +2828,7 @@ function fxBibTexteAide($clef, $mem_echo = 1, $strFallback = '') { /** Titre d'en-tête de bloc (assignation, gestion…) + aide. */ function fxBibBlockHeader($clef, $strFallback = '') { - return '' . fxBibEsc(fxBibTexte($clef, 0, $strFallback)) . fxBibAideButton($clef) . ''; + return '' . fxBibEsc(fxBibTexte($clef, 0, $strFallback)) . fxBibHelpButtons($clef) . ''; } /** Cellule d'en-tête de colonne séquence + aide optionnelle (info_texte peut être vide). */ @@ -2793,7 +2840,7 @@ function fxBibColHeader($clef, $strFallback = '') { } return '' . fxBibEsc($strLabel) - . fxBibAideButton($clef) + . fxBibHelpButtons($clef) . ''; } @@ -2817,7 +2864,7 @@ function renderBibAddRangeButton($epr_id) { data-epr-id=""> - + > - + @@ -2864,7 +2911,7 @@ function renderBibAssignActions($tabBibAssignments, $strLangue, $infoBib, $blnAu class="btn btn-sm btn-danger btn-reset"> - + @@ -2872,10 +2919,10 @@ function renderBibAssignActions($tabBibAssignments, $strLangue, $infoBib, $blnAu class="btn btn-sm btn-auto "> - + - + @@ -2883,22 +2930,22 @@ function renderBibAssignActions($tabBibAssignments, $strLangue, $infoBib, $blnAu
- +
- + - + - +
@@ -2910,13 +2957,13 @@ function renderBibAssignActions($tabBibAssignments, $strLangue, $infoBib, $blnAu - + - + @@ -2940,7 +2987,7 @@ function fxShowBibTool4($str_code, $int_eve_id, $strLangue){

-
+
> diff --git a/php/inc_settings.php b/php/inc_settings.php index dbdd312..462420b 100644 --- a/php/inc_settings.php +++ b/php/inc_settings.php @@ -7,7 +7,7 @@ * Constantes * * **************/ -define('_VERSION_CODE', '4.72.636'); +define('_VERSION_CODE', '4.72.637'); define('_DATE_CODE', '2026-06-17'); //MSIN-4290 define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');