diff options
-rw-r--r-- | admin/configuration.php | 5 | ||||
-rw-r--r-- | admin/themes/default/template/configuration.tpl | 9 | ||||
-rw-r--r-- | include/calendar_monthly.class.php | 15 | ||||
-rw-r--r-- | install/config.sql | 1 | ||||
-rw-r--r-- | install/db/93-database.php | 42 | ||||
-rw-r--r-- | language/en_UK/admin.lang.php | 1 | ||||
-rw-r--r-- | language/fr_FR/admin.lang.php | 1 |
7 files changed, 70 insertions, 4 deletions
diff --git a/admin/configuration.php b/admin/configuration.php index 36a2901ae..0f2e8bd34 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -246,6 +246,11 @@ switch ($page['section']) 'CONF_GALLERY_TITLE' => htmlspecialchars($conf['gallery_title']), 'CONF_PAGE_BANNER' => htmlspecialchars($conf['page_banner']), 'CONF_GALLERY_URL' => $conf['gallery_url'], + 'week_starts_on_options' => array( + 'sunday' => $lang['day'][0], + 'monday' => $lang['day'][1], + ), + 'week_starts_on_options_selected' => $conf['week_starts_on'], )); foreach ($main_checkboxes as $checkbox) diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index 7a6583779..903255baf 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -87,6 +87,15 @@ <input type="checkbox" name="email_admin_on_new_user" {if ($main.email_admin_on_new_user)}checked="checked"{/if}> </label> </li> + + <li> + <label> + <span class="property"> + {'Week starts on'|@translate} + {html_options name="week_starts_on" options=$main.week_starts_on_options selected=$main.week_starts_on_options_selected} + </span> + </label> + </li> </ul> </fieldset> {/if} diff --git a/include/calendar_monthly.class.php b/include/calendar_monthly.class.php index 1f7fdeee7..b3911ddb8 100644 --- a/include/calendar_monthly.class.php +++ b/include/calendar_monthly.class.php @@ -330,7 +330,7 @@ function build_year_calendar(&$tpl_var) function build_month_calendar(&$tpl_var) { - global $page; + global $page, $lang, $conf; $query='SELECT '.pwg_db_get_dayofmonth($this->date_field).' as period, COUNT(DISTINCT id) as count'; @@ -368,9 +368,12 @@ SELECT id, file,tn_ext,path, width, height, '.pwg_db_get_dayofweek($this->date_f $items[$day]['width'] = $row['width']; $items[$day]['height'] = $row['height']; $items[$day]['dow'] = $row['dow']; - } - global $lang, $conf; + if ('sunday' == $conf['week_starts_on']) + { + $items[$day]['dow']++; + } + } if ( !empty($items) and $conf['calendar_month_cell_width']>0 @@ -395,7 +398,11 @@ SELECT id, file,tn_ext,path, width, height, '.pwg_db_get_dayofweek($this->date_f { $first_day_dow -= 1; } - array_push( $wday_labels, array_shift($wday_labels) ); + + if ('monday' == $conf['week_starts_on']) + { + array_push( $wday_labels, array_shift($wday_labels) ); + } // END - pass now in week starting Monday $cell_width = $conf['calendar_month_cell_width']; diff --git a/install/config.sql b/install/config.sql index f54679352..02f6f71a1 100644 --- a/install/config.sql +++ b/install/config.sql @@ -51,3 +51,4 @@ INSERT INTO piwigo_config (param,value,comment) 'a:11:{s:6:"author";b:1;s:10:"created_on";b:1;s:9:"posted_on";b:1;s:10:"dimensions";b:1;s:4:"file";b:1;s:8:"filesize";b:1;s:4:"tags";b:1;s:10:"categories";b:1;s:6:"visits";b:1;s:12:"average_rate";b:1;s:13:"privacy_level";b:1;}', 'Information displayed on picture page' ); +INSERT INTO piwigo_config (param,value,comment) VALUES ('week_starts_on','monday','Monday may not be the first day of the week'); diff --git a/install/db/93-database.php b/install/db/93-database.php new file mode 100644 index 000000000..4d59aa17b --- /dev/null +++ b/install/db/93-database.php @@ -0,0 +1,42 @@ +<?php +// +-----------------------------------------------------------------------+ +// | Piwigo - a PHP based picture gallery | +// +-----------------------------------------------------------------------+ +// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org | +// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | +// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | +// +-----------------------------------------------------------------------+ +// | This program is free software; you can redistribute it and/or modify | +// | it under the terms of the GNU General Public License as published by | +// | the Free Software Foundation | +// | | +// | This program is distributed in the hope that it will be useful, but | +// | WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | +// | General Public License for more details. | +// | | +// | You should have received a copy of the GNU General Public License | +// | along with this program; if not, write to the Free Software | +// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | +// | USA. | +// +-----------------------------------------------------------------------+ + +if (!defined('PHPWG_ROOT_PATH')) +{ + die('Hacking attempt!'); +} + +$upgrade_description = 'Monday may not be the first day of the week'; + +$query = ' +INSERT INTO '.PREFIX_TABLE.'config (param,value,comment) + VALUES (\'week_starts_on\',\'monday\', \''.$upgrade_description.'\') +;'; +pwg_query($query); + +echo +"\n" +. $upgrade_description +."\n" +; +?> diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index 6edb53994..47bf089ee 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -799,4 +799,5 @@ $lang['Type here the title'] = 'Type here the title'; $lang['remove creation date'] = 'remove creation date'; $lang['with no album'] = 'with no album'; $lang['with no tag'] = 'with no tag'; +$lang['Week starts on'] = 'Week starts on'; ?> diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index f6349e204..4e49136d6 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -803,4 +803,5 @@ $lang['Type here the title'] = 'Entrez ici le titre'; $lang['remove creation date'] = 'supprimer la date de création'; $lang['with no album'] = 'sans album'; $lang['with no tag'] = 'sans tag'; +$lang['Week starts on'] = 'La semaine commence le'; ?> |