From e9b5a6c2d55f1fc31715ad7ff05aed631cc12699 Mon Sep 17 00:00:00 2001 From: thomascube Date: Tue, 8 Jun 2010 20:50:15 +0000 Subject: Unify directory/mailbox list actions --- program/include/rcube_template.php | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'program/include/rcube_template.php') diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index 2f1740dc9..fec12ae19 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -770,7 +770,6 @@ class rcube_template extends rcube_html_page */ public function button($attrib) { - static $sa_buttons = array(); static $s_button_count = 100; // these commands can be called directly via url @@ -787,26 +786,11 @@ class rcube_template extends rcube_html_page else { $attrib['type'] = ($attrib['image'] || $attrib['imagepas'] || $attrib['imageact']) ? 'image' : 'link'; } + $command = $attrib['command']; - // take the button from the stack - if ($attrib['name'] && $sa_buttons[$attrib['name']]) { - $attrib = $sa_buttons[$attrib['name']]; - } - else if($attrib['image'] || $attrib['imageact'] || $attrib['imagepas'] || $attrib['class']) { - // add button to button stack - if (!$attrib['name']) { - $attrib['name'] = $command; - } - if (!$attrib['image']) { - $attrib['image'] = $attrib['imagepas'] ? $attrib['imagepas'] : $attrib['imageact']; - } - $sa_buttons[$attrib['name']] = $attrib; - } - else if ($command && $sa_buttons[$command]) { - // get saved button for this command/name - $attrib = $sa_buttons[$command]; - } + if ($attrib['task']) + $command = $attrib['task'] . '.' . $command; if (!$attrib['id']) { $attrib['id'] = sprintf('rcmbtn%d', $s_button_count++); @@ -849,6 +833,9 @@ class rcube_template extends rcube_html_page if (in_array($attrib['command'], rcmail::$main_tasks)) { $attrib['href'] = rcmail_url(null, null, $attrib['command']); } + else if ($attrib['task'] && in_array($attrib['task'], rcmail::$main_tasks)) { + $attrib['href'] = rcmail_url($attrib['command'], null, $attrib['task']); + } else if (in_array($attrib['command'], $a_static_commands)) { $attrib['href'] = rcmail_url($attrib['command']); } @@ -861,7 +848,11 @@ class rcube_template extends rcube_html_page if (!$attrib['href']) { $attrib['href'] = '#'; } - if ($command && !$attrib['onclick']) { + if ($attrib['task']) { + if ($attrib['classact']) + $attrib['class'] = $attrib['classact']; + } + else if ($command && !$attrib['onclick']) { $attrib['onclick'] = sprintf( "return %s.command('%s','%s',this)", JS_OBJECT_NAME, -- cgit v1.2.3