Limit the user search results and display message if list is truncated

This commit is contained in:
Thomas Bruederli 2014-05-16 10:38:37 +02:00
parent 7d5fe4c794
commit 0fbfff3349
2 changed files with 11 additions and 1 deletions

View file

@ -746,6 +746,10 @@ class calendar extends rcube_plugin
$results[] = $cal; $results[] = $cal;
} }
// report more results available
if ($this->driver->search_more_results)
$this->rc->output->show_message('autocompletemore', 'info');
$this->rc->output->command('multi_thread_http_response', $results, get_input_value('_reqid', RCUBE_INPUT_GPC)); $this->rc->output->command('multi_thread_http_response', $results, get_input_value('_reqid', RCUBE_INPUT_GPC));
return; return;
} }

View file

@ -409,6 +409,7 @@ class kolab_driver extends calendar_driver
return array(); return array();
$this->calendars = array(); $this->calendars = array();
$this->search_more_results = false;
// find unsubscribed IMAP folders that have "event" type // find unsubscribed IMAP folders that have "event" type
if ($source == 'folders') { if ($source == 'folders') {
@ -419,7 +420,8 @@ class kolab_driver extends calendar_driver
} }
// find other user's virtual calendars // find other user's virtual calendars
else if ($source == 'users') { else if ($source == 'users') {
foreach (kolab_storage::search_users($query, 0) as $user) { $limit = $this->rc->config->get('autocomplete_max', 15) * 2; // we have slightly more space, so display twice the number
foreach (kolab_storage::search_users($query, 0, array(), $limit, $count) as $user) {
$calendar = new kolab_user_calendar($user, $this->cal); $calendar = new kolab_user_calendar($user, $this->cal);
$this->calendars[$calendar->id] = $calendar; $this->calendars[$calendar->id] = $calendar;
@ -431,6 +433,10 @@ class kolab_driver extends calendar_driver
} }
} }
} }
if ($count > $limit) {
$this->search_more_results = true;
}
} }
// don't list the birthday calendar // don't list the birthday calendar