From cf01d909e9628f2e4a936886ccae8215c5ec8e0a Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Tue, 26 Jul 2005 15:45:34 +0000
Subject: [PATCH] =?UTF-8?q?am=C3=A9lioration=20de=20l'API=20du=20filtre=20?=
 =?UTF-8?q?agenda=5Fmemo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dist/agenda.html          |  2 +-
 dist/jour.html            |  4 ++--
 dist/mois.html            |  4 ++--
 dist/periode.html         |  4 ++--
 dist/semaine.html         |  4 ++--
 ecrire/inc_calendrier.php |  6 +++---
 ecrire/inc_filtres.php3   | 21 ++++++++++++++-------
 7 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/dist/agenda.html b/dist/agenda.html
index 7fe567f5b5..3662e2b920 100644
--- a/dist/agenda.html
+++ b/dist/agenda.html
@@ -8,5 +8,5 @@
 <script type="text/javascript" src="ecrire/presentation.js"></script>
 </head><body>
 [(#ENV{type, mois}|agenda_connu)<INCLURE(page.php3)
- {fond=#ENV{type}}{type}{delais=900}{annee}{mois}{jour}{echelle}{partie_cal}>]
+ {fond=#ENV{type,mois}}{type}{delais=900}{annee}{mois}{jour}{echelle}{partie_cal}>]
 </body></html>
diff --git a/dist/jour.html b/dist/jour.html
index b452bdf73c..2210bef23e 100644
--- a/dist/jour.html
+++ b/dist/jour.html
@@ -1,8 +1,8 @@
 <BOUCLE_jour(ARTICLES)
     {agenda date, jour, #ENV{annee}, #ENV{mois}, #ENV{jour}}>[
-(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'jour'})
+(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 1})
 ]</BOUCLE_jour>
-[(#DATE|agenda_memo{'', '', '', 'jour', 'jour'})]
+[(#DATE|agenda_memo{'', '', '', 1, 'jour'})]
 </B_jour>
 <:aucun_article:>
 <//B_jour>
\ No newline at end of file
diff --git a/dist/mois.html b/dist/mois.html
index 5d5c9a4b4d..3e2fba6447 100644
--- a/dist/mois.html
+++ b/dist/mois.html
@@ -1,8 +1,8 @@
 <BOUCLE_mois(ARTICLES)
     {agenda date, mois, #ENV{annee}, #ENV{mois}}>[
-(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'mois'})
+(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 3})
 ]</BOUCLE_mois>
-[(#DATE|agenda_memo{'', '', '', 'mois', 'mois'})]
+[(#DATE|agenda_memo{'', '', '', 3, 'mois'})]
 </B_mois>
 <:aucun_article:>
 <//B_mois>
\ No newline at end of file
diff --git a/dist/periode.html b/dist/periode.html
index c8946cddfa..d152f31d36 100644
--- a/dist/periode.html
+++ b/dist/periode.html
@@ -2,9 +2,9 @@
     {agenda date, periode,
   #ENV{annee}, #ENV{mois}, #ENV{jour},
   #ENV{annee_fin}, #ENV{mois_fin}, #ENV{jour_fin}}>[
-(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'periode'})
+(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 4})
 ]</BOUCLE_periode>
-[(#DATE|agenda_memo{'', '', '', 'periode', 'periode'})]
+[(#DATE|agenda_memo{'', '', '', 4, 'periode'})]
 </B_periode>
 <:aucun_article:>
 <//B_periode>
\ No newline at end of file
diff --git a/dist/semaine.html b/dist/semaine.html
index b1df658d04..aae0c6a948 100644
--- a/dist/semaine.html
+++ b/dist/semaine.html
@@ -1,8 +1,8 @@
 <BOUCLE_semaine(ARTICLES)
     {agenda date, semaine, #ENV{annee}, #ENV{mois}, #ENV{jour}}>[
-(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'semaine'})
+(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 2})
 ]</BOUCLE_semaine>
-[(#DATE|agenda_memo{'', '', '', 'semaine', 'semaine'})]
+[(#DATE|agenda_memo{'', '', '', 2, 'semaine'})]
 </B_semaine>
 <:aucun_article:>
 <//B_semaine>
diff --git a/ecrire/inc_calendrier.php b/ecrire/inc_calendrier.php
index 097697555a..329d65186d 100644
--- a/ecrire/inc_calendrier.php
+++ b/ecrire/inc_calendrier.php
@@ -198,11 +198,11 @@ function http_calendrier_init($time='', $ltype='', $lechelle='', $lpartie_cal=''
 	if (!$time) 
 	  {
 	    $today=getdate(time());
-	    if (!isset($annee))
+	    if (!$annee)
 	      $annee = $today["year"];
-	    if (!isset($mois))
+	    if (!$mois)
 	      $mois = $today["mon"];
-	    if (!isset($jour))
+	    if (!$jour)
 	      $jour = $today["mday"];
 	    $time = mktime(0,0,0,$mois, $jour, $annee);
 	    $type= 'mois';
diff --git a/ecrire/inc_filtres.php3 b/ecrire/inc_filtres.php3
index 974b47f4fb..44d512bc9b 100644
--- a/ecrire/inc_filtres.php3
+++ b/ecrire/inc_filtres.php3
@@ -710,18 +710,24 @@ function agenda_connu($type)
   return in_array($type, array('jour','mois','semaine','periode')) ? ' ' : '';
 }
 
+// A chaque appel de moins 5 arguments,cette fonction memorise un evenement
+// decrit par une date, un descriptif, un titre et une URL. 
+// A l'appel avec 6 arguments, l'ensemble sera mis en page selon le type
+// indique par le 6e argument et la couleur indiquee par le 5e 
+// (nombre indexant le tableau $contraste de inc_calendrier -- a CSS-iser)
+// Ce 5e argument sert aussi d'index de memorisation
+// pour avoir plusieurs calendriers dans une meme page sans interferences
+
+
 function agenda_memo($date='', $descriptif='', $titre='', $url='', $cal='', $type='')
 {
   static $agenda = array();
   if (!$type)
     {
-    // rajouter une dimension dans le tableau afin d'autoriser plusieurs
-    // calendriers dans une même page
     $agenda[$cal][(date_anneemoisjour($date))][] =  array(
-# CATEGORIES reference le tableau $contraste de inc_calendrier
-# faudrait passer ca en CSS 
-			'CATEGORIES' => 2,
+			'CATEGORIES' => intval($cal),
 			'DTSTART' => date_ical($date),
+			'DTEND' => date_ical($date),
                         'DESCRIPTION' => texte_script($descriptif),
                         'SUMMARY' => texte_script($titre),
                         'URL' => $url);
@@ -729,6 +735,7 @@ function agenda_memo($date='', $descriptif='', $titre='', $url='', $cal='', $typ
     return " ";
   }  else {
 
+
     if ($type != 'periode')
       $evt = array('', $agenda[$cal]);
     else
@@ -741,8 +748,8 @@ function agenda_memo($date='', $descriptif='', $titre='', $url='', $cal='', $typ
 	$evt = array('', $agenda[$cal], $min, $max);
 	$type = 'mois';
       }
-      include('ecrire/inc_calendrier.php');
-      return http_calendrier_init('', $type, '', '', '', $evt);
+    include('ecrire/inc_calendrier.php');
+    return http_calendrier_init('', $type, '', '', '', $evt);
     }
 
 }
-- 
GitLab