* 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

This commit is contained in:
Ralf Becker 2011-06-14 18:46:03 +00:00
parent 3ccd187698
commit 4fef26e926
4 changed files with 27 additions and 15 deletions

View File

@ -187,6 +187,13 @@ class calendar_bo
*/
public $calview_no_consolidate = 5;
/**
* Warnings to show in regular UI
*
* @var array
*/
var $warnings = array();
/**
* Constructor
*/
@ -648,13 +655,13 @@ class calendar_bo
{
if ((int) $this->debug >= 2 || $this->debug == 'check_move_horizont')
{
$this->debug_message('bocal::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('bocal::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']))
@ -664,8 +671,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('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 ($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)
{
@ -677,6 +685,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')
@ -688,10 +697,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('bocal::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']);
}
/**
@ -942,7 +950,8 @@ class calendar_bo
if (!$event['recur_enddate'] || $this->date2ts($event['recur_enddate']) > $this->date2ts($end))
{
//echo "<p>recur_enddate={$event['recur_enddate']}=".egw_time::to($event['recur_enddate'])." > end=$end=".egw_time::to($end)." --> using end instead of recur_enddate</p>\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

View File

@ -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 '<p class="redItalic" align="center">'.html::htmlspecialchars($_GET['msg'])."</p>\n";
if ($this->group_warning) echo '<p class="redItalic" align="center">'.$this->group_warning."</p>\n";
if ($this->bo->warnings) echo '<p class="redItalic" align="center">'.implode('<br />',$this->bo->warnings)."</p>\n";
}
/**
@ -717,7 +717,8 @@ class calendar_ui
// Add in deleted for admins
$config = config::read('phpgwapi');
if($config['calendar_delete_history'] && $GLOBALS['egw_info']['user']['apps']['admin']) {
if($config['calendar_delete_history'])
{
$options .= '<option value="deleted"'.($this->filter == 'deleted' ? ' selected="selected"' : '').' title="'.lang('Show events that have been deleted').'">'.lang('Deleted').'</options>'."\n";
}

View File

@ -332,6 +332,7 @@ repeating interval, eg. 2 to repeat every second week calendar de Wiederholungsi
repetition calendar de Wiederholung
repetitiondetails (or empty) calendar de Details der Wiederholung (oder leer)
requested calendar de Erforderlich
requested date %1 outside allowed range of %2 days: recurring events obmitted! calendar de Gewünschtes Datum %1 außerhalb des erlauben Bereiches von %2 Tagen: wiederholdende Termine ausgelassen!
require an acl grant to invite other users and groups admin de Freigabe um andere Benutzer oder Gruppen einzuladen erforderlich
reset calendar de Zurücksetzen
reset participant stati on event shifts calendar de Rücksetzen des Teilnehmerstatus beim Verschieben von Terminen

View File

@ -332,6 +332,7 @@ repeating interval, eg. 2 to repeat every second week calendar en Repeating inte
repetition calendar en Repetition
repetitiondetails (or empty) calendar en Repetition details (or empty)
requested calendar en Requested
requested date %1 outside allowed range of %2 days: recurring events obmitted! calendar en Requested date %1 outside allowed range of %2 days: recurring events obmitted!
require an acl grant to invite other users and groups admin en Require an ACL grant to invite other users and groups
reset calendar en Reset
reset participant stati on event shifts calendar en Reset participant status on event shifts