From 5d92a6540ae036141d42bb9ca54a4d637e424afe Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 28 Jul 2014 05:16:57 -0400
Subject: [PATCH] Fix missing css/js scripts in filter form in mail task

---
 plugins/managesieve/Changelog       |    1 +
 plugins/managesieve/managesieve.php |   11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index 25ae9de..2ce1c5f 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,3 +1,4 @@
+- Fix missing css/js scripts in filter form in mail task
 - Fix bug where non-existing (or unsubscribed) folder wasn't listed in folder selector (#1489956)
 - Added optional separate interface for out-of-office management (#1488266)
 - Fix disabled "create filter" action
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 6adba4e..50191ae 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -54,7 +54,9 @@
             $this->add_hook('message_headers_output', array($this, 'mail_headers'));
 
             // inject Create Filter popup stuff
-            if (empty($this->rc->action) || $this->rc->action == 'show') {
+            if (empty($this->rc->action) || $this->rc->action == 'show'
+                || strpos($this->rc->action, 'plugin.managesieve') === 0
+            ) {
                 $this->mail_task_handler();
             }
         }
@@ -72,13 +74,15 @@
         // load localization
         $this->add_texts('localization/');
 
-        if ($this->rc->task == 'mail' || strpos($this->rc->action, 'plugin.managesieve') === 0) {
+        $sieve_action = strpos($this->rc->action, 'plugin.managesieve') === 0;
+
+        if ($this->rc->task == 'mail' || $sieve_action) {
             $this->include_script('managesieve.js');
         }
 
         // include styles
         $skin_path = $this->local_skin_path();
-        if ($this->rc->task == 'settings') {
+        if ($this->rc->task == 'settings' || $sieve_action) {
             if (is_file($this->home . "/$skin_path/managesieve.css")) {
                 $this->include_stylesheet("$skin_path/managesieve.css");
             }
@@ -88,7 +92,6 @@
                 $this->include_stylesheet("$skin_path/managesieve_mail.css");
             }
         }
-
 
         $this->ui_initialized = true;
     }

--
Gitblit v1.9.1