[ Index ] |
|
Code source de SPIP 1.9.2c |
1 <?php 2 3 /***************************************************************************\ 4 * SPIP, Systeme de publication pour l'internet * 5 * * 6 * Copyright (c) 2001-2007 * 7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * 8 * * 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 \***************************************************************************/ 12 13 if (!defined("_ECRIRE_INC_VERSION")) return; 14 15 // 16 // Affiche un mini-navigateur ajax positionne sur la rubrique $sel 17 // 18 19 // http://doc.spip.org/@inc_selectionner_dist 20 function inc_selectionner_dist ($sel, $idom="",$fonction="", $exclus=0, $aff_racine=false, $recur=true) { 21 22 if ($recur) $recur = mini_hier($sel); else $sel = 0; 23 24 if ($aff_racine) { 25 $info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&id="); 26 $idom3 = $idom . "_selection"; 27 28 $onClick = " aff_selection(0, '$idom3', '$info', event);"; 29 30 $ondbClick = strtr(str_replace("'", "’", 31 str_replace('"', """, 32 textebrut(_T('info_racine_site')))), 33 "\n\r", " "); 34 35 $ondbClick = "aff_selection_titre('$ondbClick',0,'selection_rubrique','id_parent');"; 36 37 $aff_racine = "<div class='arial11 petite-racine'\nonclick=\"" 38 . $onClick 39 . "\"\nondbclick=\"" 40 . $ondbClick 41 . $onClick 42 . "\">\n<div class='pashighlight'>" 43 . _T("info_racine_site") 44 . "</div></div>"; 45 } else $onClick = ''; 46 47 $url_init = generer_url_ecrire('plonger',"rac=$idom&exclus=$exclus&id=0&col=1", true); 48 49 $plonger = charger_fonction('plonger', 'inc'); 50 $plonger_r = $plonger($sel, $idom, $recur, 1, $exclus); 51 52 // url completee par la fonction JS onkeypress_rechercher 53 $url = generer_url_ecrire('rechercher', "exclus=$exclus&rac=$idom&type="); 54 return construire_selectionner_hierarchie($idom, $plonger_r, $aff_racine, $url, 'id_parent', $url_init); 55 } 56 57 // http://doc.spip.org/@construire_selectionner_hierarchie 58 function construire_selectionner_hierarchie($idom, $liste, $racine, $url, $name, $url_init='') 59 { 60 global $couleur_foncee, $spip_lang_right; 61 62 $idom1 = $idom . "_champ_recherche"; 63 $idom2 = $idom . "_principal"; 64 $idom3 = $idom . "_selection"; 65 $idom4 = $idom . "_col_1"; 66 $idom5 = 'img_' . $idom4; 67 $idom6 = $idom."_fonc"; 68 69 return "<div id='$idom'>" 70 . "<a id='$idom6' style='visibility: hidden;'" 71 . ($url_init ? "\nhref='$url_init'" : '') 72 . "></a>" 73 . "<table width='100%' cellpadding='0' cellspacing='0'><tr>" 74 . "<td style='vertical-align: bottom;'>\n" 75 . $racine 76 . "</td>\n<td>" 77 . http_img_pack("searching.gif", "*", "style='visibility: hidden;' id='$idom5'") 78 . "</td><td style='text-align: $spip_lang_right'>" 79 . "<input style='width: 100px;' type='search' id='$idom1'" 80 // eliminer Return car il provoque la soumission (balise unique) 81 // ce serait encore mieux de ne le faire que s'il y a encore plusieurs 82 // resultats retournes par la recherche 83 . "\nonkeypress=\"k=event.keyCode;if (k==13 || k==3){return false;}\"" 84 // lancer la recherche apres le filtrage ci-dessus 85 . "\nonkeyup=\"return onkey_rechercher(this.value," 86 // la destination de la recherche 87 . "'$idom4'" 88 # . "this.parentNode.parentNode.parentNode.parentNode.nextSibling.firstChild.id" 89 . ",'" 90 // l'url effectuant la recherche 91 . $url 92 . "'," 93 // le noeud contenant un gif anime 94 // . "'idom5'" 95 . "this.parentNode.previousSibling.firstChild" 96 . ",'" 97 // la valeur de l'attribut Name a remplir 98 . $name 99 . "','" 100 // noeud invisible memorisant l'URL initiale (pour re-initialisation) 101 . $idom6 102 . "')\"" 103 . " />" 104 . "\n</td></tr></table><div id='$idom2'" 105 . " style='position: relative; height: 170px; background-color: white; border: 1px solid $couleur_foncee; overflow: auto;'><div id='$idom4'" 106 . " class='arial1'>" 107 . $liste 108 . "</div></div>\n<div id='$idom3'></div></div>\n"; 109 } 110 111 // http://doc.spip.org/@mini_hier 112 function mini_hier ($id_rubrique) { 113 114 $id_parent = $id_rubrique; 115 $liste = $id_rubrique; 116 while ($id_parent = mini_hierarchie_rub ($id_parent)) { 117 $liste = $id_parent.",".$liste; 118 } 119 $liste = "0,".$liste; 120 return explode(',',$liste); 121 } 122 123 124 // http://doc.spip.org/@mini_hierarchie_rub 125 function mini_hierarchie_rub ($id_rubrique) { 126 $row = spip_fetch_array(spip_query("SELECT id_parent FROM spip_rubriques WHERE id_rubrique = " . intval($id_rubrique))); 127 return $row["id_parent"]; 128 } 129 130 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 10:20:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |