diff --git a/ecrire/exec/calendrier.php b/ecrire/exec/calendrier.php index 226beb5e6db492412280577243811b9552261132..4941a451caaedf26ac0d16e99489b7f8d85c7d24 100644 --- a/ecrire/exec/calendrier.php +++ b/ecrire/exec/calendrier.php @@ -12,7 +12,7 @@ if (!defined("_ECRIRE_INC_VERSION")) return; -include_spip('inc/agenda'); +include_spip('inc/presentation'); function exec_calendrier_dist() { diff --git a/ecrire/inc/agenda.php b/ecrire/inc/agenda.php index bf42d2a43933630a86dd424e2bfe5ee323bdc776..e48d9aff744d4939ebd55d7b04e7401054d0092b 100644 --- a/ecrire/inc/agenda.php +++ b/ecrire/inc/agenda.php @@ -12,7 +12,8 @@ if (!defined("_ECRIRE_INC_VERSION")) return; -include_spip('inc/presentation'); // inclut inc_layer +include_spip('inc/minipres'); +include_spip('inc/layer'); include_spip('inc/texte'); // inclut inc_filtre charger_generer_url(); @@ -1066,86 +1067,6 @@ function http_calendrier_agenda_rv ($annee, $mois, $les_rv, $fclic, $perso='', return $total . (!$ligne ? '' : "\n<tr>$ligne\n</tr>"); } -// Fonction pour la messagerie et ecrire/index.php - -function http_calendrier_rv($messages, $type) { - global $spip_lang_rtl, $spip_lang_left, $spip_lang_right; - - $total = ''; - if (!$messages) return $total; - foreach ($messages as $row) { - if (ereg("^=([^[:space:]]+)$",$row['texte'],$match)) - $url = quote_amp($match[1]); - else - $url = generer_url_ecrire("message", "id_message=".$row['id_message']); - - $rv = ($row['rv'] == 'oui'); - $date = $row['date_heure']; - $date_fin = $row['date_fin']; - if ($row['type']=="pb") $bouton = "pense-bete"; - else if ($row['type']=="affich") $bouton = "annonce"; - else $bouton = "message"; - - if ($rv) { - $date_jour = affdate_jourcourt($date); - $total .= "<tr><td colspan='2'>" . - (($date_jour == $date_rv) ? '' : - "<div class='calendrier-arial11'><b>$date_jour</b></div>") . - "</td></tr>"; - $rv = - ((affdate($date) == affdate($date_fin)) ? - ("<div class='calendrier-arial9 fond-agenda'>" - . heures($date).":".minutes($date)."<br />" - . heures($date_fin).":".minutes($date_fin)."</div>") : - ( "<div class='calendrier-arial9 fond-agenda' style='text-align: center;'>" - . heures($date).":".minutes($date)."<br />...</div>" )); - } - - $total .= "<tr><td style='width: 24px' valign='middle'>" . - http_href($url, - ($rv ? - http_img_pack("rv.gif", 'rv', - http_style_background($bouton . '.gif', "no-repeat;' border='0'")) : - http_img_pack($bouton.".gif", $bouton, "style='border: 0px'")), - '', '') . - "</td>" . - "<td valign='middle'>" . - $rv . - "<div><b>" . - http_href($url, typo($row['titre']), '', '', 'calendrier-verdana10') . - "</b></div>" . - "</td>" . - "</tr>\n"; - - $date_rv = $date_jour; - } - - if ($type == 'annonces') { - $titre = _T('info_annonces_generales'); - $couleur_titre = "ccaa00"; - $couleur_texte = "black"; - $couleur_fond = "#ffffee"; - } - else if ($type == 'pb') { - $titre = _T('infos_vos_pense_bete'); - $couleur_titre = "#3874B0"; - $couleur_fond = "#EDF3FE"; - $couleur_texte = "white"; - } - else if ($type == 'rv') { - $titre = _T('info_vos_rendez_vous'); - $couleur_titre = "#666666"; - $couleur_fond = "#eeeeee"; - $couleur_texte = "white"; - } - - return - debut_cadre_enfonce("", true, "", $titre) . - "<table width='100%' border='0' cellpadding='0' cellspacing='2'>" . - $total . - "</table>" . - fin_cadre_enfonce(true); -} function calendrier_categories($table, $num, $objet) { diff --git a/ecrire/inc/minipres.php b/ecrire/inc/minipres.php index 4ad5be23f603f2837ad0d6dd7adda9937cc086de..ded63ac39173efd05d75ed51f48f5b491c7bf7ee 100644 --- a/ecrire/inc/minipres.php +++ b/ecrire/inc/minipres.php @@ -178,6 +178,13 @@ function http_href_img($href, $img, $att, $title='', $style='', $class='', $evt= return http_href($href, http_img_pack($img, $title, $att), $title, $style, $class, $evt); } + +function http_style_background($img, $att='') +{ + return " style='background: url(\"" . _DIR_IMG_PACK . $img . '")' . + ($att ? (' ' . $att) : '') . ";'"; +} + // Pour les formulaires en methode POST, // mettre les arguments a la fois en input-hidden et dans le champ action: // 1) on peut ainsi memoriser le signet comme si c'etait un GET diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php index b541a59e3d2d9d52e7e030ee5b2a846841733536..7e778207914a8ebea5b943947db766839fb7e1d3 100644 --- a/ecrire/inc/presentation.php +++ b/ecrire/inc/presentation.php @@ -12,8 +12,7 @@ if (!defined("_ECRIRE_INC_VERSION")) return; -include_spip('inc/layer'); -include_spip('inc/agenda'); +include_spip('inc/agenda'); // inclut inc/layer, inc/texte, inc/filtre include_spip('inc/boutons'); // Choix dynamique de la couleur @@ -2983,14 +2982,6 @@ function voir_en_ligne ($type, $id, $statut=false, $image='racine-24.gif') { icone_horizontale($message, generer_url_action('redirect', "id_$type=$id&var_mode=$en_ligne"), $image, "rien.gif"); } - -function http_style_background($img, $att='') -{ - return " style='background: url(\"" . _DIR_IMG_PACK . $img . '")' . - ($att ? (' ' . $att) : '') . ";'"; -} - - // // Creer un bouton qui renvoie vers la bonne url spip_rss function bouton_spip_rss($op, $args, $fmt='rss') { @@ -3031,4 +3022,85 @@ function bouton_spip_rss($op, $args, $fmt='rss') { } +// Fonction pour la messagerie et la page d'accueil + +function http_calendrier_rv($messages, $type) { + global $spip_lang_rtl, $spip_lang_left, $spip_lang_right; + + $total = ''; + if (!$messages) return $total; + foreach ($messages as $row) { + if (ereg("^=([^[:space:]]+)$",$row['texte'],$match)) + $url = quote_amp($match[1]); + else + $url = generer_url_ecrire("message", "id_message=".$row['id_message']); + + $rv = ($row['rv'] == 'oui'); + $date = $row['date_heure']; + $date_fin = $row['date_fin']; + if ($row['type']=="pb") $bouton = "pense-bete"; + else if ($row['type']=="affich") $bouton = "annonce"; + else $bouton = "message"; + + if ($rv) { + $date_jour = affdate_jourcourt($date); + $total .= "<tr><td colspan='2'>" . + (($date_jour == $date_rv) ? '' : + "<div class='calendrier-arial11'><b>$date_jour</b></div>") . + "</td></tr>"; + $rv = + ((affdate($date) == affdate($date_fin)) ? + ("<div class='calendrier-arial9 fond-agenda'>" + . heures($date).":".minutes($date)."<br />" + . heures($date_fin).":".minutes($date_fin)."</div>") : + ( "<div class='calendrier-arial9 fond-agenda' style='text-align: center;'>" + . heures($date).":".minutes($date)."<br />...</div>" )); + } + + $total .= "<tr><td style='width: 24px' valign='middle'>" . + http_href($url, + ($rv ? + http_img_pack("rv.gif", 'rv', + http_style_background($bouton . '.gif', "no-repeat;' border='0'")) : + http_img_pack($bouton.".gif", $bouton, "style='border: 0px'")), + '', '') . + "</td>" . + "<td valign='middle'>" . + $rv . + "<div><b>" . + http_href($url, typo($row['titre']), '', '', 'calendrier-verdana10') . + "</b></div>" . + "</td>" . + "</tr>\n"; + + $date_rv = $date_jour; + } + + if ($type == 'annonces') { + $titre = _T('info_annonces_generales'); + $couleur_titre = "ccaa00"; + $couleur_texte = "black"; + $couleur_fond = "#ffffee"; + } + else if ($type == 'pb') { + $titre = _T('infos_vos_pense_bete'); + $couleur_titre = "#3874B0"; + $couleur_fond = "#EDF3FE"; + $couleur_texte = "white"; + } + else if ($type == 'rv') { + $titre = _T('info_vos_rendez_vous'); + $couleur_titre = "#666666"; + $couleur_fond = "#eeeeee"; + $couleur_texte = "white"; + } + + return + debut_cadre_enfonce("", true, "", $titre) . + "<table width='100%' border='0' cellpadding='0' cellspacing='2'>" . + $total . + "</table>" . + fin_cadre_enfonce(true); +} + ?>