Index: /trunk/include/calendar_base.class.php
===================================================================
--- /trunk/include/calendar_base.class.php	(revision 1068)
+++ /trunk/include/calendar_base.class.php	(revision 1069)
@@ -66,6 +66,9 @@
     {
       $res .= $conf['level_separator'];
-
-      $url .= $this->date_components[$i].'-';
+      if ($i>0)
+      {
+        $url .= '-';
+      }
+      $url .= $this->date_components[$i];
       if ( isset($this->date_components[$i+1]) )
       {
@@ -97,5 +100,5 @@
       $label = $this->calendar_levels[$level]['labels'][$date_component];
     }
-    elseif ($date_component == 'any' )
+    elseif ('any' === $date_component )
     {
       $label = l10n('calendar_any');
@@ -113,12 +116,12 @@
     for ($i=count($date_components)-1; $i>=0; $i--)
     {
-      if ($date_components[$i]!='any')
-      {
-        $label = $date_components[$i];
-        if (isset($this->calendar_levels[$i]['labels'][$date_components[$i]]))
+      if ('any' !== $date_components[$i])
+      {
+        $label = $this->get_date_component_label($i, $date_components[$i] );
+        if ( $res!='' )
         {
-          $label = $this->calendar_levels[$i]['labels'][$date_components[$i]];
+          $res .= ' ';
         }
-        $res .= $label.' ';
+        $res .= $label;
       }
     }
@@ -193,5 +196,5 @@
     {
       $label = l10n('calendar_any');
-      if (isset($selected_item) and 'any' == $selected_item)
+      if (isset($selected_item) and 'any' === $selected_item)
       {
         $nav_bar .= '<span class="'.$class_prefix.'Sel">';
@@ -290,29 +293,34 @@
     if ( empty($this->date_components) )
       return;
-
-    $current = '';
     $query = 'SELECT CONCAT_WS("-"';
     for ($i=0; $i<count($this->date_components); $i++)
     {
-      if ( $this->date_components[$i] != 'any' )
+      if ( 'any' === $this->date_components[$i] )
+      {
+        $query .= ','.'"any"';
+      }
+      else
       {
         $query .= ','.$this->calendar_levels[$i]['sql'];
       }
-      else
-      {
-        $query .= ','.'"any"';
-      }
-      $current .= '-' . $this->date_components[$i];
-    }
-    $current = substr($current, 1);
+    }
+    $current = implode('-', $this->date_components );
 
     $query.=') as period' . $this->inner_sql .'
 AND ' . $this->date_field . ' IS NOT NULL
 GROUP BY period';
+
     $upper_items = array_from_query( $query, 'period');
+
     usort($upper_items, 'version_compare');
-    //echo ('<pre>'. var_export($upper_items, true) . '</pre>');
     $upper_items_rank = array_flip($upper_items);
+    if ( !isset($upper_items_rank[$current]) )
+    {
+      array_push($upper_items, $current);// just in case (external link)
+      usort($upper_items, 'version_compare');
+      $upper_items_rank = array_flip($upper_items);
+    }
     $current_rank = $upper_items_rank[$current];
+
     if (!$this->has_nav_bar and
         ($current_rank>0 or $current_rank < count($upper_items)-1 ) )
@@ -320,5 +328,4 @@
       $template->assign_block_vars( 'calendar.navbar', array() );
     }
-
     if ( $current_rank>0 )
     { // has previous
Index: /trunk/include/calendar_monthly.class.php
===================================================================
--- /trunk/include/calendar_monthly.class.php	(revision 1068)
+++ /trunk/include/calendar_monthly.class.php	(revision 1069)
@@ -140,13 +140,13 @@
   }
   $res = '';
-  if (isset($date[CYEAR]) and $date[CYEAR]!='any')
+  if (isset($date[CYEAR]) and $date[CYEAR]!=='any')
   {
     $b = $date[CYEAR] . '-';
     $e = $date[CYEAR] . '-';
-    if (isset($date[CMONTH]) and $date[CMONTH]!='any')
+    if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
     {
       $b .= $date[CMONTH] . '-';
       $e .= $date[CMONTH] . '-';
-      if (isset($date[CDAY]) and $date[CDAY]!='any')
+      if (isset($date[CDAY]) and $date[CDAY]!=='any')
       {
         $b .= $date[CDAY];
@@ -163,9 +163,9 @@
       $b .= '01-01';
       $e .= '12-31';
-      if (isset($date[CMONTH]) and $date[CMONTH]!='any')
+      if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
       {
         $res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
       }
-      if (isset($date[CDAY]) and $date[CDAY]!='any')
+      if (isset($date[CDAY]) and $date[CDAY]!=='any')
       {
         $res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
@@ -177,9 +177,9 @@
   {
     $res = ' AND '.$this->date_field.' IS NOT NULL';
-    if (isset($date[CMONTH]) and $date[CMONTH]!='any')
+    if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
     {
       $res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
     }
-    if (isset($date[CDAY]) and $date[CDAY]!='any')
+    if (isset($date[CDAY]) and $date[CDAY]!=='any')
     {
       $res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
@@ -225,5 +225,6 @@
   $query.= $this->get_date_where();
   $query.= '
-  GROUP BY period';
+  GROUP BY period
+  ORDER BY YEAR('.$this->date_field.') DESC';
 
   $result = pwg_query($query);
@@ -291,5 +292,4 @@
     $items[$m]['nb_images'] += $row['count'];
   }
-  //echo ('<pre>'. var_export($items, true) . '</pre>');
   if (count($items)==1)
   { // only one month exists so bail out to month view
Index: /trunk/include/calendar_weekly.class.php
===================================================================
--- /trunk/include/calendar_weekly.class.php	(revision 1068)
+++ /trunk/include/calendar_weekly.class.php	(revision 1069)
@@ -47,4 +47,11 @@
     parent::initialize($date_field, $inner_sql, $date_components);
     global $lang;
+    $week_no_labels=array();
+    for ($i=1; $i<=53; $i++)
+    {
+      $week_no_labels[$i] = sprintf( l10n("Week %d"), $i);
+      //$week_no_labels[$i] = $i;
+    }
+
     $this->calendar_levels = array(
       array(
@@ -54,5 +61,5 @@
       array(
           'sql'=> 'WEEK('.$this->date_field.')+1',
-          'labels' => null
+          'labels' => $week_no_labels,
         ),
       array(
@@ -87,5 +94,5 @@
   if ( count($this->date_components)==1 )
   {
-    $this->build_nav_bar(CWEEK); // week nav bar 1-53
+    $this->build_nav_bar(CWEEK, array()); // week nav bar 1-53
   }
   if ( count($this->date_components)==2 )
@@ -112,5 +119,5 @@
   }
   $res = '';
-  if (isset($date[CYEAR]) and $date[CYEAR]!='any')
+  if (isset($date[CYEAR]) and $date[CYEAR]!=='any')
   {
     $y = $date[CYEAR];
@@ -118,9 +125,9 @@
   }
 
-  if (isset($date[CWEEK]) and $date[CWEEK]!='any')
+  if (isset($date[CWEEK]) and $date[CWEEK]!=='any')
   {
     $res .= ' AND '.$this->calendar_levels[CWEEK]['sql'].'='.$date[CWEEK];
   }
-  if (isset($date[CDAY]) and $date[CDAY]!='any')
+  if (isset($date[CDAY]) and $date[CDAY]!=='any')
   {
     $res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
Index: /trunk/language/en_UK.iso-8859-1/common.lang.php
===================================================================
--- /trunk/language/en_UK.iso-8859-1/common.lang.php	(revision 1068)
+++ /trunk/language/en_UK.iso-8859-1/common.lang.php	(revision 1069)
@@ -110,4 +110,5 @@
 $lang['Visits'] = 'Visits';
 $lang['Webmaster'] = 'Webmaster';
+$lang['Week %d'] = 'Week %d';
 $lang['about_page_title'] = 'About PhpWebGallery';
 $lang['access_forbiden'] = 'You are not authorized to access the requested page';
Index: /trunk/language/fr_FR.iso-8859-1/common.lang.php
===================================================================
--- /trunk/language/fr_FR.iso-8859-1/common.lang.php	(revision 1068)
+++ /trunk/language/fr_FR.iso-8859-1/common.lang.php	(revision 1069)
@@ -109,4 +109,5 @@
 $lang['Visits'] = 'Visites';
 $lang['Webmaster'] = 'Webmestre';
+$lang['Week %d'] = 'Semaine %d';
 $lang['about_page_title'] = 'À propos de PhpWebGallery';
 $lang['access_forbiden'] = 'Vous n\'êtes pas autorisé sur la page demandée';
@@ -134,5 +135,5 @@
 $lang['calendar_monthly_c'] = 'Calendrier mensuel';
 $lang['calendar_picture_hint'] = 'affiche les images du ';
-$lang['calendar_view'] = 'View';
+$lang['calendar_view'] = 'Vue';
 $lang['calendar_weekly_l'] = 'Liste hebdomadaire';
 $lang['categories'] = 'Catégories';
Index: /trunk/template/yoga/content.css
===================================================================
--- /trunk/template/yoga/content.css	(revision 1068)
+++ /trunk/template/yoga/content.css	(revision 1069)
@@ -18,7 +18,9 @@
 }
 
-#content H2, H3 {
+#content H3 {
     margin-bottom: 1ex;
 }
+
+#content H2 { margin-bottom: 3px;} /*<- for IE otherwise calendar select is displaced to middle of page*/
 
 #content H3 {
@@ -105,5 +107,5 @@
 /* actions */
 UL.categoryActions {
-  margin: 2px;
+  margin: 0 2px;
   width: auto;
   padding: 0;
@@ -118,7 +120,10 @@
 }
 
+#content DIV.titrePage {
+  padding: 0 0 3px;
+}
+
 #content UL.categoryActions LI {
   display: inline;
-
 }
 
@@ -184,5 +189,5 @@
   display: block;
   float: right;
-  margin: 2px 2px;
+  margin: 2px 0 0;
 }
 
Index: /trunk/template/yoga/default-layout.css
===================================================================
--- /trunk/template/yoga/default-layout.css	(revision 1068)
+++ /trunk/template/yoga/default-layout.css	(revision 1069)
@@ -31,5 +31,5 @@
 H2 {
     margin: 0;
-    padding: 5px;
+    padding: 0px 5px 4px;
     text-align: left;
     font-size: 120%;
@@ -91,5 +91,5 @@
 
 .table2 {
-  border: 1px solid black; 
+  border: 1px solid black;
   margin: 1em auto;
   padding: 0;
@@ -229,5 +229,5 @@
 }
 
-BODY#theAdminPage #theHeader P { 
+BODY#theAdminPage #theHeader P {
   display: none;
 }
@@ -258,2 +258,3 @@
 }
 
+
