Skip to content
Extraits de code Groupes Projets
Valider 22a280a0 rédigé par esj's avatar esj
Parcourir les fichiers

Unifier les noms des fonctions et fichiers utilisant Ajax.

parent 55ba07f8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -452,13 +452,14 @@ ecrire/inc/lang_liste.php -text
ecrire/inc/legender.php -text
ecrire/inc/maintenance.php -text
ecrire/inc/message_select.php -text
ecrire/inc/mini_nav.php -text
ecrire/inc/minipres.php -text
ecrire/inc/petitionner.php -text
ecrire/inc/plonger.php -text
ecrire/inc/plugin.php -text
ecrire/inc/popularites.php -text
ecrire/inc/poster.php -text
ecrire/inc/referencer_traduction.php -text
ecrire/inc/selectionner.php -text
ecrire/inc/sites_voir.php -text
ecrire/inc/suivi_versions.php -text
ecrire/inc/syndic.php -text
......
......@@ -23,8 +23,8 @@ function exec_plonger_dist()
$col = intval($col);
include_spip('inc/texte');
include_spip('inc/mini_nav');
ajax_retour(mini_afficher_rubrique($id, htmlentities($rac), array(), $col, $exclus));
$plonger = charger_fonction('plonger', 'inc');
ajax_retour($plonger($id, htmlentities($rac), array(), $col, $exclus));
}
?>
......@@ -21,7 +21,8 @@ function exec_rubriquer_dist()
include_spip('inc/texte');
include_spip('inc/mini_nav');
ajax_retour(mini_nav($id, "aff_nav_recherche",
$selectionner = charger_fonction('selectionner', 'inc');
ajax_retour($selectionner($id, "aff_nav_recherche",
"document.location.href='" . generer_url_ecrire('naviguer', "id_rubrique=::sel::") .
"';", 0, true));
}
......@@ -16,14 +16,14 @@ if (!defined("_ECRIRE_INC_VERSION")) return;
function exec_selectionner_dist()
{
global $id, $exclus, $rac;
$id = intval($id);
$exclus = intval($exclus);
$id = intval(_request('id'));
$exclus = intval(_request('exclus'));
$type = _request('type');
$rac = _request('racine');
include_spip('inc/texte');
include_spip('inc/mini_nav');
ajax_retour(mini_nav($id, "choix_parent", "this.form.id_rubrique.value=::sel::;this.form.titreparent.value='::sel2::';findObj_forcer('selection_rubrique').style.display='none';", $exclus, $rac, $type!='breve'));
$selectionner = charger_fonction('selectionner', 'inc');
ajax_retour($selectionner($id, "choix_parent", "this.form.id_rubrique.value=::sel::;this.form.titreparent.value='::sel2::';findObj_forcer('selection_rubrique').style.display='none';", $exclus, $rac, $type!='breve'));
}
?>
......@@ -13,7 +13,7 @@
if (!defined("_ECRIRE_INC_VERSION")) return;
// http://doc.spip.org/@mini_afficher_rubrique
function mini_afficher_rubrique($id_rubrique, $rac="", $list=array(), $col = 1, $exclu=0) {
function inc_plonger_dist($id_rubrique, $idom="", $list=array(), $col = 1, $exclu=0) {
global $spip_lang_left;
if ($list) $id_rubrique = $list[$col-1];
......@@ -37,8 +37,8 @@ function mini_afficher_rubrique($id_rubrique, $rac="", $list=array(), $col = 1,
$next = $list[$col];
if ($ordre) {
asort($ordre);
$rec = generer_url_ecrire('plonger',"rac=$rac&exclus=$exclu&col=".($col+1));
$args = "'$rac',this,$col,'$spip_lang_left'";
$rec = generer_url_ecrire('plonger',"rac=$idom&exclus=$exclu&col=".($col+1));
$args = "'$idom',this,$col,'$spip_lang_left'";
while (list($id, $titrebrut) = each($ordre)) {
$titre = "<div class='"
......@@ -71,113 +71,21 @@ function mini_afficher_rubrique($id_rubrique, $rac="", $list=array(), $col = 1,
}
}
$nom_col = $rac . "_col_".($col+1);
$idom2 = $idom . "_col_".($col+1);
$left = ($col*150);
return http_img_pack("searching.gif", "*", "style='visibility: hidden; position: absolute; $spip_lang_left: "
. ($left-30)
. "px; top: 2px; z-index: 2;' id='img_$nom_col'")
. "px; top: 2px; z-index: 2;' id='img_$idom2'")
. "<div style='width: 150px; height: 100%; overflow: auto; position: absolute; top: 0px; $spip_lang_left: "
.($left-150)
."px;'>"
. $ret
. "\n</div>\n<div id='$nom_col'>"
. "\n</div>\n<div id='$idom2'>"
. ($next
? mini_afficher_rubrique($id_rubrique, $rac, $list, $col+1, $exclu)
? inc_plonger_dist($id_rubrique, $idom, $list, $col+1, $exclu)
: "")
. "\n</div>";
}
// http://doc.spip.org/@mini_hierarchie_rub
function mini_hierarchie_rub ($id_rubrique) {
$row = spip_fetch_array(spip_query("SELECT id_parent FROM spip_rubriques WHERE id_rubrique = " . intval($id_rubrique)));
return $row["id_parent"];
}
// http://doc.spip.org/@mini_afficher_hierarchie
function mini_hier ($id_rubrique) {
$id_parent = $id_rubrique;
$liste = $id_rubrique;
while ($id_parent = mini_hierarchie_rub ($id_parent)) {
$liste = $id_parent.",".$liste;
}
$liste = "0,".$liste;
return explode(',',$liste);
}
//
// Affiche un mini-navigateur ajax positionne sur la rubrique $sel
//
// http://doc.spip.org/@mini_nav
function mini_nav ($sel, $rac="",$fonction="", $rub_exclus=0, $aff_racine=false, $plonger=true) {
if (!$fonction)
$fonction = "document.location='"
. generer_url_ecrire('naviguer', "id_rubrique=::sel::")
. "';";
global $couleur_foncee, $spip_lang_right, $spip_lang_left;
if ($id_rubrique < 1) $id_rubrique = 0;
$ret = "<div id='$rac'>"
. "<div style='display: none;'>"
. "<input type='text' id='".$rac."_fonc' value=\"$fonction\" />"
. "</div>\n"
. "<table width='100%' cellpadding='0' cellspacing='0'>"
. "<tr>"
. "<td style='vertical-align: bottom;'>";
if ($aff_racine) {
$onClick = " aff_selection('rubrique','$rac', '0');";
# ce lien provoque la selection (directe) de la rubrique cliquee
$ondbClick = "findObj_forcer('id_parent').value=0;";
# et l'affichage de son titre dans le bandeau
$ondbClick .= "findObj_forcer('titreparent').value='"
. strtr(
str_replace("'", "&#8217;",
str_replace('"', "&#34;",
textebrut(_T('info_racine_site')))),
"\n\r", " ")."';";
$ondbClick .= "findObj_forcer('selection_rubrique').style.display='none';";
}
if ($plonger)
$onClick .= "charger_id_url('" . generer_url_ecrire('plonger',"rac=$rac&exclus=$rub_exclus&id=0&col=1", true) . "', '".$rac."_col_1');";
$ret .= "\n<div class='arial11 petite-racine'\nonclick=\""
. $onClick
. "\"\nondblclick=\""
. $ondbClick
. $onClick
. "\">\n<div class='pashighlight'>"
. _T("info_racine_site")
. "</div></div>"
. "</td>" . "\n<td>"
. http_img_pack("searching.gif", "*", "style='visibility: hidden;' id='img_".$rac."_col_1'")
. "</td>"
. "\n<td style='text-align: $spip_lang_right'>"
. "<input style='width: 100px;' type='search' id='"
. $rac
. "_champ_recherche'\nonkeypress=\"t=setTimeout('lancer_recherche_rub(\'"
. $rac
. "_champ_recherche\',\'$rac\',\'$rub_exclus\')', 200); key = event.keyCode; if (key == 13 || key == 3) { return false;} \" />"
. "</td></tr></table>\n<div id='"
. $rac
. "_principal' style='position: relative; height: 170px; background-color: white; border: 1px solid $couleur_foncee; overflow: auto;'><div id='"
. $rac
. "_col_1' class='arial1'>"
. ($plonger
? mini_afficher_rubrique($sel, $rac, mini_hier($sel), 1, $rub_exclus)
: mini_afficher_rubrique(0, $rac, false, 1, $rub_exclus))
. "</div></div>\n<div id='"
. $rac
. "_selection'></div></div>\n";
return $ret;
}
?>
<?php
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
* Copyright (c) 2001-2006 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
\***************************************************************************/
if (!defined("_ECRIRE_INC_VERSION")) return;
//
// Affiche un mini-navigateur ajax positionne sur la rubrique $sel
//
function inc_selectionner_dist ($sel, $idom="",$fonction="", $exclus=0, $aff_racine=false, $recur=true) {
global $couleur_foncee, $spip_lang_right, $spip_lang_left;
if (!$fonction)
$fonction = "document.location='"
. generer_url_ecrire('naviguer', "id_rubrique=::sel::")
. "';";
if ($recur) $recur = mini_hier($sel); else $sel = 0;
if ($aff_racine) {
$onClick = " aff_selection('rubrique','$idom', '0');";
$ondbClick = "findObj_forcer('id_parent').value=0;"
. "findObj_forcer('titreparent').value='"
. strtr(
str_replace("'", "&#8217;",
str_replace('"', "&#34;",
textebrut(_T('info_racine_site')))),
"\n\r", " ")."';"
. "findObj_forcer('selection_rubrique').style.display='none';";
}
$idom1 = $idom . "_champ_recherche";
$idom2 = $idom . "_principal";
$idom3 = $idom . "_selection";
$idom4 = $idom . "_col_1";
$idom5 = 'img_' . $idom4;
$idom6 = $idom."_fonc";
if ($recur) {
$plonger = generer_url_ecrire('plonger',"rac=$idom&exclus=$exclus&id=0&col=1", true);
$onClick .= "charger_id_url('$plonger', '$idom4');";
}
$plonger = charger_fonction('plonger', 'inc');
return "<div id='$idom'>"
. "<div style='display: none;'>"
. "<input type='text' id='$idom6' value=\"$fonction\" />"
. "</div>\n"
. "<table width='100%' cellpadding='0' cellspacing='0'>"
. "<tr>"
. "<td style='vertical-align: bottom;'>"
. "\n<div class='arial11 petite-racine'\nonclick=\""
. $onClick
. "\"\nondblclick=\""
. $ondbClick
. $onClick
. "\">\n<div class='pashighlight'>"
. _T("info_racine_site")
. "</div></div></td>\n<td>"
. http_img_pack("searching.gif", "*", "style='visibility: hidden;' id='$idom5'")
. "</td>"
. "\n<td style='text-align: $spip_lang_right'>"
. "<input style='width: 100px;' type='search' id='$idom1'"
. "\nonkeypress=\"t=setTimeout('lancer_recherche_rub(\'"
. $idom1
. "\',\'"
. $idom
. "\',\'"
. $exclus
. "\')', 200); key = event.keyCode; if (key == 13 || key == 3) { return false;} \" />"
. "</td></tr></table>\n<div id='$idom2'"
. " style='position: relative; height: 170px; background-color: white; border: 1px solid $couleur_foncee; overflow: auto;'><div id='$idom4'"
. " class='arial1'>"
. $plonger($sel, $idom, $recur, 1, $exclus)
. "</div></div>\n<div id='$idom3'></div></div>\n";
}
// http://doc.spip.org/@mini_afficher_hierarchie
function mini_hier ($id_rubrique) {
$id_parent = $id_rubrique;
$liste = $id_rubrique;
while ($id_parent = mini_hierarchie_rub ($id_parent)) {
$liste = $id_parent.",".$liste;
}
$liste = "0,".$liste;
return explode(',',$liste);
}
// http://doc.spip.org/@mini_hierarchie_rub
function mini_hierarchie_rub ($id_rubrique) {
$row = spip_fetch_array(spip_query("SELECT id_parent FROM spip_rubriques WHERE id_rubrique = " . intval($id_rubrique)));
return $row["id_parent"];
}
?>
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