summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/managesieve/managesieve.php37
1 files changed, 19 insertions, 18 deletions
diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php
index 9d2be50c6..ff27486d9 100644
--- a/plugins/managesieve/managesieve.php
+++ b/plugins/managesieve/managesieve.php
@@ -63,12 +63,7 @@ class managesieve extends rcube_plugin
$this->register_action('plugin.managesieve-save', array($this, 'managesieve_save'));
if ($this->rc->task == 'settings') {
- // load localization
- $this->add_texts('localization/', array('filters','managefilters'));
-
- if (!strpos($this->rc->action, 'managesieve')) {
- $this->include_script('managesieve.js');
- }
+ $this->init_ui();
}
else if ($this->rc->task == 'mail') {
// register message hook
@@ -82,18 +77,30 @@ class managesieve extends rcube_plugin
}
/**
- * Add UI elements to the 'mailbox view' and 'show message' UI.
+ * Initializes plugin's UI (localization, js script)
*/
- function mail_task_handler()
+ private function init_ui()
{
+ if ($this->ui_initialized)
+ return;
+
// load localization
- $this->add_texts('localization/');
+ $this->add_texts('localization/', array('filters','managefilters'));
+ $this->include_script('managesieve.js');
+
+ $this->ui_initialized = true;
+ }
+ /**
+ * Add UI elements to the 'mailbox view' and 'show message' UI.
+ */
+ function mail_task_handler()
+ {
// use jQuery for popup window
$this->require_plugin('jqueryui');
- // include main js script
- $this->include_script('managesieve.js');
+ // include js script and localization
+ $this->init_ui();
// include styles
$skin = $this->rc->config->get('skin');
@@ -281,13 +288,7 @@ class managesieve extends rcube_plugin
function managesieve_actions()
{
- // load localization
- $this->add_texts('localization/', array('filters','managefilters'));
-
- // include main js script
- if ($this->api->output->type == 'html') {
- $this->include_script('managesieve.js');
- }
+ $this->init_ui();
$error = $this->managesieve_start();