From 204ea2906479a3b277b12f00e4223e36fc3044aa Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Tue, 31 May 2005 15:28:44 +0000
Subject: [PATCH] =?UTF-8?q?filtre=20agenda=5Fmemo=20pour=20calendriers=20p?=
 =?UTF-8?q?ublics=20sans=20PHP=20interpol=C3=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dist/agenda.html        | 20 ++++++++++----------
 dist/jour.html          | 21 ++++++++-------------
 dist/mois.html          | 21 ++++++++-------------
 dist/semaine.html       | 21 ++++++++-------------
 ecrire/inc_filtres.php3 | 22 ++++++++++++++++++++++
 inc-compilo.php3        | 10 +++++-----
 inc-criteres.php3       |  6 ++++--
 7 files changed, 65 insertions(+), 56 deletions(-)

diff --git a/dist/agenda.html b/dist/agenda.html
index 99317db92d..d3df1e0631 100644
--- a/dist/agenda.html
+++ b/dist/agenda.html
@@ -6,13 +6,13 @@
 <link rel="stylesheet" href="ecrire/calendrier.css" type="text/css">
 <script type="text/javascript" src="ecrire/layer.js"></script>
 <script type="text/javascript" src="ecrire/presentation.js"></script>
-</head><body>
-[(#ENV{type}|=={'jour'}|?{' ',''})
-	<INCLURE(jour.php3){annee}{mois}{jour}{echelle}{partie_cal}>]
-[(#ENV{type}|=={'semaine'}|?{' ',''})
-	<INCLURE(semaine.php3){annee}{mois}{jour}{echelle}{partie_cal}>]
-[(#ENV{type}|=={'mois'}|?{' ',''})
-	<INCLURE(mois.php3){annee}{mois}{jour}{echelle}{partie_cal}>]
-[(#ENV{type}|=={''}|?{' ',''})
-	<INCLURE(mois.php3){annee}{mois}{jour}{echelle}{partie_cal}>]
-</body></html>
+</head><body>[
+(#ENV{type}|=={'jour'}|?{' ',''}
+ )<INCLURE(jour.php3){annee}{mois}{jour}{echelle}{partie_cal}>
+][(#ENV{type}|=={'semaine'}|?{' ',''}
+   )<INCLURE(semaine.php3){annee}{mois}{jour}{echelle}{partie_cal}>
+][(#ENV{type}|=={'mois'}|?{' ',''}
+   )<INCLURE(mois.php3){annee}{mois}{jour}{echelle}{partie_cal}>
+][(#ENV{type}|=={''}|?{' ',''}
+   )<INCLURE(mois.php3){annee}{mois}{jour}{echelle}{partie_cal}>
+]</body></html>
diff --git a/dist/jour.html b/dist/jour.html
index 792da52f21..6175b1d384 100644
--- a/dist/jour.html
+++ b/dist/jour.html
@@ -1,13 +1,8 @@
-<?php
-include('ecrire/inc_calendrier.php');
-$articles = array();
-<BOUCLE_evenements(ARTICLES)
-    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, jour}>
-     $articles[[(#DATE|date_anneemoisjour)]][] =  array(
-                        'CATEGORIES' => 'info_articles',
-                        'DESCRIPTION' => '[(#DESCRIPTIF|texte_script)]',
-                        'SUMMARY' => '[(#TITRE|texte_script)]',
-                        'URL' => '#URL_ARTICLE');
-</BOUCLE_evenements>
-echo http_calendrier_init('', 'jour', '', '', '', array($articles));
-?>
+<BOUCLE_jour(ARTICLES)
+    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, jour}>[
+(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'jour'})
+]</BOUCLE_jour>
+[(#DATE|agenda_memo{'', '', '', 'jour', 'jour'})]
+</B_jour>
+<:aucun_article:>
+<//B_jour>
\ No newline at end of file
diff --git a/dist/mois.html b/dist/mois.html
index 7562cb16ec..ec09ed68c4 100644
--- a/dist/mois.html
+++ b/dist/mois.html
@@ -1,13 +1,8 @@
-<?php
-include('ecrire/inc_calendrier.php');
-$articles = array();
-<BOUCLE_evenements(ARTICLES)
-    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, mois }>
-     $articles[[(#DATE|date_anneemoisjour)]][] =  array(
-                        'CATEGORIES' => 'info_articles',
-                        'DESCRIPTION' => '[(#DESCRIPTIF|texte_script)]',
-                        'SUMMARY' => '[(#TITRE|texte_script)]',
-                        'URL' => '#URL_ARTICLE');
-</BOUCLE_evenements>
-echo http_calendrier_init('', 'mois', '', '', '', array($articles));
-?>
+<BOUCLE_mois(ARTICLES)
+    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, mois}>[
+(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'mois'})
+]</BOUCLE_mois>
+[(#DATE|agenda_memo{'', '', '', 'mois', 'mois'})]
+</B_mois>
+<:aucun_article:>
+<//B_mois>
\ No newline at end of file
diff --git a/dist/semaine.html b/dist/semaine.html
index 3de68003a3..5fc7f75d5e 100644
--- a/dist/semaine.html
+++ b/dist/semaine.html
@@ -1,13 +1,8 @@
-<?php
-include('ecrire/inc_calendrier.php');
-$articles = array();
-<BOUCLE_evenements(ARTICLES)
-    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, semaine }>
-     $articles[[(#DATE|date_anneemoisjour)]][] =  array(
-                        'CATEGORIES' => 'info_articles',
-                        'DESCRIPTION' => '[(#DESCRIPTIF|texte_script)]',
-                        'SUMMARY' => '[(#TITRE|texte_script)]',
-                        'URL' => '#URL_ARTICLE');
-</BOUCLE_evenements>
-echo http_calendrier_init('', 'semaine', '', '', '', array($articles));
-?>
+<BOUCLE_semaine(ARTICLES)
+    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, semaine}>[
+(#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'semaine'})
+]</BOUCLE_semaine>
+[(#DATE|agenda_memo{'', '', '', 'semaine', 'semaine'})]
+</B_semaine>
+<:aucun_article:>
+<//B_semaine>
diff --git a/ecrire/inc_filtres.php3 b/ecrire/inc_filtres.php3
index 5cffdf9b10..091286a5a1 100644
--- a/ecrire/inc_filtres.php3
+++ b/ecrire/inc_filtres.php3
@@ -699,6 +699,28 @@ function date_fin_semaine($annee, $mois, $jour) {
   return date("Ymd", mktime(0,0,0,$mois,$debut+6,$annee));
 }
 
+function agenda_memo($date='', $descriptif='', $titre='', $url='', $cal='', $type='')
+{
+  static $agenda = array();
+  if ($type)
+    {
+      include('ecrire/inc_calendrier.php');
+      echo http_calendrier_init('', $type, '', '', '', 
+				  array($agenda[$cal]));
+    }
+  else {
+    // rajouter une dimension dans le tableau afin d'autoriser plusieurs
+    // calendriers dans une même page
+    $agenda[$cal][(date_anneemoisjour($date))][] =  array(
+                        'CATEGORIES' => 'info_articles',
+                        'DESCRIPTION' => texte_script($descriptif),
+                        'SUMMARY' => texte_script($titre),
+                        'URL' => $url);
+    // signifier qu'il y a qqch
+    return " ";
+  }
+}
+
 //
 // Fonctions graphiques
 //
diff --git a/inc-compilo.php3 b/inc-compilo.php3
index 179e48c7fc..16af45dce9 100644
--- a/inc-compilo.php3
+++ b/inc-compilo.php3
@@ -597,11 +597,11 @@ function calculer_squelette($squelette, $nom, $gram, $sourcefile) {
 
 		foreach($boucles as $id => $boucle) {
 
-			// Reproduire la boucle en commentaire
-			$pretty = "BOUCLE$id(".strtoupper($boucle->type_requete).")";
+			// Indiquer la boucle en commentaire
+			$pretty = "BOUCLE$id ".strtoupper($boucle->type_requete);
 			// anachronique. A refaire.
 			/*    if ($boucle->param && is_array($boucle->param)) 
-			 $pretty .= " {".join("} {", $boucle->param)."}";*/
+			 $pretty .= " {".join("} {", $boucle->param)."}";
 			// sans oublier les parametres traites en amont
 		    if ($boucle->separateur)
 		      foreach($boucle->separateur as $v)
@@ -609,11 +609,11 @@ function calculer_squelette($squelette, $nom, $gram, $sourcefile) {
 		    if ($boucle->tout)
 			  $pretty .= '{tout}';
 			if ($boucle->plat)
-			  $pretty .= '{plat}';
+			  $pretty .= '{plat}'; */
 			$pretty = ereg_replace("[\r\n]", " ", $pretty);
 
 			// Puis envoyer son code
-			$codeboucle = "\n//\n// <$pretty>\n//\n"
+			$codeboucle = "\n//\n// $pretty\n//\n"
 			."function BOUCLE" . ereg_replace("-","_",$id) . $nom .
 			'(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' .
 			$boucle->return;
diff --git a/inc-criteres.php3 b/inc-criteres.php3
index 8c260a3580..bc0ee8693b 100644
--- a/inc-criteres.php3
+++ b/inc-criteres.php3
@@ -283,8 +283,10 @@ function critere_agenda($idb, &$boucles, $crit)
 	  $boucle->where[] =  "DATE_FORMAT($date, '%Y%m') = '\" .  $annee . $mois .\"'";
 	else
 	  $boucle->where[] = 
-	  "DATE_FORMAT($date, '%Y%m') >= ' \" . date_debut_semaine($annee . ',' . $mois . ',' . $jour . \"' AND
-	  DATE_FORMAT($date, '%Y%m') <= ' \" . date_fin_semaine($annee . ',' . $mois . ',' . $jour . \"'";
+	  "DATE_FORMAT($date, '%Y%m%d') >= '\" . 
+		date_debut_semaine($annee, $mois, $jour) . \"' AND
+	  DATE_FORMAT($date, '%Y%m%d') <= '\" .
+		date_fin_semaine($annee, $mois, $jour) . \"'";
 }
 
 
-- 
GitLab