diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-09-03 13:01:38 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-09-03 13:01:38 +0200 |
commit | 02f762831461233809c95189b1b4e9a647e22944 (patch) | |
tree | eb48901d23b7e065ce82979d5af141fa3e57c6b3 /program | |
parent | 334bc9792789732fd5657df5abb233ad0c2da512 (diff) |
Fix page title when using search filter (#1490023)
Diffstat (limited to 'program')
-rw-r--r-- | program/localization/en_US/labels.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 27 | ||||
-rw-r--r-- | program/steps/mail/list.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/search.inc | 9 |
4 files changed, 35 insertions, 13 deletions
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index 720d7ab99..f1ef5f436 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -338,7 +338,7 @@ $labels['assistant'] = 'Assistant'; $labels['spouse'] = 'Spouse'; $labels['allfields'] = 'All fields'; $labels['search'] = 'Search'; -$labels['searchfor'] = 'Search for "$q"'; +$labels['searchresult'] = 'Search result'; $labels['advsearch'] = 'Advanced Search'; $labels['advanced'] = 'Advanced'; $labels['other'] = 'Other'; diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index a7c483bba..25f2e3175 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -79,6 +79,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { if (!empty($_SESSION['search_scope'])) $OUTPUT->set_env('search_scope', $_SESSION['search_scope']); + + rcmail_list_pagetitle(); } $threading = (bool) $RCMAIL->storage->get_threading(); @@ -119,11 +121,6 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { 'flagged', 'unflagged', 'unread', 'deleted', 'replied', 'forwarded', 'priority', 'withattachment', 'fileuploaderror'); } - - $pagetitle = $RCMAIL->localize_foldername($mbox_name, true); - $pagetitle = str_replace($delimiter, " \xC2\xBB ", $pagetitle); - - $OUTPUT->set_pagetitle($pagetitle); } // register UI objects @@ -218,6 +215,26 @@ function rcmail_init_env() } /** + * Sets page title + */ +function rcmail_list_pagetitle() +{ + global $RCMAIL; + + if ($RCMAIL->output->get_env('search_request')) { + $pagetitle = $RCMAIL->gettext('searchresult'); + } + else { + $mbox_name = $RCMAIL->storage->get_folder(); + $delimiter = $RCMAIL->storage->get_hierarchy_delimiter(); + $pagetitle = $RCMAIL->localize_foldername($mbox_name, true); + $pagetitle = str_replace($delimiter, " \xC2\xBB ", $pagetitle); + } + + $RCMAIL->output->set_pagetitle($pagetitle); +} + +/** * Returns default search mods */ function rcmail_search_mods() diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index 2dcc40d17..32197bde3 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -81,6 +81,7 @@ if ($count = $RCMAIL->storage->count($mbox_name, $threading ? 'THREADS' : 'ALL', if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) && $_SESSION['search_request'] == $_REQUEST['_search'] ) { + $search_request = $_REQUEST['_search']; $_SESSION['search'] = $RCMAIL->storage->get_search_set(); } // remove old search data @@ -88,13 +89,12 @@ else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) { $RCMAIL->session->remove('search'); } -// empty result? we'll skip UNSEEN counting in rcmail_send_unread_count() -if (empty($search_request) && empty($a_headers)) { - $unseen = 0; -} +rcmail_list_pagetitle(); // update mailboxlist -rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), $unseen); +if (empty($search_request)) { + rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), empty($a_headers) ? 0 : null); +} // update message count display $pages = ceil($count/$RCMAIL->storage->get_pagesize()); diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index b50593480..d88e57568 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -187,8 +187,6 @@ else { } } -$OUTPUT->set_pagetitle($RCMAIL->gettext(array('name' => 'searchfor', 'vars' => array('q' => $str)))); - // update message count display $OUTPUT->set_env('search_request', $search_str ? $search_request : ''); $OUTPUT->set_env('search_filter', $_SESSION['search_filter']); @@ -198,6 +196,13 @@ $OUTPUT->set_env('pagecount', ceil($count/$RCMAIL->storage->get_pagesize())); $OUTPUT->set_env('exists', $mbox === null ? 0 : $RCMAIL->storage->count($mbox, 'EXISTS')); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count, 1), $mbox); +rcmail_list_pagetitle(); + +// update unseen messages count +if (empty($search_str)) { + rcmail_send_unread_count($mbox, false, empty($result_h) ? 0 : null); +} + if (!$result->incomplete) { $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $result->multi ? 'INBOX' : $mbox)); } |