diff --git a/CHANGELOG b/CHANGELOG index 20be09fba..c3c91faf1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Support _filter and _scope as GET arguments for opening mail UI (#5825) - Support for IMAP folders that cannot contain both folders and messages (#5057) - Added .user.ini file for php-fpm (#5846) - Email Resent (Bounce) feature (#4985) diff --git a/program/js/app.js b/program/js/app.js index 97801ce99..3ddb95b73 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -249,7 +249,11 @@ function rcube_webmail() this.enable_command('set-listmode', this.env.threads && !this.is_multifolder_listing()); // load messages - this.command('list'); + var searchfilter = $(this.gui_objects.search_filter).val(); + if (searchfilter && searchfilter != 'ALL') + this.filter_mailbox(searchfilter); + else + this.command('list'); $(this.gui_objects.qsearchbox).val(this.env.search_text).focusin(function() { ref.message_list.blur(); }); } @@ -2506,14 +2510,16 @@ function rcube_webmail() if (this.filter_disabled) return; - var lock = this.set_busy(true, 'searching'); + var params = this.search_params(false, filter), + lock = this.set_busy(true, 'searching'); this.clear_message_list(); // reset vars this.env.current_page = 1; this.env.search_filter = filter; - this.http_request('search', this.search_params(false, filter), lock); + this.http_request('search', params, lock); + this.update_state({_mbox: params._mbox, _filter: filter, _scope: params._scope}); }; // reload the current message listing diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 1285e1caf..531236d64 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -66,8 +66,10 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { if (empty($RCMAIL->action)) { $OUTPUT->set_env('search_mods', rcmail_search_mods()); - if (!empty($_SESSION['search_scope'])) - $OUTPUT->set_env('search_scope', $_SESSION['search_scope']); + $scope = rcube_utils::get_input_value('_scope', rcube_utils::INPUT_GET) ?: $_SESSION['search_scope']; + if ($scope && preg_match('/^(all|sub)$/i', $scope)) { + $OUTPUT->set_env('search_scope', strtolower($scope)); + } rcmail_list_pagetitle(); } @@ -2016,7 +2018,13 @@ function rcmail_search_filter($attrib) $RCMAIL->output->add_gui_object('search_filter', $attrib['id']); - return $select->show($_REQUEST['_search'] ? $_SESSION['search_filter'] : 'ALL'); + $selected = rcube_utils::get_input_value('_filter', rcube_utils::INPUT_GET); + + if (!$selected && $_REQUEST['_search']) { + $selected = $_SESSION['search_filter']; + } + + return $select->show($selected ?: 'ALL'); } function rcmail_search_interval($attrib)