diff --git a/.gitattributes b/.gitattributes index 07e04845dc63ec875ebadd12a2b20aaecf89313c..f15146fea27baee172023b26bbfea9379f5897a8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -434,7 +434,6 @@ ecrire/exec/export_all.php -text ecrire/exec/forum.php -text ecrire/exec/forum_admin.php -text ecrire/exec/forum_envoi.php -text -ecrire/exec/gadgets.php -text ecrire/exec/grouper_mots.php -text ecrire/exec/iconifier.php -text ecrire/exec/import_all.php -text @@ -448,6 +447,9 @@ ecrire/exec/legender.php -text ecrire/exec/legender_auteur.php -text ecrire/exec/meme_rubrique.php -text ecrire/exec/memoriser.php -text +ecrire/exec/menu_agenda.php -text +ecrire/exec/menu_navigation.php -text +ecrire/exec/menu_rubriques.php -text ecrire/exec/message.php -text ecrire/exec/message_edit.php -text ecrire/exec/messagerie.php -text diff --git a/ecrire/exec/gadgets.php b/ecrire/exec/menu_agenda.php similarity index 54% rename from ecrire/exec/gadgets.php rename to ecrire/exec/menu_agenda.php index b193fe72ac14ce17b644a5c3b37281650156a9ac..ca3347854b443882289b6399affc87b0a402c956 100644 --- a/ecrire/exec/gadgets.php +++ b/ecrire/exec/menu_agenda.php @@ -12,26 +12,25 @@ if (!defined("_ECRIRE_INC_VERSION")) return; -// http://doc.spip.org/@exec_gadgets_dist -function exec_gadgets_dist() -{ - $id_rubrique = intval(_request('id_rubrique')); - $gadget = _request('gadget'); - $gadgets = charger_fonction('gadgets', 'inc'); - - header("Cache-Control: max-age=3600"); - - if ($date = intval(_request('date'))) - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $date)." GMT"); - - if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) - AND !strstr($_SERVER['SERVER_SOFTWARE'],'IIS/')) { - include_spip('inc/headers'); - header('Content-Type: text/html; charset='. $GLOBALS['meta']['charset']); - http_status(304); - exit; - } else { - ajax_retour($gadgets($id_rubrique, $gadget)); - } +include_spip('inc/presentation'); + +function exec_menu_agenda_dist() { + + list($evtm, $evtt, $evtr) = http_calendrier_messages(date("Y"), date("m"), date("d")); + + $ret = "<table><tr>" + . "<td style='width: 200px; vertical-align: top;' >" + . "<div>" + . $evtm + . "</div>" + . "</td>" + . (!$evtt ? '' : + ( "<td style='width: 10px; vertical-align: top'> </td>" + . "<td style='width: 200px; color: black; vertical-align: top'>" + . "<div> </div>$evtt</td>")) + . "</tr></table>"; + + ajax_retour($ret); } + ?> diff --git a/ecrire/exec/menu_navigation.php b/ecrire/exec/menu_navigation.php new file mode 100644 index 0000000000000000000000000000000000000000..ec74532db80f5cf382e56e789c310abb94e4a959 --- /dev/null +++ b/ecrire/exec/menu_navigation.php @@ -0,0 +1,114 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2007 * + * 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; + +include_spip('inc/presentation'); + +function exec_menu_navigation_dist() { + global $connect_id_auteur, $connect_statut, $couleur_claire,$couleur_foncee, $spip_lang_left, $spip_lang_right, $spip_ecran; + + $id_rubrique = intval(_request('id_rubrique')); + + $gadget = '<div style="width: 300px;">'; + + $vos_articles = spip_query("SELECT articles.id_article, articles.id_rubrique, articles.titre, articles.statut FROM spip_articles AS articles, spip_auteurs_articles AS lien WHERE articles.id_article=lien.id_article AND lien.id_auteur=$connect_id_auteur AND articles.statut='prepa' ORDER BY articles.date DESC LIMIT 5"); + if (spip_num_rows($vos_articles) > 0) { + $gadget .= "<div> </div>"; + $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; + $gadget .= bandeau_titre_boite2(afficher_plus(generer_url_ecrire("articles_page","")) . '<b>' ._T('info_en_cours_validation') . '</b>', "article-24.gif", $couleur_foncee, 'white', false); + $gadget .= "\n<div class='plan-articles'>\n"; + while($row = spip_fetch_array($vos_articles)) { + $id_article = $row['id_article']; + $titre = typo(sinon($row['titre'], _T('ecrire:info_sans_titre'))); + $statut = $row['statut']; + $gadget .= "<a class='$statut spip_xx-small' href='" . generer_url_ecrire("articles","id_article=$id_article") . "'>$titre</a>\n"; + } + $gadget .= "</div>"; + $gadget .= "</div>"; + } + + $vos_articles = spip_query("SELECT id_article, id_rubrique, titre, statut FROM spip_articles WHERE statut='prop' ORDER BY date DESC LIMIT 5"); + if (spip_num_rows($vos_articles) > 0) { + $gadget .= "<div> </div>"; + $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; + $gadget .= bandeau_titre_boite2(afficher_plus('./') . '<b>' . _T('info_articles_proposes') . '</b>', "article-24.gif", $couleur_foncee, 'white', false); + $gadget .= "<div class='plan-articles'>"; + while($row = spip_fetch_array($vos_articles)) { + $id_article = $row['id_article']; + $titre = sinon($row['titre'], _T('ecrire:info_sans_titre')); + $statut = $row['statut']; + + $gadget .= "<a class='$statut spip_xx-small' href='" . generer_url_ecrire("articles","id_article=$id_article") . "'>$titre</a>"; + } + $gadget .= "</div>"; + $gadget .= "</div>"; + } + + $vos_articles = spip_query("SELECT * FROM spip_breves WHERE statut='prop' ORDER BY date_heure DESC LIMIT 5"); + if (spip_num_rows($vos_articles) > 0) { + $gadget .= "<div> </div>"; + $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; + $gadget .= bandeau_titre_boite2(afficher_plus(generer_url_ecrire("breves")).'<b>' . _T('info_breves_valider') . '</b>', "breve-24.gif", "$couleur_foncee", "white", false); + $gadget .= "<div class='plan-articles'>"; + while($row = spip_fetch_array($vos_articles)) { + $id_breve = $row['id_breve']; + $titre = typo(sinon($row['titre'], _T('ecrire:info_sans_titre'))); + $statut = $row['statut']; + + $gadget .= "<a class='$statut spip_xx-small' href='" . generer_url_ecrire("breves_voir","id_breve=$id_breve") . "'>$titre</a>"; + } + $gadget .= "</div>"; + $gadget .= "</div>"; + } + + $result = spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1"); + + if (spip_num_rows($result) > 0) { + $gadget .= "<div> </div>"; + if ($id_rubrique > 0) { + $dans_rub = "&id_rubrique=$id_rubrique"; + $dans_parent = "&id_parent=$id_rubrique"; + } else $dans_rub = $dans_parent = ''; + if ($connect_statut == "0minirezo") { + $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; + if ($id_rubrique > 0) + $gadget .= icone_horizontale(_T('icone_creer_sous_rubrique'), generer_url_ecrire("rubriques_edit","new=oui$dans_parent"), "rubrique-24.gif", "creer.gif", false); + else + $gadget .= icone_horizontale(_T('icone_creer_rubrique'), generer_url_ecrire("rubriques_edit","new=oui"), "rubrique-24.gif", "creer.gif", false); + $gadget .= "</div>"; + } + $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; + $gadget .= icone_horizontale(_T('icone_ecrire_article'), generer_url_ecrire("articles_edit","new=oui$dans_rub"), "article-24.gif","creer.gif", false); + $gadget .= "</div>"; + + if ($GLOBALS['meta']["activer_breves"] != "non") { + $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; + $gadget .= icone_horizontale(_T('icone_nouvelle_breve'), generer_url_ecrire("breves_edit","new=oui$dans_rub"), "breve-24.gif","creer.gif", false); + $gadget .= "</div>"; + } + + if ($GLOBALS['meta']["activer_sites"] == 'oui') { + if ($connect_statut == '0minirezo' OR $GLOBALS['meta']["proposer_sites"] > 0) { + $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; + $gadget .= icone_horizontale(_T('info_sites_referencer'), generer_url_ecrire("sites_edit","new=oui$dans_parent"), "site-24.gif","creer.gif", false); + $gadget .= "</div>"; + } + } + + } + + $gadget .="</div>"; + + ajax_retour($gadget); +} +?> diff --git a/ecrire/exec/menu_rubriques.php b/ecrire/exec/menu_rubriques.php new file mode 100644 index 0000000000000000000000000000000000000000..f9884450b2f3a5356077e151ba60681ba3f55c30 --- /dev/null +++ b/ecrire/exec/menu_rubriques.php @@ -0,0 +1,186 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2007 * + * 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; + +function exec_menu_rubriques_dist() { + global $spip_ecran; + + header("Cache-Control: max-age=3600"); + + if ($date = intval(_request('date'))) + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $date)." GMT"); + + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) + AND !strstr($_SERVER['SERVER_SOFTWARE'],'IIS/')) { + include_spip('inc/headers'); + header('Content-Type: text/html; charset='. $GLOBALS['meta']['charset']); + http_status(304); + exit; + } else { + + $largeur_t = ($spip_ecran == "large") ? 900 : 650; + gen_liste_rubriques(); + $arr_low = extraire_article(0); + + $total_lignes = $i = sizeof($arr_low); + $ret = ''; + + if ($i > 0) { + $nb_col = min(8,ceil($total_lignes / 30)); + if ($nb_col <= 1) $nb_col = ceil($total_lignes / 10); + $max_lignes = ceil($total_lignes / $nb_col); + $largeur = min(200, ceil($largeur_t / $nb_col)); + $count_lignes = 0; + $style = " style='z-index: 0; vertical-align: top;'"; + + foreach( $arr_low as $id_rubrique => $titre_rubrique) { + if ($count_lignes == $max_lignes) { + $count_lignes = 0; + $ret .= "</div></td>\n<td$style><div class='bandeau_rubriques'>"; + } + $count_lignes ++; + if (autoriser('voir','rubrique',$id_rubrique)){ + $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, 1, $largeur); + } + } + + $ret = "<table><tr>\n<td$style><div class='bandeau_rubriques'>" + . $ret + . "\n</div></td></tr></table>\n"; + } + + ajax_retour("<div> </div>" . $ret); + } +} + + +// http://doc.spip.org/@bandeau_rubrique +function bandeau_rubrique($id_rubrique, $titre_rubrique, $zdecal, $largeur) { + global $spip_ecran, $spip_display; + global $spip_lang, $spip_lang_rtl, $spip_lang_left, $spip_lang_right; + + $titre_rubrique = preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique); + // Limiter volontairement le nombre de sous-menus + $zmax = 6; + + if ($zdecal == 1) $image = "secteur-12.gif"; + //else $image = "rubrique-12.gif"; + else $image = ''; + + if ($image) + $image = " background-image: url(" . http_wrapper($image) .");"; + + $nav = "<a href='" + . generer_url_ecrire('naviguer', 'id_rubrique='.$id_rubrique) + . "'\nclass='bandeau_rub' style='width: " + . $largeur + . "px;" + . $image + . "'>\n " + . supprimer_tags($titre_rubrique) + . "</a>\n"; + + if ($zdecal >= $zmax) return "\n<div>$nav</div>"; + + $arr_rub = extraire_article($id_rubrique); + $i = sizeof($arr_rub); + if (!$i) return "\n<div>$nav</div>"; + + $pxdecal = max(15, ceil($largeur/5)) . 'px'; + $idom = 'b_' . $id_rubrique; + + $ret = "<div class='pos_r' +onmouseover=\"montrer('$idom');\" +onmouseout=\"cacher('$idom'); \">" + . '<div class="brt">' + . $nav + . "</div>\n<div class='bandeau_rub' style='top: 14px; left: " + . $pxdecal + . "; z-index: " + . $zdecal + . ";' id='" + . $idom + . "'><table cellspacing='0' cellpadding='0'><tr><td valign='top'>"; + + if ($nb_rub = count($arr_rub)) { + $nb_col = min(10,max(1,ceil($nb_rub / 10))); + $ret_ligne = max(4,ceil($nb_rub / $nb_col)); + } + $count_ligne = 0; + foreach( $arr_rub as $id_rub => $titre_rub) { + $count_ligne ++; + + if ($count_ligne > $ret_ligne) { + $count_ligne = 0; + $ret .= "</td>"; + $ret .= '<td valign="top" style="border-left: 1px solid #cccccc;">'; + + } + if (autoriser('voir','rubrique',$id_rub)){ + $titre = supprimer_numero(typo($titre_rub)); + $ret .= bandeau_rubrique($id_rub, $titre, $zdecal+1, $largeur); + } + } + $ret .= "</td></tr></table>\n"; + $ret .= "</div></div>\n"; + return $ret; +} + + + +function extraire_article($id_p) { + if (array_key_exists($id_p, $GLOBALS['db_art_cache'])) { + return $GLOBALS['db_art_cache'][$id_p]; + } else { + return array(); + } +} + +// http://doc.spip.org/@gen_liste_rubriques +function gen_liste_rubriques() { + + // ici, un petit fichier cache ne fait pas de mal + if (lire_fichier(_DIR_TMP.'cache-menu-rubriques.txt', $cache) + AND list($date,$GLOBALS['db_art_cache']) = @unserialize($cache) + AND $date == $GLOBALS['meta']["date_calcul_rubriques"]) + return; // c'etait en cache :-) + + // se restreindre aux rubriques utilisees recemment +secteurs + $liste="0"; + $s = spip_query("SELECT id_rubrique FROM spip_rubriques ORDER BY id_parent=0 DESC, date DESC LIMIT 500"); + while ($t = spip_fetch_array($s)) + $liste .=",".$t['id_rubrique']; + + $res = spip_query("SELECT id_rubrique, id_parent, titre FROM spip_rubriques WHERE id_rubrique IN ($liste) ORDER BY id_parent,0+titre,titre"); + + // il ne faut pas filtrer le autoriser voir ici car on met le resultat en cache, commun a tout le monde + $GLOBALS['db_art_cache'] = array(); + if (spip_num_rows($res) > 0) { + while ($row = spip_fetch_array($res)) { + $id = $row['id_rubrique']; + $parent = $row['id_parent']; + $GLOBALS['db_art_cache'][$parent][$id] = + supprimer_numero(typo(sinon($row['titre'], _T('ecrire:info_sans_titre')))); + } + } + + // ecrire dans le cache + ecrire_fichier(_DIR_TMP.'cache-menu-rubriques.txt', + serialize(array( + $GLOBALS['meta']["date_calcul_rubriques"], + $GLOBALS['db_art_cache'] + )) + ); +} + +?> diff --git a/ecrire/inc/commencer_page.php b/ecrire/inc/commencer_page.php index d80096949887b844fc7b752c314adb0cb2886471..9c837e3515eb797b1bec92d58a89bcf02602ac44 100644 --- a/ecrire/inc/commencer_page.php +++ b/ecrire/inc/commencer_page.php @@ -114,32 +114,7 @@ function init_body($rubrique='accueil', $sous_rubrique='accueil', $id_rubrique=' $res .= "\n<div align='center' style=\"max-height: 40px; width: 100%; border-bottom: solid 1px white;$style\">" . "<table cellpadding='0' style='background: none;' width='$largeur'><tr>" . "<td valign='middle' class='bandeau_couleur' style='text-align: $spip_lang_left;'>" - - // ce bouton commande le menu de rubriques (cf. inc/gadgets) - . "<a id='boutonbandeautoutsite' href='" . generer_url_ecrire("articles_tous") . "' class='icone26' onmouseover=\"changestyle('bandeautoutsite');\" onfocus=\"changestyle('bandeautoutsite');\" onblur=\"changestyle('bandeautoutsite');\">" - . http_img_pack("tout-site.png", _T('icone_site_entier'), "width='26' height='20'") . "</a>"; - if ($id_rubrique > 0) - $res .= "<a href='" . generer_url_ecrire("brouteur","id_rubrique=$id_rubrique") . "' class='icone26' onmouseover=\"changestyle('bandeaunavrapide');\" onfocus=\"changestyle('bandeaunavrapide');\" onblur=\"changestyle('bandeaunavrapide');\">" . - http_img_pack("naviguer-site.png", _T('icone_brouteur'), "width='26' height='20'") ."</a>"; - else $res .= "<a href='" . generer_url_ecrire("brouteur") . "' class='icone26' onmouseover=\"changestyle('bandeaunavrapide');\" onfocus=\"changestyle('bandeaunavrapide');\" onblur=\"changestyle('bandeaunavrapide');\">" . - http_img_pack("naviguer-site.png", _T('icone_brouteur'), "width='26' height='20'") . "</a>"; - - $res .= "<a href='" - . generer_url_ecrire("recherche") - . "' class='icone26' onmouseover=\"changestyle('bandeaurecherche'); jQuery('#form_recherche')[0].focus();\" onfocus=\"changestyle('bandeaurecherche');\" onblur=\"changestyle('bandeaurecherche');\">" - . http_img_pack("loupe.png", _T('info_rechercher'), "width='26' height='20'") - ."</a>" - . http_img_pack("rien.gif", "", "width='10'") - . "<a href='" - . generer_url_ecrire("calendrier","type=semaine") - . "' class='icone26' onmouseover=\"changestyle('bandeauagenda');\">" - . http_img_pack("cal-rv.png", _T('icone_agenda'), "width='26' height='20'") ."</a>" - . "<a href='" . generer_url_ecrire("messagerie") . "' class='icone26' onmouseover=\"changestyle('bandeaumessagerie');\" onfocus=\"changestyle('bandeaumessagerie');\" onblur=\"changestyle('bandeaumessagerie');\">" - . http_img_pack("cal-messagerie.png", _T('icone_messagerie_personnelle'), "width='26' height='20'") - ."</a>" - . "<a href='" . generer_url_ecrire("synchro") . "' class='icone26' onmouseover=\"changestyle('bandeausynchro');\" onfocus=\"changestyle('bandeausynchro');\" onblur=\"changestyle('bandeausynchro');\">" . - http_img_pack("cal-suivi.png", _T('icone_suivi_activite'), "width='26' height='20'") - . "</a>" + . installer_gadgets($id_rubrique) . "</td>" . "<td valign='middle' class='bandeau_couleur' style='text-align: $spip_lang_left;'>" diff --git a/ecrire/inc/gadgets.php b/ecrire/inc/gadgets.php index e4b53533d9deb402cf8981713bc7cbaffeb0ee34..f51e163561becf1eca706354ba71df06cba2af63 100644 --- a/ecrire/inc/gadgets.php +++ b/ecrire/inc/gadgets.php @@ -15,287 +15,15 @@ if (!defined("_ECRIRE_INC_VERSION")) return; include_spip('inc/presentation'); // -// Le bandeau des gadgets s'affiche en deux temps : +// Pour les boutons dont l'action fait des requetes SQL, +// le bandeau des gadgets s'affiche en deux temps : // 1. On affiche un minimum de <div> permettant aux boutons de jouer // du on/off au survol // -> fonction bandeau_gadgets() -// 2. En fin de page on envoie le vrai contenu (bien lourd) via innerHTML -// -> fonction dessiner_gadgets() +// 2. Au survol, sera execute un script en Ajax menu_{gadget}.php // -// http://doc.spip.org/@inc_gadgets_dist -function inc_gadgets_dist($id_rubrique, $gadget) -{ - $gadget = 'gadget_' . $gadget; - return (function_exists($gadget)) ? $gadget($id_rubrique) : ''; -} -// -// GADGET DES RUBRIQUES -// -// http://doc.spip.org/@extraire_article -function extraire_article($id_p) { - if (array_key_exists($id_p, $GLOBALS['db_art_cache'])) { - return $GLOBALS['db_art_cache'][$id_p]; - } else { - return array(); - } -} - -// http://doc.spip.org/@gen_liste_rubriques -function gen_liste_rubriques() { - - // ici, un petit fichier cache ne fait pas de mal - if (lire_fichier(_DIR_TMP.'cache-menu-rubriques.txt', $cache) - AND list($date,$GLOBALS['db_art_cache']) = @unserialize($cache) - AND $date == $GLOBALS['meta']["date_calcul_rubriques"]) - return; // c'etait en cache :-) - - // se restreindre aux rubriques utilisees recemment +secteurs - $liste="0"; - $s = spip_query("SELECT id_rubrique FROM spip_rubriques ORDER BY id_parent=0 DESC, date DESC LIMIT 500"); - while ($t = spip_fetch_array($s)) - $liste .=",".$t['id_rubrique']; - - $res = spip_query("SELECT id_rubrique, id_parent, titre FROM spip_rubriques WHERE id_rubrique IN ($liste) ORDER BY id_parent,0+titre,titre"); - - // il ne faut pas filtrer le autoriser voir ici car on met le resultat en cache, commun a tout le monde - $GLOBALS['db_art_cache'] = array(); - if (spip_num_rows($res) > 0) { - while ($row = spip_fetch_array($res)) { - $id = $row['id_rubrique']; - $parent = $row['id_parent']; - $GLOBALS['db_art_cache'][$parent][$id] = - supprimer_numero(typo(sinon($row['titre'], _T('ecrire:info_sans_titre')))); - } - } - - // ecrire dans le cache - ecrire_fichier(_DIR_TMP.'cache-menu-rubriques.txt', - serialize(array( - $GLOBALS['meta']["date_calcul_rubriques"], - $GLOBALS['db_art_cache'] - )) - ); -} - - -// http://doc.spip.org/@gadget_rubriques -function gadget_rubriques() { - global $spip_ecran; - - $largeur_t = ($spip_ecran == "large") ? 900 : 650; - gen_liste_rubriques(); - $arr_low = extraire_article(0); - - $total_lignes = $i = sizeof($arr_low); - $ret = ''; - - if ($i > 0) { - $nb_col = min(8,ceil($total_lignes / 30)); - if ($nb_col <= 1) $nb_col = ceil($total_lignes / 10); - $max_lignes = ceil($total_lignes / $nb_col); - $largeur = min(200, ceil($largeur_t / $nb_col)); - $count_lignes = 0; - $style = " style='z-index: 0; vertical-align: top;'"; - - foreach( $arr_low as $id_rubrique => $titre_rubrique) { - if ($count_lignes == $max_lignes) { - $count_lignes = 0; - $ret .= "</div></td>\n<td$style><div class='bandeau_rubriques'>"; - } - $count_lignes ++; - if (autoriser('voir','rubrique',$id_rubrique)){ - $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, 1, $largeur); - } - } - - $ret = "<table><tr>\n<td$style><div class='bandeau_rubriques'>" - . $ret - . "\n</div></td></tr></table>\n"; - } - unset($GLOBALS['db_art_cache']); // On libere la memoire - - return "<div> </div>" . $ret; -} - - -// http://doc.spip.org/@bandeau_rubrique -function bandeau_rubrique($id_rubrique, $titre_rubrique, $zdecal, $largeur) { - global $spip_ecran, $spip_display; - global $spip_lang, $spip_lang_rtl, $spip_lang_left, $spip_lang_right; - - $titre_rubrique = preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique); - // Limiter volontairement le nombre de sous-menus - $zmax = 6; - - if ($zdecal == 1) $image = "secteur-12.gif"; - //else $image = "rubrique-12.gif"; - else $image = ''; - - if ($image) - $image = " background-image: url(" . http_wrapper($image) .");"; - - $nav = "<a href='" - . generer_url_ecrire('naviguer', 'id_rubrique='.$id_rubrique) - . "'\nclass='bandeau_rub' style='width: " - . $largeur - . "px;" - . $image - . "'>\n " - . supprimer_tags($titre_rubrique) - . "</a>\n"; - - if ($zdecal >= $zmax) return "\n<div>$nav</div>"; - - $arr_rub = extraire_article($id_rubrique); - $i = sizeof($arr_rub); - if (!$i) return "\n<div>$nav</div>"; - - $pxdecal = max(15, ceil($largeur/5)) . 'px'; - $idom = 'b_' . $id_rubrique; - - $ret = "<div class='pos_r' -onmouseover=\"montrer('$idom');\" -onmouseout=\"cacher('$idom'); \">" - . '<div class="brt">' - . $nav - . "</div>\n<div class='bandeau_rub' style='top: 14px; left: " - . $pxdecal - . "; z-index: " - . $zdecal - . ";' id='" - . $idom - . "'><table cellspacing='0' cellpadding='0'><tr><td valign='top'>"; - - if ($nb_rub = count($arr_rub)) { - $nb_col = min(10,max(1,ceil($nb_rub / 10))); - $ret_ligne = max(4,ceil($nb_rub / $nb_col)); - } - $count_ligne = 0; - foreach( $arr_rub as $id_rub => $titre_rub) { - $count_ligne ++; - - if ($count_ligne > $ret_ligne) { - $count_ligne = 0; - $ret .= "</td>"; - $ret .= '<td valign="top" style="border-left: 1px solid #cccccc;">'; - - } - if (autoriser('voir','rubrique',$id_rub)){ - $titre = supprimer_numero(typo($titre_rub)); - $ret .= bandeau_rubrique($id_rub, $titre, $zdecal+1, $largeur); - } - } - $ret .= "</td></tr></table>\n"; - $ret .= "</div></div>\n"; - return $ret; -} - -// FIN GADGET DES RUBRIQUES - - -// -// GADGET DE NAVIGATION RAPIDE -// -// http://doc.spip.org/@gadget_navigation -function gadget_navigation($id_rubrique) { - global $connect_id_auteur, $connect_login, $connect_statut, $couleur_claire,$couleur_foncee, $spip_lang_left, $spip_lang_right, $spip_ecran; - - $gadget = '<div style="width: 300px;">'; - - $vos_articles = spip_query("SELECT articles.id_article, articles.id_rubrique, articles.titre, articles.statut FROM spip_articles AS articles, spip_auteurs_articles AS lien WHERE articles.id_article=lien.id_article AND lien.id_auteur=$connect_id_auteur AND articles.statut='prepa' ORDER BY articles.date DESC LIMIT 5"); - if (spip_num_rows($vos_articles) > 0) { - $gadget .= "<div> </div>"; - $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; - $gadget .= bandeau_titre_boite2(afficher_plus(generer_url_ecrire("articles_page","")) . '<b>' ._T('info_en_cours_validation') . '</b>', "article-24.gif", $couleur_foncee, 'white', false); - $gadget .= "\n<div class='plan-articles'>\n"; - while($row = spip_fetch_array($vos_articles)) { - $id_article = $row['id_article']; - $titre = typo(sinon($row['titre'], _T('ecrire:info_sans_titre'))); - $statut = $row['statut']; - $gadget .= "<a class='$statut spip_xx-small' href='" . generer_url_ecrire("articles","id_article=$id_article") . "'>$titre</a>\n"; - } - $gadget .= "</div>"; - $gadget .= "</div>"; - } - - $vos_articles = spip_query("SELECT id_article, id_rubrique, titre, statut FROM spip_articles WHERE statut='prop' ORDER BY date DESC LIMIT 5"); - if (spip_num_rows($vos_articles) > 0) { - $gadget .= "<div> </div>"; - $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; - $gadget .= bandeau_titre_boite2(afficher_plus('./') . '<b>' . _T('info_articles_proposes') . '</b>', "article-24.gif", $couleur_foncee, 'white', false); - $gadget .= "<div class='plan-articles'>"; - while($row = spip_fetch_array($vos_articles)) { - $id_article = $row['id_article']; - $titre = sinon($row['titre'], _T('ecrire:info_sans_titre')); - $statut = $row['statut']; - - $gadget .= "<a class='$statut spip_xx-small' href='" . generer_url_ecrire("articles","id_article=$id_article") . "'>$titre</a>"; - } - $gadget .= "</div>"; - $gadget .= "</div>"; - } - - $vos_articles = spip_query("SELECT * FROM spip_breves WHERE statut='prop' ORDER BY date_heure DESC LIMIT 5"); - if (spip_num_rows($vos_articles) > 0) { - $gadget .= "<div> </div>"; - $gadget .= "<div class='bandeau_rubriques' style='z-index: 1;'>"; - $gadget .= bandeau_titre_boite2(afficher_plus(generer_url_ecrire("breves")).'<b>' . _T('info_breves_valider') . '</b>', "breve-24.gif", "$couleur_foncee", "white", false); - $gadget .= "<div class='plan-articles'>"; - while($row = spip_fetch_array($vos_articles)) { - $id_breve = $row['id_breve']; - $titre = typo(sinon($row['titre'], _T('ecrire:info_sans_titre'))); - $statut = $row['statut']; - - $gadget .= "<a class='$statut spip_xx-small' href='" . generer_url_ecrire("breves_voir","id_breve=$id_breve") . "'>$titre</a>"; - } - $gadget .= "</div>"; - $gadget .= "</div>"; - } - - $result = spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 1"); - - if (spip_num_rows($result) > 0) { - $gadget .= "<div> </div>"; - if ($id_rubrique > 0) { - $dans_rub = "&id_rubrique=$id_rubrique"; - $dans_parent = "&id_parent=$id_rubrique"; - } else $dans_rub = $dans_parent = ''; - if ($connect_statut == "0minirezo") { - $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; - if ($id_rubrique > 0) - $gadget .= icone_horizontale(_T('icone_creer_sous_rubrique'), generer_url_ecrire("rubriques_edit","new=oui$dans_parent"), "rubrique-24.gif", "creer.gif", false); - else - $gadget .= icone_horizontale(_T('icone_creer_rubrique'), generer_url_ecrire("rubriques_edit","new=oui"), "rubrique-24.gif", "creer.gif", false); - $gadget .= "</div>"; - } - $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; - $gadget .= icone_horizontale(_T('icone_ecrire_article'), generer_url_ecrire("articles_edit","new=oui$dans_rub"), "article-24.gif","creer.gif", false); - $gadget .= "</div>"; - - if ($GLOBALS['meta']["activer_breves"] != "non") { - $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; - $gadget .= icone_horizontale(_T('icone_nouvelle_breve'), generer_url_ecrire("breves_edit","new=oui$dans_rub"), "breve-24.gif","creer.gif", false); - $gadget .= "</div>"; - } - - if ($GLOBALS['meta']["activer_sites"] == 'oui') { - if ($connect_statut == '0minirezo' OR $GLOBALS['meta']["proposer_sites"] > 0) { - $gadget .= "<div style='width: 140px; float: $spip_lang_left;'>"; - $gadget .= icone_horizontale(_T('info_sites_referencer'), generer_url_ecrire("sites_edit","new=oui$dans_parent"), "site-24.gif","creer.gif", false); - $gadget .= "</div>"; - } - } - - } - - $gadget .="</div>"; - - return $gadget; -} - - // http://doc.spip.org/@bandeau_gadgets function bandeau_gadgets($largeur, $options, $id_rubrique) { global $connect_id_auteur, $connect_login, $connect_statut, $couleur_claire,$couleur_foncee, $spip_lang_left, $spip_lang_right, $spip_ecran; @@ -433,25 +161,6 @@ function bandeau_gadgets($largeur, $options, $id_rubrique) { return $bandeau; } -// http://doc.spip.org/@gadget_agenda -function gadget_agenda() { - global $connect_id_auteur; - - list($evtm, $evtt, $evtr) = http_calendrier_messages(date("Y"), date("m"), date("d")); - - return "<table><tr>" - . "<td style='width: 200px; vertical-align: top;' >" - . "<div>" - . $evtm - . "</div>" - . "</td>" - . (!$evtt ? '' : - ( "<td style='width: 10px; vertical-align: top'> </td>" - . "<td style='width: 200px; color: black; vertical-align: top'>" - . "<div> </div>$evtt</td>")) - . "</tr></table>"; -} - // http://doc.spip.org/@gadget_messagerie function gadget_messagerie() { global $connect_statut; @@ -463,45 +172,88 @@ function gadget_messagerie() { icone_horizontale(_T('lien_nouvelle_annonce'),generer_action_auteur("editer_message","affich"), "annonce.gif",'',false)); } +function installer_gadgets($id_rubrique) +{ + return "<a id='boutonbandeautoutsite' href='" + . generer_url_ecrire("articles_tous") + . "' class='icone26' onmouseover=\"changestyle('bandeautoutsite');\" onfocus=\"changestyle('bandeautoutsite');\" onblur=\"changestyle('bandeautoutsite');\">" + . http_img_pack("tout-site.png", _T('icone_site_entier'), "width='26' height='20'") + . "</a>" + . "<a id='boutonbandeaunavrapide' href='" + . generer_url_ecrire("brouteur",($id_rubrique ? "id_rubrique=$id_rubrique" : '')) + . "' class='icone26' onmouseover=\"changestyle('bandeaunavrapide');\" onfocus=\"changestyle('bandeaunavrapide');\" onblur=\"changestyle('bandeaunavrapide');\">" + . http_img_pack("naviguer-site.png", _T('icone_brouteur'), "width='26' height='20'") + ."</a>" + . "<a href='" + . generer_url_ecrire("recherche") + . "' class='icone26' onmouseover=\"changestyle('bandeaurecherche'); jQuery('#form_recherche')[0].focus();\" onfocus=\"changestyle('bandeaurecherche');\" onblur=\"changestyle('bandeaurecherche');\">" + . http_img_pack("loupe.png", _T('info_rechercher'), "width='26' height='20'") + ."</a>" + . http_img_pack("rien.gif", "", "width='10'") + . "<a id='boutonbandeauagenda' href='" + . generer_url_ecrire("calendrier","type=semaine") + . "' class='icone26' onmouseover=\"changestyle('bandeauagenda');\">" + . http_img_pack("cal-rv.png", _T('icone_agenda'), "width='26' height='20'") + ."</a>" + . "<a href='" + . generer_url_ecrire("messagerie") + . "' class='icone26' onmouseover=\"changestyle('bandeaumessagerie');\" onfocus=\"changestyle('bandeaumessagerie');\" onblur=\"changestyle('bandeaumessagerie');\">" + . http_img_pack("cal-messagerie.png", _T('icone_messagerie_personnelle'), "width='26' height='20'") + ."</a>" + . "<a href='" + . generer_url_ecrire("synchro") + . "' class='icone26' onmouseover=\"changestyle('bandeausynchro');\" onfocus=\"changestyle('bandeausynchro');\" onblur=\"changestyle('bandeausynchro');\">" + . http_img_pack("cal-suivi.png", _T('icone_suivi_activite'), "width='26' height='20'") + . "</a>"; +} + // http://doc.spip.org/@repercuter_gadgets function repercuter_gadgets($id_rubrique) { if (!_SPIP_AJAX) return ''; // ne sert ici qu'a caracteriser l'asynchronisme de ces scripts, - // afin de les neutraliser lors d'une restauration + // afin de les ignorer lors des scripts speciaux (restauration etc). $ajax = "\\x26var_ajaxcharset=utf8" ; - $rub = $ajax . ($id_rubrique ? "\\x26id_rubrique=$id_rubrique" : ''); - // comme on cache fortement ce menu, son url change en fonction de sa date de modif $date = $GLOBALS['meta']['date_calcul_rubriques']; return - // Seul le gadget des rubriques (potentiellement lourd) est charge en ajax " jQuery('#boutonbandeautoutsite') .parent() .one('mouseover',function(){ changestyle('bandeautoutsite'); jQuery('#gadget-rubriques') - .load('./?exec=gadgets\\x26gadget=rubriques$ajax\\x26date=$date'); + .load('./?exec=menu_rubriques$ajax\\x26date=$date'); }) .one('focus', function(){jQuery(this).mouseover();});" - // les autres sont remplis ici ." - jQuery('#gadget-navigation') - .html('".addslashes(strtr(gadget_navigation($id_rubrique),"\n\r"," "))."'); - " + jQuery('#boutonbandeaunavrapide') + .parent() + .one('mouseover',function(){ + changestyle('bandeaunavrapide'); + jQuery('#gadget-navigation') + .load('./?exec=menu_navigation$ajax\\x26id_rubrique=$id_rubrique'); + }) + .one('focus', function(){jQuery(this).mouseover();});" + ." - jQuery('#gadget-agenda') - .html('".addslashes(strtr(gadget_agenda($id_rubrique),"\n\r"," "))."'); - " + jQuery('#boutonbandeauagenda') + .parent() + .one('mouseover',function(){ + changestyle('bandeauagenda'); + jQuery('#gadget-agenda') + .load('./?exec=menu_agenda$ajax'); + }) + .one('focus', function(){jQuery(this).mouseover();});" + ." jQuery('#gadget-messagerie') - .html('".addslashes(strtr(gadget_messagerie($id_rubrique),"\n\r"," "))."'); + .html('".addslashes(strtr(gadget_messagerie(),"\n\r"," "))."'); " // la case de recherche s'efface la premiere fois qu'on la clique @@ -509,7 +261,6 @@ function repercuter_gadgets($id_rubrique) { jQuery('#form_recherche') .one('click',function(){this.value='';}); "; - } ?>