diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 1b76d2c0..d0b6c029 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -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))); } } } diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js index c76939f7..64d67c21 100644 --- a/plugins/calendar/calendar_ui.js +++ b/plugins/calendar/calendar_ui.js @@ -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; });