From a1335b963f47c160c916d88898e92ac5456e858b Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 14 Mar 2014 10:08:58 +0100 Subject: [PATCH] Add Settings section in PHP not javascript, small improvements --- plugins/kolab_activesync/kolab_activesync.js | 22 +---------------- plugins/kolab_activesync/kolab_activesync.php | 24 +++++++++++++++++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/plugins/kolab_activesync/kolab_activesync.js b/plugins/kolab_activesync/kolab_activesync.js index d9e2943e..1f625e6b 100644 --- a/plugins/kolab_activesync/kolab_activesync.js +++ b/plugins/kolab_activesync/kolab_activesync.js @@ -159,25 +159,5 @@ function kolab_activesync_config() window.rcmail && rcmail.addEventListener('init', function(evt) { - // add button to tabs list - var tab = $('').attr('id', 'settingstabpluginactivesync').addClass('tablink'), - button = $('').attr('href', rcmail.env.comm_path+'&_action=plugin.activesync') - .html(rcmail.gettext('tabtitle', 'kolab_activesync')) - .appendTo(tab); - rcmail.add_element(tab, 'tabs'); - - if (/^plugin.activesync/.test(rcmail.env.action)) - activesync_object = new kolab_activesync_config(); + activesync_object = new kolab_activesync_config(); }); - - -// extend jQuery -(function($){ - $.fn.serializeJSON = function(){ - var json = {}; - jQuery.map($(this).serializeArray(), function(n, i) { - json[n['name']] = n['value']; - }); - return json; - }; -})(jQuery); diff --git a/plugins/kolab_activesync/kolab_activesync.php b/plugins/kolab_activesync/kolab_activesync.php index 05e1f354..a7ee1014 100644 --- a/plugins/kolab_activesync/kolab_activesync.php +++ b/plugins/kolab_activesync/kolab_activesync.php @@ -52,8 +52,28 @@ class kolab_activesync extends rcube_plugin $this->register_action('plugin.activesync-config', array($this, 'config_frame')); $this->register_action('plugin.activesync-json', array($this, 'json_command')); - $this->add_texts('localization/', true); - $this->include_script('kolab_activesync.js'); + $this->add_hook('settings_actions', array($this, 'settings_actions')); + + $this->add_texts('localization/', array('devicedeleteconfirm', 'savingdata')); + + if (strpos($this->rc->action, 'plugin.activesync') === 0) { + $this->include_script('kolab_activesync.js'); + } + } + + /** + * Adds Activesync section in Settings + */ + function settings_actions($args) + { + $args['actions'][] = array( + 'action' => 'plugin.activesync', + 'class' => 'activesync', + 'label' => 'tabtitle', + 'domain' => 'kolab_activesync', + ); + + return $args; } /**