calendar improvements: week on weekly list starts on Monday,

ability to show grayed months/weeks/days (without any picture in it),
added icons for created/posted fields
language uniformization

calendar fixes: correct number of pictures in calendar view,
code simplification (I hope so)

git-svn-id: http://piwigo.org/svn/trunk@1059 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2006-02-28 04:28:06 +00:00
commit 97898b3685
19 changed files with 470 additions and 336 deletions

View file

@ -152,7 +152,7 @@ $available_order_by= array(
array(l10n('Controversy'), 'std_rates DESC'),
array(l10n('File name'), 'file DESC'),
array(l10n('Creation date'), 'date_creation DESC'),
array(l10n('Availability date'), 'date_available DESC'),
array(l10n('Post date'), 'date_available DESC'),
);

View file

@ -163,17 +163,46 @@ if ( ! isset($_GET['calendar']) )
{
$calendar_view_link .= (empty($_GET)? '?':'&' ) . 'calendar=';
$template->assign_block_vars(
'calendar_view',
'mode_created',
array( 'URL' => $calendar_view_link.'created' )
);
$template->assign_block_vars(
'mode_posted',
array( 'URL' => $calendar_view_link.'posted' )
);
}
else
{
$template->assign_block_vars(
'mode_normal',
array( 'URL' => $calendar_view_link )
);
if (get_query_string_diff( array('start','calendar') )=='')
{
$calendar_view_link .= '?';
}
else
{
$calendar_view_link .= '&';
}
$calendar_view_link .= 'calendar=';
if ( strpos($_GET['calendar'], 'posted') === false)
{
$template->assign_block_vars(
'mode_posted',
array( 'URL' => $calendar_view_link.'posted' )
);
}
else
{
$template->assign_block_vars(
'normal_view',
array( 'URL' => $calendar_view_link )
'mode_created',
array( 'URL' => $calendar_view_link.'created' )
);
}
}
$template->assign_vars(
array(
@ -298,10 +327,19 @@ $template->assign_block_vars(
'NAME' => $lang['recent_cats_cat']
));
// calendar
if ( $conf['calendar_datefield'] == 'date_available' )
{
$calendar_link = 'posted';
}
else
{
$calendar_link = 'created';
}
$calendar_link .= '-monthly-c';
$template->assign_block_vars(
'special_cat',
array(
'URL' => PHPWG_ROOT_PATH.'category.php?calendar=monthly-c',
'URL' => PHPWG_ROOT_PATH.'category.php?calendar='.$calendar_link,
'TITLE' => $lang['calendar_hint'],
'NAME' => $lang['calendar']
));

View file

@ -37,7 +37,8 @@ class CalendarBase
var $url_base;
// array of date components e.g. (2005,10,12) ...
var $date_components;
//
var $calendar_levels;
/**
* Initialize the calendar
@ -52,16 +53,45 @@ class CalendarBase
$this->date_components = $date_components;
}
function get_display_name()
{
global $conf;
$res = '';
$url = $this->url_base;
for ($i=0; $i<count($this->date_components); $i++)
{
$res .= $conf['level_separator'];
$url .= $this->date_components[$i].'-';
if ( isset($this->date_components[$i+1]) )
{
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($i, $this->date_components[$i])
.'</a>';
}
else
{
$res .=
'<span class="calInHere">'
.$this->get_date_component_label($i, $this->date_components[$i])
.'</span>';
}
}
return $res;
}
//--------------------------------------------------------- private members ---
/**
* Returns a display name for a date component optionally using labels
*/
function get_date_component_label($date_component, $labels=null)
function get_date_component_label($level, $date_component)
{
$label = $date_component;
if (isset($labels[$date_component]))
if (isset($this->calendar_levels[$level]['labels'][$date_component]))
{
$label = $labels[$date_component];
$label = $this->calendar_levels[$level]['labels'][$date_component];
}
elseif ($date_component == 'any' )
{
@ -77,15 +107,31 @@ class CalendarBase
* @param array items - hash of items to put in the bar (e.g. 2005,2006)
* @param array selected_item - item currently selected (e.g. 2005)
* @param string class_prefix - html class attribute prefix for span elements
* @param bool allow_any - adds any to the end of the bar
* @param bool show_any - adds any link to the end of the bar
* @param bool show_empty - shows all labels even those without items
* @param array labels - optional labels for items (e.g. Jan,Feb,...)
* @return string the navigation bar
*/
function get_nav_bar_from_items($url_base, $items, $selected_item,
$class_prefix, $allow_any, $labels=null)
$class_prefix, $show_any,
$show_empty=false, $labels=null)
{
global $conf;
$nav_bar = '';
if ($conf['calendar_show_empty'] and $show_empty and !empty($labels) )
{
foreach ($labels as $item => $label)
{
if ( ! isset($items[$item]) )
{
$items[$item] = -1;
}
}
ksort($items);
}
foreach ($items as $item => $nb_images)
{
$label = $item;
@ -98,6 +144,11 @@ class CalendarBase
$nav_bar .= '<span class="'.$class_prefix.'Sel">';
$nav_bar .= $label;
}
elseif ($nb_images==-1)
{
$nav_bar .= '<span class="'.$class_prefix.'Empty">';
$nav_bar .= $label;
}
else
{
$nav_bar .= '<span class="'.$class_prefix.'">';
@ -112,8 +163,8 @@ class CalendarBase
}
$nav_bar.= '</span>';
}
global $conf;
if ($conf['calendar_show_any'] and $allow_any and count($items) > 1)
if ($conf['calendar_show_any'] and $show_any and count($items) > 1)
{
$label = l10n('calendar_any');
if (isset($selected_item) and 'any' == $selected_item)
@ -137,18 +188,15 @@ class CalendarBase
/**
* Creates a calendar navigation bar for a given level.
*
* @param string sql_func - YEAR/MONTH/DAY/WEEK/DAYOFWEEK ...
* @param string sql_offset - (e.g. +1 for WEEK - first in year is 1)
* @param array labels - optional labels to show in the navigation bar
* @param int level - the level (0-year,1-month/week,2-day)
* @return void
*/
function build_nav_bar($level, $sql_func,
$sql_offset='', $labels=null)
function build_nav_bar($level, $labels=null)
{
global $template;
global $template, $conf;
$query = '
SELECT DISTINCT('.$sql_func.'('.$this->date_field.')'.$sql_offset
SELECT DISTINCT('.$this->calendar_levels[$level]['sql']
.') as period';
$query.= $this->inner_sql;
$query.= $this->get_date_where($level);
@ -163,6 +211,24 @@ SELECT DISTINCT('.$sql_func.'('.$this->date_field.')'.$sql_offset
$level_items[$row['period']] = 0;
}
if ( count($level_items)==1 )
{
if ( ! isset($this->date_components[$level]) )
{
list($key) = array_keys($level_items);
$this->date_components[$level] = (int)$key;
}
}
if ( $conf['calendar_multi_bar']==false )
{
if ( $level<count($this->date_components) and
$level!=count($this->calendar_levels)-1 )
{
return;
}
}
$url_base = $this->url_base;
for ($i=0; $i<$level; $i++)
{
@ -180,9 +246,10 @@ SELECT DISTINCT('.$sql_func.'('.$this->date_field.')'.$sql_offset
$url_base,
$level_items,
$selected,
'cal',
'calItem',
true,
$labels
true,
isset($labels) ? $labels : $this->calendar_levels[$level]['labels']
);
$template->assign_block_vars(

View file

@ -36,6 +36,32 @@ define ('CDAY', 2);
class Calendar extends CalendarBase
{
/**
* Initialize the calendar
* @param string date_field db column on which this calendar works
* @param string inner_sql used for queries (INNER JOIN or normal)
* @param array date_components
*/
function initialize($date_field, $inner_sql, $date_components)
{
parent::initialize($date_field, $inner_sql, $date_components);
global $lang;
$this->calendar_levels = array(
array(
'sql'=> 'YEAR('.$this->date_field.')',
'labels' => null
),
array(
'sql'=> 'MONTH('.$this->date_field.')',
'labels' => $lang['month']
),
array(
'sql'=> 'DAYOFMONTH('.$this->date_field.')',
'labels' => null
),
);
}
/**
* Generate navigation bars for category page
* @return boolean false to indicate that thumbnails
@ -43,7 +69,7 @@ class Calendar extends CalendarBase
*/
function generate_category_content($url_base, $view_type)
{
global $lang, $conf;
global $conf;
$this->url_base = $url_base;
@ -59,8 +85,7 @@ function generate_category_content($url_base, $view_type)
{//case B: year given - display all days in given year
if ($this->build_year_calendar())
{
if ( $conf['calendar_multi_bar'] )
$this->build_nav_bar2(CYEAR, 'YEAR'); // years
$this->build_nav_bar(CYEAR); // years
return true;
}
}
@ -68,34 +93,30 @@ function generate_category_content($url_base, $view_type)
if ( count($this->date_components)==2 )
{//case C: year+month given - display a nice month calendar
$this->build_month_calendar();
if ( $conf['calendar_multi_bar'] )
{
$this->build_nav_bar2(CYEAR, 'YEAR'); // years
}
if (count($this->date_components)>=1 and
( $conf['calendar_multi_bar'] or count($this->date_components)==1 ) )
{
$this->build_nav_bar2(CMONTH, 'MONTH', $lang['month']); // month
}
$this->build_nav_bar(CYEAR); // years
$this->build_nav_bar(CMONTH); // month
return true;
}
}
if ($view_type==CAL_VIEW_LIST or count($this->date_components)==3)
{
if ( $conf['calendar_multi_bar'] or count($this->date_components)==0 )
if ( count($this->date_components)>=0 )
{
$this->build_nav_bar2(CYEAR, 'YEAR'); // years
$this->build_nav_bar(CYEAR); // years
}
if ( count($this->date_components)>=1 and
( $conf['calendar_multi_bar'] or count($this->date_components)==1 )
)
if ( count($this->date_components)>=1)
{
$this->build_nav_bar2(CMONTH, 'MONTH', $lang['month']); // month
$this->build_nav_bar(CMONTH); // month
}
if ( count($this->date_components)>=2 )
{
$this->build_nav_bar2(CDAY, 'DAYOFMONTH' ); // days
$this->build_nav_bar(
CDAY,
$this->get_all_days_in_month(
$this->date_components[CYEAR] ,$this->date_components[CMONTH]
)
); // days
}
}
return false;
@ -141,11 +162,11 @@ function get_date_where($max_levels=3)
$e .= '12-31';
if (isset($date[CMONTH]) and $date[CMONTH]!='any')
{
$res .= ' AND MONTH('.$this->date_field.')='.$date[CMONTH];
$res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
}
if (isset($date[2]) and $date[2]!='any')
if (isset($date[CDAY]) and $date[CDAY]!='any')
{
$res .= ' AND DAYOFMONTH('.$this->date_field.')='.$date[CDAY];
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
}
}
$res = " AND $this->date_field BETWEEN '$b' AND '$e 23:59:59'" . $res;
@ -155,74 +176,56 @@ function get_date_where($max_levels=3)
$res = ' AND '.$this->date_field.' IS NOT NULL';
if (isset($date[CMONTH]) and $date[CMONTH]!='any')
{
$res .= ' AND MONTH('.$this->date_field.')='.$date[CMONTH];
$res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
}
if (isset($date[CDAY]) and $date[CDAY]!='any')
{
$res .= ' AND DAYOFMONTH('.$this->date_field.')='.$date[CDAY];
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
}
}
return $res;
}
function get_display_name()
{
global $conf, $lang;
$res = '';
$url = $this->url_base;
if ( isset($this->date_components[CYEAR]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CYEAR].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CYEAR])
.'</a>';
}
if ( isset($this->date_components[CMONTH]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CMONTH].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label(
$this->date_components[CMONTH],
$lang['month']
)
.'</a>';
}
if ( isset($this->date_components[CDAY]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CDAY].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CDAY])
.'</a>';
}
return $res;
}
//--------------------------------------------------------- private members ---
function build_nav_bar2($level, $sql_func, $labels=null)
// returns an array with alll the days in a given month
function get_all_days_in_month($year, $month)
{
parent::build_nav_bar($level, $sql_func, '', $labels);
$md= array(1=>31,28,31,30,31,30,31,31,30,31,30,31);
if ( is_numeric($year) and $month==2)
{
$nb_days = $md[2];
if ( ($year%4==0) and ( ($year%100!=0) or ($year%400!=0) ) )
{
$nb_days++;
}
}
elseif ( is_numeric($month) )
{
$nb_days = $md[ $month ];
}
else
{
$nb_days = 31;
}
return range(1, $nb_days);
}
function build_global_calendar()
{
assert( count($this->date_components) == 0 );
$query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%Y%m")) as period,
COUNT(id) as count';
COUNT( DISTINCT(id) ) as count';
$query.= $this->inner_sql;
$query.= $this->get_date_where();
$query.= '
GROUP BY period';
$result = pwg_query($query);
$items=array();
while ($row = mysql_fetch_array($result))
{
$y = substr($row['period'], 0, 4);
@ -253,7 +256,7 @@ function build_global_calendar()
$url_base .= '-';
$nav_bar .= $this->get_nav_bar_from_items( $url_base,
$year_data['children'], null, 'calCal', false, $lang['month'] );
$year_data['children'], null, 'calCal', false, false, $lang['month'] );
$template->assign_block_vars( 'calendar.calbar',
array( 'BAR' => $nav_bar)
@ -266,13 +269,14 @@ function build_year_calendar()
{
assert( count($this->date_components) == 1 );
$query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%m%d")) as period,
COUNT(id) as count';
COUNT( DISTINCT(id) ) as count';
$query.= $this->inner_sql;
$query.= $this->get_date_where();
$query.= '
GROUP BY period';
$result = pwg_query($query);
$items=array();
while ($row = mysql_fetch_array($result))
{
$m = (int)substr($row['period'], 0, 2);
@ -331,18 +335,11 @@ function build_month_calendar()
while ($row = mysql_fetch_array($result))
{
$d = $row['period'];
$items[$d] = $row['count'];
$items[$d] = array('nb_images'=>$row['count']);
}
global $lang, $template;
$template->assign_block_vars('thumbnails', array());
$template->assign_block_vars('thumbnails.line', array());
foreach ( $items as $day=>$nb_images)
foreach ( $items as $day=>$data)
{
$url_base = $this->url_base.
$this->date_components[CYEAR].'-'.
$this->date_components[CMONTH].'-'.$day;
$this->date_components[CDAY]=$day;
$query = '
SELECT file,tn_ext,path, DAYOFWEEK('.$this->date_field.')-1 as dw';
@ -354,16 +351,28 @@ SELECT file,tn_ext,path, DAYOFWEEK('.$this->date_field.')-1 as dw';
unset ( $this->date_components[CDAY] );
$row = mysql_fetch_array(pwg_query($query));
$items[$day]['tn_path'] = get_thumbnail_src($row['path'], @$row['tn_ext']);
$items[$day]['tn_file'] = $row['file'];
$items[$day]['tn_dw'] = $row['dw'];
}
$thumbnail_src = get_thumbnail_src($row['path'], @$row['tn_ext']);
$thumbnail_title = $lang['day'][$row['dw']] . ' ' . $day;
$name = $thumbnail_title .' ('.$nb_images.')';
global $lang, $template;
$template->assign_block_vars('thumbnails', array());
$template->assign_block_vars('thumbnails.line', array());
foreach ( $items as $day=>$data)
{
$url_base = $this->url_base.
$this->date_components[CYEAR].'-'.
$this->date_components[CMONTH].'-'.$day;
$thumbnail_title = $lang['day'][$data['tn_dw']] . ' ' . $day;
$name = $thumbnail_title .' ('.$data['nb_images'].')';
$template->assign_block_vars(
'thumbnails.line.thumbnail',
array(
'IMAGE'=>$thumbnail_src,
'IMAGE_ALT'=>$row['file'],
'IMAGE'=>$data['tn_path'],
'IMAGE_ALT'=>$data['tn_file'],
'IMAGE_TITLE'=>$thumbnail_title,
'U_IMG_LINK'=>$url_base
)
@ -375,6 +384,7 @@ SELECT file,tn_ext,path, DAYOFWEEK('.$this->date_field.')-1 as dw';
)
);
}
return true;
}

View file

@ -36,32 +36,58 @@ define ('CDAY', 2);
class Calendar extends CalendarBase
{
/**
* Initialize the calendar
* @param string date_field db column on which this calendar works
* @param string inner_sql used for queries (INNER JOIN or normal)
* @param array date_components
*/
function initialize($date_field, $inner_sql, $date_components)
{
parent::initialize($date_field, $inner_sql, $date_components);
global $lang;
$this->calendar_levels = array(
array(
'sql'=> 'YEAR('.$this->date_field.')',
'labels' => null
),
array(
'sql'=> 'WEEK('.$this->date_field.')+1',
'labels' => null
),
array(
'sql'=> 'DAYOFWEEK('.$this->date_field.')-1',
'labels' => $lang['day']
),
);
//Comment next lines for week starting on Sunday or if MySQL version<4.0.17
//WEEK(date,5) = "0-53 - Week 1=the first week with a Monday in this year"
$this->calendar_levels[CWEEK]['sql'] = 'WEEK('.$this->date_field.',5)+1';
$this->calendar_levels[CDAY]['sql'] = 'WEEKDAY('.$this->date_field.')';
array_push( $this->calendar_levels[CDAY]['labels'],
array_shift( $this->calendar_levels[CDAY]['labels'] ) );
}
/**
* Generate navigation bars for category page
* @return boolean false to indicate that thumbnails where not included here
*/
function generate_category_content($url_base, $view_type)
{
global $lang, $conf;
global $conf;
$this->url_base = $url_base;
assert($view_type==CAL_VIEW_LIST);
if ( $conf['calendar_multi_bar'] or count($this->date_components)==0 )
$this->build_nav_bar(CYEAR); // years
if ( count($this->date_components)>=1 )
{
$this->build_nav_bar(CYEAR, 'YEAR'); // years
}
if ( count($this->date_components)>=1 and
( $conf['calendar_multi_bar'] or count($this->date_components)==1 )
)
{
$this->build_nav_bar(CWEEK, 'WEEK', '+1' ); // month
$this->build_nav_bar(CWEEK); // week nav bar 1-53
}
if ( count($this->date_components)>=2 )
{
$this->build_nav_bar(CDAY, 'DAYOFWEEK', '-1',
$lang['day'] ); // days
$this->build_nav_bar(CDAY); // days nav bar Mon-Sun
}
return false;
}
@ -75,26 +101,25 @@ function generate_category_content($url_base, $view_type)
*/
function get_date_where($max_levels=3)
{
$date_components = $this->date_components;
while (count($date_components)>$max_levels)
$date = $this->date_components;
while (count($date)>$max_levels)
{
array_pop($date_components);
array_pop($date);
}
$res = '';
if (isset($date_components[CYEAR]) and $date_components[CYEAR]!='any')
if (isset($date[CYEAR]) and $date[CYEAR]!='any')
{
$y = $date_components[CYEAR];
$y = $date[CYEAR];
$res = " AND $this->date_field BETWEEN '$y-01-01' AND '$y-12-31 23:59:59'";
}
if (isset($date_components[CWEEK]) and $date_components[CWEEK]!='any')
if (isset($date[CWEEK]) and $date[CWEEK]!='any')
{
$res .= ' AND WEEK('.$this->date_field.')+1='.$date_components[CWEEK];
$res .= ' AND '.$this->calendar_levels[CWEEK]['sql'].'='.$date[CWEEK];
}
if (isset($date_components[CDAY]) and $date_components[CDAY]!='any')
if (isset($date[CDAY]) and $date[CDAY]!='any')
{
$res .= ' AND DAYOFWEEK('.$this->date_field.')-1='
.$date_components[CDAY];
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
}
if (empty($res))
{
@ -103,44 +128,6 @@ function get_date_where($max_levels=3)
return $res;
}
function get_display_name()
{
global $conf,$lang;
$res = '';
$url = $this->url_base;
if ( isset($this->date_components[CYEAR]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CYEAR].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CYEAR])
.'</a>';
}
if ( isset($this->date_components[CWEEK]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CWEEK].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label($this->date_components[CWEEK])
.'</a>';
}
if ( isset($this->date_components[CDAY]) )
{
$res .= $conf['level_separator'];
$url .= $this->date_components[CDAY].'-';
$res .=
'<a href="'.$url.'">'
.$this->get_date_component_label(
$this->date_components[CDAY],
$lang['day']
)
.'</a>';
}
return $res;
}
}
?>

View file

@ -98,6 +98,10 @@ $conf['calendar_multi_bar'] = true;
// year/month/week/day navigation bars
$conf['calendar_show_any'] = true;
// calendar_show_empty : the calendar shows month/weeks/days even if there are
//no elements for these
$conf['calendar_show_empty'] = true;
// newcat_default_commentable : at creation, must a category be commentable
// or not ?
$conf['newcat_default_commentable'] = 'true';

View file

@ -101,16 +101,14 @@ WHERE id IN (' . implode(',',$page['items']) .')';
$fields = array(
// Created
'created' => array(
// TODO change next line when calendar_datefield disapears
'default_link' => ( $conf['calendar_datefield']=='date_creation' ? '' : 'created-' ),
'default_link' => 'created-',
'label' => l10n('Creation date'),
'db_field' => 'date_creation',
),
// Posted
'posted' => array(
// TODO change next line when calendar_datefield disapears
'default_link' => ( $conf['calendar_datefield']=='date_available' ? '' : 'posted-' ),
'label' => l10n('Availability date'),
'default_link' => 'posted-',
'label' => l10n('Post date'),
'db_field' => 'date_available',
),
);
@ -119,14 +117,12 @@ WHERE id IN (' . implode(',',$page['items']) .')';
// Monthly style
'monthly' => array(
'default_link' => '',
'label' => l10n('Monthly'),
'include' => 'calendar_monthly.class.php',
'view_calendar' => true,
),
// Weekly style
'weekly' => array(
'default_link' => 'weekly-',
'label' => l10n('Weekly'),
'include' => 'calendar_weekly.class.php',
'view_calendar' => false,
),
@ -136,12 +132,10 @@ WHERE id IN (' . implode(',',$page['items']) .')';
// list view
CAL_VIEW_LIST => array(
'default_link' => '',
'label' => l10n('List')
),
// calendar view
CAL_VIEW_CALENDAR => array(
'default_link' => CAL_VIEW_CALENDAR.'-',
'label' => l10n('calendar')
),
);
@ -190,6 +184,10 @@ WHERE id IN (' . implode(',',$page['items']) .')';
array_pop($requested);
}
}
else
{
$requested[$i] = (int)$requested[$i];
}
}
if ($any_count == 3)
{
@ -198,15 +196,15 @@ WHERE id IN (' . implode(',',$page['items']) .')';
$calendar->initialize($fields[$cal_field]['db_field'], $inner_sql, $requested);
//echo ('<pre>'. var_export($fields, true) . '</pre>');
//echo ('<pre>'. var_export($calendar, true) . '</pre>');
$url_base = get_query_string_diff(array('start', 'calendar'));
$url_base =
PHPWG_ROOT_PATH.'category.php'
.get_query_string_diff(array('start', 'calendar'))
.$url_base
.(empty($url_base) ? '?' : '&')
.'calendar='.$cal_field.'-'
;
$must_show_list = true; // true until calendar generates its own display
if (basename($_SERVER["PHP_SELF"]) == 'category.php')
{
@ -255,7 +253,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
'calendar.views.view',
array(
'VALUE' => $url,
'CONTENT' => $style_data['label'].' ('.$view_data['label'].')',
'CONTENT' => l10n('calendar_'.$style.'_'.$view),
'SELECTED' => $selected,
)
);
@ -271,7 +269,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
$template->assign_block_vars(
'calendar',
array(
'TITLE' => $calendar_title,
'TITLE' => '<br/>'.$calendar_title,
)
);
@ -289,7 +287,7 @@ WHERE id IN (' . implode(',',$page['items']) .')';
{
$order_by = str_replace(
'ORDER BY ',
'ORDER BY '.$calendar->date_field.',', $conf['order_by']
'ORDER BY '.$calendar->date_field.' DESC,', $conf['order_by']
);
$query .= $order_by;
}

View file

@ -274,11 +274,11 @@ function get_category_preferred_image_orders()
{
global $conf;
return array(
array('Default', '', true),
array(l10n('default_sort'), '', true),
array(l10n('Average rate'), 'average_rate DESC', $conf['rate']),
array(l10n('most_visited_cat'), 'hit DESC', true),
array(l10n('Creation date'), 'date_creation DESC', true),
array(l10n('Availability date'), 'date_available DESC', true),
array(l10n('Post date'), 'date_available DESC', true),
array(l10n('File name'), 'file ASC', true)
);
}

View file

@ -43,7 +43,6 @@ $lang['%d waiting elements'] = '%d waiting elements';
$lang['About'] = 'About';
$lang['At least one listed rule must be satisfied.'] = 'At least one listed rule must be satisfied.';
$lang['Author'] = 'Author';
$lang['Availability date'] = 'Availability date';
$lang['Average rate'] = 'Average rate';
$lang['Categories'] = 'Categories';
$lang['Category'] = 'Category';
@ -75,9 +74,7 @@ $lang['Identification'] = 'Identification';
$lang['Keyword'] = 'Keyword';
$lang['Keywords'] = 'Keywords';
$lang['Links'] = 'Links';
$lang['List'] = 'List';
$lang['Mail address'] = 'Mail address';
$lang['Monthly'] = 'Monthly';
$lang['N/A'] = 'N/A';
$lang['New on %s'] = 'New on %s';
$lang['New password confirmation does not correspond'] = 'New password confirmation does not correspond';
@ -90,12 +87,13 @@ $lang['Original dimensions'] = 'Original dimensions';
$lang['Password forgotten'] = 'Password forgotten';
$lang['Password'] = 'Password';
$lang['PhpWebGallery Help'] = 'PhpWebGallery Help';
$lang['Post date'] = 'Post date';
$lang['Posted on'] = 'Posted on';
$lang['Profile'] = 'Profile';
$lang['Quick connect'] = 'Quick connect';
$lang['Rate'] = 'Rate';
$lang['RSS feed'] = 'RSS feed';
$lang['Register'] = 'Register';
$lang['Registered on'] = 'Registered on';
$lang['Registration'] = 'Registration';
$lang['Reset'] = 'Reset';
$lang['Retrieve password'] = 'Retrieve password';
@ -111,7 +109,6 @@ $lang['User comments'] = 'User comments';
$lang['Username'] = 'Username';
$lang['Visits'] = 'Visits';
$lang['Webmaster'] = 'Webmaster';
$lang['Weekly'] = 'Weekly';
$lang['about_page_title'] = 'About PhpWebGallery';
$lang['access_forbiden'] = 'You are not authorized to access the requested page';
$lang['add to caddie'] = 'add to caddie';
@ -124,17 +121,21 @@ $lang['already_rated'] = 'You\'ve already rated this item';
$lang['ascending'] = 'ascending';
$lang['author(s) : %s'] = 'author(s) : %s';
$lang['auto_expand'] = 'Expand all categories';
$lang['became available after %s (%s)'] = 'became available after %s (%s)';
$lang['became available before %s (%s)'] = 'became available before %s (%s)';
$lang['became available between %s (%s) and %s (%s)'] = 'became available between %s (%s) and %s (%s)';
$lang['became available on %s'] = 'became available on %s';
$lang['became available after %s (%s)'] = 'posted after %s (%s)';
$lang['became available before %s (%s)'] = 'posted before %s (%s)';
$lang['became available between %s (%s) and %s (%s)'] = 'posted between %s (%s) and %s (%s)';
$lang['became available on %s'] = 'posted on %s';
$lang['best_rated_cat'] = 'Best rated';
$lang['best_rated_cat_hint'] = 'displays best rated items';
$lang['caddie'] = 'caddie';
$lang['calendar'] = 'Calendar';
$lang['calendar_any'] = 'All';
$lang['calendar_hint'] = 'displays each day with pictures, month per month';
$lang['calendar_monthly_l'] = 'Monthly list';
$lang['calendar_monthly_c'] = 'Monthly calendar';
$lang['calendar_picture_hint'] = 'displays pictures added on ';
$lang['calendar_view'] = 'View';
$lang['calendar_weekly_l'] = 'Weekly list';
$lang['categories'] = 'Categories';
$lang['click_to_redirect'] = 'Click here if your browser does not automatically forward you';
$lang['comment date'] = 'comment date';
@ -163,6 +164,7 @@ $lang['day'][4] = 'Thursday';
$lang['day'][5] = 'Friday';
$lang['day'][6] = 'Saturday';
$lang['days'] = 'days';
$lang['default_sort'] = 'Default';
$lang['del_favorites_alt'] = 'Delete from favorites';
$lang['del_favorites_hint'] = 'Delete this picture from your favorites';
$lang['delete'] = 'Delete';
@ -208,6 +210,9 @@ $lang['maxheight'] = 'Maximum height of the pictures';
$lang['maxheight_error'] = 'Maximum height must be a number superior to 50';
$lang['maxwidth'] = 'Maximum width of the pictures';
$lang['maxwidth_error'] = 'Maximum width must be a number superior to 50';
$lang['mode_normal_hint'] = 'return to normal view mode';
$lang['mode_created_hint'] = 'displays a calendar by creation date';
$lang['mode_posted_hint'] = 'displays a calendar by date posted';
$lang['month'][10] = 'October';
$lang['month'][11] = 'November';
$lang['month'][12] = 'December';
@ -272,8 +277,6 @@ $lang['search_ascending'] = 'Ascending';
$lang['search_author'] = 'Search for Author';
$lang['search_categories'] = 'Search in Categories';
$lang['search_date'] = 'Search by Date';
$lang['search_date_available'] = 'Availability';
$lang['search_date_creation'] = 'Creation';
$lang['search_date_from'] = 'Date';
$lang['search_date_to'] = 'End-Date';
$lang['search_date_type'] = 'Kind of date';

View file

@ -42,7 +42,6 @@ $lang['%d new users'] = '%d nouveaux utilisateurs';
$lang['About'] = 'À propos';
$lang['At least one listed rule must be satisfied.'] = 'Au moins un des critères doit être satisfait.';
$lang['Author'] = 'Auteur';
$lang['Availability date'] = 'Date de disponibilité';
$lang['Average rate'] = 'Note moyenne';
$lang['Categories'] = 'Catégories';
$lang['Category'] = 'Catégorie';
@ -74,9 +73,7 @@ $lang['Identification'] = 'Identification';
$lang['Keyword'] = 'Mot-clef';
$lang['Keywords'] = 'Mots-clef';
$lang['Links'] = 'Liens';
$lang['List'] = 'Liste';
$lang['Mail address'] = $lang['Email address'];
$lang['Monthly'] = 'Mensuel';
$lang['N/A'] = 'non disponible';
$lang['New on %s'] = 'Nouveau le %s';
$lang['New password confirmation does not correspond'] = 'Erreur de confirmation de mot de passe';
@ -89,12 +86,13 @@ $lang['Original dimensions'] = 'Dimensions d\'origine';
$lang['Password forgotten'] = 'Mot de passe oublié';
$lang['Password'] = 'Mot de passe';
$lang['PhpWebGallery Help'] = 'Aide de PhpWebGallery';
$lang['Post date'] = 'Date d\'ajout';
$lang['Posted on'] = 'Ajoutée le';
$lang['Profile'] = 'Profil';
$lang['Quick connect'] = 'Connexion rapide';
$lang['Rate'] = 'Note';
$lang['RSS feed'] = 'flux RSS';
$lang['Register'] = 'S\'enregistrer';
$lang['Registered on'] = 'Enregistrée le';
$lang['Registration'] = 'Enregistrement';
$lang['Reset'] = 'Annuler';
$lang['Retrieve password'] = 'Récupérer un mot de passe';
@ -110,7 +108,6 @@ $lang['User comments'] = 'Commentaires utilisateur';
$lang['Username'] = 'Nom d\'utilisateur';
$lang['Visits'] = 'Visites';
$lang['Webmaster'] = 'Webmestre';
$lang['Weekly'] = 'Hebdomadaire';
$lang['about_page_title'] = 'À propos de PhpWebGallery';
$lang['access_forbiden'] = 'Vous n\'êtes pas autorisé sur la page demandée';
$lang['add to caddie'] = 'ajouter au panier';
@ -133,7 +130,11 @@ $lang['caddie'] = 'Panier';
$lang['calendar'] = 'Calendrier';
$lang['calendar_any'] = 'Tout';
$lang['calendar_hint'] = 'affichage année par année, mois par mois, jour par jour';
$lang['calendar_monthly_l'] = 'Liste mensuelle';
$lang['calendar_monthly_c'] = 'Calendrier mensuel';
$lang['calendar_picture_hint'] = 'affiche les images du ';
$lang['calendar_view'] = 'View';
$lang['calendar_weekly_l'] = 'Liste hebdomadaire';
$lang['categories'] = 'Catégories';
$lang['click_to_redirect'] = 'Cliquez ici si votre navigateur ne vous redirige pas.';
$lang['comment date'] = 'date du commentaire';
@ -162,6 +163,7 @@ $lang['day'][4] = 'Jeudi';
$lang['day'][5] = 'Vendredi';
$lang['day'][6] = 'Samedi';
$lang['days'] = 'jours';
$lang['default_sort'] = 'Par défaut';
$lang['del_favorites_alt'] = 'Supprimer des favoris';
$lang['del_favorites_hint'] = 'Supprimer cette image de vos favoris';
$lang['delete'] = 'Supprimer';
@ -207,6 +209,9 @@ $lang['maxheight'] = 'Hauteur maximum des images';
$lang['maxheight_error'] = 'La hauteur maximum des images doit être supérieure à 50';
$lang['maxwidth'] = 'Largeur maximum des images';
$lang['maxwidth_error'] = 'La largeur des images doit être supérieure à 50';
$lang['mode_normal_hint'] = 'retourne à la vue normale';
$lang['mode_created_hint'] = 'affiche un calendrier par date de création';
$lang['mode_posted_hint'] = 'affiche un calendrier par date d\'ajout';
$lang['month'][10] = 'Octobre';
$lang['month'][11] = 'Novembre';
$lang['month'][12] = 'Decembre';
@ -271,7 +276,6 @@ $lang['search_ascending'] = 'Croissant';
$lang['search_author'] = 'Rechercher un auteur';
$lang['search_categories'] = 'Rechercher dans les catégories';
$lang['search_date'] = 'Recherche par date';
$lang['search_date_available'] = 'Disponibilité';
$lang['search_date_creation'] = 'Création';
$lang['search_date_from'] = 'Date';
$lang['search_date_to'] = 'Date de fin';

View file

@ -804,7 +804,7 @@ else
// date of availability
$val = format_date($picture['current']['date_available'], 'mysql_datetime');
$infos['INFO_AVAILABILITY_DATE'] = '<a href="'.
$infos['INFO_POSTED_DATE'] = '<a href="'.
PHPWG_ROOT_PATH.'category.php?calendar=posted-c-'.
substr($picture['current']['date_available'],0,10).'">'.$val.'</a>';

View file

@ -178,8 +178,6 @@ $template->assign_vars(array(
'L_DAYS'=>$lang['days'],
'L_MONTH'=>$lang['w_month'],
'L_SEARCH_DATE_TYPE'=>$lang['search_date_type'],
'L_SEARCH_CREATION'=>$lang['search_date_creation'],
'L_SEARCH_AVAILABILITY'=>$lang['search_date_available'],
'L_RESULT_SORT'=>$lang['search_sort'],
'L_SORT_ASCENDING'=>$lang['search_ascending'],
'L_SORT_DESCENDING'=>$lang['search_descending'],

View file

@ -130,37 +130,41 @@
<li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>
<!-- END search_rules -->
<!-- BEGIN calendar_view -->
<li><a href="{calendar_view.URL}" title="{lang:calendar_hint}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:calendar}"></a></li>
<!-- END calendar_view -->
<!-- BEGIN normal_view -->
<li><a href="{normal_view.URL}" title="{lang:calendar}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:calendar}"></a></li>
<!-- END normal_view -->
<!-- BEGIN mode_normal -->
<li><a href="{mode_normal.URL}" title="{lang:mode_normal_hint}"><img src="{themeconf:icon_dir}/normal_mode.png" class="button" alt="{lang:mode_normal_hint}"></a></li>
<!-- END mode_normal -->
<!-- BEGIN mode_posted -->
<li><a href="{mode_posted.URL}" title="{lang:mode_posted_hint}"><img src="{themeconf:icon_dir}/calendar.png" class="button" alt="{lang:mode_posted_hint}"></a></li>
<!-- END mode_posted -->
<!-- BEGIN mode_created -->
<li><a href="{mode_created.URL}" title="{lang:mode_created_hint}"><img src="{themeconf:icon_dir}/calendar_created.png" class="button" alt="{lang:mode_created_hint}"></a></li>
<!-- END mode_created -->
</ul>
<h2>{TITLE}
<!-- BEGIN calendar -->
<br/>{calendar.TITLE}
<!-- END calendar --></h2>
{calendar.TITLE}
<!-- END calendar -->
</h2>
</div> <!-- content -->
<!-- BEGIN calendar -->
<!-- BEGIN views -->
<div class="calendarViews">
<select onchange="document.location = this.options[this.selectedIndex].value;">
{lang:calendar_view}: <select onchange="document.location = this.options[this.selectedIndex].value;">
<!-- BEGIN view -->
<option value="{calendar.views.view.VALUE}" {calendar.views.view.SELECTED}>{calendar.views.view.CONTENT}</option>
<!-- END view -->
</select>
</div><br/>
</div>
<!-- END views -->
<!-- BEGIN navbar -->
<div class="navigationBar">{calendar.navbar.BAR}</div>
<div class="calendarBar">{calendar.navbar.BAR}</div>
<!-- END navbar -->
<!-- BEGIN calbar -->
<div class="calendarBar">{calendar.calbar.BAR}</div>
<div class="calendarCalBar">{calendar.calbar.BAR}</div>
<!-- END calbar -->
<!-- END calendar -->

View file

@ -180,24 +180,37 @@ SPAN.filename:after {
#content DIV.calendarViews {
float: left;
display: block;
text-align: left;
margin: 5px 0;
}
SPAN.cal {
#content DIV.calendarBar {
margin: 8px 4px;
}
SPAN.calItem {
font-weight: bold;
border: 1px solid gray;
margin: 0 2px;
border: 1px solid gray;
}
SPAN.calSel {
SPAN.calItemSel {
font-weight: bold;
margin: 0 2px;
border: 1px solid gray;
color: dark-gray;
border: 1px solid gray;
margin: 0 2px;
}
#content .calendarBar {
margin: 8px 5px;
SPAN.calItemEmpty {
font-weight: bold;
margin: 0 2px;
border: 1px solid gray;
color: lightgray;
}
#content DIV.calendarCalBar {
margin: 10px 10px;
text-align: left;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

View file

@ -91,8 +91,8 @@
<td class="value">{INFO_CREATION_DATE}</td>
</tr>
<tr>
<td class="label">{lang:Registered on}</td>
<td class="value">{INFO_AVAILABILITY_DATE}</td>
<td class="label">{lang:Posted on}</td>
<td class="value">{INFO_POSTED_DATE}</td>
</tr>
<tr>
<td class="label">{lang:Dimensions}</td>

View file

@ -97,8 +97,8 @@
<tr>
<td width="25%" nowrap="nowrap"><b>{L_SEARCH_DATE_TYPE} : </b></td>
<td width="25%" nowrap="nowrap">
<input type="radio" name="date_type" value="date_creation" checked="checked" />{L_SEARCH_CREATION}<br />
<input type="radio" name="date_type" value="date_available" />{L_SEARCH_AVAILABILITY}
<input type="radio" name="date_type" value="date_creation" checked="checked" />{lang:Creation date}<br />
<input type="radio" name="date_type" value="date_available" />{lang:Post date}
</td>
<td><b>{L_RESULT_SORT} : </b></td>
<td nowrap="nowrap">

View file

@ -113,3 +113,11 @@ A.navThumb, A.navThumb:hover {
display:block;
background:#3f3f3f;
}
SPAN.calItemSel {
color: #fff48e;
}
SPAN.calItemEmpty {
color: darkgray;
}