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)
|
public function refresh($attr)
|
||||||
{
|
{
|
||||||
// refresh the entire calendar every 10th time to also sync deleted events
|
// 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) {
|
foreach ($this->driver->list_calendars(true) as $cal) {
|
||||||
if ($refetch) {
|
$events = $this->driver->load_events(
|
||||||
$this->rc->output->command('plugin.refresh_calendar',
|
get_input_value('start', RCUBE_INPUT_GET),
|
||||||
array('source' => $cal['id'], 'refetch' => true));
|
get_input_value('end', RCUBE_INPUT_GET),
|
||||||
}
|
get_input_value('q', RCUBE_INPUT_GET),
|
||||||
else {
|
$cal['id'],
|
||||||
$events = $this->driver->load_events(
|
1,
|
||||||
get_input_value('start', RCUBE_INPUT_GET),
|
$attr['last']
|
||||||
get_input_value('end', RCUBE_INPUT_GET),
|
);
|
||||||
get_input_value('q', RCUBE_INPUT_GET),
|
|
||||||
$cal['id'],
|
|
||||||
1,
|
|
||||||
$attr['last']
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
$this->rc->output->command('plugin.refresh_calendar',
|
$this->rc->output->command('plugin.refresh_calendar',
|
||||||
array('source' => $cal['id'], 'update' => $this->_client_event($event)));
|
array('source' => $cal['id'], 'update' => $this->_client_event($event)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2164,6 +2164,10 @@ function rcube_calendar_ui(settings)
|
||||||
if (me.fisheye_date)
|
if (me.fisheye_date)
|
||||||
me.fisheye_view(me.fisheye_date);
|
me.fisheye_view(me.fisheye_date);
|
||||||
}
|
}
|
||||||
|
// refetch all calendars
|
||||||
|
else if (p.refetch) {
|
||||||
|
fc.fullCalendar('refetchEvents');
|
||||||
|
}
|
||||||
|
|
||||||
// remove temp events
|
// remove temp events
|
||||||
fc.fullCalendar('removeEvents', function(e){ return e.temp; });
|
fc.fullCalendar('removeEvents', function(e){ return e.temp; });
|
||||||
|
|
Loading…
Add table
Reference in a new issue