summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-01-20 10:05:36 +0100
committerThomas Bruederli <thomas@roundcube.net>2014-01-20 10:05:36 +0100
commit1bbf8c48868efb87baab7ae71721f2c9ad408e65 (patch)
treea851d01eead102fabf9dddaef55465c4985d88b4 /program/steps/mail
parent689a222170aed32165cbe8bc8fc89fd428b29186 (diff)
- Make search scope selectable in UI
- Disable thread mode when searching over multiple folders - Encode UID values for HTML message row identifiers
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/func.inc3
-rw-r--r--program/steps/mail/search.inc13
2 files changed, 14 insertions, 2 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 45d4242f9..fd321e294 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -105,6 +105,9 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
}
$OUTPUT->set_env('search_mods', rcmail_search_mods());
+
+ if (!empty($_SESSION['search_scope']))
+ $OUTPUT->set_env('search_scope', $_SESSION['search_scope']);
}
$threading = (bool) $RCMAIL->storage->get_threading();
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index b45cdc0de..88bbe6eda 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -35,6 +35,7 @@ $str = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GET, true);
$mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GET, true);
$filter = rcube_utils::get_input_value('_filter', rcube_utils::INPUT_GET);
$headers = rcube_utils::get_input_value('_headers', rcube_utils::INPUT_GET);
+$scope = rcube_utils::get_input_value('_scope', rcube_utils::INPUT_GET);
$subject = array();
$search_request = md5($mbox.$filter.$str);
@@ -106,8 +107,15 @@ if (!empty($subject)) {
$search_str = trim($search_str);
$sort_column = rcmail_sort_column();
-// TEMPORARY: search all folders
-$mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail');
+// search all, current or subfolders folders
+if ($scope == 'all') {
+ $mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail');
+}
+else if ($scope == 'sub') {
+ $mboxes = $RCMAIL->storage->list_folders_subscribed($mbox, '*', 'mail');
+ if ($mbox != 'INBOX' && $mboxes[0] == 'INBOX')
+ array_shift($mboxes);
+}
// execute IMAP search
if ($search_str) {
@@ -128,6 +136,7 @@ if ($search_str) {
$_SESSION['last_text_search'] = $str;
}
$_SESSION['search_request'] = $search_request;
+$_SESSION['search_scope'] = $scope;
// Add 'folder' column to list
if ($_SESSION['search'][1]->multi) {