From ec48d32681fa4ecf86781333de5d6c6a496a89b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Mon, 3 May 2010 16:43:42 +0000 Subject: [PATCH] Calendar recurrence horizont configurable; fix recur_enddate issue --- admin/templates/default/config.tpl | 15 ++++++++++----- calendar/inc/class.calendar_bo.inc.php | 26 +++++++++++++++++--------- calendar/inc/class.calendar_so.inc.php | 4 ++-- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/admin/templates/default/config.tpl b/admin/templates/default/config.tpl index 9956f873c8..0fe4c99abb 100644 --- a/admin/templates/default/config.tpl +++ b/admin/templates/default/config.tpl @@ -25,8 +25,13 @@ {lang_Timeout_for_application_session_data_in_seconds_(default_86400_=_1_day)}: - + + {lang_Calendar_recurrence_horizont_in_days_(default_1000)}: + + + + {lang_Would_you_like_to_show_each_application's_upgrade_status_?}: @@ -46,7 +51,7 @@ - + {lang_Should_the_login_page_include_a_language_selectbox_(useful_for_demo-sites)_?}: @@ -75,7 +80,7 @@ - + {lang_Enter_the_VFS-Path_where_additional_images,_icons_or_logos_can be_placed_(and_found_by_EGroupwares_applications)._The_path_MUST_start_with_/,and_be_readable_by_all_users}: diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index a661802608..01d15d523b 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -622,16 +622,21 @@ class calendar_bo } $new_horizont = $this->date2ts($new_horizont,true); // now we are in server-time, where this function operates - if ($new_horizont > time()+1000*DAY_s) // some user tries to "look" more then 1000 days in the future - { - if ($this->debug == 'check_move_horizont') $this->debug_message('bocal::check_move_horizont(%1) horizont=%2 new horizont more then 1000 days from now --> ignoring it',true,$new_horizont,$this->config['horizont']); - return; - } if ($new_horizont <= $this->config['horizont']) // no move necessary { if ($this->debug == 'check_move_horizont') $this->debug_message('bocal::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,$this->config['horizont']); return; } + if (!empty($GLOBALS['egw_info']['server']['calendar_horizont'])) + { + $maxdays = abs($GLOBALS['egw_info']['server']['calendar_horizont']); + } + if (empty($maxdays)) $maxdays = 1000; // old default + if ($new_horizont > time()+$maxdays*DAY_s) // some user tries to "look" more then the maximum number of days in the future + { + if ($this->debug == 'check_move_horizont') $this->debug_message('bocal::check_move_horizont(%1) horizont=%2 new horizont more then 1000 days from now --> ignoring it',true,$new_horizont,$this->config['horizont']); + $new_horizont = time()+$maxdays*DAY_s; + } if ($new_horizont < time()+31*DAY_s) { $new_horizont = time()+31*DAY_s; @@ -747,10 +752,13 @@ class calendar_bo $time = new egw_time($event['recurrence'], egw_time::$server_timezone); $time =& $this->so->startOfDay($time, $event['tzid']); $event['recurrence'] = egw_time::to($time, $date_format); - $time = new egw_time($event['recur_enddate'], egw_time::$server_timezone); - $time =& $this->so->startOfDay($time, $event['tzid']); - $time->setTime(23, 59, 59); - $event['recur_enddate'] = egw_time::to($time, $date_format); + if (!empty($event['recur_enddate'])) + { + $time = new egw_time($event['recur_enddate'], egw_time::$server_timezone); + $time =& $this->so->startOfDay($time, $event['tzid']); + $time->setTime(23, 59, 59); + $event['recur_enddate'] = egw_time::to($time, $date_format); + } $timestamps = array('modified','created'); } else diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index 2c39d7c823..34800fab24 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -405,7 +405,7 @@ class calendar_so switch($filter) { case 'showonlypublic': - $where[] = "cal_public=1"; + $where[] = 'cal_public=1'; $where[] = "cal_status != 'R'"; break; case 'deleted': $where[] = 'cal_deleted='.$this->db->quote(true,'bool'); @@ -2116,7 +2116,7 @@ ORDER BY cal_user_type, cal_usre_id * * @return DateTime */ - function &startOfDay(egw_time $time, $tz_id) + function &startOfDay(egw_time $time, $tz_id=null) { if (empty($tz_id)) {