From c9e35c9715d05a4221fbe57f2ef31ca11e170ddc Mon Sep 17 00:00:00 2001
From: ARNO* <arno@rezo.net>
Date: Tue, 25 Nov 2003 17:00:33 +0000
Subject: [PATCH] Correction bug calendrier: le calendrier mensuel ne fait plus
 "perdre" le jour de navigation

---
 ecrire/calendrier.php3         | 10 ++++++----
 ecrire/calendrier_jour.php3    | 14 +++++++-------
 ecrire/calendrier_semaine.php3 |  4 ++--
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/ecrire/calendrier.php3 b/ecrire/calendrier.php3
index d6cc8a4301..c2f34659fe 100644
--- a/ecrire/calendrier.php3
+++ b/ecrire/calendrier.php3
@@ -157,10 +157,9 @@ function afficher_mois($jour_today,$mois_today,$annee_today,$nom_mois){
 
 	if ($activer_messagerie == "oui" AND $connect_activer_messagerie != "non"){
 		echo "<div style='float: $spip_lang_right; width: 120px;'>";
-		if (!$afficher_lien_aujourdhui) echo "<a href='calendrier_jour.php3'><img src='img_pack/cal-jour.gif' alt='jour' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
-		else  echo "<a href='calendrier_jour.php3?jour=1&mois=$mois_today&annee=$annee_today'><img src='img_pack/cal-jour.gif' alt='jour' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
+		echo "<a href='calendrier_jour.php3?jour=$jour_today&mois=$mois_today&annee=$annee_today'><img src='img_pack/cal-jour.gif' alt='jour' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
 		echo "&nbsp;";
-		echo "<a href='calendrier_semaine.php3?jour=1&mois=$mois_today&annee=$annee_today'><img src='img_pack/cal-semaine.gif' alt='semaine' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
+		echo "<a href='calendrier_semaine.php3?jour=$jour_today&mois=$mois_today&annee=$annee_today'><img src='img_pack/cal-semaine.gif' alt='semaine' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
 		echo "&nbsp;";
 		echo "<img src='img_pack/cal-mois.gif' alt='mois' width='26' height='20' border='0' style='border:1px solid black;'>";
 		echo aide ("messcalen");
@@ -243,13 +242,16 @@ function afficher_mois($jour_today,$mois_today,$annee_today,$nom_mois){
 
 // date du jour
 $today=getdate(time());
-$jour=$today["mday"];
 
 // sans arguments => mois courant
 if (!$mois){
+	$jour=$today["mday"];
+	$jour = $today["mday"];
 	$mois=$today["mon"];
 	$annee=$today["year"];
 }
+if (!$jour) $jour=$today["mday"];
+
 
 $nom_mois = nom_mois('2000-'.sprintf("%02d", $mois).'-01');
 
diff --git a/ecrire/calendrier_jour.php3 b/ecrire/calendrier_jour.php3
index 1a7866f02a..d073a2dbb3 100644
--- a/ecrire/calendrier_jour.php3
+++ b/ecrire/calendrier_jour.php3
@@ -13,14 +13,14 @@ $today=getdate(time());
 	$annee_today = $today["year"];
 
 // sans arguments => mois courant
-if (!$mois){
-	$jour=$today["mday"];
-	$mois=$today["mon"];
-	$annee=$today["year"];
-}
+	if (!$mois){
+		$jour=$today["mday"];
+		$mois=$today["mon"];
+		$annee=$today["year"];
+	}
 
 	$date = date("Y-m-d", mktime(0,0,0,$mois, $jour, $annee));
-	$jour = jour($date);
+	$jour = journum($date);
 	$mois = mois($date);
 	$annee = annee($date);
 
@@ -59,7 +59,7 @@ debut_page(nom_jour("$annee-$mois-$jour")." ".affdate("$annee-$mois-$jour"),  "r
 		echo "&nbsp;";
 		echo "<a href='calendrier_semaine.php3?mois=$mois&annee=$annee&jour=$jour'><img src='img_pack/cal-semaine.gif' alt='semaine' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
 		echo "&nbsp;";
-		echo "<a href='calendrier.php3?mois=$mois&annee=$annee'><img src='img_pack/cal-mois.gif' alt='mois' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
+		echo "<a href='calendrier.php3?mois=$mois&annee=$annee&jour=$jour'><img src='img_pack/cal-mois.gif' alt='mois' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
 		echo aide ("messcalen");
 		echo "</div>";
 
diff --git a/ecrire/calendrier_semaine.php3 b/ecrire/calendrier_semaine.php3
index 51d3f6d98e..6c719a8aa4 100644
--- a/ecrire/calendrier_semaine.php3
+++ b/ecrire/calendrier_semaine.php3
@@ -24,7 +24,7 @@ function afficher_semaine($jour_today,$mois_today,$annee_today){
 	
 	if ($spip_ecran == "large") {
 		$largeur_table = 974;
-		$largeur_gauche = 130;
+		$largeur_gauche = 170;
 	} else {
 		$largeur_table = 750;
 		$largeur_gauche = 100;
@@ -77,7 +77,7 @@ function afficher_semaine($jour_today,$mois_today,$annee_today){
 		echo "&nbsp;";
 		echo "<img src='img_pack/cal-semaine.gif' alt='semaine' width='26' height='20' border='0' style='border: 1px solid black'>";
 		echo "&nbsp;";
-		echo "<a href='calendrier.php3?mois=$mois_today&annee=$annee_today'><img src='img_pack/cal-mois.gif' alt='mois' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
+		echo "<a href='calendrier.php3?mois=$mois_today&annee=$annee_today&jour=$jour_today'><img src='img_pack/cal-mois.gif' alt='mois' width='26' height='20' border='0' style='filter: alpha(opacity=50);'></a>";
 		echo aide ("messcalen");
 		echo "</div>";
 
-- 
GitLab