From e2d80479d61379937cc1f5e18e337ecc294a5393 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 26 Feb 2017 15:31:06 +0100 Subject: [PATCH] Make possible to set (some) config options from a skin --- program/include/rcmail_output_html.php | 4 ++++ program/js/app.js | 19 +++++++++---------- program/lib/Roundcube/rcube_config.php | 14 ++++++++++---- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 61fab0e0b..259aca1c5 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -297,6 +297,10 @@ EOF; $this->load_skin('skins/' . $meta['extends']); } } + + foreach ((array) $meta['config'] as $key => $value) { + $this->config->set($key, $value, true); + } } /** diff --git a/program/js/app.js b/program/js/app.js index bca2f2c7a..8835e8e2d 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2594,10 +2594,9 @@ function rcube_webmail() // load message list to target frame/window if (mbox) { - this.set_busy(true, 'loading'); url._mbox = mbox; - if (page) - url._page = page; + url._page = page; + this.set_busy(true, 'loading'); this.location_href(url, target); } }; @@ -2618,9 +2617,10 @@ function rcube_webmail() if (typeof url != 'object') url = {}; + + url._layout = this.env.layout url._mbox = mbox; - if (page) - url._page = page; + url._page = page; // disable double-click on the list when preview pane is on // this eliminates delay when opening a message in preview pane (#5199) @@ -5251,9 +5251,6 @@ function rcube_webmail() if (!search && this.gui_objects.qsearchbox) search = this.gui_objects.qsearchbox.value; - if (filter) - url._filter = filter; - if (this.gui_objects.search_interval) url._interval = $(this.gui_objects.search_interval).val(); @@ -5270,8 +5267,10 @@ function rcube_webmail() } } - if (scope) - url._scope = scope; + url._layout = this.env.layout; + url._filter = filter; + url._scope = scope; + if (mbox && scope != 'all') url._mbox = mbox; diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 9aa6f281a..0985c2192 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -31,6 +31,7 @@ class rcube_config private $prop = array(); private $errors = array(); private $userprefs = array(); + private $immutable = array(); /** @@ -415,12 +416,17 @@ class rcube_config /** * Setter for a config parameter * - * @param string $name Parameter name - * @param mixed $value Parameter value + * @param string $name Parameter name + * @param mixed $value Parameter value + * @param bool $immutable Make the value immutable */ - public function set($name, $value) + public function set($name, $value, $immutable = false) { $this->prop[$name] = $value; + + if ($immutable) { + $this->immutable[$name] = $value; + } } /** @@ -431,7 +437,7 @@ class rcube_config public function merge($prefs) { $prefs = $this->fix_legacy_props($prefs); - $this->prop = array_merge($this->prop, $prefs, $this->userprefs); + $this->prop = array_merge($this->prop, $prefs, $this->userprefs, $this->immutable); } /**