From 80d74f863ee5126439ba3eaba934061c5f396b49 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 13 Feb 2014 11:00:29 +0000 Subject: [PATCH] fixed typo in adding classes causing image to be lost and cleaned up adding of classes --- phpgwapi/inc/class.html.inc.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 4b514a8af6..4eed1c2566 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -692,6 +692,9 @@ egw_LAB.wait(function() { { $options .= ' style="cursor: pointer;"'; } + // add et2_classes to "old" buttons + $classes = array('et2_button'); + if ($image != '') { $image = str_replace(array('.gif','.GIF','.png','.PNG'),'',$image); @@ -701,14 +704,11 @@ egw_LAB.wait(function() { $path = $image; // name may already contain absolut path } $image = ' src="'.$path.'"'; - if (strpos($options, 'class="') !== false) - { - $options = str_replace('class="', 'class="image_button ', $options); - } - else - { - $options .= ' class="image_button"'; - } + $classes[] = 'image_button'; + } + else + { + $classes[] = 'et_button_text'; } if (!$no_lang) { @@ -728,8 +728,6 @@ egw_LAB.wait(function() { } if ($onClick) $options .= ' onclick="'.str_replace('"','\\"',$onClick).'"'; - // add et2_classes to "old" buttons - $classes = array('et2_button', 'et2_button_text'); // add default background-image to get et2 like buttons foreach(self::$default_background_images as $img => $reg_exp) { @@ -749,9 +747,9 @@ egw_LAB.wait(function() { break; } } - if (strpos($options, 'class="')) + if (strpos($options, 'class="') !== false) { - $options = str_replace($options, 'class="', 'class="'.implode(' ', $classes).' ', $options); + $options = str_replace('class="', 'class="'.implode(' ', $classes).' ', $options); } else {