diff --git a/agenda_jour.php3 b/agenda_jour.php3
deleted file mode 100644
index b98f20dbe316160fba5283e4a9df1c0ee99d7c6a..0000000000000000000000000000000000000000
--- a/agenda_jour.php3
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-$fond = "jour";
-$delais = 2 * 3600;
-
-include ("inc-public.php3");
-
-?>
diff --git a/agenda_mois.php3 b/agenda_mois.php3
deleted file mode 100644
index 6c2d52b84891d6e615936c89cb2301bebe911caf..0000000000000000000000000000000000000000
--- a/agenda_mois.php3
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-$fond = "mois";
-$delais = 2 * 3600;
-
-include ("inc-public.php3");
-
-?>
diff --git a/agenda_semaine.php3 b/agenda_semaine.php3
deleted file mode 100644
index e9e9fa293d4414f0855fdb11722eb4de0e9c7a4f..0000000000000000000000000000000000000000
--- a/agenda_semaine.php3
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-$fond = "semaine";
-$delais = 2 * 3600;
-
-include ("inc-public.php3");
-
-?>
diff --git a/dist/agenda.html b/dist/agenda.html
index aaaee4cf0d60690ca380b34c0af02c879b0dcc4d..f5f0a8342429bfdb3fb571fdfe07e538860f0237 100644
--- a/dist/agenda.html
+++ b/dist/agenda.html
@@ -6,13 +6,6 @@
 <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(agenda_jour.php3){annee}{mois}{jour}{echelle}{partie_cal}>
-][(#ENV{type}|=={'semaine'}|?{' ',''}
-   )<INCLURE(agenda_semaine.php3){annee}{mois}{jour}{echelle}{partie_cal}>
-][(#ENV{type}|=={'mois'}|?{' ',''}
-   )<INCLURE(agenda_mois.php3){annee}{mois}{jour}{echelle}{partie_cal}>
-][(#ENV{type}|=={''}|?{' ',''}
-   )<INCLURE(agenda_mois.php3){annee}{mois}{jour}{echelle}{partie_cal}>
-]</body></html>
+</head><body>
+[(#ENV{type, mois}|agenda_connu)<INCLURE(page.php3){fond=#ENV{type}}{type}{annee}{mois}{jour}{echelle}{partie_cal}>]
+</body></html>
diff --git a/dist/jour.html b/dist/jour.html
index 6175b1d3840348ed73d91cbfcc4d3d8a757ea314..b452bdf73cbf4643bc9403642b7c55d3fb286dde 100644
--- a/dist/jour.html
+++ b/dist/jour.html
@@ -1,5 +1,5 @@
 <BOUCLE_jour(ARTICLES)
-    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, jour}>[
+    {agenda date, jour, #ENV{annee}, #ENV{mois}, #ENV{jour}}>[
 (#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'jour'})
 ]</BOUCLE_jour>
 [(#DATE|agenda_memo{'', '', '', 'jour', 'jour'})]
diff --git a/dist/mois.html b/dist/mois.html
index ec09ed68c473c19643a7243129d66552523c5c6b..5d5c9a4b4d62e7ec5dd069baa99c89fab9859976 100644
--- a/dist/mois.html
+++ b/dist/mois.html
@@ -1,5 +1,5 @@
 <BOUCLE_mois(ARTICLES)
-    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, mois}>[
+    {agenda date, mois, #ENV{annee}, #ENV{mois}}>[
 (#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'mois'})
 ]</BOUCLE_mois>
 [(#DATE|agenda_memo{'', '', '', 'mois', 'mois'})]
diff --git a/dist/periode.html b/dist/periode.html
new file mode 100644
index 0000000000000000000000000000000000000000..c8946cddfa1499451c9a9de52ff12748d9db17d2
--- /dev/null
+++ b/dist/periode.html
@@ -0,0 +1,10 @@
+<BOUCLE_periode(ARTICLES)
+    {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'})
+]</BOUCLE_periode>
+[(#DATE|agenda_memo{'', '', '', 'periode', 'periode'})]
+</B_periode>
+<:aucun_article:>
+<//B_periode>
\ No newline at end of file
diff --git a/dist/semaine.html b/dist/semaine.html
index 5fc7f75d5eefa53206961291ebb3a6b9ba2e3ebf..b1df658d049cfbaac4483b6428022be0229a7a62 100644
--- a/dist/semaine.html
+++ b/dist/semaine.html
@@ -1,5 +1,5 @@
 <BOUCLE_semaine(ARTICLES)
-    {agenda date, #ENV{annee}, #ENV{mois}, #ENV{jour}, semaine}>[
+    {agenda date, semaine, #ENV{annee}, #ENV{mois}, #ENV{jour}}>[
 (#DATE|agenda_memo{#DESCRIPTIF, #TITRE, #URL_ARTICLE, 'semaine'})
 ]</BOUCLE_semaine>
 [(#DATE|agenda_memo{'', '', '', 'semaine', 'semaine'})]
diff --git a/ecrire/inc_calendrier.php b/ecrire/inc_calendrier.php
index a3723b52e73ed168dadcbb413536f7b3085f91e5..42b6bd7b6093c09edb106955dec8e8ffa9d3432d 100644
--- a/ecrire/inc_calendrier.php
+++ b/ecrire/inc_calendrier.php
@@ -262,6 +262,7 @@ function http_calendrier_mois($annee, $mois, $jour, $echelle, $partie_cal, $scri
 	global $spip_ecran, $couleur_claire, $couleur_foncee;
 
 	list($sansduree, $evenements, $premier_jour, $dernier_jour) = $evt;
+
 	if ($sansduree)
 		foreach($sansduree as $d => $r) 
 			{
@@ -1083,14 +1084,16 @@ function http_calendrier_invisible($annee, $mois, $jour, $script, $ancre, $id)
 	$annee_avant = $annee - 1;
 	$annee_apres = $annee + 1;
 
+	$finurl = "&type=mois&echelle=$echelle" . $ancre; 
+
 	for ($i=$mois; $i < 13; $i++) {
 		$gadget .= http_href($script .
-				     calendrier_args_date($annee_avant, $i, 1) . $ancre,
+				     calendrier_args_date($annee_avant, $i, 1) . $finurl,
 				     nom_mois("$annee_avant-$i-1"),'','', 'calendrier-annee') ;
 			}
 	for ($i=1; $i < $mois - 1; $i++) {
 		$gadget .= http_href($script .
-				     calendrier_args_date($annee, $i, 1) . $ancre,
+				     calendrier_args_date($annee, $i, 1) . $finurl,
 					nom_mois("$annee-$i-1"),'','', 'calendrier-annee');
 			}
 	$gadget .= "</td></tr>"
@@ -1105,12 +1108,12 @@ function http_calendrier_invisible($annee, $mois, $jour, $script, $ancre, $id)
 		. "\n<tr><td colspan='3' style='text-align:$spip_lang_right;'>";
 	for ($i=$mois+2; $i <= 12; $i++) {
 				$gadget .= http_href($script .
-				     calendrier_args_date($annee, $i, 1) . $ancre,
+				     calendrier_args_date($annee, $i, 1) . $finurl,
 					nom_mois("$annee-$i-1"),'','', 'calendrier-annee');
 			}
 	for ($i=1; $i < $mois+1; $i++) {
 		$gadget .= http_href($script . 
-				     calendrier_args_date($annee_apres, $i, 1) . $ancre,
+				     calendrier_args_date($annee_apres, $i, 1) . $finurl,
 					nom_mois("$annee_apres-$i-1"),'','', 'calendrier-annee');
 			}
 	return $gadget . "</td></tr></table></div>";
@@ -1128,7 +1131,8 @@ function http_calendrier_agenda ($annee, $mois, $jour_ved, $mois_ved, $annee_ved
   return 
     "<div class='calendrier-titre calendrier-arial10'>" .
     http_href($script .
-	      calendrier_args_date($annee, $mois, 1) . $ancre,
+	      calendrier_args_date($annee, $mois, 1) .
+	      '&type=mois' . $ancre,
 	      affdate_mois_annee("$annee-$mois-1"),
 	      '',
 	      'color: black;') .
@@ -1136,7 +1140,7 @@ function http_calendrier_agenda ($annee, $mois, $jour_ved, $mois_ved, $annee_ved
     http_calendrier_agenda_rv ($annee, $mois, $evt,				
 			        'http_calendrier_clic', array($script, $ancre),
 			        $jour_ved, $mois_ved, $annee_ved, 
-				$semaine) .
+				$semaine) . 
     "</table>" .
     "</div>";
 }
diff --git a/ecrire/inc_filtres.php3 b/ecrire/inc_filtres.php3
index ab329836ddadffd40259eba6589055497d0ff62f..7684f2453eda9188b9bfcdad77be1a2e5cd9b32f 100644
--- a/ecrire/inc_filtres.php3
+++ b/ecrire/inc_filtres.php3
@@ -705,16 +705,16 @@ function date_fin_semaine($annee, $mois, $jour) {
   return date("Ymd", mktime(0,0,0,$mois,$debut+6,$annee));
 }
 
+function agenda_connu($type)
+{
+  return in_array($type, array('jour','mois','semaine','periode')) ? ' ' : '';
+}
+
 function agenda_memo($date='', $descriptif='', $titre='', $url='', $cal='', $type='')
 {
   static $agenda = array();
-  if ($type)
+  if (!$type)
     {
-      include('ecrire/inc_calendrier.php');
-      return 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(
@@ -724,7 +724,25 @@ function agenda_memo($date='', $descriptif='', $titre='', $url='', $cal='', $typ
                         'URL' => $url);
     // signifier qu'il y a qqch
     return " ";
-  }
+  }  else {
+
+    if ($type != 'periode')
+      $evt = array($agenda[$cal]);
+    else
+      {
+	$d = array_keys($agenda[$cal]);
+	$mindate = min($d);
+	$max = max($d) - $mindate;
+	$min = substr($mindate,6,2);
+	$max += $min;
+	if ($max < 31) $max = 0;
+	$evt = array($agenda[$cal], '', $min, $max);
+	$type = 'mois';
+      }
+      include('ecrire/inc_calendrier.php');
+      return http_calendrier_init('', $type, '', '', '', $evt);
+    }
+
 }
 
 //
diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3
index 23f52e6a4155040ff81a111069ee83d2284ac72f..c528c1367031005be4e838faf2f62a1cfd853ecb 100644
--- a/ecrire/inc_presentation.php3
+++ b/ecrire/inc_presentation.php3
@@ -1277,7 +1277,7 @@ function afficher_messages($titre_table, $query_message, $afficher_auteurs = tru
 
 				$s = "<div " . 
 				  http_style_background('rv-12.gif', "$spip_lang_left center no-repeat; padding-$spip_lang_left: 15px") .
-				  "><a href='calendrier_jour.php3?jour=$jour&mois=$mois&annee=$annee'><b style='color: black;'>$s</b><br />$heure-$heure_fin</a></div>";
+				  "><a href='calendrier.php3?type=jour&jour=$jour&mois=$mois&annee=$annee'><b style='color: black;'>$s</b><br />$heure-$heure_fin</a></div>";
 			} else {
 				$s = "<font color='#999999'>$s</font>";
 			}
@@ -2275,7 +2275,7 @@ else {
 
 		echo http_img_pack("rien.gif", " ", "width='10'");
 
-		echo "<a href='calendrier_semaine.php3' class='icone26' onMouseOver=\"changestyle('bandeauagenda','visibility','visible');\">" .
+		echo "<a href='calendrier.php3?type=semaine' class='icone26' onMouseOver=\"changestyle('bandeauagenda','visibility','visible');\">" .
 		  http_img_pack("cal-rv.png", "", "width='26' height='20' border='0'") ."</a>";
 		echo "<a href='messagerie.php3' class='icone26' onMouseOver=\"changestyle('bandeaumessagerie','visibility','visible');\">" .
 		  http_img_pack("cal-messagerie.png", "", "width='26' height='20' border='0'") ."</a>";
@@ -2547,7 +2547,7 @@ else {
 
 		// Calendrier
 			$gadget .= "<div id='bandeauagenda' class='bandeau_couleur_sous' style='width: $largeur; $spip_lang_left: 100px;'>";
-			$gadget .= "<a href='calendrier_semaine.php3' class='lien_sous'>";
+			$gadget .= "<a href='calendrier.php3?type=semaine' class='lien_sous'>";
 			$gadget .= _T('icone_agenda');
 			$gadget .= "</a>";
 			
diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3
index 35e63ead6c13d7cd03ed8f8c1b742efab5b94339..8ee3b74367230198bfd87a571d794f09e0b864b9 100644
--- a/ecrire/inc_version.php3
+++ b/ecrire/inc_version.php3
@@ -415,7 +415,7 @@ define_once('_AUTH_USER_FILE', '.htpasswd');
 $spip_version = 1.819;
 
 // version de spip
-$spip_version_affichee = "1.8.2 CVS beta 2";
+$spip_version_affichee = "1.8.2 CVS beta 3";
 
 // version de spip / tag cvs
 if (ereg('Name: v(.*) ','$Name$', $regs)) $spip_version_affichee = $regs[1];
diff --git a/inc-criteres.php3 b/inc-criteres.php3
index da43a4d11a36d0f15ceae60d1e303341bad4acf2..2d03d8693c7a36877cfbd3b949e9e364378a2ebb 100644
--- a/inc-criteres.php3
+++ b/inc-criteres.php3
@@ -264,7 +264,7 @@ function critere_parinverse($idb, &$boucles, $crit, $sens) {
 
 // {inverse}
 // http://www.spip.net/@inverse
-// ancienne spec si pas d'argument, nouvelle sinon
+// obsolete. utiliser {!par ...}
 function critere_inverse_dist($idb, &$boucles, $crit) {
 
 	$boucle = &$boucles[$idb];
@@ -280,50 +280,74 @@ function critere_inverse_dist($idb, &$boucles, $crit) {
 	    else
 	      erreur_squelette(_T('zbug_info_erreur_squelette'), "{inverse ?} BOUCLE$idb");
 	  }
-
-
 }
 
 function critere_agenda($idb, &$boucles, $crit)
 {
 	$params = $crit->param;
+
+	if (count($params) < 1)
+	      erreur_squelette(_T('zbug_info_erreur_squelette'),
+			       "{agenda ?} BOUCLE$idb");
+
 	$parent = $boucles[$idb]->id_parent;
 
 	// les valeur $date et $type doivent etre connus à la compilation
 	// autrement dit ne pas être des champs
+
 	$date = array_shift($params);
 	$date = $date[0]->texte;
 
-	$annee = array_shift($params);
-	$annee = "\n" . '((($x = ' .
+	$type = array_shift($params);
+	$type = $type[0]->texte;
+
+	$annee = $params ? array_shift($params) : "";
+	$annee = "\n" . 'sprintf("%04d", ($x = ' .
 		calculer_liste($annee, array(), $boucles, $parent) .
-		') !== "") ? $x : date("Y"))';
+		') ? $x : date("Y"))';
 
-	$mois = array_shift($params);
-	$mois = "\n" . '(($x = ' .
+	$mois =  $params ? array_shift($params) : "";
+	$mois = "\n" . 'sprintf("%02d", ($x = ' .
 		calculer_liste($mois, array(), $boucles, $parent) .
 		') ? $x : date("m"))';
 
-	$jour = array_shift($params);
-	$jour = "\n" . '(($x = ' .
+	$jour =  $params ? array_shift($params) : "";
+	$jour = "\n" . 'sprintf("%02d", ($x = ' .
 		calculer_liste($jour, array(), $boucles, $parent) .
 		') ? $x : date("d"))';
 
-	$type = array_shift($params);
-	$type = $type[0]->texte;
+	$annee2 = $params ? array_shift($params) : "";
+	$annee2 = "\n" . 'sprintf("%04d", ($x = ' .
+		calculer_liste($annee2, array(), $boucles, $parent) .
+		') ? $x : date("Y"))';
+
+	$mois2 =  $params ? array_shift($params) : "";
+	$mois2 = "\n" . 'sprintf("%02d", ($x = ' .
+		calculer_liste($mois2, array(), $boucles, $parent) .
+		') ? $x : date("m"))';
+
+	$jour2 =  $params ? array_shift($params) : "";
+	$jour2 = "\n" .  'sprintf("%02d", ($x = ' .
+		calculer_liste($jour2, array(), $boucles, $parent) .
+		') ? $x : date("d"))';
 
 	$boucle = &$boucles[$idb];
 	$date = $boucle->id_table . ".$date";
 	if ($type == 'jour')
 	  $boucle->where[] =  "DATE_FORMAT($date, '%Y%m%d') = '\" .  $annee . $mois . $jour .\"'";
-	elseif ($type != 'semaine')
+	elseif ($type == 'mois')
 	  $boucle->where[] =  "DATE_FORMAT($date, '%Y%m') = '\" .  $annee . $mois .\"'";
-	else
+	elseif ($type == 'semaine')
 	  $boucle->where[] = 
 	  "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) . \"'";
+	elseif ($annee && $jour2)
+	  $boucle->where[] = 
+	  "DATE_FORMAT($date, '%Y%m%d') >= '\" . $annee . $mois . $jour .\"' AND
+	  DATE_FORMAT($date, '%Y%m%d') <= '\" . $annee2 . $mois2 . $jour2 .\"'";
+	// sinon on veut tout
 }