From df2ed0d8e6417eea9718b92324d56d524173f6e3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 14 Mar 2014 10:25:33 +0100 Subject: [PATCH] Add Settings action in PHP not in javascript, small improvements --- plugins/kolab_delegation/kolab_delegation.js | 7 ------ plugins/kolab_delegation/kolab_delegation.php | 25 +++++++++++++++++-- .../kolab_delegation/skins/larry/style.css | 4 +-- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/plugins/kolab_delegation/kolab_delegation.js b/plugins/kolab_delegation/kolab_delegation.js index 1efa70bc..d113c71f 100644 --- a/plugins/kolab_delegation/kolab_delegation.js +++ b/plugins/kolab_delegation/kolab_delegation.js @@ -38,13 +38,6 @@ window.rcmail && rcmail.addEventListener('init', function(evt) { else if (rcmail.env.task != 'settings') return; - // add Delegation section to the list - var tab = $('').attr('id', 'settingstabplugindelegation').addClass('tablink'), - button = $('').attr('href', rcmail.env.comm_path+'&_action=plugin.delegation') - .html(rcmail.gettext('tabtitle', 'kolab_delegation')) - .appendTo(tab); - rcmail.add_element(tab, 'tabs'); - if (/^plugin.delegation/.test(rcmail.env.action)) { rcmail.addEventListener('plugin.delegate_save_complete', function(e) { rcmail.delegate_save_complete(e); }); diff --git a/plugins/kolab_delegation/kolab_delegation.php b/plugins/kolab_delegation/kolab_delegation.php index 060308fb..8b4a5ef9 100644 --- a/plugins/kolab_delegation/kolab_delegation.php +++ b/plugins/kolab_delegation/kolab_delegation.php @@ -65,9 +65,15 @@ class kolab_delegation extends rcube_plugin $this->register_action('plugin.delegation-save', array($this, 'controller_action')); $this->register_action('plugin.delegation-autocomplete', array($this, 'controller_action')); + $this->add_hook('settings_actions', array($this, 'settings_actions')); + if ($this->rc->action == 'plugin.delegation' || empty($_REQUEST['_framed'])) { - $this->add_texts('localization/', array('tabtitle', 'deleteconfirm', 'savingdata', 'yes', 'no')); - $this->include_script('kolab_delegation.js'); + $this->add_texts('localization/', array('deleteconfirm', 'savingdata', 'yes', 'no')); + + if ($this->rc->action == 'plugin.delegation') { + $this->include_script('kolab_delegation.js'); + } + $this->skin_path = $this->local_skin_path(); $this->include_stylesheet($this->skin_path . '/style.css'); } @@ -78,6 +84,21 @@ class kolab_delegation extends rcube_plugin } } + /** + * Adds Delegation section in Settings + */ + function settings_actions($args) + { + $args['actions'][] = array( + 'action' => 'plugin.delegation', + 'class' => 'delegation', + 'label' => 'tabtitle', + 'domain' => 'kolab_delegation', + ); + + return $args; + } + /** * Engine object getter */ diff --git a/plugins/kolab_delegation/skins/larry/style.css b/plugins/kolab_delegation/skins/larry/style.css index 35c1bf68..eda61c17 100644 --- a/plugins/kolab_delegation/skins/larry/style.css +++ b/plugins/kolab_delegation/skins/larry/style.css @@ -1,10 +1,10 @@ /* Stylesheets for the Kolab Delegation configuration UI */ -#settings-sections #settingstabplugindelegation a { +#settings-sections span.listitem.delegation a { background: url(delegation.png) 6px 1px no-repeat; } -#settings-sections #settingstabplugindelegation.selected a { +#settings-sections span.listitem.delegation.selected a { background-position: 6px -23px; }