From 2850592d9c898642f8bb4d7c9f1c0b9ce2961ded Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 19 Feb 2013 15:29:43 +0100 Subject: [PATCH] Use templates engine for plugin dialogs content --- plugins/kolab_files/kolab_files.js | 10 ++-------- plugins/kolab_files/kolab_files.php | 6 +++--- plugins/kolab_files/lib/kolab_files_engine.php | 15 +++++++++++++++ plugins/kolab_files/skins/larry/style.css | 5 +++++ .../skins/larry/templates/compose_plugin.html | 6 ++++++ .../skins/larry/templates/message_plugin.html | 3 +++ 6 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 plugins/kolab_files/skins/larry/templates/compose_plugin.html create mode 100644 plugins/kolab_files/skins/larry/templates/message_plugin.html diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index 5fa844e1..eea14c58 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -15,9 +15,6 @@ window.rcmail && rcmail.addEventListener('init', function() { input.val(rcmail.gettext('kolab_files.fromcloud')) .click(function() { kolab_files_selector_dialog(); }) .appendTo(elem); - - var dialog = $('
').hide(); - $('body').append(dialog); } // mail preview else if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { @@ -28,9 +25,6 @@ window.rcmail && rcmail.addEventListener('init', function() { .text(rcmail.gettext('kolab_files.saveall')) .click(function() { kolab_directory_selector_dialog(); }) .appendTo(attachment_list); - - var dialog = $('
').hide(); - $('body').append(dialog); } } @@ -84,7 +78,7 @@ function kolab_directory_selector_dialog() minHeight: 300, height: 250, width: 250 - }).html('
').show(); + }).show(); file_api.folder_selector(); }; @@ -134,7 +128,7 @@ function kolab_files_selector_dialog() minHeight: 300, width: 600, height: 400 - }).html('
').show(); + }).show(); file_api.folder_selector(); }; diff --git a/plugins/kolab_files/kolab_files.php b/plugins/kolab_files/kolab_files.php index f38a6847..43045132 100644 --- a/plugins/kolab_files/kolab_files.php +++ b/plugins/kolab_files/kolab_files.php @@ -103,8 +103,8 @@ class kolab_files extends rcube_plugin */ public function actions() { - $this->load_config(); - $engine = $this->engine(); - $engine->actions(); + if ($engine = $this->engine()) { + $engine->actions(); + } } } diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php index 220d4407..893077da 100644 --- a/plugins/kolab_files/lib/kolab_files_engine.php +++ b/plugins/kolab_files/lib/kolab_files_engine.php @@ -51,6 +51,21 @@ class kolab_files_engine $this->plugin->include_stylesheet($this->url . '/skins/default/images/mimetypes/style.css'); $this->plugin->include_script($this->url . '/js/files_api.js'); $this->plugin->include_script('kolab_files.js'); + + // add dialogs + if ($this->rc->task = 'mail') { + if ($this->rc->action == 'compose') { + $template = 'compose_plugin'; + } + else if ($this->rc->action == 'show' || $this->rc->action == 'preview') { + $template = 'message_plugin'; + } + } + + if (!empty($template)) { + $this->rc->output->add_footer( + $this->rc->output->parse('kolab_files.' . $template, false, false)); + } } /** diff --git a/plugins/kolab_files/skins/larry/style.css b/plugins/kolab_files/skins/larry/style.css index 57f6728e..ffcc8b47 100644 --- a/plugins/kolab_files/skins/larry/style.css +++ b/plugins/kolab_files/skins/larry/style.css @@ -1,3 +1,8 @@ +#files-dialog, +#files-compose-dialog { + display: none; +} + #files-folder-selector { position: absolute; top: 5px; diff --git a/plugins/kolab_files/skins/larry/templates/compose_plugin.html b/plugins/kolab_files/skins/larry/templates/compose_plugin.html new file mode 100644 index 00000000..2a71e571 --- /dev/null +++ b/plugins/kolab_files/skins/larry/templates/compose_plugin.html @@ -0,0 +1,6 @@ +
+
+
+
+
+
diff --git a/plugins/kolab_files/skins/larry/templates/message_plugin.html b/plugins/kolab_files/skins/larry/templates/message_plugin.html new file mode 100644 index 00000000..5d8b06e4 --- /dev/null +++ b/plugins/kolab_files/skins/larry/templates/message_plugin.html @@ -0,0 +1,3 @@ +
+
+