summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-29 16:11:45 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-10-31 11:58:15 (GMT)
commit39a86a909b89f906dbfd2375a6d3a04b94048164 (patch)
tree69420fa505feee77d8471b8bd877bdcc3ff04dc0 /plugins
parenta2152768a1d61fc5469f9972a87cbd6bb591d4e9 (diff)
downloadroundcubemail-plugins-kolab-39a86a909b89f906dbfd2375a6d3a04b94048164.tar.gz
Refresh the entire tasks list/calendar on every 10th request to sync deleted items (#2369)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/calendar/calendar.php31
-rw-r--r--plugins/tasklist/tasklist.js9
-rw-r--r--plugins/tasklist/tasklist.php6
3 files changed, 32 insertions, 14 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 24ffa38..ced9b20 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -925,19 +925,28 @@ 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;
+
foreach ($this->driver->list_calendars(true) as $cal) {
- $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']
- );
+ 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']
+ );
- foreach ($events as $event) {
- $args = array('source' => $cal['id'], 'update' => $this->_client_event($event));
- $this->rc->output->command('plugin.refresh_calendar', $args);
+ foreach ($events as $event) {
+ $this->rc->output->command('plugin.refresh_calendar',
+ array('source' => $cal['id'], 'update' => $this->_client_event($event)));
+ }
}
}
}
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index 8fd1889..5035f77 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -135,9 +135,12 @@ function rcube_tasklist_ui(settings)
rcmail.addEventListener('plugin.insert_tasklist', insert_list);
rcmail.addEventListener('plugin.update_tasklist', update_list);
rcmail.addEventListener('plugin.destroy_tasklist', destroy_list);
- rcmail.addEventListener('plugin.reload_data', function(){ list_tasks(null); });
rcmail.addEventListener('plugin.unlock_saving', unlock_saving);
rcmail.addEventListener('requestrefresh', before_refresh);
+ rcmail.addEventListener('plugin.reload_data', function(){
+ list_tasks(null, true);
+ setTimeout(fetch_counts, 200);
+ });
// start loading tasks
fetch_counts();
@@ -400,7 +403,7 @@ function rcube_tasklist_ui(settings)
/**
* List tasks matching the given selector
*/
- function list_tasks(sel)
+ function list_tasks(sel, force)
{
if (rcmail.busy)
return;
@@ -412,7 +415,7 @@ function rcube_tasklist_ui(settings)
var active = active_lists(),
basefilter = filtermask == FILTER_MASK_COMPLETE ? FILTER_MASK_COMPLETE : FILTER_MASK_ALL,
- reload = active.join(',') != loadstate.lists || basefilter != loadstate.filter || loadstate.search != search_query;
+ reload = force || active.join(',') != loadstate.lists || basefilter != loadstate.filter || loadstate.search != search_query;
if (active.length && reload) {
ui_loading = rcmail.set_busy(true, 'loading');
diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php
index aaeea95..619a652 100644
--- a/plugins/tasklist/tasklist.php
+++ b/plugins/tasklist/tasklist.php
@@ -742,6 +742,12 @@ class tasklist extends rcube_plugin
*/
public function refresh($attr)
{
+ // refresh the entire list every 10th time to also sync deleted items
+ if (rand(0,10) == 10) {
+ $this->rc->output->command('plugin.reload_data');
+ return;
+ }
+
$filter = array(
'since' => $attr['last'],
'search' => get_input_value('q', RCUBE_INPUT_GPC),