MDL-23486 fixed regression, sorrrrry

This commit is contained in:
Petr Skoda 2010-07-24 19:19:37 +00:00
parent ff85f9022c
commit e56458a7c7

View File

@ -22,7 +22,7 @@
require_once('PEAR.php');
require_once('HTML/Common.php');
$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] =
$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] =
array(
'group' =>array('HTML/QuickForm/group.php','HTML_QuickForm_group'),
'hidden' =>array('HTML/QuickForm/hidden.php','HTML_QuickForm_hidden'),
@ -126,7 +126,7 @@ class HTML_QuickForm extends HTML_Common {
* @since 1.0
* @var array
* @access private
*/
*/
var $_required = array();
/**
@ -134,7 +134,7 @@ class HTML_QuickForm extends HTML_Common {
* @since 1.0
* @var string
* @access public
*/
*/
var $_jsPrefix = 'Invalid information entered.';
/**
@ -142,7 +142,7 @@ class HTML_QuickForm extends HTML_Common {
* @since 1.0
* @var string
* @access public
*/
*/
var $_jsPostfix = 'Please correct these fields.';
/**
@ -298,7 +298,7 @@ class HTML_QuickForm extends HTML_Common {
default:
$this->_maxFileSize = $matches['1'];
}
}
}
} // end constructor
// }}}
@ -446,8 +446,8 @@ class HTML_QuickForm extends HTML_Common {
* Initializes constant form values.
* These values won't get overridden by POST or GET vars
*
* @param array $constantValues values used to fill the form
* @param mixed $filter (optional) filter(s) to apply to all default values
* @param array $constantValues values used to fill the form
* @param mixed $filter (optional) filter(s) to apply to all default values
*
* @since 2.0
* @access public
@ -522,8 +522,8 @@ class HTML_QuickForm extends HTML_Common {
/**
* Creates a new form element of the given type.
*
* This method accepts variable number of parameters, their
*
* This method accepts variable number of parameters, their
* meaning and count depending on $elementType
*
* @param string $elementType type of element to add (text, textarea, file...)
@ -581,9 +581,9 @@ class HTML_QuickForm extends HTML_Common {
/**
* Adds an element into the form
*
* If $element is a string representing element type, then this
* method accepts variable number of parameters, their meaning
*
* If $element is a string representing element type, then this
* method accepts variable number of parameters, their meaning
* and count depending on $element
*
* @param mixed $element element object or type of element to add (text, textarea, file...)
@ -628,7 +628,7 @@ class HTML_QuickForm extends HTML_Common {
return $elementObject;
} // end func addElement
// }}}
// {{{ insertElementBefore()
@ -725,7 +725,7 @@ class HTML_QuickForm extends HTML_Common {
$group =& $this->addElement('group', $name, $groupLabel, $elements, $separator, $appendName);
return $group;
} // end func addGroup
// }}}
// {{{ &getElement()
@ -753,8 +753,8 @@ class HTML_QuickForm extends HTML_Common {
/**
* Returns the element's raw value
*
* This returns the value as submitted by the form (not filtered)
*
* This returns the value as submitted by the form (not filtered)
* or set via setDefaults() or setConstants()
*
* @param string $element Element name
@ -794,7 +794,7 @@ class HTML_QuickForm extends HTML_Common {
* @since 2.0
* @access public
* @return mixed submitted element value or null if not set
*/
*/
function getSubmitValue($elementName)
{
$value = null;
@ -831,7 +831,7 @@ class HTML_QuickForm extends HTML_Common {
}
}
}
// This is only supposed to work for groups with appendName = false
if (null === $value && 'group' == $this->getElementType($elementName)) {
$group =& $this->getElement($elementName);
@ -889,7 +889,7 @@ class HTML_QuickForm extends HTML_Common {
return $this->_errors[$element];
}
} // end func getElementError
// }}}
// {{{ setElementError()
@ -898,7 +898,7 @@ class HTML_QuickForm extends HTML_Common {
*
* @param string $element Name of form element to set error for
* @param string $message Error message, if empty then removes the current error message
* @since 1.0
* @since 1.0
* @access public
* @return void
*/
@ -910,7 +910,7 @@ class HTML_QuickForm extends HTML_Common {
unset($this->_errors[$element]);
}
} // end func setElementError
// }}}
// {{{ getElementType()
@ -968,11 +968,11 @@ class HTML_QuickForm extends HTML_Common {
* Removes an element
*
* The method "unlinks" an element from the form, returning the reference
* to the element object. If several elements named $elementName exist,
* to the element object. If several elements named $elementName exist,
* it removes the first one, leaving the others intact.
*
*
* @param string $elementName The element name
* @param boolean $removeRules True if rules for this element are to be removed too
* @param boolean $removeRules True if rules for this element are to be removed too
* @access public
* @since 2.0
* @return object HTML_QuickForm_element a reference to the removed element
@ -1004,7 +1004,7 @@ class HTML_QuickForm extends HTML_Common {
* Adds a validation rule for the given field
*
* If the element is in fact a group, it will be considered as a whole.
* To validate grouped elements as separated entities,
* To validate grouped elements as separated entities,
* use addGroupRule instead of addRule.
*
* @param string $element Form element name
@ -1108,7 +1108,7 @@ class HTML_QuickForm extends HTML_Common {
$this->_rules[$elementName][] = array(
'type' => $type,
'format' => $format,
'format' => $format,
'message' => $rule[0],
'validation' => $validation,
'reset' => $reset,
@ -1145,7 +1145,7 @@ class HTML_QuickForm extends HTML_Common {
}
$this->_rules[$group][] = array('type' => $type,
'format' => $format,
'format' => $format,
'message' => $arg1,
'validation' => $validation,
'howmany' => $howmany,
@ -1163,13 +1163,13 @@ class HTML_QuickForm extends HTML_Common {
// {{{ addFormRule()
/**
* Adds a global validation rule
*
* Adds a global validation rule
*
* This should be used when for a rule involving several fields or if
* you want to use some completely custom validation for your form.
* The rule function/method should return true in case of successful
* The rule function/method should return true in case of successful
* validation and array('element name' => 'error') when there were errors.
*
*
* @access public
* @param mixed Callback, either function name or array(&$object, 'method')
* @throws HTML_QuickForm_Error
@ -1181,7 +1181,7 @@ class HTML_QuickForm extends HTML_Common {
}
$this->_formRules[] = $rule;
}
// }}}
// {{{ applyFilter()
@ -1415,7 +1415,7 @@ class HTML_QuickForm extends HTML_Common {
$this->_jsPrefix = $pref;
$this->_jsPostfix = $post;
} // end func setJsWarnings
// }}}
// {{{ setRequiredNote()
@ -1458,7 +1458,7 @@ class HTML_QuickForm extends HTML_Common {
*/
function validate()
{
if (count($this->_rules) == 0 && count($this->_formRules) == 0 &&
if (count($this->_rules) == 0 && count($this->_formRules) == 0 &&
$this->isSubmitted()) {
return (0 == count($this->_errors));
} elseif (!$this->isSubmitted()) {
@ -1506,6 +1506,8 @@ class HTML_QuickForm extends HTML_Common {
//horrible horrible hack
if (!isset($submitValue['text']) or $submitValue['text'] === '') {
$result = false;
} else {
$result = true;
}
} elseif (is_array($submitValue) && !isset($rule['howmany'])) {
$result = $registry->validate($rule['type'], $submitValue, $rule['format'], true);
@ -1573,7 +1575,7 @@ class HTML_QuickForm extends HTML_Common {
}
return true;
} // end func freeze
// }}}
// {{{ isFrozen()
@ -1752,7 +1754,7 @@ class HTML_QuickForm extends HTML_Common {
if (count($test) > 0) {
return
"\n<script type=\"text/javascript\">\n" .
"//<![CDATA[\n" .
"//<![CDATA[\n" .
"function validate_" . $this->_attributes['id'] . "(frm) {\n" .
" var value = '';\n" .
" var errFlag = new Array();\n" .
@ -1796,7 +1798,7 @@ class HTML_QuickForm extends HTML_Common {
* Returns the form's contents in an array.
*
* The description of the array structure is in HTML_QuickForm_Renderer_Array docs
*
*
* @since 2.0
* @access public
* @param bool Whether to collect hidden elements (passed to the Renderer's constructor)
@ -1815,7 +1817,7 @@ class HTML_QuickForm extends HTML_Common {
/**
* Returns a 'safe' element's value
*
*
* This method first tries to find a cleaned-up submitted value,
* it will return a value set by setValue()/setDefaults()/setConstants()
* if submitted value does not exist for the given element.
@ -1850,9 +1852,9 @@ class HTML_QuickForm extends HTML_Common {
/**
* Returns 'safe' elements' values
*
* Unlike getSubmitValues(), this will return only the values
* Unlike getSubmitValues(), this will return only the values
* corresponding to the elements present in the form.
*
*
* @param mixed Array/string of element names, whose values we want. If not set then return all elements.
* @access public
* @return array An assoc array of elements' values