From ffdc0454e0625cf1478d0c74bbe38d365e040f5f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 25 Feb 2016 18:16:54 +0100 Subject: [PATCH] Performance: Load tags UI (and initialize configuration folder/cache) on when it's needed --- plugins/kolab_tags/kolab_tags.php | 4 -- plugins/kolab_tags/lib/kolab_tags_engine.php | 44 +++++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/plugins/kolab_tags/kolab_tags.php b/plugins/kolab_tags/kolab_tags.php index c3a18469..730d50cd 100644 --- a/plugins/kolab_tags/kolab_tags.php +++ b/plugins/kolab_tags/kolab_tags.php @@ -79,10 +79,6 @@ class kolab_tags extends rcube_plugin return; } - if ($this->rc->action == 'print') { - return; - } - if ($engine = $this->engine()) { $engine->ui(); } diff --git a/plugins/kolab_tags/lib/kolab_tags_engine.php b/plugins/kolab_tags/lib/kolab_tags_engine.php index b1158fc7..b9840494 100644 --- a/plugins/kolab_tags/lib/kolab_tags_engine.php +++ b/plugins/kolab_tags/lib/kolab_tags_engine.php @@ -47,26 +47,32 @@ class kolab_tags_engine public function ui() { // set templates of Files UI and widgets - if ($this->rc->task == 'mail') { - $this->plugin->add_texts('localization/'); - - $this->plugin->include_stylesheet($this->plugin->local_skin_path().'/style.css'); - $this->plugin->include_script('kolab_tags.js'); - $this->rc->output->add_label('cancel', 'save'); - $this->plugin->add_label('tags', 'add', 'edit', 'delete', 'saving', - 'nameempty', 'nameexists', 'colorinvalid', 'untag', 'tagname', - 'tagcolor', 'tagsearchnew', 'newtag'); - - $this->rc->output->add_handlers(array( - 'plugin.taglist' => array($this, 'taglist'), - )); - - $ui = $this->rc->output->parse('kolab_tags.ui', false, false); - $this->rc->output->add_footer($ui); - - // load miniColors - jqueryui::miniColors(); + if ($this->rc->task != 'mail') { + return; } + + if ($this->rc->action && !in_array($this->rc->action, array('show', 'preview'))) { + return; + } + + $this->plugin->add_texts('localization/'); + + $this->plugin->include_stylesheet($this->plugin->local_skin_path().'/style.css'); + $this->plugin->include_script('kolab_tags.js'); + $this->rc->output->add_label('cancel', 'save'); + $this->plugin->add_label('tags', 'add', 'edit', 'delete', 'saving', + 'nameempty', 'nameexists', 'colorinvalid', 'untag', 'tagname', + 'tagcolor', 'tagsearchnew', 'newtag'); + + $this->rc->output->add_handlers(array( + 'plugin.taglist' => array($this, 'taglist'), + )); + + $ui = $this->rc->output->parse('kolab_tags.ui', false, false); + $this->rc->output->add_footer($ui); + + // load miniColors + jqueryui::miniColors(); } /**