6 * @author Aleksander 'A.L.E.C' Machniak
9 * Configuration (see config.inc.php.dist)
13 class help extends rcube_plugin
15 // all task excluding 'login' and 'logout'
16 public $task = '?(?!login|logout).*';
17 // we've got no ajax handlers
18 public $noajax = true;
20 public $noframe = true;
24 $rcmail = rcmail::get_instance();
26 $this->add_texts('localization/', false);
29 $this->register_task('help');
32 $this->register_action('', array($this, 'action'));
33 $this->register_action('about', array($this, 'action'));
34 $this->register_action('license', array($this, 'action'));
37 $this->add_button(array(
39 'class' => 'button-help',
40 'label' => 'help.help',
41 'href' => './?_task=help',
42 'onclick' => sprintf("return %s.command('help')", JS_OBJECT_NAME)
45 $rcmail->output->add_script(
46 JS_OBJECT_NAME . ".enable_command('help', true);\n" .
47 JS_OBJECT_NAME . ".help = function () { location.href = './?_task=help'; }",
50 $skin = $rcmail->config->get('skin');
51 if (!file_exists($this->home."/skins/$skin/help.css"))
54 // add style for taskbar button (must be here) and Help UI
55 $this->include_stylesheet("skins/$skin/help.css");
60 $rcmail = rcmail::get_instance();
64 // register UI objects
65 $rcmail->output->add_handlers(array(
66 'helpcontent' => array($this, 'content'),
69 if ($rcmail->action == 'about')
70 $rcmail->output->set_pagetitle($this->gettext('about'));
71 else if ($rcmail->action == 'license')
72 $rcmail->output->set_pagetitle($this->gettext('license'));
74 $rcmail->output->set_pagetitle($this->gettext('help'));
76 $rcmail->output->send('help.help');
79 function content($attrib)
81 $rcmail = rcmail::get_instance();
83 if ($rcmail->action == 'about') {
84 return @file_get_contents($this->home.'/content/about.html');
86 else if ($rcmail->action == 'license') {
87 return @file_get_contents($this->home.'/content/license.html');
90 // default content: iframe
92 if ($src = $rcmail->config->get('help_source'))
93 $attrib['src'] = $src;
95 if (empty($attrib['id']))
96 $attrib['id'] = 'rcmailhelpcontent';
98 // allow the following attributes to be added to the <iframe> tag
99 $attrib_str = create_attrib_string($attrib, array(
100 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));
102 $out = sprintf('<iframe name="%s"%s></iframe>'."\n", $attrib['id'], $attrib_str);