Add Settings action in PHP not in javascript, small improvements

This commit is contained in:
Aleksander Machniak 2014-03-14 10:25:33 +01:00
parent a1335b963f
commit df2ed0d8e6
3 changed files with 25 additions and 11 deletions

View file

@ -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 = $('<span>').attr('id', 'settingstabplugindelegation').addClass('tablink'),
button = $('<a>').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); });

View file

@ -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
*/

View file

@ -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;
}