From c41a86e5cc26dc8ae37ed4b3fddcaa195b1616a4 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 06 Aug 2012 12:00:38 -0400
Subject: [PATCH] Updated translations from launchpad

---
 plugins/help/help.php |  121 +++++++++++++++++++++-------------------
 1 files changed, 64 insertions(+), 57 deletions(-)

diff --git a/plugins/help/help.php b/plugins/help/help.php
index 336321c..1a76cbb 100644
--- a/plugins/help/help.php
+++ b/plugins/help/help.php
@@ -4,87 +4,94 @@
  * Help Plugin
  *
  * @author Aleksander 'A.L.E.C' Machniak
- * @licence GNU GPL
+ * @license GNU GPLv3+
  *
- * Enable the plugin in config/main.inc.php and set Help content iframe source
- *   $rcmail_config['help_source'] = 'http://trac.roundcube.net/wiki';
+ * Configuration (see config.inc.php.dist)
  * 
  **/
- 
+
 class help extends rcube_plugin
 {
+    // all task excluding 'login' and 'logout'
+    public $task = '?(?!login|logout).*';
+    // we've got no ajax handlers
+    public $noajax = true;
+    // skip frames
+    public $noframe = true;
+
     function init()
     {
-      $this->add_texts('localization/', false);
-      
-      // register actions
-      $this->register_action('plugin.help', array($this, 'action'));
-      $this->register_action('plugin.helpabout', array($this, 'action'));
-      $this->register_action('plugin.helplicense', array($this, 'action'));
+        $rcmail = rcmail::get_instance();
 
-      // add taskbar button
-      $this->add_button(array(
-	'name' 	=> 'helptask',
-	'class'	=> 'button-help',
-	'label'	=> 'help.help',
-	'href'	=> './?_task=dummy&_action=plugin.help',
+        $this->add_texts('localization/', false);
+
+        // register task
+        $this->register_task('help');
+
+        // register actions
+        $this->register_action('index', array($this, 'action'));
+        $this->register_action('about', array($this, 'action'));
+        $this->register_action('license', array($this, 'action'));
+
+        // add taskbar button
+        $this->add_button(array(
+            'command'    => 'help',
+            'class'      => 'button-help',
+            'classsel'   => 'button-help button-selected',
+            'innerclass' => 'button-inner',
+            'label'      => 'help.help',
         ), 'taskbar');
 
-      $skin = rcmail::get_instance()->config->get('skin');
-      if (!file_exists($this->home."/skins/$skin/help.css"))
-	$skin = 'default';
-
-      // add style for taskbar button (must be here) and Help UI    
-      $this->include_stylesheet("skins/$skin/help.css");
+        // add style for taskbar button (must be here) and Help UI
+        $skin_path = $this->local_skin_path();
+        if (is_file($this->home . "/$skin_path/help.css")) {
+            $this->include_stylesheet("$skin_path/help.css");
+        }
     }
 
     function action()
     {
-      $rcmail = rcmail::get_instance();
+        $rcmail = rcmail::get_instance();
 
-      // register UI objects
-      $rcmail->output->add_handlers(array(
-	    'helpcontent' => array($this, 'content'),
-      ));
+        $this->load_config();
 
-      if ($rcmail->action == 'plugin.helpabout')
-	$rcmail->output->set_pagetitle($this->gettext('about'));
-      else if ($rcmail->action == 'plugin.helplicense')
-        $rcmail->output->set_pagetitle($this->gettext('license'));
-      else
-        $rcmail->output->set_pagetitle($this->gettext('help'));
+        // register UI objects
+        $rcmail->output->add_handlers(array(
+            'helpcontent' => array($this, 'content'),
+        ));
 
-      $rcmail->output->send('help.help');
+        if ($rcmail->action == 'about')
+            $rcmail->output->set_pagetitle($this->gettext('about'));
+        else if ($rcmail->action == 'license')
+            $rcmail->output->set_pagetitle($this->gettext('license'));
+        else
+            $rcmail->output->set_pagetitle($this->gettext('help'));
+
+        $rcmail->output->send('help.help');
     }
-    
+
     function content($attrib)
     {
-      $rcmail = rcmail::get_instance();
+        $rcmail = rcmail::get_instance();
 
-      if ($rcmail->action == 'plugin.helpabout') {
-	return @file_get_contents($this->home.'/content/about.html');
-      }
-      else if ($rcmail->action == 'plugin.helplicense') {
-	return @file_get_contents($this->home.'/content/license.html');
-      }
+        if ($rcmail->action == 'about') {
+            return @file_get_contents($this->home.'/content/about.html');
+        }
+        else if ($rcmail->action == 'license') {
+            return @file_get_contents($this->home.'/content/license.html');
+        }
 
-      // default content: iframe
+        // default content: iframe
+        if ($src = $rcmail->config->get('help_source'))
+            $attrib['src'] = $src;
 
-      if ($src = $rcmail->config->get('help_source'))
-	$attrib['src'] = $src;
+        if (empty($attrib['id']))
+            $attrib['id'] = 'rcmailhelpcontent';
 
-      if (empty($attrib['id']))
-        $attrib['id'] = 'rcmailhelpcontent';
-    
-      // allow the following attributes to be added to the <iframe> tag
-      $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));
-      $framename = $attrib['id'];
+        $attrib['name'] = $attrib['id'];
 
-      $out = sprintf('<iframe name="%s"%s></iframe>'."\n", $framename, $attrib_str);
-    
-      return $out;
+        return html::tag('iframe', $attrib, '', array(
+            'id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));
     }
-    
-}
 
-?>
+}

--
Gitblit v1.9.1