From f94e442469deca30b39f3fa08aade83cbd0ede70 Mon Sep 17 00:00:00 2001 From: thomascube Date: Fri, 16 Dec 2011 18:38:59 +0000 Subject: Add more classes and options to HTML elements for better styleability --- program/include/main.inc | 20 ++++++++++++++++++++ program/include/rcube_template.php | 11 ++++------- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'program/include') diff --git a/program/include/main.inc b/program/include/main.inc index 55f0a8aae..012ee8ddf 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1607,6 +1607,26 @@ function rcmail_display_server_error($fallback=null, $fallback_args=null) } +/** + * Generate CSS classes from mimetype and filename extension + * + * @param string Mimetype + * @param string The filename + * @return string CSS classes separated by space + */ +function rcmail_filetype2classname($mimetype, $filename) +{ + list($primary, $secondary) = explode('/', $mimetype); + + $classes = array($primary ? $primary : 'unknown'); + if ($secondary) + $classes[] = $secondary; + if (preg_match('/\.([a-z0-9]+)$/', $filename, $m)) + $classes[] = $m[1]; + + return join(" ", $classes); +} + /** * Output HTML editor scripts * diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index 06503f2f5..f65080373 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -983,14 +983,11 @@ class rcube_template extends rcube_html_page if ($attrib['label']) { $attrib['value'] = $attrib['label']; } + if ($attrib['command']) { + $attrib['disabled'] = 'disabled'; + } - $attrib_str = html::attrib_string( - $attrib, - array( - 'type', 'value', 'onclick', 'id', 'class', 'style', 'tabindex' - ) - ); - $out = sprintf('', $attrib_str); + $out = html::tag('input', $attrib, '', array('type', 'value', 'onclick', 'id', 'class', 'style', 'tabindex', 'disabled')); } // generate html code for button -- cgit v1.2.3