Thomas Bruederli
2013-09-28 cf46aefd9d8be57722514ab0b6047fa573f46a36
Make password plugin use the new 'settings_actions' hook to register its link in the settings navigation
2 files modified
17 ■■■■ changed files
plugins/password/password.js 7 ●●●● patch | view | raw | blame | history
plugins/password/password.php 10 ●●●● patch | view | raw | blame | history
plugins/password/password.js
@@ -5,13 +5,8 @@
if (window.rcmail) {
  rcmail.addEventListener('init', function(evt) {
    // <span id="settingstabdefault" class="tablink"><roundcube:button command="preferences" type="link" label="preferences" title="editpreferences" /></span>
    var tab = $('<span>').attr('id', 'settingstabpluginpassword').addClass('tablink password');
    var button = $('<a>').attr('href', rcmail.env.comm_path+'&_action=plugin.password')
      .html(rcmail.gettext('password')).appendTo(tab);
    // add button and register commands
    rcmail.add_element(tab, 'tabs');
    // register command handler
    rcmail.register_command('plugin.password-save', function() { 
      var input_curpasswd = rcube_find_object('_curpasswd');
      var input_newpasswd = rcube_find_object('_newpasswd');
plugins/password/password.php
@@ -69,13 +69,19 @@
            }
        }
        // add Tab label
        $rcmail->output->add_label('password');
        $this->add_hook('settings_actions', array($this, 'settings_actions'));
        $this->register_action('plugin.password', array($this, 'password_init'));
        $this->register_action('plugin.password-save', array($this, 'password_save'));
        $this->include_script('password.js');
    }
    function settings_actions($args)
    {
        // register as settings action
        $args['actions'][] = array('action' => 'plugin.password', 'class' => 'password', 'label' => 'password', 'domain' => 'password');
        return $args;
    }
    function password_init()
    {
        $this->add_texts('localization/');