From 238ec1ecdfdb00a8d4d0c4e30d9ef4d856e12025 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 30 Oct 2017 11:48:56 +0100 Subject: [PATCH] Archive: Style folder icon also in Settings > Folders --- plugins/archive/archive.js | 11 +++++++++-- plugins/archive/archive.php | 13 ++++++++++--- plugins/archive/composer.json | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js index 1cd39b4b1..a9b3092d6 100644 --- a/plugins/archive/archive.js +++ b/plugins/archive/archive.js @@ -57,7 +57,14 @@ if (window.rcmail) { // set css style for archive folder var li; - if (rcmail.env.archive_folder && (li = rcmail.get_folder_li(rcmail.env.archive_folder, '', true))) - $(li).addClass('archive'); + if (rcmail.env.archive_folder) { + if (rcmail.subscription_list) + li = rcmail.subscription_list.get_item(rcmail.env.archive_folder); + else + li = rcmail.get_folder_li(rcmail.env.archive_folder, '', true); + + if (li) + $(li).addClass('archive'); + } }); } diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index bcbda4d84..306ae05be 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -22,9 +22,9 @@ class archive extends rcube_plugin // register special folder type rcube_storage::$folder_types[] = 'archive'; - if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') - && ($archive_folder = $rcmail->config->get('archive_mbox')) - ) { + $archive_folder = $rcmail->config->get('archive_mbox'); + + if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && $archive_folder) { $this->include_stylesheet($this->local_skin_path() . '/archive.css', true); $this->include_script('archive.js'); $this->add_texts('localization', true); @@ -57,6 +57,13 @@ class archive extends rcube_plugin else if ($rcmail->task == 'settings') { $this->add_hook('preferences_list', array($this, 'prefs_table')); $this->add_hook('preferences_save', array($this, 'save_prefs')); + + if ($rcmail->action == 'folders' && $archive_folder) { + $this->include_stylesheet($this->local_skin_path() . '/archive.css', true); + $this->include_script('archive.js'); + // set env variables for client + $rcmail->output->set_env('archive_folder', $archive_folder); + } } } diff --git a/plugins/archive/composer.json b/plugins/archive/composer.json index 4be5b3f3d..3b914b46b 100644 --- a/plugins/archive/composer.json +++ b/plugins/archive/composer.json @@ -3,7 +3,7 @@ "type": "roundcube-plugin", "description": "This adds a button to move the selected messages to an archive folder. The folder (and the optional structure of subfolders) can be selected in the settings panel.", "license": "GPLv3+", - "version": "3.2", + "version": "3.3", "authors": [ { "name": "Thomas Bruederli",