summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-06-03 12:34:48 +0000
committeralecpl <alec@alec.pl>2011-06-03 12:34:48 +0000
commitb896b18f87064f523dca82c3fcaa5465ec8328ad (patch)
tree4608edfbf9029a2bf26fa604fef4688f0104f1a2 /program/steps
parenta5be870d6c7ca8913e0e3accaf6d4cf188a3c3cd (diff)
- Call addressbook_get hook only if build-in addressbook doesn't match wanted ID (for better performance), other improvements
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/func.inc23
-rw-r--r--program/steps/addressbook/list.inc4
2 files changed, 18 insertions, 9 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index df86fced2..62fde971c 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -21,15 +21,21 @@
$SEARCH_MODS_DEFAULT = array('name'=>1, 'firstname'=>1, 'surname'=>1, 'email'=>1, '*'=>1);
-// add list of address sources to client env
-$js_list = $RCMAIL->get_address_sources();
-
// select source
$source = get_input_value('_source', RCUBE_INPUT_GPC);
-// if source is not set use first directory
-if (empty($source))
- $source = $js_list[key($js_list)]['id'];
+if (!$RCMAIL->action && !$OUTPUT->ajax_call) {
+ // add list of address sources to client env
+ $js_list = $RCMAIL->get_address_sources();
+
+ // if source is not set use first directory
+ if (empty($source))
+ $source = $js_list[key($js_list)]['id'];
+
+ $search_mods = $RCMAIL->config->get('addressbook_search_mods', $SEARCH_MODS_DEFAULT);
+ $OUTPUT->set_env('search_mods', $search_mods);
+ $OUTPUT->set_env('address_sources', $js_list);
+}
// instantiate a contacts object according to the given source
$CONTACTS = $RCMAIL->get_address_book($source);
@@ -44,18 +50,17 @@ else
if (!empty($_REQUEST['_gid']))
$CONTACTS->set_group(get_input_value('_gid', RCUBE_INPUT_GPC));
-
+/*
// set message set for search result
if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
$CONTACTS->set_search_set($_SESSION['search'][$_REQUEST['_search']]);
-
+*/
// set data source env
$OUTPUT->set_env('source', $source ? $source : '0');
$OUTPUT->set_env('readonly', $CONTACTS->readonly, false);
if (!$OUTPUT->ajax_call) {
$search_mods = $RCMAIL->config->get('addressbook_search_mods', $SEARCH_MODS_DEFAULT);
$OUTPUT->set_env('search_mods', $search_mods);
- $OUTPUT->set_env('address_sources', $js_list);
$OUTPUT->set_pagetitle(rcube_label('addressbook'));
}
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc
index 0eb4b806a..864ad939b 100644
--- a/program/steps/addressbook/list.inc
+++ b/program/steps/addressbook/list.inc
@@ -19,6 +19,10 @@
*/
+// set message set for search result
+if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
+ $CONTACTS->set_search_set($_SESSION['search'][$_REQUEST['_search']]);
+
// get contacts for this user
$result = $CONTACTS->list_records(array('name'));