3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2011 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
15 include_spip('inc/texte');
17 // http://doc.spip.org/@inc_plonger_dist
18 function inc_plonger_dist($id_rubrique, $idom="", $list=array(), $col = 1, $exclu=0, $do='aff') {
19 global $spip_lang_left;
21 if ($list) $id_rubrique = $list[$col-1];
25 # recherche les filles et petites-filles de la rubrique donnee
26 # en excluant une eventuelle rubrique interdite (par exemple, lorsqu'on
27 # deplace une rubrique, on peut la deplacer partout a partir de la
28 # racine... sauf vers elle-meme ou sa propre branche)
32 $res = sql_select("rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant",
33 "spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)",
34 "rub1.id_parent = ".sql_quote($id_rubrique)."
35 AND rub1.id_rubrique!=".sql_quote($exclu)."
36 AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=".sql_quote($exclu).")", "", "0+rub1.titre,rub1.titre");
38 while ($row = sql_fetch($res)) {
39 if (autoriser('voir','rubrique',$row['id_rubrique'])){
40 $rub[$row['id_rubrique']]['enfants'] = $row['id_enfant'];
41 if ($row['id_parent'] == $id_rubrique) {
42 $t = trim(typo(supprimer_numero($row['titre'])));
43 if ($row['langue_choisie'] != 'oui')
44 $t .= ' <small title="'
45 .traduire_nom_langue($row['lang'])
46 .'">[' . $row['lang'] . ']</small>';
47 $ordre[$row['id_rubrique']] = $t;
51 $next = isset($list[$col]) ?
$list[$col] : 0;
53 $rec = generer_url_ecrire('plonger',"rac=$idom&exclus=$exclu&do=$do&col=".($col+
1));
54 $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
55 $args = "'$idom',this,$col,'$spip_lang_left','$info',event";
56 while (list($id, $titrebrut) = each($ordre)) {
58 $titre = supprimer_numero($titrebrut);
60 $classe1 = $id_rubrique ?
'petite-rubrique' : "petit-secteur";
61 if (isset($rub[$id]["enfants"])) {
62 $classe2 = " class='rub-ouverte'";
63 $url = "\nhref='$rec&id=$id'" ;
64 } else { $url = $classe2 = '' ; }
66 $js_func = $do . '_selection_titre';
67 $click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn "
68 . (!is_array($list) ?
' false'
69 : "aff_selection_provisoire($id,$args)")
70 # ce lien provoque la selection (directe) de la rubrique cliquee
71 # et l'affichage de son titre dans le bandeau
74 . "firstChild.nodeValue,"
76 . ",'selection_rubrique','id_parent');"
77 . "\nreturn aff_selection_provisoire($id,$args);"
80 $ret .= "<div class='"
81 . (($id == $next) ?
"highlight" : "highlight off")
89 . "</a></div></div></div>";
93 $idom2 = $idom . "_col_".($col+
1);
96 return http_img_pack("searching.gif", "*", "style='visibility: hidden; position: absolute; $spip_lang_left: "
98 . "px; top: 2px; z-index: 2;' id='img_$idom2'")
99 . "<div style='width: 150px; height: 100%; overflow: auto; position: absolute; top: 0px; $spip_lang_left: "
103 . "\n</div>\n<div id='$idom2'>"
105 ?
inc_plonger_dist($id_rubrique, $idom, $list, $col+
1, $exclu)