From ea52e72086a1dd9698ab838577e1e12c27811688 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 8 Jul 2026 15:04:30 -0400 Subject: [PATCH] Update anomaly navigation badge functionality and localization, increment version code to 4.72.771 This commit enhances the anomaly navigation badge by updating the label format to include a count of items to review. The JavaScript and PHP files are modified to support this new format, improving user feedback on the number of anomalies. Additionally, new localization keys are added for the formatted label in both French and English. The version code is incremented to 4.72.771 to reflect these updates. --- js/v2/bib-assignments.js | 19 ++++++++++++++----- php/inc_fx_promoteur.php | 10 ++++++++-- php/inc_settings.php | 2 +- sql/MSIN-4440-anomalies-nav-badge.sql | 12 +++++++++--- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/js/v2/bib-assignments.js b/js/v2/bib-assignments.js index de3e976..c440970 100644 --- a/js/v2/bib-assignments.js +++ b/js/v2/bib-assignments.js @@ -478,7 +478,7 @@ if (toolId === 'anomalies') { var anomCount = panel.querySelector('.bib-anomalies-count'); var destBadge = dest.querySelector('[data-bib-anomalies-nav-badge]'); - var strTodo = bibJs('jsAnomaliesNavTodo') || 'Élément à valider'; + var strTodoFmt = bibJs('jsAnomaliesNavTodoFmt') || 'Élément à valider : %d'; var intCount = 0; var blnPending = true; @@ -492,13 +492,19 @@ } } + function bibAnomaliesNavBadgeLabel(count) { + return strTodoFmt.replace(/%d/g, String(count)); + } + if (!destBadge) { dest.innerHTML = ''; if (!blnPending && intCount > 0) { + var strLabel = bibAnomaliesNavBadgeLabel(intCount); dest.innerHTML = '' - + strTodo + + ' data-bib-anomalies-nav-count="' + intCount + '"' + + ' title="' + strLabel.replace(/"/g, '"') + '">' + + strLabel + ''; } return; @@ -508,11 +514,14 @@ destBadge.classList.add('bib-ui-hidden'); destBadge.setAttribute('aria-hidden', 'true'); destBadge.textContent = ''; + destBadge.removeAttribute('data-bib-anomalies-nav-count'); } else { + var strBadgeLabel = bibAnomaliesNavBadgeLabel(intCount); destBadge.classList.remove('bib-ui-hidden'); destBadge.removeAttribute('aria-hidden'); - destBadge.textContent = strTodo; - destBadge.setAttribute('title', strTodo); + destBadge.textContent = strBadgeLabel; + destBadge.setAttribute('title', strBadgeLabel); + destBadge.setAttribute('data-bib-anomalies-nav-count', String(intCount)); } } } diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index 68aa37e..2b659ac 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -3332,6 +3332,7 @@ function fxBibStaticFallback($clef) { 'bib_v4_event_config_title' => ['fr' => "Configuration globale pour l'assignation de dossard", 'en' => 'Global bib assignment settings'], 'bib_v4_event_config_inter_epr_on' => ['fr' => 'Inter épreuve', 'en' => 'Inter-race'], 'bib_v4_anomalies_nav_todo' => ['fr' => 'Élément à valider', 'en' => 'Item to review'], + 'bib_v4_anomalies_nav_todo_fmt' => ['fr' => 'Élément à valider : %d', 'en' => 'Item to review: %d'], 'bib_v4_qty_summary_title' => ['fr' => 'Sommaire des quantités', 'en' => 'Quantity summary'], 'bib_v4_qty_summary_a_assigner' => ['fr' => 'À assigner', 'en' => 'To assign'], 'bib_v4_qty_summary_bib_restant' => ['fr' => 'Dossards restants', 'en' => 'Bibs remaining'], @@ -3579,7 +3580,8 @@ function fxBibModuleJsDataAttrs() { 'assign-full' => 'bib_v4_ajax_assign_full', 'assign-partial' => 'bib_v4_ajax_assign_partial', 'assign-none' => 'bib_v4_ajax_assign_none', - 'anomalies-nav-todo' => 'bib_v4_anomalies_nav_todo', + 'anomalies-nav-todo' => 'bib_v4_anomalies_nav_todo', + 'anomalies-nav-todo-fmt' => 'bib_v4_anomalies_nav_todo_fmt', ]; $html = ''; foreach ($map as $attr => $clef) { @@ -4421,10 +4423,14 @@ function renderBibAnomaliesNavBadge($intCount = 0, $blnPending = false) { . '" data-bib-anomalies-nav-badge="1" aria-hidden="true">'; } - $strLabel = fxBibTexte('bib_v4_anomalies_nav_todo', 0); + $strLabel = fxBibMsg('bib_v4_anomalies_nav_todo_fmt', (int)$intCount); + if ($strLabel === '' || $strLabel === 'bib_v4_anomalies_nav_todo_fmt') { + $strLabel = fxBibTexte('bib_v4_anomalies_nav_todo', 0) . ' : ' . (int)$intCount; + } return '' . fxBibEsc($strLabel) . ''; diff --git a/php/inc_settings.php b/php/inc_settings.php index d43d3a7..eaf7b15 100644 --- a/php/inc_settings.php +++ b/php/inc_settings.php @@ -7,7 +7,7 @@ * Constantes * * **************/ -define('_VERSION_CODE', '4.72.770'); +define('_VERSION_CODE', '4.72.771'); define('_DATE_CODE', '2026-07-08'); //MSIN-4290 define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe'); diff --git a/sql/MSIN-4440-anomalies-nav-badge.sql b/sql/MSIN-4440-anomalies-nav-badge.sql index 6632520..11e69cc 100644 --- a/sql/MSIN-4440-anomalies-nav-badge.sql +++ b/sql/MSIN-4440-anomalies-nav-badge.sql @@ -1,9 +1,15 @@ -- MSIN-4440 — Pastille tuile Anomalies (grille outils bib v4) --- Libellé « Élément à valider » sur la tuile, style Inter épreuve (pas de compteur rouge). +-- Libellé « Élément à valider : N » sur la tuile, style Inter épreuve (pas de compteur rouge). -- Idempotent. -SELECT 'bib_v4_anomalies_nav_todo', 'fr', 'Élément à valider', 'Pastille tuile Anomalies quand au moins une anomalie est ouverte.', 'compte.php', '', 0, 1, '', '', '', NOW() +SELECT 'bib_v4_anomalies_nav_todo', 'fr', 'Élément à valider', 'Libellé court pastille tuile Anomalies.', 'compte.php', '', 0, 1, '', '', '', NOW() FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_anomalies_nav_todo' AND info_langue = 'fr' AND info_prg = 'compte.php'); -SELECT 'bib_v4_anomalies_nav_todo', 'en', 'Item to review', 'Anomalies tool tile badge when at least one issue is present.', 'compte.php', '', 0, 1, '', '', '', NOW() +SELECT 'bib_v4_anomalies_nav_todo', 'en', 'Item to review', 'Short label for anomalies tool tile badge.', 'compte.php', '', 0, 1, '', '', '', NOW() FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_anomalies_nav_todo' AND info_langue = 'en' AND info_prg = 'compte.php'); + +SELECT 'bib_v4_anomalies_nav_todo_fmt', 'fr', 'Élément à valider : %d', 'Pastille tuile Anomalies avec quantité.', 'compte.php', '', 0, 1, '', '', '', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_anomalies_nav_todo_fmt' AND info_langue = 'fr' AND info_prg = 'compte.php'); + +SELECT 'bib_v4_anomalies_nav_todo_fmt', 'en', 'Item to review: %d', 'Anomalies tool tile badge with count.', 'compte.php', '', 0, 1, '', '', '', NOW() +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM info WHERE info_clef = 'bib_v4_anomalies_nav_todo_fmt' AND info_langue = 'en' AND info_prg = 'compte.php');