From: <du...@us...> - 2012-10-08 21:24:52
|
Revision: 10208 http://sourceforge.net/p/xoops/svn/10208 Author: dugris Date: 2012-10-08 21:24:50 +0000 (Mon, 08 Oct 2012) Log Message: ----------- update forms class Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formmail.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formradio.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formurl.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formmail.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formmail.php 2012-10-08 20:39:33 UTC (rev 10207) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formmail.php 2012-10-08 21:24:50 UTC (rev 10208) @@ -26,34 +26,9 @@ /** * A simple text field */ -class XoopsFormMail extends XoopsFormElement +class XoopsFormMail extends XoopsFormText { /** - * Size - * - * @var int - * @access private - */ - private $_size; - - /** - * Maximum length of the text - * - * @var int - * @access private - */ - - private $_maxlength; - - /** - * placeholder for this element - * - * @var string - * @access private - */ - private $_placeholder; - - /** * Constructor * * @param string $caption Caption @@ -64,50 +39,12 @@ * @param string $placeholder placeholder for this element. */ public function __construct($caption, $name, $size, $maxlength, $value = '', $placeholder = '') - { - $this->setCaption($caption); - $this->setName($name); - $this->_size = intval($size); - $this->_maxlength = intval($maxlength); - $this->setValue($value); - $this->_placeholder = $placeholder; + { + parent::__construct($caption, $name, $size, $maxlength, $value, $placeholder); $this->setPattern('[^@]+@[^@]+\.[a-zA-Z]{2,6}', _FORM_VALID_MAIL); } /** - * Get size - * - * @return int - */ - public function getSize() - { - return $this->_size; - } - - /** - * Get maximum text length - * - * @return int - */ - public function getMaxlength() - { - return $this->_maxlength; - } - - /** - * Get placeholder for this element - * - * @return string - */ - public function getPlaceholder() - { - if (empty($this->_placeholder)) { - return ''; - } - return $this->_placeholder; - } - - /** * Prepare HTML for output * * @return string HTML Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formradio.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formradio.php 2012-10-08 20:39:33 UTC (rev 10207) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formradio.php 2012-10-08 21:24:50 UTC (rev 10208) @@ -154,6 +154,7 @@ $ele_inline = $this->getInline(); $class = ($this->getClass() != '' ? " class='" . $this->getClass() . "'" : ''); $extra = ($this->getExtra() != '' ? " " . $this->getExtra() : ''); + $required = ($this->isRequired() ? ' required' : ''); $ret = ""; $id_ele = 0; foreach ($ele_options as $value => $name) { @@ -164,7 +165,7 @@ } $id_ele++; $ret .= "<label class='radio" . $ele_inline . "'>" . NWLINE; - $ret .= "<input type='radio' name='" . $ele_name . "' title='" . $ele_title . "' id='" . $ele_name . $id_ele . "' value='" . $value . "'" . $class . $extra . $ele_checked . ">" . NWLINE; + $ret .= "<input type='radio' name='" . $ele_name . "' title='" . $ele_title . "' id='" . $ele_name . $id_ele . "' value='" . $value . "'" . $class . $extra . $ele_checked . $required . ">" . NWLINE; $ret .= $name . NWLINE; $ret .= "</label>" . NWLINE; } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formurl.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formurl.php 2012-10-08 20:39:33 UTC (rev 10207) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formurl.php 2012-10-08 21:24:50 UTC (rev 10208) @@ -26,34 +26,9 @@ /** * A simple text field */ -class XoopsFormUrl extends XoopsFormElement +class XoopsFormUrl extends XoopsFormText { /** - * Size - * - * @var int - * @access private - */ - private $_size; - - /** - * Maximum length of the text - * - * @var int - * @access private - */ - - private $_maxlength; - - /** - * placeholder for this element - * - * @var string - * @access private - */ - private $_placeholder; - - /** * Constructor * * @param string $caption Caption @@ -65,53 +40,10 @@ */ public function __construct($caption, $name, $size, $maxlength, $value = '', $placeholder = '') { - $this->setCaption($caption); - $this->setName($name); - $this->_size = intval($size); - $this->_maxlength = intval($maxlength); - $this->setValue($value); - $this->_placeholder = $placeholder; + parent::__construct($caption, $name, $size, $maxlength, $value, $placeholder); $this->setPattern('https?://.+', _FORM_VALID_URL); } - /** - * Get size - * - * @return int - */ - public function getSize() - { - return $this->_size; - } - - /** - * Get maximum text length - * - * @return int - */ - public function getMaxlength() - { - return $this->_maxlength; - } - - /** - * Get placeholder for this element - * - * @return string - */ - public function getPlaceholder() - { - if (empty($this->_placeholder)) { - return ''; - } - return $this->_placeholder; - } - - /** - * Prepare HTML for output - * - * @return string HTML - */ public function render() { $name = $this->getName(); |