From 7edec6c2d2f6088fdfefbc6f416f94287b2d0cc2 Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Tue, 9 Feb 2021 10:26:44 +0100
Subject: [PATCH] Fix divers petits glitchs sur le picker de rubrique

---
 ecrire/inc/filtres_selecteur_generique.php  | 5 +++++
 prive/ajax_item_pick_fonctions.php          | 2 +-
 prive/formulaires/selecteur/navigateur.html | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ecrire/inc/filtres_selecteur_generique.php b/ecrire/inc/filtres_selecteur_generique.php
index 32e8d8854c..5d65d6e2fd 100644
--- a/ecrire/inc/filtres_selecteur_generique.php
+++ b/ecrire/inc/filtres_selecteur_generique.php
@@ -156,6 +156,11 @@ function picker_identifie_id_rapide($ref, $rubriques_ou_objets = false, $article
 		}
 	}
 
+	// si id numerique et un seul objet possible, pas d'ambiguite
+	if (is_numeric($ref) and count($objets) === 1) {
+		$ref = reset($objets) . $ref;
+	}
+
 	// Si la référence ne correspond à rien, c'est fini
 	if (!($match = typer_raccourci($ref))) {
 		return json_export(false);
diff --git a/prive/ajax_item_pick_fonctions.php b/prive/ajax_item_pick_fonctions.php
index 693da34e67..ebf1fae3c5 100644
--- a/prive/ajax_item_pick_fonctions.php
+++ b/prive/ajax_item_pick_fonctions.php
@@ -4,4 +4,4 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 	return;
 }
 
-include_spip('formulaires/selecteur/selecteur_fonctions');
+include_spip('inc/filtres_selecteur_generique');
diff --git a/prive/formulaires/selecteur/navigateur.html b/prive/formulaires/selecteur/navigateur.html
index 6a33c3d855..26c87e5548 100644
--- a/prive/formulaires/selecteur/navigateur.html
+++ b/prive/formulaires/selecteur/navigateur.html
@@ -21,7 +21,7 @@
 	[(#ENV{limite_branche}|non)
 	[(#GRAND_TOTAL|<{#TOTAL_BOUCLE}|oui)
 	<div class='frame[ total_(#GRAND_TOTAL|max{#TOTAL_BOUCLE|moins{1}})] frame_0'><h2>[<a(#ENV{rubriques,0}|oui) href='#' onclick="jQuery(this).item_pick('rubrique|0','#ENV{name,id_item}','<:info_racine_site|texte_script|attribut_html:>','rubrique');return false;"
-><img class='add' src='#CHEMIN_IMAGE{ajouter-16.png}' alt='' /></a>]<:info_racine_site:></h2>
+>[(#CHEMIN_IMAGE{ajouter-16.png}|balise_img{'',add})]</a>]<:info_racine_site:></h2>
 	[(#INCLURE{fond=formulaires/selecteur/inc-nav-rubriques}{id_rubrique=0}{env})]</div>]]
 	<BOUCLE_contenu(HIERARCHIE){id_rubrique}{tout}{n-4,4}>#SET{n,0}
 	<div class='frame[ total_(#GRAND_TOTAL|min{#TOTAL_BOUCLE|moins{1}})][ frame_(#COMPTEUR_BOUCLE|moins{#GRAND_TOTAL|plus{1}|max{#TOTAL_BOUCLE}}|plus{#TOTAL_BOUCLE})]'>[(#ID_RUBRIQUE|=={#ENV{limite_branche}}|non)<a
-- 
GitLab