Skip to content
Extraits de code Groupes Projets
Valider 6e7d4a07 rédigé par Fil's avatar Fil
Parcourir les fichiers

généralisation de la sélection de la rubrique au clavier

parent 5d2cdee4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -384,82 +384,10 @@ echo "<P><HR><P>";
debut_cadre_couleur("$logo_parent", false, "", _T('titre_cadre_interieur_rubrique').aide ("artrub"));
echo "<script language='JavaScript' type='text/javascript'>
<!--
/*
Author: Justin Whitford
Source: www.evolt.org
*/
function filtery(pattern, list){
/*
if the dropdown list passed in hasn't
already been backed up, we'll do that now
*/
if (!list.bak){
/*
We're going to attach an array to the select object
where we'll keep a backup of the original dropdown list
*/
list.bak = new Array();
for (n=0; n<list.length; n++){
list.bak[list.bak.length] = new Array(list[n].value, list[n].text);
}
bakselected = list.selectedIndex;
}
/*
We're going to iterate through the backed up dropdown
list. If an item matches, it is added to the list of
matches. If not, then it is added to the list of non matches.
*/
match = new Array();
nomatch = new Array();
if (pattern.length != 0) {
for (n=0; n<list.bak.length; n++){
if(list.bak[n][1].toLowerCase().indexOf(pattern.toLowerCase())!=-1 || list.bak[n][0] == pattern ){
match[match.length] = new Array(list.bak[n][0], list.bak[n][1]);
}else{
nomatch[nomatch.length] = new Array(list.bak[n][0], list.bak[n][1]);
}
}
}
/*
Now we completely rewrite the dropdown list.
First we write in the matches, then we write
in the non matches
*/
if (match.length > 0) {
list.options.length = match.length;
for (n=0; n<match.length; n++){
list[n].value = match[n][0];
list[n].text = match[n][1];
}
list.selectedIndex=0;
}
else {
list.options.length = list.bak.length;
for (n=0; n<list.bak.length; n++){
list[n].value = list.bak[n][0];
list[n].text = list.bak[n][1];
}
list.selectedIndex = bakselected;
}
}
// -->
</script>";
// Integrer la recherche de rubrique au clavier
echo "<script language='JavaScript' type='text/javascript' src='filtery.js' />\n";
echo "<input type='text' size='10' style='font-size: 90%; width: 15%;' onkeyup=\"filtery(this.value,this.form.id_rubrique);\" onChange=\"filtery(this.value,this.form.id_rubrique);\"> ";
echo "<SELECT NAME='id_rubrique' style='font-size: 90%; width:80%; font-face:verdana,arial,helvetica,sans-serif; max-height: 24px;' SIZE=1>\n";
enfant(0);
echo "</SELECT><BR>\n";
......
/*
Author: Justin Whitford
Source: www.evolt.org
*/
function filtery(pattern, list){
/*
if the dropdown list passed in hasn't
already been backed up, we'll do that now
*/
if (!list.bak){
/*
We're going to attach an array to the select object
where we'll keep a backup of the original dropdown list
*/
list.bak = new Array();
for (n=0; n<list.length; n++){
list.bak[list.bak.length] = new Array(list[n].value, list[n].text);
}
bakselected = list.selectedIndex;
}
/*
We're going to iterate through the backed up dropdown
list. If an item matches, it is added to the list of
matches. If not, then it is added to the list of non matches.
*/
match = new Array();
nomatch = new Array();
if (pattern.length != 0) {
for (n=0; n<list.bak.length; n++){
if(list.bak[n][1].toLowerCase().indexOf(pattern.toLowerCase())!=-1 || list.bak[n][0] == pattern ){
match[match.length] = new Array(list.bak[n][0], list.bak[n][1]);
}else{
nomatch[nomatch.length] = new Array(list.bak[n][0], list.bak[n][1]);
}
}
}
/*
Now we completely rewrite the dropdown list.
First we write in the matches, then we write
in the non matches
*/
if (match.length > 0) {
list.options.length = match.length;
for (n=0; n<match.length; n++){
list[n].value = match[n][0];
list[n].text = match[n][1];
}
list.selectedIndex=0;
}
else {
list.options.length = list.bak.length;
for (n=0; n<list.bak.length; n++){
list[n].value = list.bak[n][0];
list[n].text = list.bak[n][1];
}
list.selectedIndex = bakselected;
}
}
......@@ -29,7 +29,8 @@ function extraire_article($id_p) {
function gen_liste_rubriques() {
$q = "SELECT id_rubrique, id_parent, titre
FROM spip_rubriques
ORDER BY id_parent,0+titre,titre";
ORDER BY id_parent,0+titre,titre
LIMIT 0,150";
$res = spip_query($q);
......
......@@ -167,8 +167,13 @@ echo "<INPUT TYPE='text' CLASS='formo' NAME='titre' VALUE=\"$titre\" SIZE='40' $
debut_cadre_couleur("$logo_parent", false, '', _T('entree_interieur_rubrique').aide ("rubrub"));
//echo "<B>"._T('entree_interieur_rubrique')."</B> ".aide ("rubrub")."<BR>\n";
echo "<SELECT NAME='id_parent' style='background-color:#ffffff; font-size:90%; font-face:verdana,arial,helvetica,sans-serif; max-height: 24px;' class='forml' SIZE='1'>\n";
// Integrer la recherche de rubrique au clavier
echo "<script language='JavaScript' type='text/javascript' src='filtery.js' />\n";
echo "<input type='text' size='10' style='font-size: 90%; width: 15%;' onkeyup=\"filtery(this.value,this.form.id_parent);\" onChange=\"filtery(this.value,this.form.id_parent);\"> ";
echo "<SELECT NAME='id_parent' style='font-size: 90%; width:80%; font-face:verdana,arial,helvetica,sans-serif; max-height: 24px;' SIZE=1>\n";
if ($connect_toutes_rubriques) {
echo "<OPTION".mySel("0",$id_parent). http_style_background('racine-site-12.gif', "$spip_lang_left no-repeat; background-color:$couleur_foncee; padding-$spip_lang_left: 16px; font-weight:bold; color:white") .'>'._T('info_racine_site')."\n";
} else {
......
......@@ -222,7 +222,12 @@ echo "<input type='text' class='formo' name='url_site' value=\"$url_site\" size=
}
debut_cadre_couleur("$logo_parent", false, "", _T('entree_interieur_rubrique'));
echo "<select name='id_rubrique' style='background-color:#ffffff; font-size:90%; width:100%; max-height: 24px; font-face:verdana,arial,helvetica,sans-serif;' size=1>\n";
// Integrer la recherche de rubrique au clavier
echo "<script language='JavaScript' type='text/javascript' src='filtery.js' />\n";
echo "<input type='text' size='10' style='font-size: 90%; width: 15%;' onkeyup=\"filtery(this.value,this.form.id_rubrique);\" onChange=\"filtery(this.value,this.form.id_rubrique);\"> ";
echo "<SELECT NAME='id_rubrique' style='font-size: 90%; width:80%; font-face:verdana,arial,helvetica,sans-serif; max-height: 24px;' SIZE=1>\n";
enfant(0);
echo "</select>\n";
fin_cadre_couleur();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter