Fix calendar refreshing (#2516)
This commit is contained in:
parent
0bd01c80f5
commit
65f4a8ce3d
2 changed files with 19 additions and 18 deletions
|
@ -942,27 +942,24 @@ class calendar extends rcube_plugin
|
|||
public function refresh($attr)
|
||||
{
|
||||
// refresh the entire calendar every 10th time to also sync deleted events
|
||||
$refetch = rand(0,10) == 10;
|
||||
if (rand(0,10) == 10) {
|
||||
$this->rc->output->command('plugin.refresh_calendar', array('refetch' => true));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->driver->list_calendars(true) as $cal) {
|
||||
if ($refetch) {
|
||||
$this->rc->output->command('plugin.refresh_calendar',
|
||||
array('source' => $cal['id'], 'refetch' => true));
|
||||
}
|
||||
else {
|
||||
$events = $this->driver->load_events(
|
||||
get_input_value('start', RCUBE_INPUT_GET),
|
||||
get_input_value('end', RCUBE_INPUT_GET),
|
||||
get_input_value('q', RCUBE_INPUT_GET),
|
||||
$cal['id'],
|
||||
1,
|
||||
$attr['last']
|
||||
);
|
||||
$events = $this->driver->load_events(
|
||||
get_input_value('start', RCUBE_INPUT_GET),
|
||||
get_input_value('end', RCUBE_INPUT_GET),
|
||||
get_input_value('q', RCUBE_INPUT_GET),
|
||||
$cal['id'],
|
||||
1,
|
||||
$attr['last']
|
||||
);
|
||||
|
||||
foreach ($events as $event) {
|
||||
$this->rc->output->command('plugin.refresh_calendar',
|
||||
array('source' => $cal['id'], 'update' => $this->_client_event($event)));
|
||||
}
|
||||
foreach ($events as $event) {
|
||||
$this->rc->output->command('plugin.refresh_calendar',
|
||||
array('source' => $cal['id'], 'update' => $this->_client_event($event)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2164,6 +2164,10 @@ function rcube_calendar_ui(settings)
|
|||
if (me.fisheye_date)
|
||||
me.fisheye_view(me.fisheye_date);
|
||||
}
|
||||
// refetch all calendars
|
||||
else if (p.refetch) {
|
||||
fc.fullCalendar('refetchEvents');
|
||||
}
|
||||
|
||||
// remove temp events
|
||||
fc.fullCalendar('removeEvents', function(e){ return e.temp; });
|
||||
|
|
Loading…
Add table
Reference in a new issue