3 if (!defined('_ECRIRE_INC_VERSION')) return;
5 function aide_changer_langue($var_lang_r, $lang_r) {
7 changer_langue($lang = $var_lang_r);
9 # pour le cas ou on a fait appel au menu de changement de langue
10 # (aide absente dans la langue x)
11 changer_langue($lang = $lang_r);
12 else $lang = $GLOBALS['spip_lang'];
17 function aide_contenu(){
18 static $contenu = null;
19 if ($contenu) return $contenu;
22 if (!is_array($help_server)) $help_server = array($help_server);
23 $path = $GLOBALS['spip_lang'] . "-aide.html";
25 include_spip('inc/aider');
26 list($contenu, $lastm) = aide_fichier($path, $help_server);
28 if (strpos($contenu,"aide_index")!==false){
29 $contenu = preg_replace(",target=['\"][^'\"]*['\"],Uims","class='ajax'",$contenu);
30 $contenu = str_replace("aide_index","aide",$contenu);
35 function aide_extrait_section($aide){
36 return aide_section($aide,aide_contenu());
39 function aide_cache_image($help_server, $cache, $rep, $lang, $file, $ext) {
40 if ($rep=="IMG" AND $lang=="cache"
41 AND @file_exists($img = _DIR_VAR.'cache-TeX/'.preg_replace(',^TeX-,', '', $file))) {
44 else if (@file_exists($img = _DIR_AIDE . $cache)) {
47 else if (@file_exists($img = _DIR_RACINE . 'AIDE/aide-'.$cache)) {
51 include_spip('inc/distant');
52 sous_repertoire(_DIR_AIDE,'','',true);
53 $img = "$help_server/$rep/$lang/$file";
54 recuperer_page($img,$f=_DIR_AIDE . $cache);
60 // Affichage du menu de gauche avec analyse de la section demandee
61 // afin d'ouvrir le sous-menu correspondant a l'affichage a droite
62 // http://doc.spip.org/@help_menu_rubrique
63 function aide_menu($aide) {
64 $contenu = aide_contenu();
65 preg_match_all(_SECTIONS_AIDE
, $contenu, $sections, PREG_SET_ORDER
);
74 foreach ($sections as $section) {
75 list(,$prof, $sujet, $bloc) = $section;
77 if ($afficher && $texte)
78 $res .= block_parfois_visible("block$numrub", "<div class='rubrique'>$titre</div>", "\n$texte",'', $ouvrir);
79 $afficher = $bloc ?
($bloc == 'redac') : true;
90 if ($aide == $sujet) {
92 $class = "article-actif";
93 $texte .= http_script("curr_article = '$id';");
94 } else $class = "article-inactif";
96 $h = generer_url_aide("aide=$sujet&frame=body&var_lang=$spip_lang");
97 $texte .= "<a class='$class' target='droite' id='$id' href='$h' onclick=\"activer_article('$id');return true;\">"
99 . "</a><br style='clear:both;' />\n";
102 if ($afficher && $texte)
103 $res .= block_parfois_visible("block$numrub", "<div class='rubrique'>$titre</div>", "\n$texte",'', $ouvrir);