From 054489071369abc520f2bfa2d5e5e1e4d5631a59 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 20 Mar 2008 08:54:18 +0000 Subject: [PATCH] Multiple week view and fix for daylight saving time change problem reported by Manfred on the german list --- calendar/inc/class.uical.inc.php | 11 +++++++- calendar/inc/class.uiviews.inc.php | 36 ++++++++++++++++-------- calendar/inc/hook_settings.inc.php | 44 +++++++++++++++++++----------- calendar/setup/egw_de.lang | 4 +++ calendar/setup/egw_en.lang | 5 +++- 5 files changed, 71 insertions(+), 29 deletions(-) diff --git a/calendar/inc/class.uical.inc.php b/calendar/inc/class.uical.inc.php index cb9733bfaf..9f334f889a 100644 --- a/calendar/inc/class.uical.inc.php +++ b/calendar/inc/class.uical.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @package calendar * @author Ralf Becker - * @copyright (c) 2004-7 by RalfBecker-At-outdoor-training.de + * @copyright (c) 2004-8 by RalfBecker-At-outdoor-training.de * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -585,6 +585,11 @@ class uical 'value' => 'menuaction=calendar.uiviews.week&days=5', 'selected' => $this->view == 'week' && $this->cal_prefs['days_in_weekview'] == 5, ), + array( + 'text' => lang('Multiple week view'), + 'value' => 'menuaction=calendar.uiviews.weekN', + 'selected' => $this->view == 'weekN', + ), array( 'text' => lang('monthview'), 'value' => 'menuaction=calendar.uiviews.month', @@ -641,6 +646,10 @@ class uical } $link_vars['menuaction'] = $this->view_menuaction; // stay in the planner } + elseif(substr($this->view,0,4) == 'week' && $view == 'week') + { + $link_vars['menuaction'] = $this->view_menuaction; // stay in the N-week-view + } elseif ($view == 'day' && $this->view == 'day4') { $link_vars['menuaction'] = $this->view_menuaction; // stay in the day-view diff --git a/calendar/inc/class.uiviews.inc.php b/calendar/inc/class.uiviews.inc.php index 18db4b44d8..c613b3fbe3 100644 --- a/calendar/inc/class.uiviews.inc.php +++ b/calendar/inc/class.uiviews.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @package calendar * @author Ralf Becker - * @copyright (c) 2004-7 by RalfBecker-At-outdoor-training.de + * @copyright (c) 2004-8 by RalfBecker-At-outdoor-training.de * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -33,6 +33,7 @@ class uiviews extends uical 'day' => True, 'day4' => True, 'week' => True, + 'weekN' => True, 'month' => True, 'planner' => True, ); @@ -284,6 +285,18 @@ class uiviews extends uical } return $content; } + + /** + * Displays a multiple week-view + * + * @param boolean $home=false if true return content suitable for home-page + */ + function &weekN($home=false) + { + if (($num = (int)$this->cal_prefs['multiple_weeks']) < 2) $num = 3; // default 3 weeks + + return $this->month($num,$home); + } /** * Displays the monthview or a multiple week-view @@ -299,8 +312,8 @@ class uiviews extends uical if ($weeks) { - $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day=1); - $this->last = $this->first + $weeks * 7 * DAY_s - 1; + $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); + $this->last = strtotime("+$weeks weeks",$this->first) - 1; } else { @@ -317,12 +330,12 @@ class uiviews extends uical $content = ''; // we add DAY_s/2 to $this->first (using 12h), to deal with daylight saving changes - for ($week_start = $this->first+DAY_s/2; $week_start < $this->last; $week_start += WEEK_s) + for ($week_start = $this->first; $week_start < $this->last; $week_start = strtotime("+1 week",$week_start)) { $week = array(); for ($i = 0; $i < 7; ++$i) { - $day_ymd = $this->bo->date2string($week_start+$i*DAY_s); + $day_ymd = $this->bo->date2string($i ? strtotime("+$i days",$week_start) : $week_start); $week[$day_ymd] = array_shift($days); } $week_view = array( @@ -332,7 +345,7 @@ class uiviews extends uical $title = lang('Wk').' '.adodb_date('W',$week_start); $title = $this->html->a_href($title,$week_view,'',' title="'.lang('Weekview').'"'); - $content .= $this->timeGridWidget($this->tagWholeDayOnTop($week),60,200,'',$title,0,$week_start+WEEK_s >= $this->last); + $content .= $this->timeGridWidget($this->tagWholeDayOnTop($week),$weeks == 2 ? 30 : 60,200,'',$title,0,$week_start+WEEK_s >= $this->last); } if (!$home) { @@ -414,7 +427,7 @@ class uiviews extends uical if ($days == 4) // next 4 days view { $wd_start = $this->first = $this->bo->date2ts($this->date); - $this->last = $this->first + $days * DAY_s - 1; + $this->last = strtotime("+$days days",$this->first) - 1; $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Four days view').' '.$this->bo->long_date($this->first,$this->last); } else @@ -425,14 +438,14 @@ class uiviews extends uical switch($this->cal_prefs['weekdaystarts']) { case 'Saturday': - $this->first += DAY_s; - // fall through + $this->first = strtotime("+2 days",$this->first); + break; case 'Sunday': - $this->first += DAY_s; + $this->first = strtotime("+1 day",$this->first); break; } } - $this->last = $this->first + $days * DAY_s - 1; + $this->last = strtotime("+$days days",$this->first) - 1; $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Week').' '.adodb_date('W',$this->first).': '.$this->bo->long_date($this->first,$this->last); } @@ -1155,6 +1168,7 @@ class uiviews extends uical $tpl->set_var(array( // event-content, some of it displays only if it really has content or is needed + 'owner' => $GLOBALS['egw']->common->grab_owner_name($event['owner']), 'header_icons' => $small ? '' : implode("",$icons), 'body_icons' => $small ? implode("\n",$icons) : '', 'icons' => implode('',$icons), diff --git a/calendar/inc/hook_settings.inc.php b/calendar/inc/hook_settings.inc.php index 8158d36f0c..818cea069f 100644 --- a/calendar/inc/hook_settings.inc.php +++ b/calendar/inc/hook_settings.inc.php @@ -1,19 +1,16 @@ * - * http://www.radix.net/~cknudsen * - * Modified by Mark Peters * - * Modified by Ralf Becker * - * -------------------------------------------- * - * 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; either version 2 of the License, or (at your * - * option) any later version. * - \**************************************************************************/ - - /* $Id$ */ +/** + * eGroupWare - Calendar Preferences + * + * @link http://www.egroupware.org + * @package calendar + * @author Ralf Becker + * @author Mark Peters + * Originally based on Webcalendar by Craig Knudsen + * http://www.radix.net/~cknudsen + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ $bocal =& CreateObject('calendar.bocal'); $bocal->check_set_default_prefs(); @@ -22,6 +19,7 @@ 'day' => lang('Dayview'), 'day4' => lang('Four days view'), 'week' => lang('Weekview'), + 'weekN' => lang('Multiple week view'), 'month' => lang('Monthview'), 'planner_cat' => lang('Planner by category'), 'planner_user' => lang('Planner by user'), @@ -94,6 +92,11 @@ { $times[$i] = $GLOBALS['egw']->common->formattime($i,'00'); } + + for ($i = 2; $i <= 9; ++$i) + { + $muliple_weeks[$i.' weeks'] = lang('%1 weeks',$i); + } $intervals = array( 5 => '5', @@ -144,6 +147,15 @@ 'xmlrpc' => True, 'admin' => False ), + 'multiple_weeks' => array( + 'type' => 'select', + 'label' => 'Weeks in multiple week view', + 'name' => 'multiple_weeks', + 'values' => $muliple_weeks, + 'help' => 'How many weeks should the multiple week view show?', + 'xmlrpc' => True, + 'admin' => False + ), 'mainscreen_showevents' => array( 'type' => 'select', 'label' => 'show default view on main screen', @@ -228,7 +240,7 @@ 'label' => 'Show empty rows in Planner', 'name' => 'planner_show_empty_rows', 'values' => array( - '' => lang('no'), + 0 => lang('no'), 'user' => lang('Planner by user'), 'cat' => lang('Planner by category'), 'both' => lang('All'), diff --git a/calendar/setup/egw_de.lang b/calendar/setup/egw_de.lang index 68eed9a84e..edf564e0f9 100644 --- a/calendar/setup/egw_de.lang +++ b/calendar/setup/egw_de.lang @@ -1,6 +1,7 @@ %1 %2 in %3 calendar de %1 %2 im %3 %1 records imported calendar de %1 Datensätze importiert %1 records read (not yet imported, you may go back and uncheck test import) calendar de %1 Datensätze gelesen (noch nicht importiert, sie können zurück gehen und Test Import ausschalten) +%1 weeks calendar de %1 Wochen please note: the calendar use the holidays of your country, which is set to %1. you can change it in your %2.
holidays are %3 automatic installed from %4. you can changed it in %5. calendar de Bitte beachten: Der Kalender verwendet die Feiertages Ihres Landes, welches auf %1 eingestellt ist. Das können Sie in Ihren %2 ändern.
Feiertage werden %3 automatisch von %4 installiert, was in %5 änderbar ist. a non blocking event will not conflict with other events calendar de Ein nicht blockierender Termin ergibt keine Konflikt mit anderen Terminen accept or reject an invitation calendar de Einladung zu- oder absagen @@ -152,6 +153,7 @@ holidays calendar de Feiertage hours calendar de Stunden how far to search (from startdate) calendar de wie weit suchen (vom Startdatum) how many minutes should each interval last? calendar de Wie viele Minute soll jedes Interval dauern? +how many weeks should the multiple week view show? calendar de Wie viele Wochen soll die Mehrwochenansicht zeigen? ical calendar de iCal ical / rfc2445 calendar de iCal / RFC2445 ical export calendar de iCal Export @@ -185,6 +187,7 @@ monthly calendar de Monatlich monthly (by date) calendar de Monatlich (nach Datum) monthly (by day) calendar de Monatlich (nach Wochentag) monthview calendar de Monatsansicht +multiple week view calendar de Mehrwochenansicht new search with the above parameters calendar de neue Suche mit den obigen Parametern no events found calendar de Keine Termine gefunden no filter calendar de Kein Filter @@ -318,6 +321,7 @@ weekday starts on calendar de Arbeitswoche beginnt am weekdays calendar de Wochentage weekdays to use in search calendar de Wochentage für die Suche weekly calendar de Wöchentlich +weeks in multiple week view calendar de Wochen in der Mehrwochenansicht weekview calendar de Wochenansicht weekview with weekend calendar de Wochenansicht mit Wochenende weekview without weekend calendar de Wochenansicht ohne Wochenende diff --git a/calendar/setup/egw_en.lang b/calendar/setup/egw_en.lang index 70c63d18a5..06a100be2c 100644 --- a/calendar/setup/egw_en.lang +++ b/calendar/setup/egw_en.lang @@ -1,6 +1,7 @@ %1 %2 in %3 calendar en %1 %2 in %3 %1 records imported calendar en %1 records imported %1 records read (not yet imported, you may go back and uncheck test import) calendar en %1 records read (not yet imported, you may go back and uncheck Test Import) +%1 weeks calendar en %1 weeks please note: the calendar use the holidays of your country, which is set to %1. you can change it in your %2.
holidays are %3 automatic installed from %4. you can changed it in %5. calendar en Please note: The calendar use the holidays of your country, which is set to %1. You can change it in your %2.
Holidays are %3 automatic installed from %4. You can changed it in %5. a non blocking event will not conflict with other events calendar en A non blocking event will not conflict with other events accept or reject an invitation calendar en Accept or reject an invitation @@ -152,6 +153,7 @@ holidays calendar en Holidays hours calendar en hours how far to search (from startdate) calendar en how far to search (from startdate) how many minutes should each interval last? calendar en How many minutes should each interval last? +how many weeks should the multiple week view show? calendar en How many weeks should the multiple week view show? ical calendar en iCal ical / rfc2445 calendar en iCal / rfc2445 ical export calendar en iCal Export @@ -185,6 +187,7 @@ monthly calendar en Monthly monthly (by date) calendar en Monthly (by date) monthly (by day) calendar en Monthly (by day) monthview calendar en Monthview +multiple week view calendar en Multiple week view new search with the above parameters calendar en new search with the above parameters no events found calendar en No events found no filter calendar en No filter @@ -260,7 +263,6 @@ setting lock time calender admin en Setting Datalock Time for Calendar (default should invitations you rejected still be shown in your calendar ?
you can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar! calendar en Should invitations you rejected still be shown in your calendar ?
You can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar! should new events created as private by default ? calendar en Should new events created as private by default ? should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is %1. calendar en Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is %1. -should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is https://localhost/egroupware/calendar/freebusy.php?user=leithoff_net_002. calendar en Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is https://localhost/egroupware/calendar/freebusy.php?user=leithoff_net_002. should the planner display an empty row for users or categories without any appointment. calendar en Should the planner display an empty row for users or categories without any appointment. should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ? calendar en Should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ? show birthdays from addressbook admin en Show birthdays from addressbook @@ -319,6 +321,7 @@ weekday starts on calendar en weekday starts on weekdays calendar en Weekdays weekdays to use in search calendar en Weekdays to use in search weekly calendar en Weekly +weeks in multiple week view calendar en Weeks in multiple week view weekview calendar en Weekview weekview with weekend calendar en Weekview with weekend weekview without weekend calendar en Weekview without weekend