From 9d45ef20cc681e76b1825126c9311b465fc0262c Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 29 Dec 2016 12:22:10 +0100 Subject: [PATCH] Fix so group/addressbook selection is retained on page refresh --- CHANGELOG | 1 + program/js/app.js | 3 +++ program/steps/addressbook/func.inc | 10 +++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0b30ce330..def07b2dd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -83,6 +83,7 @@ CHANGELOG Roundcube Webmail - Fix adding images to new identity signatures - Fix rsync error handling in installto.sh script (#5562) - Fix some advanced search issues with multiple addressbooks (#5572) +- Fix so group/addressbook selection is retained on page refresh RELEASE 1.2.3 ------------- diff --git a/program/js/app.js b/program/js/app.js index 4f2f96e4a..8114b08c4 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -5899,6 +5899,9 @@ function rcube_webmail() url._search = this.env.search_request; this.http_request(this.env.task == 'mail' ? 'list-contacts' : 'list', url, lock); + + if (this.env.task != 'mail') + this.update_state({_source: src, _page: page && page > 1 ? page : null, _gid: group}); }; this.list_contacts_clear = function() diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 916c7c6ba..a6c36cd8b 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -152,14 +152,18 @@ function rcmail_contact_source($source=null, $init_env=false, $writable=false) else $CONTACTS->set_page(isset($_SESSION['page']) ? $_SESSION['page'] : 1); - if (!empty($_REQUEST['_gid'])) - $CONTACTS->set_group(rcube_utils::get_input_value('_gid', rcube_utils::INPUT_GPC)); + if (!empty($_REQUEST['_gid'])) { + $group = rcube_utils::get_input_value('_gid', rcube_utils::INPUT_GPC); + $CONTACTS->set_group($group); + } - if (!$init_env) + if (!$init_env) { return $CONTACTS; + } $OUTPUT->set_env('readonly', $CONTACTS->readonly); $OUTPUT->set_env('source', (string) $source); + $OUTPUT->set_env('group', $group); // reduce/extend $CONTACT_COLTYPES with specification from the current $CONTACT object if (is_array($CONTACTS->coltypes)) {