Changeset 1069


Ignore:
Timestamp:
Mar 8, 2006, 4:22:25 AM (18 years ago)
Author:
rvelices
Message:

calendar: removed some warnings, improved display for weekly style and
worked on css (still not perfect due to IE)

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_base.class.php

    r1062 r1069  
    6666    {
    6767      $res .= $conf['level_separator'];
    68 
    69       $url .= $this->date_components[$i].'-';
     68      if ($i>0)
     69      {
     70        $url .= '-';
     71      }
     72      $url .= $this->date_components[$i];
    7073      if ( isset($this->date_components[$i+1]) )
    7174      {
     
    97100      $label = $this->calendar_levels[$level]['labels'][$date_component];
    98101    }
    99     elseif ($date_component == 'any' )
     102    elseif ('any' === $date_component )
    100103    {
    101104      $label = l10n('calendar_any');
     
    113116    for ($i=count($date_components)-1; $i>=0; $i--)
    114117    {
    115       if ($date_components[$i]!='any')
    116       {
    117         $label = $date_components[$i];
    118         if (isset($this->calendar_levels[$i]['labels'][$date_components[$i]]))
     118      if ('any' !== $date_components[$i])
     119      {
     120        $label = $this->get_date_component_label($i, $date_components[$i] );
     121        if ( $res!='' )
    119122        {
    120           $label = $this->calendar_levels[$i]['labels'][$date_components[$i]];
     123          $res .= ' ';
    121124        }
    122         $res .= $label.' ';
     125        $res .= $label;
    123126      }
    124127    }
     
    193196    {
    194197      $label = l10n('calendar_any');
    195       if (isset($selected_item) and 'any' == $selected_item)
     198      if (isset($selected_item) and 'any' === $selected_item)
    196199      {
    197200        $nav_bar .= '<span class="'.$class_prefix.'Sel">';
     
    290293    if ( empty($this->date_components) )
    291294      return;
    292 
    293     $current = '';
    294295    $query = 'SELECT CONCAT_WS("-"';
    295296    for ($i=0; $i<count($this->date_components); $i++)
    296297    {
    297       if ( $this->date_components[$i] != 'any' )
     298      if ( 'any' === $this->date_components[$i] )
     299      {
     300        $query .= ','.'"any"';
     301      }
     302      else
    298303      {
    299304        $query .= ','.$this->calendar_levels[$i]['sql'];
    300305      }
    301       else
    302       {
    303         $query .= ','.'"any"';
    304       }
    305       $current .= '-' . $this->date_components[$i];
    306     }
    307     $current = substr($current, 1);
     306    }
     307    $current = implode('-', $this->date_components );
    308308
    309309    $query.=') as period' . $this->inner_sql .'
    310310AND ' . $this->date_field . ' IS NOT NULL
    311311GROUP BY period';
     312
    312313    $upper_items = array_from_query( $query, 'period');
     314
    313315    usort($upper_items, 'version_compare');
    314     //echo ('<pre>'. var_export($upper_items, true) . '</pre>');
    315316    $upper_items_rank = array_flip($upper_items);
     317    if ( !isset($upper_items_rank[$current]) )
     318    {
     319      array_push($upper_items, $current);// just in case (external link)
     320      usort($upper_items, 'version_compare');
     321      $upper_items_rank = array_flip($upper_items);
     322    }
    316323    $current_rank = $upper_items_rank[$current];
     324
    317325    if (!$this->has_nav_bar and
    318326        ($current_rank>0 or $current_rank < count($upper_items)-1 ) )
     
    320328      $template->assign_block_vars( 'calendar.navbar', array() );
    321329    }
    322 
    323330    if ( $current_rank>0 )
    324331    { // has previous
  • trunk/include/calendar_monthly.class.php

    r1063 r1069  
    140140  }
    141141  $res = '';
    142   if (isset($date[CYEAR]) and $date[CYEAR]!='any')
     142  if (isset($date[CYEAR]) and $date[CYEAR]!=='any')
    143143  {
    144144    $b = $date[CYEAR] . '-';
    145145    $e = $date[CYEAR] . '-';
    146     if (isset($date[CMONTH]) and $date[CMONTH]!='any')
     146    if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
    147147    {
    148148      $b .= $date[CMONTH] . '-';
    149149      $e .= $date[CMONTH] . '-';
    150       if (isset($date[CDAY]) and $date[CDAY]!='any')
     150      if (isset($date[CDAY]) and $date[CDAY]!=='any')
    151151      {
    152152        $b .= $date[CDAY];
     
    163163      $b .= '01-01';
    164164      $e .= '12-31';
    165       if (isset($date[CMONTH]) and $date[CMONTH]!='any')
     165      if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
    166166      {
    167167        $res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
    168168      }
    169       if (isset($date[CDAY]) and $date[CDAY]!='any')
     169      if (isset($date[CDAY]) and $date[CDAY]!=='any')
    170170      {
    171171        $res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
     
    177177  {
    178178    $res = ' AND '.$this->date_field.' IS NOT NULL';
    179     if (isset($date[CMONTH]) and $date[CMONTH]!='any')
     179    if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
    180180    {
    181181      $res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
    182182    }
    183     if (isset($date[CDAY]) and $date[CDAY]!='any')
     183    if (isset($date[CDAY]) and $date[CDAY]!=='any')
    184184    {
    185185      $res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
     
    225225  $query.= $this->get_date_where();
    226226  $query.= '
    227   GROUP BY period';
     227  GROUP BY period
     228  ORDER BY YEAR('.$this->date_field.') DESC';
    228229
    229230  $result = pwg_query($query);
     
    291292    $items[$m]['nb_images'] += $row['count'];
    292293  }
    293   //echo ('<pre>'. var_export($items, true) . '</pre>');
    294294  if (count($items)==1)
    295295  { // only one month exists so bail out to month view
  • trunk/include/calendar_weekly.class.php

    r1062 r1069  
    4747    parent::initialize($date_field, $inner_sql, $date_components);
    4848    global $lang;
     49    $week_no_labels=array();
     50    for ($i=1; $i<=53; $i++)
     51    {
     52      $week_no_labels[$i] = sprintf( l10n("Week %d"), $i);
     53      //$week_no_labels[$i] = $i;
     54    }
     55
    4956    $this->calendar_levels = array(
    5057      array(
     
    5461      array(
    5562          'sql'=> 'WEEK('.$this->date_field.')+1',
    56           'labels' => null
     63          'labels' => $week_no_labels,
    5764        ),
    5865      array(
     
    8794  if ( count($this->date_components)==1 )
    8895  {
    89     $this->build_nav_bar(CWEEK); // week nav bar 1-53
     96    $this->build_nav_bar(CWEEK, array()); // week nav bar 1-53
    9097  }
    9198  if ( count($this->date_components)==2 )
     
    112119  }
    113120  $res = '';
    114   if (isset($date[CYEAR]) and $date[CYEAR]!='any')
     121  if (isset($date[CYEAR]) and $date[CYEAR]!=='any')
    115122  {
    116123    $y = $date[CYEAR];
     
    118125  }
    119126
    120   if (isset($date[CWEEK]) and $date[CWEEK]!='any')
     127  if (isset($date[CWEEK]) and $date[CWEEK]!=='any')
    121128  {
    122129    $res .= ' AND '.$this->calendar_levels[CWEEK]['sql'].'='.$date[CWEEK];
    123130  }
    124   if (isset($date[CDAY]) and $date[CDAY]!='any')
     131  if (isset($date[CDAY]) and $date[CDAY]!=='any')
    125132  {
    126133    $res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r1059 r1069  
    110110$lang['Visits'] = 'Visits';
    111111$lang['Webmaster'] = 'Webmaster';
     112$lang['Week %d'] = 'Week %d';
    112113$lang['about_page_title'] = 'About PhpWebGallery';
    113114$lang['access_forbiden'] = 'You are not authorized to access the requested page';
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r1059 r1069  
    109109$lang['Visits'] = 'Visites';
    110110$lang['Webmaster'] = 'Webmestre';
     111$lang['Week %d'] = 'Semaine %d';
    111112$lang['about_page_title'] = 'À propos de PhpWebGallery';
    112113$lang['access_forbiden'] = 'Vous n\'êtes pas autorisé sur la page demandée';
     
    134135$lang['calendar_monthly_c'] = 'Calendrier mensuel';
    135136$lang['calendar_picture_hint'] = 'affiche les images du ';
    136 $lang['calendar_view'] = 'View';
     137$lang['calendar_view'] = 'Vue';
    137138$lang['calendar_weekly_l'] = 'Liste hebdomadaire';
    138139$lang['categories'] = 'Catégories';
  • trunk/template/yoga/content.css

    r1062 r1069  
    1818}
    1919
    20 #content H2, H3 {
     20#content H3 {
    2121    margin-bottom: 1ex;
    2222}
     23
     24#content H2 { margin-bottom: 3px;} /*<- for IE otherwise calendar select is displaced to middle of page*/
    2325
    2426#content H3 {
     
    105107/* actions */
    106108UL.categoryActions {
    107   margin: 2px;
     109  margin: 0 2px;
    108110  width: auto;
    109111  padding: 0;
     
    118120}
    119121
     122#content DIV.titrePage {
     123  padding: 0 0 3px;
     124}
     125
    120126#content UL.categoryActions LI {
    121127  display: inline;
    122 
    123128}
    124129
     
    184189  display: block;
    185190  float: right;
    186   margin: 2px 2px;
     191  margin: 2px 0 0;
    187192}
    188193
  • trunk/template/yoga/default-layout.css

    r972 r1069  
    3131H2 {
    3232    margin: 0;
    33     padding: 5px;
     33    padding: 0px 5px 4px;
    3434    text-align: left;
    3535    font-size: 120%;
     
    9191
    9292.table2 {
    93   border: 1px solid black; 
     93  border: 1px solid black;
    9494  margin: 1em auto;
    9595  padding: 0;
     
    229229}
    230230
    231 BODY#theAdminPage #theHeader P { 
     231BODY#theAdminPage #theHeader P {
    232232  display: none;
    233233}
     
    258258}
    259259
     260
Note: See TracChangeset for help on using the changeset viewer.