| | |
| | | |
| | | /* |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/html.php | |
| | | | | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2011, The Roundcube Dev Team | |
| | | | | |
| | |
| | | | | |
| | | | PURPOSE: | |
| | | | Helper class to create valid XHTML code | |
| | | | | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | |
| | | * Class for HTML code creation |
| | | * |
| | | * @package Framework |
| | | * @subpackage HTML |
| | | * @subpackage View |
| | | */ |
| | | class html |
| | | { |
| | |
| | | $attr = array('href' => $attr); |
| | | } |
| | | return self::tag('a', $attr, $cont, array_merge(self::$common_attrib, |
| | | array('href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup'))); |
| | | array('href','target','name','rel','onclick','onmouseover','onmouseout','onmousedown','onmouseup'))); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | // attributes with no value |
| | | if (in_array($key, array('checked', 'multiple', 'disabled', 'selected'))) { |
| | | if (in_array($key, array('checked', 'multiple', 'disabled', 'selected', 'autofocus'))) { |
| | | if ($value) { |
| | | $attrib_arr[] = $key . '="' . $key . '"'; |
| | | } |
| | |
| | | /** |
| | | * Class to create an HTML input field |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | class html_inputfield extends html |
| | | { |
| | |
| | | 'type','name','value','size','tabindex','autocapitalize', |
| | | 'autocomplete','checked','onchange','onclick','disabled','readonly', |
| | | 'spellcheck','results','maxlength','src','multiple','placeholder', |
| | | 'autofocus', |
| | | ); |
| | | |
| | | /** |
| | |
| | | /** |
| | | * Class to create an HTML password field |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | class html_passwordfield extends html_inputfield |
| | | { |
| | |
| | | /** |
| | | * Class to create an hidden HTML input field |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | |
| | | class html_hiddenfield extends html |
| | | { |
| | | protected $tagname = 'input'; |
| | |
| | | /** |
| | | * Class to create HTML radio buttons |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | class html_radiobutton extends html_inputfield |
| | | { |
| | |
| | | /** |
| | | * Class to create HTML checkboxes |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | class html_checkbox extends html_inputfield |
| | | { |
| | |
| | | /** |
| | | * Class to create an HTML textarea |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | class html_textarea extends html |
| | | { |
| | |
| | | * print $select->show('CH'); |
| | | * </pre> |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | class html_select extends html |
| | | { |
| | |
| | | /** |
| | | * Class to build an HTML table |
| | | * |
| | | * @package HTML |
| | | * @package Framework |
| | | * @subpackage View |
| | | */ |
| | | class html_table extends html |
| | | { |
| | |
| | | } |
| | | |
| | | $cell = new stdClass; |
| | | $cell->attrib = $attr; |
| | | $cell->attrib = $attr; |
| | | $cell->content = $cont; |
| | | |
| | | $this->rows[$this->rowindex]->cells[$this->colindex] = $cell; |
| | |
| | | } |
| | | |
| | | $cell = new stdClass; |
| | | $cell->attrib = $attr; |
| | | $cell->content = $cont; |
| | | $cell->attrib = $attr; |
| | | $cell->content = $cont; |
| | | $this->header[] = $cell; |
| | | } |
| | | |
| | | /** |
| | | /** |
| | | * Remove a column from a table |
| | | * Useful for plugins making alterations |
| | | * |
| | | * @param string $class |
| | | * |
| | | * @param string $class |
| | | */ |
| | | public function remove_column($class) |
| | | { |
| | |
| | | */ |
| | | public function show($attrib = null) |
| | | { |
| | | if (is_array($attrib)) |
| | | if (is_array($attrib)) { |
| | | $this->attrib = array_merge($this->attrib, $attrib); |
| | | } |
| | | |
| | | $thead = $tbody = ""; |
| | | |
| | |
| | | */ |
| | | public function size() |
| | | { |
| | | return count($this->rows); |
| | | return count($this->rows); |
| | | } |
| | | |
| | | /** |