Newer
Older
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
* 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/agenda'); // inclut inc/layer, inc/texte, inc/filtre
include_spip('inc/actions');
// http://doc.spip.org/@choix_couleur
$res = '';
$res = "<a href=\"".parametre_url(self(), 'set_couleur', $key)."\">" .
http_img_pack("rien.gif", " ", "width='8' height='8' style='margin: 1px; background-color: ".$val['couleur_claire'].";' onmouseover=\"changestyle('bandeauinterface','visibility', 'visible');\""). "</a>";
return $res;
// Faux HR, avec controle de couleur
function hr($color, $retour = false) {
$ret = "<div style='height: 1px; margin-top: 5px; padding-top: 5px; border-top: 1px solid $color;'></div>";
if ($retour) return $ret;
else echo $ret;
}
//
//
// http://doc.spip.org/@debut_cadre
function debut_cadre($style, $icone = "", $fonction = "", $titre = "") {
global $spip_display, $spip_lang_left;
static $accesskey = 97; // a
if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
$style_gauche = " padding-$spip_lang_left: 38px;";
$style_cadre = " style='margin-top: 14px;'";
} else $style_cadre = $style_gauche = '';
Fil
a validé
if ($accesskey <= 122) // z
{
$accesskey_c = chr($accesskey++);
$ret = "<a name='access-$accesskey_c' href='#access-$accesskey_c' accesskey='$accesskey_c'></a>";
} else $ret ='';
if ($style == "e") {
$ret .= "<div class='cadre-e-noir'$style_cadre><div class='cadre-$style'>";
}
else {
$ret .= "<div class='cadre-$style'$style_cadre>";
}
$ret .= "<div style='position: relative;'>";
if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
$ret .= "<div style='position: absolute; top: -16px; $spip_lang_left: 10px;'>";
if ($fonction) {
$ret .= "<div " . http_style_background($icone, "no-repeat; padding: 0px; margin: 0px") . ">";
esj
a validé
$ret .= http_img_pack($fonction, "", "");
esj
a validé
else $ret .= http_img_pack("$icone", "", "");
$ret .= "</div>";
$style_cadre = " style='position: relative; top: 15px; margin-bottom: 14px;'";
}
if (strlen($titre) > 0) {
if ($spip_display == 4) {
$ret .= "<h3 class='cadre-titre'>$titre</h3>";
} else {
$ret .= "<div class='cadre-titre' style='margin: 0px;$style_gauche'>$titre</div>";
}
}
$ret .= "</div>";
$ret .= "<div class='cadre-padding' style='overflow:hidden;'>";
// http://doc.spip.org/@fin_cadre
function fin_cadre($style) {
$ret = "</div>";
$ret .= "</div>";
if ($style == "e") $ret .= "</div>";
if ($style != "forum" AND $style != "thread-forum") $ret .= "<div style='height: 5px;'></div>";
return $ret;
}
// http://doc.spip.org/@debut_cadre_relief
function debut_cadre_relief($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('r', $icone, $fonction, $titre);
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_relief
function fin_cadre_relief($return = false){
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_enfonce
function debut_cadre_enfonce($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('e', $icone, $fonction, $titre);
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
// http://doc.spip.org/@fin_cadre_enfonce
function fin_cadre_enfonce($return = false){
$retour_aff = fin_cadre('e');
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_sous_rub
function debut_cadre_sous_rub($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('sous_rub', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_sous_rub
function fin_cadre_sous_rub($return = false){
$retour_aff = fin_cadre('sous_rub');
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_forum
function debut_cadre_forum($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('forum', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_forum
function fin_cadre_forum($return = false){
$retour_aff = fin_cadre('forum');
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_thread_forum
function debut_cadre_thread_forum($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('thread-forum', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_thread_forum
function fin_cadre_thread_forum($return = false){
$retour_aff = fin_cadre('thread-forum');
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_gris_clair
function debut_cadre_gris_clair($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('gris-clair', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_gris_clair
function fin_cadre_gris_clair($return = false){
$retour_aff = fin_cadre('gris-clair');
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_couleur
function debut_cadre_couleur($icone='', $return = false, $fonction='', $titre=''){
$retour_aff = debut_cadre('couleur', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_couleur
function fin_cadre_couleur($return = false){
$retour_aff = fin_cadre('couleur');
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_couleur_foncee
function debut_cadre_couleur_foncee($icone='', $return = false, $fonction='', $titre=''){
$retour_aff = debut_cadre('couleur-foncee', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_couleur_foncee
function fin_cadre_couleur_foncee($return = false){
$retour_aff = fin_cadre('couleur-foncee');
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@debut_cadre_trait_couleur
function debut_cadre_trait_couleur($icone='', $return = false, $fonction='', $titre=''){
$retour_aff = debut_cadre('trait-couleur', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
// http://doc.spip.org/@fin_cadre_trait_couleur
function fin_cadre_trait_couleur($return = false){
$retour_aff = fin_cadre('trait-couleur');
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
}
//
// une boite alerte
//
// http://doc.spip.org/@debut_boite_alerte
function debut_boite_alerte() {
echo "<p><table cellpadding='6' border='0'><tr><td width='100%' bgcolor='red'>";
echo "<table width='100%' cellpadding='12' border='0'><tr><td width='100%' bgcolor='white'>";
}
// http://doc.spip.org/@fin_boite_alerte
function fin_boite_alerte() {
}
//
// une boite info
//
// http://doc.spip.org/@debut_boite_info
esj
a validé
function debut_boite_info($return=false) {
$r ="<div class='cadre-info verdana1'>";
if ($return) return $r; else echo $r;
}
// http://doc.spip.org/@fin_boite_info
esj
a validé
function fin_boite_info($return=false) {
esj
a validé
$r = "</div>";
if ($return) return $r; else echo $r;
}
// http://doc.spip.org/@bandeau_titre_boite2
Fil
a validé
function bandeau_titre_boite2($titre, $logo="", $fond="white", $texte="black", $echo = true) {
global $spip_lang_left, $spip_display, $browser_name;
if (strlen($logo) > 0 AND $spip_display != 1 AND $spip_display != 4) {
$ie_style = ($browser_name == "MSIE") ? "height:1%" : '';
$retour = "<div style='position: relative;$ie_style'>"
. "<div style='position: absolute; top: -12px; $spip_lang_left: 3px;'>" .
http_img_pack("$logo", "", "")
. "</div>"
. "<div style='background-color: $fond; color: $texte; padding: 3px; padding-$spip_lang_left: 30px; border-bottom: 1px solid #444444;' class='verdana2'>$titre</div>"
. "</div>";
$retour = "<h3 style='background-color: $fond; color: $texte; padding: 3px; border-bottom: 1px solid #444444; margin: 0px;' class='verdana2'>$titre</h3>";
if ($echo) echo $retour; return $retour;
Antoine Pitrou
a validé
//
// La boite des raccourcis
// Se place a droite si l'ecran est en mode panoramique.
Antoine Pitrou
a validé
Christian Lefebvre
a validé
// http://doc.spip.org/@bloc_des_raccourcis
function bloc_des_raccourcis($bloc) {
return "<div> </div>"
. creer_colonne_droite('',true)
. debut_cadre_enfonce('',true)
. (($spip_display != 4)
? ("<font face='Verdana,Arial,Sans,sans-serif' size='1'><b>"
._T('titre_cadre_raccourcis')
."</b><p />")
: ( "<h3>"._T('titre_cadre_raccourcis')."</h3><ul>"))
. $bloc
. (($spip_display != 4) ? "</font>" : "</ul>")
. fin_cadre_enfonce(true);
Antoine Pitrou
a validé
}
// Afficher un petit "+" pour lien vers autre page
// http://doc.spip.org/@afficher_plus
function afficher_plus($lien) {
global $options, $spip_lang_right, $spip_display;
ARNO*
a validé
if ($options == "avancees" AND $spip_display != 4) {
return "<div style='float:$spip_lang_right; padding-top: 2px;'><a href='$lien'>" .
Fil
a validé
http_img_pack("plus.gif", "+", "") ."</a></div>";
ARNO*
a validé
}
//
// Fonctions d'affichage
//
// http://doc.spip.org/@afficher_liste
function afficher_liste($largeurs, $table, $styles = '') {
global $spip_display;
if (!is_array($table)) return "";
if ($spip_display != 4) {
$res = '';
while (list(, $t) = each($table)) {
$res .= afficher_liste_display_neq4($largeurs, $t, $styles);
$res = "\n<ul style='text-align: $spip_lang_left; background-color: white;'>";
while (list(, $t) = each($table)) {
$res .= afficher_liste_display_eq4($largeurs, $t, $styles);
}
return $res;
}
// http://doc.spip.org/@afficher_liste_display_neq4
function afficher_liste_display_neq4($largeurs, $t, $styles = '') {
global $spip_lang_left;
$res = '';
$evt = (eregi("msie", $browser_name) ? " onmouseover=\"changeclass(this,'tr_liste_over');\" onmouseout=\"changeclass(this,'tr_liste');\"" :'');
$res .= "\n<tr class='tr_liste'$evt>";
reset($largeurs);
if ($styles) reset($styles);
while (list(, $texte) = each($t)) {
$style = $largeur = "";
list(, $largeur) = each($largeurs);
if ($styles) list(, $style) = each($styles);
if (!trim($texte)) $texte .= " ";
$res .= "\n<td" .
($largeur ? " width=\"$largeur\"" : '') .
($style ? " class=\"$style\"" : '') .
">$texte\n</td>";
}
$res .= "\n</tr>";
return $res;
}
// http://doc.spip.org/@afficher_liste_display_eq4
function afficher_liste_display_eq4($largeurs, $t, $styles = '') {
global $spip_lang_left;
$res .= "<li>";
reset($largeurs);
if ($styles) reset($styles);
while (list(, $texte) = each($t)) {
$style = $largeur = "";
list(, $largeur) = each($largeurs);
if (!$largeur) $res .= $texte." ";
}
$res .= "</li>\n";
return $res;
}
// http://doc.spip.org/@afficher_tranches_requete
function afficher_tranches_requete($num_rows, $tmp_var, $url='', $nb_aff = 10) {
global $browser_name, $spip_lang_right, $spip_display;
$deb_aff = intval(_request($tmp_var));
$ancre++;
$self = self();
$ie_style = ($browser_name == "MSIE") ? "height:1%" : '';
$texte = "\n<div style='position: relative;$ie_style; background-color: #dddddd; border-bottom: 1px solid #444444; padding: 2px;' class='arial1' id='a$ancre'>";
$on ='';
for ($i = 0; $i < $num_rows; $i += $nb_aff){
$deb = $i + 1;
$fin = $i + $nb_aff;
if ($fin > $num_rows) $fin = $num_rows;
if ($deb > 1) $texte .= " |\n";
if ($deb_aff + 1 >= $deb AND $deb_aff + 1 <= $fin) {
$texte .= "<b>$deb</b>";
}
else {
$script = parametre_url($self, $tmp_var, $deb-1);
if ($url) {
$on = "\nonclick=\"return charger_id_url('"
. $url
. "&"
. $tmp_var
. '='
. "','"
. '\');"';
}
$texte .= "<a href=\"$script#a$ancre\"$on>$deb</a>";
}
$texte .= "<span class=\"arial2\" style='border-bottom: 1px solid #444444; position: absolute; top: 2px; $spip_lang_right: 15px;'>";
$script = parametre_url($self, $tmp_var, -1);
if ($url) {
$on = "\nonclick=\"return charger_id_url('"
. $url
. "&"
. $tmp_var
. "=-1','"
. '\');"';
}
$l = htmlentities(_T('lien_tout_afficher'));
$texte .= "<a href=\"$script#a$ancre\"$on><img\nsrc='". _DIR_IMG_PACK . "plus.gif' title=\"$l\" alt=\"$l\" /></a>";
$texte .= "</span></div>\n";
return $texte;
}
// http://doc.spip.org/@affiche_tranche_bandeau
function affiche_tranche_bandeau($requete, $icone, $fg, $bg, $tmp_var, $titre, $force, $largeurs, $styles, $skel, $own='')
{
global $spip_display ;
$voir_logo = ($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non");
if (!isset($requete['GROUP BY'])) $requete['GROUP BY'] = '';
$cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '')));
if (! ($force OR ($cpt = $cpt['n']))) return array();
if ($titre) echo "<div style='height: 12px;'></div>";
echo "<div class='liste'>";
echo bandeau_titre_boite2('<b>' . $titre . '</b>', $icone, $fg, $bg, false);
echo "<table width='100%' cellpadding='2' cellspacing='0' border='0'>";
if (isset($requete['LIMIT'])) $cpt = min($requete['LIMIT'], $cpt);
$deb_aff = intval(_request($tmp_var));
$nb_aff = floor(1.5 * _TRANCHES);
if ($cpt > $nb_aff) {
$nb_aff = (_TRANCHES);
echo afficher_tranches_requete($cpt, $tmp_var, '', $nb_aff);
$result = spip_query("SELECT " . (isset($requete["SELECT"]) ? $requete["SELECT"] : "*") . " FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '') . ($requete['ORDER BY'] ? (' ORDER BY ' . $requete['ORDER BY']) : '') . " LIMIT " . ($deb_aff >= 0 ? "$deb_aff, $nb_aff" : ($requete['LIMIT'] ? $requete['LIMIT'] : "99999")));
while ($row = spip_fetch_array($result)) {
$table[]= $skel($row, $tous_id, $voir_logo, $own);
}
spip_free_result($result);
echo afficher_liste($largeurs, $table, $styles);
echo "</table>";
echo "</div>\n";
return $tous_id;
}
// http://doc.spip.org/@afficher_liste_debut_tableau
function afficher_liste_debut_tableau() {
global $spip_display;
if ($spip_display != 4) return "<table width='100%' cellpadding='2' cellspacing='0' border='0'>";
}
// http://doc.spip.org/@afficher_liste_fin_tableau
function afficher_liste_fin_tableau() {
global $spip_display;
if ($spip_display != 4) return "</table>";
}
// http://doc.spip.org/@puce_statut_article
function puce_statut_article($id, $statut, $id_rubrique) {
global $spip_lang_left, $dir_lang, $connect_statut, $options;
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
switch ($statut) {
case 'publie':
$clip = 2;
$puce = 'verte';
$title = _T('info_article_publie');
break;
case 'prepa':
$clip = 0;
$puce = 'blanche';
$title = _T('info_article_redaction');
break;
case 'prop':
$clip = 1;
$puce = 'orange';
$title = _T('info_article_propose');
break;
case 'refuse':
$clip = 3;
$puce = 'rouge';
$title = _T('info_article_refuse');
break;
case 'poubelle':
$clip = 4;
$puce = 'poubelle';
$title = _T('info_article_supprime');
break;
}
$puce = "puce-$puce.gif";
if ($connect_statut == '0minirezo' AND $options == 'avancees' AND acces_rubrique($id_rubrique)) {
esj
a validé
// les versions de MSIE ne font pas toutes pareil sur alt/title
// la combinaison suivante semble ok pour tout le monde.
$titles = array(
"blanche" => _T('texte_statut_en_cours_redaction'),
"orange" => _T('texte_statut_propose_evaluation'),
"verte" => _T('texte_statut_publie'),
"rouge" => _T('texte_statut_refuse'),
"poubelle" => _T('texte_statut_poubelle'));
$action = "onmouseover=\"montrer('statutdecalarticle$id');\"";
$inser_puce = "\n<div class='puce_article' id='statut$id'$dir_lang>"
. "\n<div class='puce_article_fixe' $action>" .
Fil
a validé
http_img_pack("$puce", "", "id='imgstatutarticle$id' style='margin: 1px;'") ."</div>"
. "\n<div class='puce_article_popup' id='statutdecalarticle$id' onmouseout=\"cacher('statutdecalarticle$id');\" style=' margin-left: -".((11*$clip)+1)."px;'>\n"
esj
a validé
. afficher_script_statut($id, 'article', -1, 'puce-blanche.gif', 'prepa', $titles['blanche'], $action)
. afficher_script_statut($id, 'article', -12, 'puce-orange.gif', 'prop', $titles['orange'], $action)
. afficher_script_statut($id, 'article', -23, 'puce-verte.gif', 'publie', $titles['verte'], $action)
. afficher_script_statut($id, 'article', -34, 'puce-rouge.gif', 'refuse', $titles['rouge'], $action)
. afficher_script_statut($id, 'article', -45, 'puce-poubelle.gif', 'poubelle', $titles['poubelle'], $action)
. "</div></div>";
Fil
a validé
$inser_puce = http_img_pack("$puce", "", "id='imgstatutarticle$id' style='margin: 1px;'");
// http://doc.spip.org/@puce_statut_breve
function puce_statut_breve($id, $statut, $type, $droit) {
global $spip_lang_left, $dir_lang;
$puces = array(
0 => 'puce-orange-breve.gif',
1 => 'puce-verte-breve.gif',
2 => 'puce-rouge-breve.gif',
3 => 'puce-blanche-breve.gif');
switch ($statut) {
$title = _T('titre_breve_proposee');
break;
case 'publie':
$clip = 1;
$title = _T('titre_breve_publiee');
break;
case 'refuse':
$clip = 2;
default:
$clip = 0;
$puce = $puces[3];
$title = '';
}
Fil
a validé
$inser_puce = http_img_pack($puce, "", "id='img$type1' style='margin: 1px;'");
if (!$droit) return $inser_puce;
$type2 = "statutdecal$type$id";
$action = "onmouseover=\"montrer('$type2');\"\n";
esj
a validé
// les versions de MSIE ne font pas toutes pareil sur alt/title
// la combinaison suivante semble ok pour tout le monde.
return "<div class='puce_breve' id='$type1'$dir_lang>"
. "<div class='puce_breve_fixe' $action>"
. $inser_puce
. "</div>"
. "\n<div class='puce_breve_popup' id='$type2' onmouseout=\"cacher('$type2');\" style=' margin-left: -".((9*$clip)+1)."px;'>\n"
esj
a validé
. afficher_script_statut($id, $type, -1, $puces[0], 'prop',_T('texte_statut_propose_evaluation'), $action)
. afficher_script_statut($id, $type, -10, $puces[1], 'publie',_T('texte_statut_publie'), $action)
. afficher_script_statut($id, $type, -19, $puces[2], 'refuse',_T('texte_statut_refuse'), $action)
// http://doc.spip.org/@afficher_script_statut
esj
a validé
function afficher_script_statut($id, $type, $n, $img, $statut, $title, $act)
{
return http_href_img("javascript:selec_statut('$id', '$type', -1, '" .
generer_action_auteur("instituer_$type","$id-$statut") .
esj
a validé
$img,
"title=\"".$title."\"",
'','','',
$act);
}
//
// Afficher tableau d'articles
//
// http://doc.spip.org/@afficher_articles
function afficher_articles($titre, $requete, $formater_article='') {
if (!isset($requete['FROM'])) $requete['FROM'] = 'spip_articles AS articles';
if (!isset($requete['SELECT'])) {
$requete['SELECT'] = "articles.id_article, articles.titre, articles.id_rubrique, articles.statut, articles.date, articles.lang, articles.id_trad, articles.descriptif";
}
if (!isset($requete['GROUP BY'])) $requete['GROUP BY'] = '';
// memorisation des arguments pour grer l'affichage par tranche
// et/ou par langues.
$hash = substr(md5(serialize($requete) . $GLOBALS['meta']['gerer_trad'] . $titre), 0, 31);
$tmp_var = 't' . substr($hash, 0, 7);
// le champ id_auteur sert finalement a memoriser le nombre de lignes
// (a renommer)
$res_proch = spip_query("SELECT id_ajax_fonc, id_auteur FROM spip_ajax_fonc WHERE hash=0x$hash LIMIT 1");
if ($row = spip_fetch_array($res_proch)) {
$id_ajax = $row["id_ajax_fonc"];
$cpt = $row["id_auteur"];
} else {
$cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '')));
if (!$cpt = $cpt['n']) return '' ;
if (isset($requete['LIMIT'])) $cpt = min($requete['LIMIT'], $cpt);
$v = serialize(array($titre, $requete, $tmp_var, $formater_article));
include_spip ('base/abstract_sql');
$id_ajax = spip_abstract_insert("spip_ajax_fonc", "(variables, hash, id_auteur, date)", "(" . _q($v) . ", 0x$hash, $cpt, NOW())");
}
$nb_aff = floor(1.5 * _TRANCHES);
$deb_aff = intval(_request($tmp_var));
$requete['FROM'] = preg_replace("/(spip_articles AS \w*)/", "\\1 LEFT JOIN spip_petitions AS petitions USING (id_article)", $requete['FROM']);
$requete['SELECT'] .= ", petitions.id_article AS petition ";
return afficher_articles_trad($titre, $requete, $formater_article, $tmp_var, $id_ajax, $cpt);
// http://doc.spip.org/@afficher_articles_trad
function afficher_articles_trad($titre_table, $requete, $formater_article, $tmp_var, $id_ajax, $cpt, $trad=0) {
global $options, $spip_lang_right;
if ($trad) {
$formater_article = 'afficher_articles_trad_boucle';
$icone = "langues-off-12.gif";
if (!$formater_article)
$formater_article = charger_fonction('formater_article', 'inc');
$icone = 'langues-12.gif';
$nb_aff = ($cpt > floor(1.5 * _TRANCHES)) ? _TRANCHES : floor(1.5 * _TRANCHES) ;
$deb_aff = intval(_request($tmp_var));
$q = spip_query("SELECT " . $requete['SELECT'] . " FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '') . ($requete['ORDER BY'] ? (' ORDER BY ' . $requete['ORDER BY']) : '') . " LIMIT " . ($deb_aff >= 0 ? "$deb_aff, $nb_aff" : ($requete['LIMIT'] ? $requete['LIMIT'] : "99999")));
$t = '';
while ($r = spip_fetch_array($q)) $t .= $formater_article($r);
spip_free_result($q);
$style = "style='visibility: hidden; float: $spip_lang_right'";
$texte = http_img_pack("searching.gif", "*", $style . " id='img_$tmp_var'");
if (($GLOBALS['meta']['gerer_trad'] == "oui")) {
$url = generer_url_ecrire('memoriser',"id_ajax_fonc=$id_ajax&trad=" . (1-$trad));
$texte .=
"\n<div style='float: $spip_lang_right;'><a href=\"#\"\nonclick=\"return charger_id_url('$url','$tmp_var');\">"
. "<img\nsrc='". _DIR_IMG_PACK . $icone ."' alt=' ' /></a></div>";
$texte .= '<b>' . $titre_table . '</b>';
$res = "\n<div style='height: 12px;'></div>"
. "\n<div class='liste'>"
. bandeau_titre_boite2($texte, "article-24.gif", 'white', 'black',false)
. (($cpt <= $nb_aff) ? ''
: afficher_tranches_requete($cpt, $tmp_var, generer_url_ecrire('memoriser', "id_ajax_fonc=$id_ajax&trad=$trad"), $nb_aff))
. afficher_liste_debut_tableau()
. afficher_liste_fin_tableau()
. "</div>\n";
return ajax_action_greffe($tmp_var,$res);
}
// http://doc.spip.org/@afficher_articles_trad_boucle
function afficher_articles_trad_boucle($row)
{
global $dir_lang, $spip_lang_right;
$vals = '';
$id_article = $row['id_article'];
$titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
$id_rubrique = $row['id_rubrique'];
$date = $row['date'];
$statut = $row['statut'];
$id_trad = $row['id_trad'];
$lang = $row['lang'];
// La petite puce de changement de statut
$vals[] = puce_statut_article($id_article, $statut, $id_rubrique);
// Le titre (et la langue)
$langues_art = "";
$dates_art = "";
$l = "";
$res_trad = spip_query("SELECT id_article, lang, date_modif FROM spip_articles WHERE id_trad = $id_trad AND id_trad > 0");
while ($row_trad = spip_fetch_array($res_trad)) {
$id_article_trad = $row_trad["id_article"];
$lang_trad = $row_trad["lang"];
$date_trad = $row_trad["date_modif"];
$dates_art[$lang_trad] = $date_trad;
$langues_art[$lang_trad] = $id_article_trad;
if ($id_article_trad == $id_trad) $date_ref = $date;
}
// faudrait sortir ces invariants de boucle
if (($GLOBALS['meta']['multi_rubriques'] == 'oui' AND (!isset($GLOBALS['id_rubrique']))) OR $GLOBALS['meta']['multi_articles'] == 'oui') {
$afficher_langue = true;
$langue_defaut = isset($GLOBALS['langue_rubrique'])
? $GLOBALS['meta']['langue_site']
: $GLOBALS['langue_rubrique'];
}
$span_lang = false;
foreach(explode(',', $GLOBALS['meta']['langues_multilingue']) as $k){
if ($langues_art[$k]) {
if ($langues_art[$k] == $id_trad) {
$span_lang = "<a href='" . generer_url_ecrire("articles","id_article=".$langues_art[$k]) . "'><span class='lang_base'>$k</span></a>";
$l .= $span_lang;
} else {
$date = $dates_art[$k];
if ($date < $date_ref)
$l .= "<a href='" . generer_url_ecrire("articles","id_article=".$langues_art[$k]) . "' class='claire'>$k</a>";
else $l .= "<a href='" . generer_url_ecrire("articles","id_article=".$langues_art[$k]) . "' class='foncee'>$k</a>";
}
}
# else $l.= "<span class='creer'>$k</span>";
}
if (!$span_lang)
$span_lang = "<a href='" . generer_url_ecrire("articles","id_article=$id_article") . "'><span class='lang_base'>$lang</span></a>";
$vals[] = "<div style='text-align: center;'>$span_lang</div>";
$s = "<div>";
$s .= "<div style='float: $spip_lang_right; margin-right: -10px;'>$l</div>";
if (acces_restreint_rubrique($id_rubrique))
$s .= http_img_pack("admin-12.gif", "", "width='12' height='12'", _T('titre_image_admin_article'));
$s .= "<a href='" . generer_url_ecrire("articles","id_article=$id_article") . "'$dir_lang style=\"display:block;\">";
if ($id_article == $id_trad) $titre = "<b>$titre</b>";
$s .= typo($titre);
if ($afficher_langue AND $lang != $langue_defaut)
$s .= " <font size='1' color='#666666'$dir_lang>(".traduire_nom_langue($lang).")</font>";
$s .= "</a>";
$s .= "</div>";
$vals[] = $s;
$vals[] = "";
$largeurs = array(11, 24, '', '1');
$styles = array('', 'arial1', 'arial1', '');
return ($spip_display != 4)
? afficher_liste_display_neq4($largeurs, $vals, $styles)
: afficher_liste_display_eq4($largeurs, $vals, $styles);
//
// Afficher tableau de breves
//
// http://doc.spip.org/@afficher_breves
function afficher_breves($titre_table, $requete, $affrub=false) {
global $couleur_foncee, $options;
if (($GLOBALS['meta']['multi_rubriques'] == 'oui'
AND (!isset($GLOBALS['id_rubrique'])))
OR $GLOBALS['meta']['multi_articles'] == 'oui') {
$afficher_langue = true;
if (isset($GLOBALS['langue_rubrique'])) $langue_defaut = $GLOBALS['langue_rubrique'];
} else $afficher_langue = $langue_defaut = '';
$tmp_var = 't_' . substr(md5(join('', $requete)), 0, 4);
if ($options == "avancees") {
if ($affrub) $largeurs = array('7', '', '188', '38');
else $largeurs = array('7','', '100', '38');
$styles = array('', 'arial11', 'arial1', 'arial1');
} else {
if ($affrub) $largeurs = array('7','', '188');
else $largeurs = array('7','', '100');
$styles = array('','arial11', 'arial1');
}
return affiche_tranche_bandeau($requete, "breve-24.gif", $couleur_foncee, "white", $tmp_var, $titre_table, false, $largeurs, $styles, 'afficher_breves_boucle', array( $afficher_langue, $affrub, $langue_defaut));
}
// http://doc.spip.org/@afficher_breves_boucle
function afficher_breves_boucle($row, &$tous_id, $voir_logo, $own)
global $dir_lang, $options, $connect_statut, $spip_lang_right;
$droit = ($connect_statut == '0minirezo' && $options == 'avancees');
list($afficher_langue, $affrub, $langue_defaut) = $own;
$vals = '';
$id_breve = $row['id_breve'];
$tous_id[] = $id_breve;
$date_heure = $row['date_heure'];
$titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
$statut = $row['statut'];
if (isset($row['lang']))
changer_typo($lang = $row['lang']);
$id_rubrique = $row['id_rubrique'];
$vals[] = puce_statut_breve($id_breve, $statut, 'breve', ($droit && acces_rubrique($id_rubrique)), $id_rubrique);
$s = "<div>";
$s .= "<a href='" . generer_url_ecrire("breves_voir","id_breve=$id_breve") . "' style=\"display:block;\">";
if ($voir_logo) {
$logo_f = charger_fonction('chercher_logo', 'inc');
if ($logo = $logo_f($id_breve, 'id_breve', 'on')) {
list($fid, $dir, $nom, $format) = $logo;
$logo = ratio_image($fid, $nom, $format, 26, 20, "alt=''");
if ($logo)
$s .= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</div>";
}
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
$s .= typo($titre);
if ($afficher_langue AND $lang != $langue_defaut)
$s .= " <font size='1' color='#666666'$dir_lang>(".traduire_nom_langue($lang).")</font>";
$s .= "</a>";
$s .= "</div>";
$vals[] = $s;
$s = "";
if ($affrub) {
$rub = spip_fetch_array(spip_query("SELECT id_rubrique, titre FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
$id_rubrique = $rub['id_rubrique'];
$s .= "<a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "' style=\"display:block;\">".typo($rub['titre'])."</a>";
} else if ($statut != "prop")
$s = affdate_jourcourt($date_heure);
else
$s .= _T('info_a_valider');
$vals[] = $s;
if ($options == "avancees") {
$vals[] = "<b>"._T('info_numero_abbreviation')."$id_breve</b>";
}
return $vals;
}
//
// Afficher tableau de rubriques
//
// http://doc.spip.org/@afficher_rubriques
function afficher_rubriques($titre_table, $requete) {
$tmp_var = 't_' . substr(md5(join('', $requete)), 0, 4);
$largeurs = array('12','', '');
$styles = array('', 'arial2', 'arial11');
return affiche_tranche_bandeau($requete, "rubrique-24.gif", "#999999", "white", $tmp_var, $titre_table, false, $largeurs, $styles, 'afficher_rubriques_boucle');
}
// http://doc.spip.org/@afficher_rubriques_boucle
function afficher_rubriques_boucle($row, &$tous_id)
{
$vals = '';
$id_rubrique = $row['id_rubrique'];
$id_parent = $row['id_parent'];
$tous_id[] = $id_rubrique;
$titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
$lang = traduire_nom_langue($row['lang']);
$langue_choisie = $row['langue_choisie'];
if ($langue_choisie == "oui") $lang = "<b>$lang</b>";
else $lang = "($lang)";
if ($id_parent == 0) $puce = "secteur-12.gif";
else $puce = "rubrique-12.gif";
Fil
a validé
$s = http_img_pack($puce, '- ', "");