| | |
| | | $attrib['name'] = $this->eval_expression($attrib['expression']); |
| | | |
| | | if ($attrib['name'] || $attrib['command']) { |
| | | // @FIXME: 'noshow' is useless, remove? |
| | | if ($attrib['noshow']) { |
| | | return ''; |
| | | } |
| | | |
| | | $vars = $attrib + array('product' => $this->config->get('product_name')); |
| | | unset($vars['name'], $vars['command']); |
| | | |
| | | $label = $this->app->gettext($attrib + array('vars' => $vars)); |
| | | $quoting = !empty($attrib['quoting']) ? strtolower($attrib['quoting']) : (rcube_utils::get_boolean((string)$attrib['html']) ? 'no' : ''); |
| | | |
| | | // 'noshow' can be used in skins to define new labels |
| | | if ($attrib['noshow']) { |
| | | return ''; |
| | | } |
| | | |
| | | switch ($quoting) { |
| | | case 'no': |
| | |
| | | */ |
| | | public function button($attrib) |
| | | { |
| | | static $s_button_count = 100; |
| | | static $s_button_count = 100; |
| | | static $disabled_actions = null; |
| | | |
| | | // these commands can be called directly via url |
| | | $a_static_commands = array('compose', 'list', 'preferences', 'folders', 'identities'); |
| | |
| | | return ''; |
| | | } |
| | | |
| | | |
| | | // try to find out the button type |
| | | if ($attrib['type']) { |
| | | $attrib['type'] = strtolower($attrib['type']); |
| | | if ($pos = strpos($attrib['type'], '-menuitem')) { |
| | | $attrib['type'] = substr($attrib['type'], 0, -9); |
| | | $menuitem = true; |
| | | } |
| | | } |
| | | else { |
| | | $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $attrib['imageact']) ? 'image' : 'link'; |
| | |
| | | |
| | | $command = $attrib['command']; |
| | | |
| | | if ($attrib['task']) |
| | | $command = $attrib['task'] . '.' . $command; |
| | | if ($attrib['task']) { |
| | | $element = $command = $attrib['task'] . '.' . $command; |
| | | } |
| | | else { |
| | | $element = ($this->env['task'] ? $this->env['task'] . '.' : '') . $command; |
| | | } |
| | | |
| | | if ($disabled_actions === null) { |
| | | $disabled_actions = (array) $this->config->get('disabled_actions'); |
| | | } |
| | | |
| | | // remove buttons for disabled actions |
| | | if (in_array($element, $disabled_actions)) { |
| | | return ''; |
| | | } |
| | | |
| | | if (!$attrib['image']) { |
| | | $attrib['image'] = $attrib['imagepas'] ? $attrib['imagepas'] : $attrib['imageact']; |
| | |
| | | $out = html::tag($attrib['wrapper'], null, $out); |
| | | } |
| | | |
| | | if ($menuitem) { |
| | | $class = $attrib['menuitem-class'] ? ' class="' . $attrib['menuitem-class'] . '"' : ''; |
| | | $out = '<li role="menuitem"' . $class . '>' . $out . '</li>'; |
| | | } |
| | | |
| | | return $out; |
| | | } |
| | | |