Aleksander Machniak
2014-09-03 02f762831461233809c95189b1b4e9a647e22944
Fix page title when using search filter (#1490023)
5 files modified
49 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/localization/en_US/labels.inc 2 ●●● patch | view | raw | blame | history
program/steps/mail/func.inc 27 ●●●● patch | view | raw | blame | history
program/steps/mail/list.inc 10 ●●●● patch | view | raw | blame | history
program/steps/mail/search.inc 9 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -47,6 +47,7 @@
- Optimize some framed pages content for better performance (#1489792)
- Improve text messages display and conversion to HTML (#1488937)
- Don't remove links when html signature is converted to text (#1489621)
- Fix page title when using search filter (#1490023)
- Fix mbox files import
- Fix some mime-type to extension mapping checks in Installer (#1489983)
- Fix errors when using localStorage in Safari's private browsing mode (#1489996)
program/localization/en_US/labels.inc
@@ -338,7 +338,7 @@
$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';
program/steps/mail/func.inc
@@ -79,6 +79,8 @@
        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 @@
            '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 @@
}
/**
 * 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()
program/steps/mail/list.inc
@@ -81,6 +81,7 @@
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 @@
    $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());
program/steps/mail/search.inc
@@ -187,8 +187,6 @@
    }
}
$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('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));
}