From: <ma...@us...> - 2012-09-08 21:49:18
|
Revision: 10157 http://xoops.svn.sourceforge.net/xoops/?rev=10157&view=rev Author: mageg Date: 2012-09-08 21:49:11 +0000 (Sat, 08 Sep 2012) Log Message: ----------- Update forms Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formcolorpicker.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdatetime.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdhtmltextarea.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formelement.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formpassword.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtext.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextarea.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextdateselect.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/testform.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/16/content.png XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/16/subcategory.png Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formcolorpicker.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formcolorpicker.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formcolorpicker.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -33,7 +33,7 @@ */ public function XoopsFormColorPicker($caption, $name, $value = '#FFFFFF') { - parent::__construct($caption, $name, 9, 7, '', $value); + parent::__construct($caption, $name, 2, 7, '', $value); } /** Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdatetime.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdatetime.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdatetime.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -32,14 +32,13 @@ * @param integer $value * @param mixed $showtime */ - public function __construct($caption, $name, $size = 15, $value = 0, $showtime = true) + public function __construct($caption, $name, $size = 2, $value = 0, $showtime = true) { parent::__construct($caption, ''); $value = intval($value); $value = ($value > 0) ? $value : time(); $datetime = getDate($value); $date = new XoopsFormTextDateSelect('', $name . '[date]', $size, $value); - $date->setClass('span2'); $this->addElement($date); if ($showtime) { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdhtmltextarea.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdhtmltextarea.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formdhtmltextarea.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -167,7 +167,12 @@ $xoops = Xoops::getInstance(); $xoops->loadLanguage('formdhtmltextarea'); - $class = ($this->getClass() != '' ? " class='" . $this->getClass() . "'" : ''); + if ($this->getCols() > $this->getMaxcols()) { + $maxcols = $this->getMaxcols(); + } else { + $maxcols = $this->getCols(); + } + $class = ($this->getClass() != '' ? " class='span" . $maxcols . " " . $this->getClass() . "'" : " class='span" . $maxcols . "'"); $extra = ($this->getExtra() != '' ? " " . $this->getExtra() : ''); $required = ($this->isRequired() ? ' required' : ''); $ret = ""; @@ -179,7 +184,7 @@ $ret .= "<input type='button' class='btn' onclick=\"XoopsCheckLength('" . $this->getName() . "', '" . @$this->configs['maxlength'] . "', '" . _XOOPS_FORM_ALT_LENGTH . "', '" . _XOOPS_FORM_ALT_LENGTH_MAX . "');\" value=' ? ' title='" . _XOOPS_FORM_ALT_CHECKLENGTH . "' />"; $ret .= "<br />\n"; // the textarea box - $ret .= "<textarea" . $class . " id='" . $this->getName() . "' name='" . $this->getName() . "' title='" . $this->getTitle() . "' onselect=\"xoopsSavePosition('" . $this->getName() . "');\" onclick=\"xoopsSavePosition('" . $this->getName() . "');\" onkeyup=\"xoopsSavePosition('" . $this->getName() . "');\" cols='" . $this->getCols() . "' rows='" . $this->getRows() . "'" . $extra . $required . ">" . $this->getValue() . "</textarea><br />\n"; + $ret .= "<textarea" . $class . " id='" . $this->getName() . "' name='" . $this->getName() . "' title='" . $this->getTitle() . "' onselect=\"xoopsSavePosition('" . $this->getName() . "');\" onclick=\"xoopsSavePosition('" . $this->getName() . "');\" onkeyup=\"xoopsSavePosition('" . $this->getName() . "');\" rows='" . $this->getRows() . "'" . $extra . $required . ">" . $this->getValue() . "</textarea><br />\n"; if (empty($this->skipPreview)) { if (empty($xoops->theme)) { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formelement.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formelement.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formelement.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -130,6 +130,14 @@ protected $_value = ''; /** + * maximum columns for a field + * + * @var integer + * @access private + */ + private $_maxcols = 12; + + /** * Generates output for the element. * * This method is abstract and must be overwritten by the child classes. @@ -517,4 +525,15 @@ } return false; } + + /** + * get the maximum columns for a field + * + * @param bool $encode To sanitizer the text? + * @return integer + */ + public function getMaxcols($encode = false) + { + return $encode ? htmlspecialchars($this->_maxcols, ENT_QUOTES) : $this->_maxcols; + } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formpassword.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formpassword.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formpassword.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -123,12 +123,17 @@ public function render() { $name = $this->getName(); - $class = ($this->getClass() != '' ? " class='" . $this->getClass() . "'" : ''); + if ($this->getSize() > $this->getMaxcols()) { + $maxcols = $this->getMaxcols(); + } else { + $maxcols = $this->getSize(); + } + $class = ($this->getClass() != '' ? " class='span" . $maxcols . " " . $this->getClass() . "'" : " class='span" . $maxcols . "'"); $pattern = ($this->getPattern() != '' ? " pattern='" . $this->getPattern() . "'" : ''); $placeholder = ($this->getPlaceholder() != '' ? " placeholder='" . $this->getPlaceholder() . "'" : ''); $extra = ($this->getExtra() != '' ? " " . $this->getExtra() : ''); $autocomplete = ($this->autoComplete ? '' : " autocomplete='off'"); $required = ($this->isRequired() ? ' required' : ''); - return "<input type='password' name='" . $name . "' title='" . $this->getTitle() . "' id='" . $name . "'" . $class ." size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $pattern . $placeholder . $extra . $autocomplete . $required . ">"; + return "<input type='password' name='" . $name . "' title='" . $this->getTitle() . "' id='" . $name . "'" . $class ."' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $pattern . $placeholder . $extra . $autocomplete . $required . ">"; } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtext.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtext.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtext.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -114,12 +114,17 @@ public function render() { $name = $this->getName(); - $class = ($this->getClass() != '' ? " class='" . $this->getClass() . "'" : ''); + if ($this->getSize() > $this->getMaxcols()) { + $maxcols = $this->getMaxcols(); + } else { + $maxcols = $this->getSize(); + } + $class = ($this->getClass() != '' ? " class='span" . $maxcols . " " . $this->getClass() . "'" : " class='span" . $maxcols . "'"); $list = ($this->isDatalist() != '' ? " list='list_" . $name . "'" : ''); $pattern = ($this->getPattern() != '' ? " pattern='" . $this->getPattern() . "'" : ''); $placeholder = ($this->getPlaceholder() != '' ? " placeholder='" . $this->getPlaceholder() . "'" : ''); $extra = ($this->getExtra() != '' ? " " . $this->getExtra() : ''); $required = ($this->isRequired() ? ' required' : ''); - return "<input type='text' name='" . $name . "' title='" . $this->getTitle() . "' id='" . $name . "'" . $class ." size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $list . $pattern . $placeholder . $extra . $required . ">"; + return "<input type='text' name='" . $name . "' title='" . $this->getTitle() . "' id='" . $name . "'" . $class ." maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $list . $pattern . $placeholder . $extra . $required . ">"; } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextarea.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextarea.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextarea.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -34,7 +34,7 @@ * @var int * @access private */ - private $_cols; + public $_cols; /** * number of rows @@ -42,7 +42,7 @@ * @var int * @access private */ - private $_rows; + public $_rows; /** * placeholder for this element @@ -50,7 +50,7 @@ * @var string * @access private */ - private $_placeholder; + public $_placeholder; /** @@ -63,7 +63,7 @@ * @param int $cols number of columns * @param string $placeholder placeholder for this element. */ - public function __construct($caption, $name, $value = "", $rows = 5, $cols = 50, $placeholder = '') + public function __construct($caption, $name, $value = "", $rows = 5, $cols = 6, $placeholder = '') { $this->setCaption($caption); $this->setName($name); @@ -115,9 +115,15 @@ { $name = $this->getName(); $class = ($this->getClass() != '' ? " class='" . $this->getClass() . "'" : ''); + if ($this->getCols() > $this->getMaxcols()) { + $maxcols = $this->getMaxcols(); + } else { + $maxcols = $this->getCols(); + } + $class = ($this->getClass() != '' ? " class='span" . $maxcols . " " . $this->getClass() . "'" : " class='span" . $maxcols . "'"); $placeholder = ($this->getPlaceholder() != '' ? " placeholder='" . $this->getPlaceholder() . "'" : ''); $extra = ($this->getExtra() != '' ? " " . $this->getExtra() : ''); $required = ($this->isRequired() ? ' required' : ''); - return "<textarea name='" . $name . "' title='" . $this->getTitle() . "' id='" . $name . "'" . $class ." rows='" . $this->getRows() . "' cols='" . $this->getCols() . "'" . $placeholder . $extra . $required . ">" . $this->getValue() . "</textarea>"; + return "<textarea name='" . $name . "' title='" . $this->getTitle() . "' id='" . $name . "'" . $class ." rows='" . $this->getRows() . "'" . $placeholder . $extra . $required . ">" . $this->getValue() . "</textarea>"; } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextdateselect.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextdateselect.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtextdateselect.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -35,11 +35,11 @@ * @param int $size * @param int $value */ - public function __construct($caption, $name, $size = 15, $value = 0) + public function __construct($caption, $name, $size = 2, $value = 0) { $value = !is_numeric($value) ? time() : intval($value); $value = ($value == 0) ? time() : $value; - parent::__construct($caption, $name, $size, 25, $value); + parent::__construct($caption, $name, $size, 2, $value); } public function render() @@ -144,9 +144,14 @@ Calendar._TT["WK"] = ""; '); } - $class = ($this->getClass() != '' ? " class='" . $this->getClass() . "'" : ''); + if ($this->getSize() > $this->getMaxcols()) { + $maxcols = $this->getMaxcols(); + } else { + $maxcols = $this->getSize(); + } + $class = ($this->getClass() != '' ? " class='span" . $maxcols . " " . $this->getClass() . "'" : " class='span" . $maxcols . "'"); $extra = ($this->getExtra() != '' ? " " . $this->getExtra() : ''); $required = ($this->isRequired() ? ' required' : ''); - return "<input type='text' name='" . $ele_name . "' id='" . $ele_name . "'" . $class ." size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $display_value . "'" . $extra . $required . " /><button class='btn' type='button' onclick='return showCalendar(\"" . $this->getName() . "\");'> ... </button>" ; + return "<input type='text' name='" . $ele_name . "' id='" . $ele_name . "'" . $class ."' maxlength='" . $this->getMaxlength() . "' value='" . $display_value . "'" . $extra . $required . " /><button class='btn' type='button' onclick='return showCalendar(\"" . $this->getName() . "\");'> ... </button>" ; } } \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/16/content.png =================================================================== (Binary files differ) Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/16/content.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/16/subcategory.png =================================================================== (Binary files differ) Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/media/xoops/images/icons/16/subcategory.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/testform.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/testform.php 2012-09-08 14:58:08 UTC (rev 10156) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/testform.php 2012-09-08 21:49:11 UTC (rev 10157) @@ -24,27 +24,23 @@ // Form Horizontal $form = new XoopsThemeForm('Form Horizontal', 'form_horizontal', 'testform.php', 'post', true, 'horizontal'); -$code = new XoopsFormText('Code', 'code', 26, 25, '','Code...'); +$code = new XoopsFormText('Code', 'code', 2, 25, '','Code...'); $code->setDescription('Description code'); -$code->setClass('span2'); $code->setPattern('^.{3,}$', 'You need at least 3 characters'); $code->setDatalist(array('list 1','list 2','list 3')); $form->addElement($code, true); -$password = new XoopsFormPassword('Password', 'password', 26, 25, '', false, 'Your Password'); +$password = new XoopsFormPassword('Password', 'password', 3, 25, '', false, 'Your Password'); $password->setDescription('Description password'); -$password->setClass('span3'); $password->setPattern('^.{8,}$', 'You need at least 8 characters'); $form->addElement($password, true); -$description = new XoopsFormTextArea('Description', 'description', '', 5, 90, 'Your description'); +$description = new XoopsFormTextArea('Description', 'description', '', 5, 6, 'Your description'); $description->setDescription('Put the description'); -$description->setClass('span5'); $form->addElement($description, true); -$description_2 = new XoopsFormDhtmlTextArea('Description_2', 'description_2', '', 5, 90); +$description_2 = new XoopsFormDhtmlTextArea('Description_2', 'description_2', '', 6, 7); $description_2->setDescription('Put the description_2'); -$description_2->setClass('span6'); $form->addElement($description_2, true); @@ -106,12 +102,11 @@ $select_optgroup->setClass('span3'); $form->addElement($select_optgroup, true); -$date = new XoopsFormTextDateSelect('Date', 'date', 15,'','Date...'); +$date = new XoopsFormTextDateSelect('Date', 'date', 2,'','Date...'); $date->setDescription('Description Date'); -$date->setClass('span2'); $form->addElement($date, true); -$date_time = new XoopsFormDateTime('Date time', 'date_time', 15,'','Date...'); +$date_time = new XoopsFormDateTime('Date time', 'date_time', 3,'','Date...'); $date_time->setDescription('Description Date time'); $form->addElement($date_time, true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |