From 5dc47a9044dd186194ef38741ae53f8ecab0e24f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 14 Jun 2011 18:33:26 +0000 Subject: [PATCH] * Calendar: warning if user tries to move horizont further then default 1000 days and NOT start moving horizont, to allow adding events after the horizont --- calendar/inc/class.calendar_bo.inc.php | 25 +++++++++++++++++-------- calendar/inc/class.calendar_ui.inc.php | 24 +++++++++++++----------- calendar/lang/egw_de.lang | 5 +++++ calendar/lang/egw_en.lang | 4 +++- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index f152b2727e..c58f4d06f7 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -191,6 +191,13 @@ class calendar_bo */ public $calview_no_consolidate = 5; + /** + * Warnings to show in regular UI + * + * @var array + */ + var $warnings = array(); + /** * Constructor */ @@ -626,13 +633,13 @@ class calendar_bo { if ((int) $this->debug >= 2 || $this->debug == 'check_move_horizont') { - $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2',true,$new_horizont,$this->config['horizont']); + $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2',true,$new_horizont,(int)$this->config['horizont']); } $new_horizont = $this->date2ts($new_horizont,true); // now we are in server-time, where this function operates if ($new_horizont <= $this->config['horizont']) // no move necessary { - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,$this->config['horizont']); + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,(int)$this->config['horizont']); return; } if (!empty($GLOBALS['egw_info']['server']['calendar_horizont'])) @@ -642,8 +649,9 @@ class calendar_bo 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('calendar_bo::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 ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 new horizont more then %3 days from now --> ignoring it',true,$new_horizont,(int)$this->config['horizont'],$maxdays); + $this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', egw_time::to($new_horizont,true), $maxdays); + return; } if ($new_horizont < time()+31*DAY_s) { @@ -655,6 +663,7 @@ class calendar_bo // create further recurrences for all recurring and not yet (at the old horizont) ended events if (($recuring = $this->so->unfinished_recuring($old_horizont))) { + @set_time_limit(0); // disable time-limit, in case it takes longer to calculate the recurrences foreach($this->read(array_keys($recuring)) as $cal_id => $event) { if ($this->debug == 'check_move_horizont') @@ -666,10 +675,9 @@ class calendar_bo } } // update the horizont - $config = CreateObject('phpgwapi.config','calendar'); - $config->save_value('horizont',$this->config['horizont'],'calendar'); + config::save_value('horizont',$this->config['horizont'],'calendar'); - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,$this->config['horizont']); + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']); } /** @@ -926,7 +934,8 @@ class calendar_bo if (!$event['recur_enddate'] || $this->date2ts($event['recur_enddate']) > $this->date2ts($end)) { //echo "

recur_enddate={$event['recur_enddate']}=".egw_time::to($event['recur_enddate'])." > end=$end=".egw_time::to($end)." --> using end instead of recur_enddate

\n"; - $event['recur_enddate'] = $end; + // insert at least the event itself, if it's behind the horizont + $event['recur_enddate'] = $this->date2ts($end) < $this->date2ts($event['end']) ? $event['end'] : $end; } // loop over all recurrences and insert them, if they are after $start $rrule = calendar_rrule::event2rrule($event, true); // true = we operate in usertime, like the rest of calendar_bo diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index c98ccad421..a5854dcb57 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -202,17 +202,17 @@ class calendar_ui { return $msg; } - $GLOBALS['egw']->common->egw_header(); + common::egw_header(); if ($GLOBALS['egw_info']['flags']['nonavbar']) parse_navbar(); echo $msg; - $GLOBALS['egw']->common->egw_footer(); - $GLOBALS['egw']->common->egw_exit(); + common::egw_footer(); + common::egw_exit(); } if (count($no_access_group)) { - $this->group_warning = lang('Groupmember(s) %1 not included, because you have no access.',implode(', ',$no_access_group)); + $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.',implode(', ',$no_access_group)); } return false; } @@ -223,11 +223,11 @@ class calendar_ui function do_header() { $GLOBALS['egw_info']['flags']['include_xajax'] = true; - $GLOBALS['egw']->common->egw_header(); + common::egw_header(); if ($_GET['msg']) echo '

'.html::htmlspecialchars($_GET['msg'])."

\n"; - if ($this->group_warning) echo '

'.$this->group_warning."

\n"; + if ($this->bo->warnings) echo '

'.implode('
',$this->bo->warnings)."

\n"; } /** @@ -748,6 +748,7 @@ class calendar_ui 'hideprivate' => array(lang('Hide private infos'),lang('Show all events, as if they were private')), 'showonlypublic' => array(lang('Hide private events'),lang('Show only events flagged as public, (not checked as private)')), 'no-enum-groups' => array(lang('only group-events'),lang('Do not include events of group members')), + 'not-unknown' => array(lang('No meeting requests'),lang('Show all status, but unknown')), ) as $value => $label) { list($label,$title) = $label; @@ -756,7 +757,8 @@ class calendar_ui // Add in deleted for admins $config = config::read('phpgwapi'); - if($config['calendar_delete_history']) { + if($config['calendar_delete_history']) + { $options .= '