|
From: <ma...@us...> - 2012-03-26 20:25:46
|
Revision: 9204
http://xoops.svn.sourceforge.net/xoops/?rev=9204&view=rev
Author: mageg
Date: 2012-03-26 20:25:40 +0000 (Mon, 26 Mar 2012)
Log Message:
-----------
test for new formtext
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtext.php
XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/smilies/class/form/smilies.php
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-03-26 20:05:51 UTC (rev 9203)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/formtext.php 2012-03-26 20:25:40 UTC (rev 9204)
@@ -44,7 +44,39 @@
*/
private $_maxlength;
+ /**
+ * class for the imput
+ *
+ * @var string
+ * @access private
+ */
+ private $_class;
+
/**
+ * pattern for the imput
+ *
+ * @var string
+ * @access private
+ */
+ private $_pattern;
+
+ /**
+ * placeholder for the imput
+ *
+ * @var string
+ * @access private
+ */
+ private $_placeholder;
+
+ /**
+ * required for the imput
+ *
+ * @var boolean
+ * @access private
+ */
+ private $_required;
+
+ /**
* Constructor
*
* @param string $caption Caption
@@ -52,14 +84,22 @@
* @param int $size Size
* @param int $maxlength Maximum length of text
* @param string $value Initial text
+ * @param string $class Class of input
+ * @param string $pattern Allows a data verification with regular expressions
+ * @param string $placeholder Displays information in the imput
+ * @param string $required Indicate if the input is required
*/
- public function __construct($caption, $name, $size, $maxlength, $value = '')
+ public function __construct($caption, $name, $size, $maxlength, $value = '', $class = '', $pattern = '', $placeholder = '', $required = false)
{
$this->setCaption($caption);
$this->setName($name);
$this->_size = intval($size);
$this->_maxlength = intval($maxlength);
$this->setValue($value);
+ $this->_class = $class;
+ $this->_pattern = $pattern;
+ $this->_placeholder = $placeholder;
+ $this->_required = $required;
}
/**
@@ -83,12 +123,61 @@
}
/**
+ * Get class
+ *
+ * @return string
+ */
+ public function getClass()
+ {
+ return $this->_class;
+ }
+
+ /**
+ * Get pattern
+ *
+ * @return string
+ */
+ public function getPattern()
+ {
+ if ( $this->_pattern != '') {
+ return $this->_pattern;
+ } else {
+ return '*';
+ }
+ }
+
+ /**
+ * Get placeholder
+ *
+ * @return string
+ */
+ public function getPlaceholder()
+ {
+ return $this->_placeholder;
+ }
+
+ /**
+ * Get required
+ *
+ * @return string
+ */
+ public function getRequired()
+ {
+ if ( $this->_required == true) {
+ return 'required';
+ } else {
+ return '';
+ }
+ }
+ /**
* Prepare HTML for output
*
* @return string HTML
*/
public function render()
{
- return "<input type='text' name='" . $this->getName() . "' title='" . $this->getTitle() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . " />";
+ return "<input type='text' class='" . $this->getClass() . "' name='" . $this->getName() . "' title='" . $this->getTitle() . "' id='" . $this->getName() . "'
+ size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "' pattern='" . $this->getPattern() . "'
+ placeholder='" . $this->getPlaceholder() . "' " . $this->getExtra() . " " . $this->getRequired() . ">\n";
}
}
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/smilies/class/form/smilies.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/smilies/class/form/smilies.php 2012-03-26 20:05:51 UTC (rev 9203)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/smilies/class/form/smilies.php 2012-03-26 20:25:40 UTC (rev 9204)
@@ -40,8 +40,8 @@
parent::__construct($title, 'form', 'smilies.php', 'post', true);
$this->setExtra('enctype="multipart/form-data"');
- $this->addElement(new XoopsFormText(_AM_SMILIES_CODE, 'code', 26, 25, $obj->getVar('code')), true);
- $this->addElement(new XoopsFormText(_AM_SMILIES_DESCRIPTION, 'emotion', 50, 50, $obj->getVar('emotion')), true);
+ $this->addElement(new XoopsFormText(_AM_SMILIES_CODE, 'code', 26, 25, $obj->getVar('code'), '', '^Code(.*)$', 'Code', true), true);
+ $this->addElement(new XoopsFormText(_AM_SMILIES_DESCRIPTION, 'emotion', 50, 50, $obj->getVar('emotion'), '', '', '', true), true);
$imgtray_img = new XoopsFormElementTray( _AM_SMILIES_FILE, '<br />' );
$imgpath_img = sprintf( _AM_SMILIES_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/smilies/' );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|