From 581b6b41fd51549fe05afede9da647ccf6297660 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 27 Aug 2014 08:46:57 -0400
Subject: [PATCH] Make possible to set vacation start/end date and time
---
program/include/rcmail_output_html.php | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index f5430d9..a848246 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -430,6 +430,8 @@
if ($framed) {
$this->scripts = array();
$this->script_files = array();
+ $this->header = '';
+ $this->footer = '';
}
// write all javascript commands
@@ -1137,7 +1139,8 @@
*/
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');
@@ -1146,9 +1149,14 @@
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';
@@ -1156,8 +1164,21 @@
$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'];
@@ -1290,6 +1311,11 @@
$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;
}
--
Gitblit v1.9.1