Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libs/HTML/QuickForm')
-rwxr-xr-xlibs/HTML/QuickForm/Renderer.php316
-rwxr-xr-xlibs/HTML/QuickForm/Renderer/Array.php678
-rwxr-xr-xlibs/HTML/QuickForm/Renderer/ArraySmarty.php802
-rwxr-xr-xlibs/HTML/QuickForm/Rule.php162
-rwxr-xr-xlibs/HTML/QuickForm/Rule/Callback.php246
-rwxr-xr-xlibs/HTML/QuickForm/Rule/Compare.php210
-rwxr-xr-xlibs/HTML/QuickForm/Rule/Email.php144
-rwxr-xr-xlibs/HTML/QuickForm/Rule/Range.php148
-rwxr-xr-xlibs/HTML/QuickForm/Rule/Regex.php200
-rwxr-xr-xlibs/HTML/QuickForm/Rule/Required.php126
-rwxr-xr-xlibs/HTML/QuickForm/RuleRegistry.php698
-rwxr-xr-xlibs/HTML/QuickForm/advcheckbox.php572
-rwxr-xr-xlibs/HTML/QuickForm/autocomplete.php516
-rwxr-xr-xlibs/HTML/QuickForm/button.php160
-rwxr-xr-xlibs/HTML/QuickForm/checkbox.php554
-rwxr-xr-xlibs/HTML/QuickForm/date.php1020
-rwxr-xr-xlibs/HTML/QuickForm/element.php986
-rwxr-xr-xlibs/HTML/QuickForm/file.php716
-rwxr-xr-xlibs/HTML/QuickForm/group.php1174
-rwxr-xr-xlibs/HTML/QuickForm/header.php148
-rwxr-xr-xlibs/HTML/QuickForm/hidden.php188
-rwxr-xr-xlibs/HTML/QuickForm/hiddenselect.php236
-rwxr-xr-xlibs/HTML/QuickForm/hierselect.php1184
-rwxr-xr-xlibs/HTML/QuickForm/html.php154
-rwxr-xr-xlibs/HTML/QuickForm/image.php254
-rwxr-xr-xlibs/HTML/QuickForm/input.php418
-rwxr-xr-xlibs/HTML/QuickForm/link.php400
-rwxr-xr-xlibs/HTML/QuickForm/password.php230
-rwxr-xr-xlibs/HTML/QuickForm/radio.php502
-rwxr-xr-xlibs/HTML/QuickForm/reset.php158
-rwxr-xr-xlibs/HTML/QuickForm/select.php1228
-rwxr-xr-xlibs/HTML/QuickForm/static.php402
-rwxr-xr-xlibs/HTML/QuickForm/submit.php178
-rwxr-xr-xlibs/HTML/QuickForm/text.php196
-rwxr-xr-xlibs/HTML/QuickForm/textarea.php458
-rwxr-xr-xlibs/HTML/QuickForm/xbutton.php306
36 files changed, 8034 insertions, 8034 deletions
diff --git a/libs/HTML/QuickForm/Renderer.php b/libs/HTML/QuickForm/Renderer.php
index 9524dfd4f7..970d4367d8 100755
--- a/libs/HTML/QuickForm/Renderer.php
+++ b/libs/HTML/QuickForm/Renderer.php
@@ -1,158 +1,158 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * An abstract base class for QuickForm renderers
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- *
- * The class implements a Visitor design pattern
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.0
- * @abstract
- */
-class HTML_QuickForm_Renderer
-{
- /**
- * Constructor
- *
- * @access public
- */
- function HTML_QuickForm_Renderer()
- {
- } // end constructor
-
- /**
- * Called when visiting a form, before processing any form elements
- *
- * @param HTML_QuickForm a form being visited
- * @access public
- * @return void
- * @abstract
- */
- function startForm(&$form)
- {
- return;
- } // end func startForm
-
- /**
- * Called when visiting a form, after processing all form elements
- *
- * @param HTML_QuickForm a form being visited
- * @access public
- * @return void
- * @abstract
- */
- function finishForm(&$form)
- {
- return;
- } // end func finishForm
-
- /**
- * Called when visiting a header element
- *
- * @param HTML_QuickForm_header a header element being visited
- * @access public
- * @return void
- * @abstract
- */
- function renderHeader(&$header)
- {
- return;
- } // end func renderHeader
-
- /**
- * Called when visiting an element
- *
- * @param HTML_QuickForm_element form element being visited
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- * @access public
- * @return void
- * @abstract
- */
- function renderElement(&$element, $required, $error)
- {
- return;
- } // end func renderElement
-
- /**
- * Called when visiting a hidden element
- *
- * @param HTML_QuickForm_element a hidden element being visited
- * @access public
- * @return void
- * @abstract
- */
- function renderHidden(&$element)
- {
- return;
- } // end func renderHidden
-
- /**
- * Called when visiting a raw HTML/text pseudo-element
- *
- * Only implemented in Default renderer. Usage of 'html' elements is
- * discouraged, templates should be used instead.
- *
- * @param HTML_QuickForm_html a 'raw html' element being visited
- * @access public
- * @return void
- * @abstract
- */
- function renderHtml(&$data)
- {
- return;
- } // end func renderHtml
-
- /**
- * Called when visiting a group, before processing any group elements
- *
- * @param HTML_QuickForm_group A group being visited
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- * @abstract
- */
- function startGroup(&$group, $required, $error)
- {
- return;
- } // end func startGroup
-
- /**
- * Called when visiting a group, after processing all group elements
- *
- * @param HTML_QuickForm_group A group being visited
- * @access public
- * @return void
- * @abstract
- */
- function finishGroup(&$group)
- {
- return;
- } // end func finishGroup
-} // end class HTML_QuickForm_Renderer
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * An abstract base class for QuickForm renderers
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * An abstract base class for QuickForm renderers
+ *
+ * The class implements a Visitor design pattern
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.0
+ * @abstract
+ */
+class HTML_QuickForm_Renderer
+{
+ /**
+ * Constructor
+ *
+ * @access public
+ */
+ function HTML_QuickForm_Renderer()
+ {
+ } // end constructor
+
+ /**
+ * Called when visiting a form, before processing any form elements
+ *
+ * @param HTML_QuickForm a form being visited
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function startForm(&$form)
+ {
+ return;
+ } // end func startForm
+
+ /**
+ * Called when visiting a form, after processing all form elements
+ *
+ * @param HTML_QuickForm a form being visited
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function finishForm(&$form)
+ {
+ return;
+ } // end func finishForm
+
+ /**
+ * Called when visiting a header element
+ *
+ * @param HTML_QuickForm_header a header element being visited
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function renderHeader(&$header)
+ {
+ return;
+ } // end func renderHeader
+
+ /**
+ * Called when visiting an element
+ *
+ * @param HTML_QuickForm_element form element being visited
+ * @param bool Whether an element is required
+ * @param string An error message associated with an element
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function renderElement(&$element, $required, $error)
+ {
+ return;
+ } // end func renderElement
+
+ /**
+ * Called when visiting a hidden element
+ *
+ * @param HTML_QuickForm_element a hidden element being visited
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function renderHidden(&$element)
+ {
+ return;
+ } // end func renderHidden
+
+ /**
+ * Called when visiting a raw HTML/text pseudo-element
+ *
+ * Only implemented in Default renderer. Usage of 'html' elements is
+ * discouraged, templates should be used instead.
+ *
+ * @param HTML_QuickForm_html a 'raw html' element being visited
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function renderHtml(&$data)
+ {
+ return;
+ } // end func renderHtml
+
+ /**
+ * Called when visiting a group, before processing any group elements
+ *
+ * @param HTML_QuickForm_group A group being visited
+ * @param bool Whether a group is required
+ * @param string An error message associated with a group
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function startGroup(&$group, $required, $error)
+ {
+ return;
+ } // end func startGroup
+
+ /**
+ * Called when visiting a group, after processing all group elements
+ *
+ * @param HTML_QuickForm_group A group being visited
+ * @access public
+ * @return void
+ * @abstract
+ */
+ function finishGroup(&$group)
+ {
+ return;
+ } // end func finishGroup
+} // end class HTML_QuickForm_Renderer
+?>
diff --git a/libs/HTML/QuickForm/Renderer/Array.php b/libs/HTML/QuickForm/Renderer/Array.php
index b8eab80b7a..fd2fefc60e 100755
--- a/libs/HTML/QuickForm/Renderer/Array.php
+++ b/libs/HTML/QuickForm/Renderer/Array.php
@@ -1,340 +1,340 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an array of form contents
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- */
-require_once 'HTML/QuickForm/Renderer.php';
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an array of form contents
- *
- * Based on old HTML_QuickForm::toArray() code.
- *
- * The form array structure is the following:
- * <pre>
- * array(
- * 'frozen' => 'whether the form is frozen',
- * 'javascript' => 'javascript for client-side validation',
- * 'attributes' => 'attributes for <form> tag',
- * 'requirednote => 'note about the required elements',
- * // if we set the option to collect hidden elements
- * 'hidden' => 'collected html of all hidden elements',
- * // if there were some validation errors:
- * 'errors' => array(
- * '1st element name' => 'Error for the 1st element',
- * ...
- * 'nth element name' => 'Error for the nth element'
- * ),
- * // if there are no headers in the form:
- * 'elements' => array(
- * element_1,
- * ...
- * element_N
- * )
- * // if there are headers in the form:
- * 'sections' => array(
- * array(
- * 'header' => 'Header text for the first header',
- * 'name' => 'Header name for the first header',
- * 'elements' => array(
- * element_1,
- * ...
- * element_K1
- * )
- * ),
- * ...
- * array(
- * 'header' => 'Header text for the Mth header',
- * 'name' => 'Header name for the Mth header',
- * 'elements' => array(
- * element_1,
- * ...
- * element_KM
- * )
- * )
- * )
- * );
- * </pre>
- *
- * where element_i is an array of the form:
- * <pre>
- * array(
- * 'name' => 'element name',
- * 'value' => 'element value',
- * 'type' => 'type of the element',
- * 'frozen' => 'whether element is frozen',
- * 'label' => 'label for the element',
- * 'required' => 'whether element is required',
- * 'error' => 'error associated with the element',
- * 'style' => 'some information about element style (e.g. for Smarty)',
- * // if element is not a group
- * 'html' => 'HTML for the element'
- * // if element is a group
- * 'separator' => 'separator for group elements',
- * 'elements' => array(
- * element_1,
- * ...
- * element_N
- * )
- * );
- * </pre>
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @version Release: 3.2.9
- * @since 3.0
- */
-class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer
-{
- /**#@+
- * @access private
- */
- /**
- * An array being generated
- * @var array
- */
- var $_ary;
-
- /**
- * Number of sections in the form (i.e. number of headers in it)
- * @var integer
- */
- var $_sectionCount;
-
- /**
- * Current section number
- * @var integer
- */
- var $_currentSection;
-
- /**
- * Array representing current group
- * @var array
- */
- var $_currentGroup = null;
-
- /**
- * Additional style information for different elements
- * @var array
- */
- var $_elementStyles = array();
-
- /**
- * true: collect all hidden elements into string; false: process them as usual form elements
- * @var bool
- */
- var $_collectHidden = false;
-
- /**
- * true: render an array of labels to many labels, $key 0 named 'label', the rest "label_$key"
- * false: leave labels as defined
- * @var bool
- */
- var $_staticLabels = false;
- /**#@-*/
-
- /**
- * Constructor
- *
- * @param bool true: collect all hidden elements into string; false: process them as usual form elements
- * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
- * @access public
- */
- function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false)
- {
- $this->HTML_QuickForm_Renderer();
- $this->_collectHidden = $collectHidden;
- $this->_staticLabels = $staticLabels;
- } // end constructor
-
-
- /**
- * Returns the resultant array
- *
- * @access public
- * @return array
- */
- function toArray()
- {
- return $this->_ary;
- }
-
-
- function startForm(&$form)
- {
- $this->_ary = array(
- 'frozen' => $form->isFrozen(),
- 'javascript' => $form->getValidationScript(),
- 'attributes' => $form->getAttributes(true),
- 'requirednote' => $form->getRequiredNote(),
- 'errors' => array()
- );
- if ($this->_collectHidden) {
- $this->_ary['hidden'] = '';
- }
- $this->_elementIdx = 1;
- $this->_currentSection = null;
- $this->_sectionCount = 0;
- } // end func startForm
-
-
- function renderHeader(&$header)
- {
- $this->_ary['sections'][$this->_sectionCount] = array(
- 'header' => $header->toHtml(),
- 'name' => $header->getName()
- );
- $this->_currentSection = $this->_sectionCount++;
- } // end func renderHeader
-
-
- function renderElement(&$element, $required, $error)
- {
- $elAry = $this->_elementToArray($element, $required, $error);
- if (!empty($error)) {
- $this->_ary['errors'][$elAry['name']] = $error;
- }
- $this->_storeArray($elAry);
- } // end func renderElement
-
-
- function renderHidden(&$element)
- {
- if ($this->_collectHidden) {
- $this->_ary['hidden'] .= $element->toHtml() . "\n";
- } else {
- $this->renderElement($element, false, null);
- }
- } // end func renderHidden
-
-
- function startGroup(&$group, $required, $error)
- {
- $this->_currentGroup = $this->_elementToArray($group, $required, $error);
- if (!empty($error)) {
- $this->_ary['errors'][$this->_currentGroup['name']] = $error;
- }
- } // end func startGroup
-
-
- function finishGroup(&$group)
- {
- $this->_storeArray($this->_currentGroup);
- $this->_currentGroup = null;
- } // end func finishGroup
-
-
- /**
- * Creates an array representing an element
- *
- * @access private
- * @param HTML_QuickForm_element element being processed
- * @param bool Whether an element is required
- * @param string Error associated with the element
- * @return array
- */
- function _elementToArray(&$element, $required, $error)
- {
- $ret = array(
- 'name' => $element->getName(),
- 'value' => $element->getValue(),
- 'type' => $element->getType(),
- 'frozen' => $element->isFrozen(),
- 'required' => $required,
- 'error' => $error
- );
- // render label(s)
- $labels = $element->getLabel();
- if (is_array($labels) && $this->_staticLabels) {
- foreach($labels as $key => $label) {
- $key = is_int($key)? $key + 1: $key;
- if (1 === $key) {
- $ret['label'] = $label;
- } else {
- $ret['label_' . $key] = $label;
- }
- }
- } else {
- $ret['label'] = $labels;
- }
-
- // set the style for the element
- if (isset($this->_elementStyles[$ret['name']])) {
- $ret['style'] = $this->_elementStyles[$ret['name']];
- }
- if ('group' == $ret['type']) {
- $ret['separator'] = $element->_separator;
- $ret['elements'] = array();
- } else {
- $ret['html'] = $element->toHtml();
- }
- return $ret;
- }
-
-
- /**
- * Stores an array representation of an element in the form array
- *
- * @access private
- * @param array Array representation of an element
- * @return void
- */
- function _storeArray($elAry)
- {
- // where should we put this element...
- if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) {
- $this->_currentGroup['elements'][] = $elAry;
- } elseif (isset($this->_currentSection)) {
- $this->_ary['sections'][$this->_currentSection]['elements'][] = $elAry;
- } else {
- $this->_ary['elements'][] = $elAry;
- }
- }
-
-
- /**
- * Sets a style to use for element rendering
- *
- * @param mixed element name or array ('element name' => 'style name')
- * @param string style name if $elementName is not an array
- * @access public
- * @return void
- */
- function setElementStyle($elementName, $styleName = null)
- {
- if (is_array($elementName)) {
- $this->_elementStyles = array_merge($this->_elementStyles, $elementName);
- } else {
- $this->_elementStyles[$elementName] = $styleName;
- }
- }
-}
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * A concrete renderer for HTML_QuickForm, makes an array of form contents
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Thomas Schulz <ths@4bconsult.de>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * An abstract base class for QuickForm renderers
+ */
+require_once 'HTML/QuickForm/Renderer.php';
+
+/**
+ * A concrete renderer for HTML_QuickForm, makes an array of form contents
+ *
+ * Based on old HTML_QuickForm::toArray() code.
+ *
+ * The form array structure is the following:
+ * <pre>
+ * array(
+ * 'frozen' => 'whether the form is frozen',
+ * 'javascript' => 'javascript for client-side validation',
+ * 'attributes' => 'attributes for <form> tag',
+ * 'requirednote => 'note about the required elements',
+ * // if we set the option to collect hidden elements
+ * 'hidden' => 'collected html of all hidden elements',
+ * // if there were some validation errors:
+ * 'errors' => array(
+ * '1st element name' => 'Error for the 1st element',
+ * ...
+ * 'nth element name' => 'Error for the nth element'
+ * ),
+ * // if there are no headers in the form:
+ * 'elements' => array(
+ * element_1,
+ * ...
+ * element_N
+ * )
+ * // if there are headers in the form:
+ * 'sections' => array(
+ * array(
+ * 'header' => 'Header text for the first header',
+ * 'name' => 'Header name for the first header',
+ * 'elements' => array(
+ * element_1,
+ * ...
+ * element_K1
+ * )
+ * ),
+ * ...
+ * array(
+ * 'header' => 'Header text for the Mth header',
+ * 'name' => 'Header name for the Mth header',
+ * 'elements' => array(
+ * element_1,
+ * ...
+ * element_KM
+ * )
+ * )
+ * )
+ * );
+ * </pre>
+ *
+ * where element_i is an array of the form:
+ * <pre>
+ * array(
+ * 'name' => 'element name',
+ * 'value' => 'element value',
+ * 'type' => 'type of the element',
+ * 'frozen' => 'whether element is frozen',
+ * 'label' => 'label for the element',
+ * 'required' => 'whether element is required',
+ * 'error' => 'error associated with the element',
+ * 'style' => 'some information about element style (e.g. for Smarty)',
+ * // if element is not a group
+ * 'html' => 'HTML for the element'
+ * // if element is a group
+ * 'separator' => 'separator for group elements',
+ * 'elements' => array(
+ * element_1,
+ * ...
+ * element_N
+ * )
+ * );
+ * </pre>
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Thomas Schulz <ths@4bconsult.de>
+ * @version Release: 3.2.9
+ * @since 3.0
+ */
+class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer
+{
+ /**#@+
+ * @access private
+ */
+ /**
+ * An array being generated
+ * @var array
+ */
+ var $_ary;
+
+ /**
+ * Number of sections in the form (i.e. number of headers in it)
+ * @var integer
+ */
+ var $_sectionCount;
+
+ /**
+ * Current section number
+ * @var integer
+ */
+ var $_currentSection;
+
+ /**
+ * Array representing current group
+ * @var array
+ */
+ var $_currentGroup = null;
+
+ /**
+ * Additional style information for different elements
+ * @var array
+ */
+ var $_elementStyles = array();
+
+ /**
+ * true: collect all hidden elements into string; false: process them as usual form elements
+ * @var bool
+ */
+ var $_collectHidden = false;
+
+ /**
+ * true: render an array of labels to many labels, $key 0 named 'label', the rest "label_$key"
+ * false: leave labels as defined
+ * @var bool
+ */
+ var $_staticLabels = false;
+ /**#@-*/
+
+ /**
+ * Constructor
+ *
+ * @param bool true: collect all hidden elements into string; false: process them as usual form elements
+ * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
+ * @access public
+ */
+ function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false)
+ {
+ $this->HTML_QuickForm_Renderer();
+ $this->_collectHidden = $collectHidden;
+ $this->_staticLabels = $staticLabels;
+ } // end constructor
+
+
+ /**
+ * Returns the resultant array
+ *
+ * @access public
+ * @return array
+ */
+ function toArray()
+ {
+ return $this->_ary;
+ }
+
+
+ function startForm(&$form)
+ {
+ $this->_ary = array(
+ 'frozen' => $form->isFrozen(),
+ 'javascript' => $form->getValidationScript(),
+ 'attributes' => $form->getAttributes(true),
+ 'requirednote' => $form->getRequiredNote(),
+ 'errors' => array()
+ );
+ if ($this->_collectHidden) {
+ $this->_ary['hidden'] = '';
+ }
+ $this->_elementIdx = 1;
+ $this->_currentSection = null;
+ $this->_sectionCount = 0;
+ } // end func startForm
+
+
+ function renderHeader(&$header)
+ {
+ $this->_ary['sections'][$this->_sectionCount] = array(
+ 'header' => $header->toHtml(),
+ 'name' => $header->getName()
+ );
+ $this->_currentSection = $this->_sectionCount++;
+ } // end func renderHeader
+
+
+ function renderElement(&$element, $required, $error)
+ {
+ $elAry = $this->_elementToArray($element, $required, $error);
+ if (!empty($error)) {
+ $this->_ary['errors'][$elAry['name']] = $error;
+ }
+ $this->_storeArray($elAry);
+ } // end func renderElement
+
+
+ function renderHidden(&$element)
+ {
+ if ($this->_collectHidden) {
+ $this->_ary['hidden'] .= $element->toHtml() . "\n";
+ } else {
+ $this->renderElement($element, false, null);
+ }
+ } // end func renderHidden
+
+
+ function startGroup(&$group, $required, $error)
+ {
+ $this->_currentGroup = $this->_elementToArray($group, $required, $error);
+ if (!empty($error)) {
+ $this->_ary['errors'][$this->_currentGroup['name']] = $error;
+ }
+ } // end func startGroup
+
+
+ function finishGroup(&$group)
+ {
+ $this->_storeArray($this->_currentGroup);
+ $this->_currentGroup = null;
+ } // end func finishGroup
+
+
+ /**
+ * Creates an array representing an element
+ *
+ * @access private
+ * @param HTML_QuickForm_element element being processed
+ * @param bool Whether an element is required
+ * @param string Error associated with the element
+ * @return array
+ */
+ function _elementToArray(&$element, $required, $error)
+ {
+ $ret = array(
+ 'name' => $element->getName(),
+ 'value' => $element->getValue(),
+ 'type' => $element->getType(),
+ 'frozen' => $element->isFrozen(),
+ 'required' => $required,
+ 'error' => $error
+ );
+ // render label(s)
+ $labels = $element->getLabel();
+ if (is_array($labels) && $this->_staticLabels) {
+ foreach($labels as $key => $label) {
+ $key = is_int($key)? $key + 1: $key;
+ if (1 === $key) {
+ $ret['label'] = $label;
+ } else {
+ $ret['label_' . $key] = $label;
+ }
+ }
+ } else {
+ $ret['label'] = $labels;
+ }
+
+ // set the style for the element
+ if (isset($this->_elementStyles[$ret['name']])) {
+ $ret['style'] = $this->_elementStyles[$ret['name']];
+ }
+ if ('group' == $ret['type']) {
+ $ret['separator'] = $element->_separator;
+ $ret['elements'] = array();
+ } else {
+ $ret['html'] = $element->toHtml();
+ }
+ return $ret;
+ }
+
+
+ /**
+ * Stores an array representation of an element in the form array
+ *
+ * @access private
+ * @param array Array representation of an element
+ * @return void
+ */
+ function _storeArray($elAry)
+ {
+ // where should we put this element...
+ if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) {
+ $this->_currentGroup['elements'][] = $elAry;
+ } elseif (isset($this->_currentSection)) {
+ $this->_ary['sections'][$this->_currentSection]['elements'][] = $elAry;
+ } else {
+ $this->_ary['elements'][] = $elAry;
+ }
+ }
+
+
+ /**
+ * Sets a style to use for element rendering
+ *
+ * @param mixed element name or array ('element name' => 'style name')
+ * @param string style name if $elementName is not an array
+ * @access public
+ * @return void
+ */
+ function setElementStyle($elementName, $styleName = null)
+ {
+ if (is_array($elementName)) {
+ $this->_elementStyles = array_merge($this->_elementStyles, $elementName);
+ } else {
+ $this->_elementStyles[$elementName] = $styleName;
+ }
+ }
+}
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/Renderer/ArraySmarty.php b/libs/HTML/QuickForm/Renderer/ArraySmarty.php
index e7495a17b3..6eb06dc2c8 100755
--- a/libs/HTML/QuickForm/Renderer/ArraySmarty.php
+++ b/libs/HTML/QuickForm/Renderer/ArraySmarty.php
@@ -1,402 +1,402 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A static renderer for HTML_QuickForm, makes an array of form content
- * useful for a Smarty template
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an array of form contents
- */
-require_once 'HTML/QuickForm/Renderer/Array.php';
-
-/**
- * A static renderer for HTML_QuickForm, makes an array of form content
- * useful for a Smarty template
- *
- * Based on old HTML_QuickForm::toArray() code and ITStatic renderer.
- *
- * The form array structure is the following:
- * <pre>
- * Array (
- * [frozen] => whether the complete form is frozen'
- * [javascript] => javascript for client-side validation
- * [attributes] => attributes for <form> tag
- * [hidden] => html of all hidden elements
- * [requirednote] => note about the required elements
- * [errors] => Array
- * (
- * [1st_element_name] => Error for the 1st element
- * ...
- * [nth_element_name] => Error for the nth element
- * )
- *
- * [header] => Array
- * (
- * [1st_header_name] => Header text for the 1st header
- * ...
- * [nth_header_name] => Header text for the nth header
- * )
- *
- * [1st_element_name] => Array for the 1st element
- * ...
- * [nth_element_name] => Array for the nth element
- * </pre>
- *
- * where an element array has the form:
- * <pre>
- * (
- * [name] => element name
- * [value] => element value,
- * [type] => type of the element
- * [frozen] => whether element is frozen
- * [label] => label for the element
- * [required] => whether element is required
- * // if element is not a group:
- * [html] => HTML for the element
- * // if element is a group:
- * [separator] => separator for group elements
- * [1st_gitem_name] => Array for the 1st element in group
- * ...
- * [nth_gitem_name] => Array for the nth element in group
- * )
- * )
- * </pre>
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @version Release: 3.2.9
- * @since 3.0
- */
-class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array
-{
- /**#@+
- * @access private
- */
- /**
- * The Smarty template engine instance
- * @var object
- */
- var $_tpl = null;
-
- /**
- * Current element index
- * @var integer
- */
- var $_elementIdx = 0;
-
- /**
- * The current element index inside a group
- * @var integer
- */
- var $_groupElementIdx = 0;
-
- /**
- * How to handle the required tag for required fields
- * @var string
- * @see setRequiredTemplate()
- */
- var $_required = '';
-
- /**
- * How to handle error messages in form validation
- * @var string
- * @see setErrorTemplate()
- */
- var $_error = '';
- /**#@-*/
-
- /**
- * Constructor
- *
- * @param Smarty reference to the Smarty template engine instance
- * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
- * @access public
- */
- function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false)
- {
- $this->HTML_QuickForm_Renderer_Array(false, $staticLabels);
- $this->_tpl =& $tpl;
- } // end constructor
-
- /**
- * Called when visiting a header element
- *
- * @param HTML_QuickForm_header header element being visited
- * @access public
- * @return void
- */
- function renderHeader(&$header)
- {
- if ($name = $header->getName()) {
- $this->_ary['header'][$name] = $header->toHtml();
- } else {
- $this->_ary['header'][$this->_sectionCount] = $header->toHtml();
- }
- $this->_currentSection = $this->_sectionCount++;
- } // end func renderHeader
-
- /**
- * Called when visiting a group, before processing any group elements
- *
- * @param HTML_QuickForm_group group being visited
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- */
- function startGroup(&$group, $required, $error)
- {
- parent::startGroup($group, $required, $error);
- $this->_groupElementIdx = 1;
- } // end func startGroup
-
- /**
- * Creates an array representing an element containing
- * the key for storing this
- *
- * @access private
- * @param HTML_QuickForm_element form element being visited
- * @param bool Whether an element is required
- * @param string Error associated with the element
- * @return array
- */
- function _elementToArray(&$element, $required, $error)
- {
- $ret = parent::_elementToArray($element, $required, $error);
-
- if ('group' == $ret['type']) {
- $ret['html'] = $element->toHtml();
- // we don't need the elements, see the array structure
- unset($ret['elements']);
- }
- if (($required || $error) && !empty($this->_required)){
- $this->_renderRequired($ret['label'], $ret['html'], $required, $error);
- }
- if ($error && !empty($this->_error)) {
- $this->_renderError($ret['label'], $ret['html'], $error);
- $ret['error'] = $error;
- }
- // create keys for elements grouped by native group or name
- if (strstr($ret['name'], '[') or $this->_currentGroup) {
- // Fix for bug #8123: escape backslashes and quotes to prevent errors
- // in eval(). The code below seems to handle the case where element
- // name has unbalanced square brackets. Dunno whether we really
- // need this after the fix for #8123, but I'm wary of making big
- // changes to this code.
- preg_match('/([^]]*)\\[([^]]*)\\]/', $ret['name'], $matches);
- if (isset($matches[1])) {
- $sKeysSub = substr_replace($ret['name'], '', 0, strlen($matches[1]));
- $sKeysSub = str_replace(
- array('\\', '\'', '[' , ']', '[\'\']'),
- array('\\\\', '\\\'', '[\'', '\']', '[]' ),
- $sKeysSub
- );
- $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $matches[1]) . '\']' . $sKeysSub;
- } else {
- $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']';
- }
- // special handling for elements in native groups
- if ($this->_currentGroup) {
- // skip unnamed group items unless radios: no name -> no static access
- // identification: have the same key string as the parent group
- if ($this->_currentGroup['keys'] == $sKeys and 'radio' != $ret['type']) {
- return false;
- }
- // reduce string of keys by remove leading group keys
- if (0 === strpos($sKeys, $this->_currentGroup['keys'])) {
- $sKeys = substr_replace($sKeys, '', 0, strlen($this->_currentGroup['keys']));
- }
- }
- // element without a name
- } elseif ($ret['name'] == '') {
- $sKeys = '[\'element_' . $this->_elementIdx . '\']';
- // other elements
- } else {
- $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']';
- }
- // for radios: add extra key from value
- if ('radio' == $ret['type'] and substr($sKeys, -2) != '[]') {
- $sKeys .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['value']) . '\']';
- }
- $this->_elementIdx++;
- $ret['keys'] = $sKeys;
- return $ret;
- } // end func _elementToArray
-
- /**
- * Stores an array representation of an element in the form array
- *
- * @access private
- * @param array Array representation of an element
- * @return void
- */
- function _storeArray($elAry)
- {
- if ($elAry) {
- $sKeys = $elAry['keys'];
- unset($elAry['keys']);
- // where should we put this element...
- if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) {
- $toEval = '$this->_currentGroup' . $sKeys . ' = $elAry;';
- } else {
- $toEval = '$this->_ary' . $sKeys . ' = $elAry;';
- }
- eval($toEval);
- }
- return;
- }
-
- /**
- * Called when an element is required
- *
- * This method will add the required tag to the element label and/or the element html
- * such as defined with the method setRequiredTemplate.
- *
- * @param string The element label
- * @param string The element html rendering
- * @param boolean The element required
- * @param string The element error
- * @see setRequiredTemplate()
- * @access private
- * @return void
- */
- function _renderRequired(&$label, &$html, &$required, &$error)
- {
- $this->_tpl->assign(array(
- 'label' => $label,
- 'html' => $html,
- 'required' => $required,
- 'error' => $error
- ));
- if (!empty($label) && strpos($this->_required, $this->_tpl->left_delimiter . '$label') !== false) {
- $label = $this->_tplFetch($this->_required);
- }
- if (!empty($html) && strpos($this->_required, $this->_tpl->left_delimiter . '$html') !== false) {
- $html = $this->_tplFetch($this->_required);
- }
- $this->_tpl->clear_assign(array('label', 'html', 'required'));
- } // end func _renderRequired
-
- /**
- * Called when an element has a validation error
- *
- * This method will add the error message to the element label or the element html
- * such as defined with the method setErrorTemplate. If the error placeholder is not found
- * in the template, the error will be displayed in the form error block.
- *
- * @param string The element label
- * @param string The element html rendering
- * @param string The element error
- * @see setErrorTemplate()
- * @access private
- * @return void
- */
- function _renderError(&$label, &$html, &$error)
- {
- $this->_tpl->assign(array('label' => '', 'html' => '', 'error' => $error));
- $error = $this->_tplFetch($this->_error);
- $this->_tpl->assign(array('label' => $label, 'html' => $html));
-
- if (!empty($label) && strpos($this->_error, $this->_tpl->left_delimiter . '$label') !== false) {
- $label = $this->_tplFetch($this->_error);
- } elseif (!empty($html) && strpos($this->_error, $this->_tpl->left_delimiter . '$html') !== false) {
- $html = $this->_tplFetch($this->_error);
- }
- $this->_tpl->clear_assign(array('label', 'html', 'error'));
- } // end func _renderError
-
- /**
- * Process an template sourced in a string with Smarty
- *
- * Smarty has no core function to render a template given as a string.
- * So we use the smarty eval plugin function to do this.
- *
- * @param string The template source
- * @access private
- * @return void
- */
- function _tplFetch($tplSource)
- {
- if (!function_exists('smarty_function_eval')) {
- require SMARTY_DIR . '/plugins/function.eval.php';
- }
- return smarty_function_eval(array('var' => $tplSource), $this->_tpl);
- }// end func _tplFetch
-
- /**
- * Sets the way required elements are rendered
- *
- * You can use {$label} or {$html} placeholders to let the renderer know where
- * where the element label or the element html are positionned according to the
- * required tag. They will be replaced accordingly with the right value. You
- * can use the full smarty syntax here, especially a custom modifier for I18N.
- * For example:
- * {if $required}<span style="color: red;">*</span>{/if}{$label|translate}
- * will put a red star in front of the label if the element is required and
- * translate the label.
- *
- *
- * @param string The required element template
- * @access public
- * @return void
- */
- function setRequiredTemplate($template)
- {
- $this->_required = $template;
- } // end func setRequiredTemplate
-
- /**
- * Sets the way elements with validation errors are rendered
- *
- * You can use {$label} or {$html} placeholders to let the renderer know where
- * where the element label or the element html are positionned according to the
- * error message. They will be replaced accordingly with the right value.
- * The error message will replace the {$error} placeholder.
- * For example:
- * {if $error}<span style="color: red;">{$error}</span>{/if}<br />{$html}
- * will put the error message in red on top of the element html.
- *
- * If you want all error messages to be output in the main error block, use
- * the {$form.errors} part of the rendered array that collects all raw error
- * messages.
- *
- * If you want to place all error messages manually, do not specify {$html}
- * nor {$label}.
- *
- * Groups can have special layouts. With this kind of groups, you have to
- * place the formated error message manually. In this case, use {$form.group.error}
- * where you want the formated error message to appear in the form.
- *
- * @param string The element error template
- * @access public
- * @return void
- */
- function setErrorTemplate($template)
- {
- $this->_error = $template;
- } // end func setErrorTemplate
-}
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * A static renderer for HTML_QuickForm, makes an array of form content
+ * useful for a Smarty template
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Thomas Schulz <ths@4bconsult.de>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * A concrete renderer for HTML_QuickForm, makes an array of form contents
+ */
+require_once 'HTML/QuickForm/Renderer/Array.php';
+
+/**
+ * A static renderer for HTML_QuickForm, makes an array of form content
+ * useful for a Smarty template
+ *
+ * Based on old HTML_QuickForm::toArray() code and ITStatic renderer.
+ *
+ * The form array structure is the following:
+ * <pre>
+ * Array (
+ * [frozen] => whether the complete form is frozen'
+ * [javascript] => javascript for client-side validation
+ * [attributes] => attributes for <form> tag
+ * [hidden] => html of all hidden elements
+ * [requirednote] => note about the required elements
+ * [errors] => Array
+ * (
+ * [1st_element_name] => Error for the 1st element
+ * ...
+ * [nth_element_name] => Error for the nth element
+ * )
+ *
+ * [header] => Array
+ * (
+ * [1st_header_name] => Header text for the 1st header
+ * ...
+ * [nth_header_name] => Header text for the nth header
+ * )
+ *
+ * [1st_element_name] => Array for the 1st element
+ * ...
+ * [nth_element_name] => Array for the nth element
+ * </pre>
+ *
+ * where an element array has the form:
+ * <pre>
+ * (
+ * [name] => element name
+ * [value] => element value,
+ * [type] => type of the element
+ * [frozen] => whether element is frozen
+ * [label] => label for the element
+ * [required] => whether element is required
+ * // if element is not a group:
+ * [html] => HTML for the element
+ * // if element is a group:
+ * [separator] => separator for group elements
+ * [1st_gitem_name] => Array for the 1st element in group
+ * ...
+ * [nth_gitem_name] => Array for the nth element in group
+ * )
+ * )
+ * </pre>
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Thomas Schulz <ths@4bconsult.de>
+ * @version Release: 3.2.9
+ * @since 3.0
+ */
+class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array
+{
+ /**#@+
+ * @access private
+ */
+ /**
+ * The Smarty template engine instance
+ * @var object
+ */
+ var $_tpl = null;
+
+ /**
+ * Current element index
+ * @var integer
+ */
+ var $_elementIdx = 0;
+
+ /**
+ * The current element index inside a group
+ * @var integer
+ */
+ var $_groupElementIdx = 0;
+
+ /**
+ * How to handle the required tag for required fields
+ * @var string
+ * @see setRequiredTemplate()
+ */
+ var $_required = '';
+
+ /**
+ * How to handle error messages in form validation
+ * @var string
+ * @see setErrorTemplate()
+ */
+ var $_error = '';
+ /**#@-*/
+
+ /**
+ * Constructor
+ *
+ * @param Smarty reference to the Smarty template engine instance
+ * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
+ * @access public
+ */
+ function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false)
+ {
+ $this->HTML_QuickForm_Renderer_Array(false, $staticLabels);
+ $this->_tpl =& $tpl;
+ } // end constructor
+
+ /**
+ * Called when visiting a header element
+ *
+ * @param HTML_QuickForm_header header element being visited
+ * @access public
+ * @return void
+ */
+ function renderHeader(&$header)
+ {
+ if ($name = $header->getName()) {
+ $this->_ary['header'][$name] = $header->toHtml();
+ } else {
+ $this->_ary['header'][$this->_sectionCount] = $header->toHtml();
+ }
+ $this->_currentSection = $this->_sectionCount++;
+ } // end func renderHeader
+
+ /**
+ * Called when visiting a group, before processing any group elements
+ *
+ * @param HTML_QuickForm_group group being visited
+ * @param bool Whether a group is required
+ * @param string An error message associated with a group
+ * @access public
+ * @return void
+ */
+ function startGroup(&$group, $required, $error)
+ {
+ parent::startGroup($group, $required, $error);
+ $this->_groupElementIdx = 1;
+ } // end func startGroup
+
+ /**
+ * Creates an array representing an element containing
+ * the key for storing this
+ *
+ * @access private
+ * @param HTML_QuickForm_element form element being visited
+ * @param bool Whether an element is required
+ * @param string Error associated with the element
+ * @return array
+ */
+ function _elementToArray(&$element, $required, $error)
+ {
+ $ret = parent::_elementToArray($element, $required, $error);
+
+ if ('group' == $ret['type']) {
+ $ret['html'] = $element->toHtml();
+ // we don't need the elements, see the array structure
+ unset($ret['elements']);
+ }
+ if (($required || $error) && !empty($this->_required)){
+ $this->_renderRequired($ret['label'], $ret['html'], $required, $error);
+ }
+ if ($error && !empty($this->_error)) {
+ $this->_renderError($ret['label'], $ret['html'], $error);
+ $ret['error'] = $error;
+ }
+ // create keys for elements grouped by native group or name
+ if (strstr($ret['name'], '[') or $this->_currentGroup) {
+ // Fix for bug #8123: escape backslashes and quotes to prevent errors
+ // in eval(). The code below seems to handle the case where element
+ // name has unbalanced square brackets. Dunno whether we really
+ // need this after the fix for #8123, but I'm wary of making big
+ // changes to this code.
+ preg_match('/([^]]*)\\[([^]]*)\\]/', $ret['name'], $matches);
+ if (isset($matches[1])) {
+ $sKeysSub = substr_replace($ret['name'], '', 0, strlen($matches[1]));
+ $sKeysSub = str_replace(
+ array('\\', '\'', '[' , ']', '[\'\']'),
+ array('\\\\', '\\\'', '[\'', '\']', '[]' ),
+ $sKeysSub
+ );
+ $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $matches[1]) . '\']' . $sKeysSub;
+ } else {
+ $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']';
+ }
+ // special handling for elements in native groups
+ if ($this->_currentGroup) {
+ // skip unnamed group items unless radios: no name -> no static access
+ // identification: have the same key string as the parent group
+ if ($this->_currentGroup['keys'] == $sKeys and 'radio' != $ret['type']) {
+ return false;
+ }
+ // reduce string of keys by remove leading group keys
+ if (0 === strpos($sKeys, $this->_currentGroup['keys'])) {
+ $sKeys = substr_replace($sKeys, '', 0, strlen($this->_currentGroup['keys']));
+ }
+ }
+ // element without a name
+ } elseif ($ret['name'] == '') {
+ $sKeys = '[\'element_' . $this->_elementIdx . '\']';
+ // other elements
+ } else {
+ $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']';
+ }
+ // for radios: add extra key from value
+ if ('radio' == $ret['type'] and substr($sKeys, -2) != '[]') {
+ $sKeys .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['value']) . '\']';
+ }
+ $this->_elementIdx++;
+ $ret['keys'] = $sKeys;
+ return $ret;
+ } // end func _elementToArray
+
+ /**
+ * Stores an array representation of an element in the form array
+ *
+ * @access private
+ * @param array Array representation of an element
+ * @return void
+ */
+ function _storeArray($elAry)
+ {
+ if ($elAry) {
+ $sKeys = $elAry['keys'];
+ unset($elAry['keys']);
+ // where should we put this element...
+ if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) {
+ $toEval = '$this->_currentGroup' . $sKeys . ' = $elAry;';
+ } else {
+ $toEval = '$this->_ary' . $sKeys . ' = $elAry;';
+ }
+ eval($toEval);
+ }
+ return;
+ }
+
+ /**
+ * Called when an element is required
+ *
+ * This method will add the required tag to the element label and/or the element html
+ * such as defined with the method setRequiredTemplate.
+ *
+ * @param string The element label
+ * @param string The element html rendering
+ * @param boolean The element required
+ * @param string The element error
+ * @see setRequiredTemplate()
+ * @access private
+ * @return void
+ */
+ function _renderRequired(&$label, &$html, &$required, &$error)
+ {
+ $this->_tpl->assign(array(
+ 'label' => $label,
+ 'html' => $html,
+ 'required' => $required,
+ 'error' => $error
+ ));
+ if (!empty($label) && strpos($this->_required, $this->_tpl->left_delimiter . '$label') !== false) {
+ $label = $this->_tplFetch($this->_required);
+ }
+ if (!empty($html) && strpos($this->_required, $this->_tpl->left_delimiter . '$html') !== false) {
+ $html = $this->_tplFetch($this->_required);
+ }
+ $this->_tpl->clear_assign(array('label', 'html', 'required'));
+ } // end func _renderRequired
+
+ /**
+ * Called when an element has a validation error
+ *
+ * This method will add the error message to the element label or the element html
+ * such as defined with the method setErrorTemplate. If the error placeholder is not found
+ * in the template, the error will be displayed in the form error block.
+ *
+ * @param string The element label
+ * @param string The element html rendering
+ * @param string The element error
+ * @see setErrorTemplate()
+ * @access private
+ * @return void
+ */
+ function _renderError(&$label, &$html, &$error)
+ {
+ $this->_tpl->assign(array('label' => '', 'html' => '', 'error' => $error));
+ $error = $this->_tplFetch($this->_error);
+ $this->_tpl->assign(array('label' => $label, 'html' => $html));
+
+ if (!empty($label) && strpos($this->_error, $this->_tpl->left_delimiter . '$label') !== false) {
+ $label = $this->_tplFetch($this->_error);
+ } elseif (!empty($html) && strpos($this->_error, $this->_tpl->left_delimiter . '$html') !== false) {
+ $html = $this->_tplFetch($this->_error);
+ }
+ $this->_tpl->clear_assign(array('label', 'html', 'error'));
+ } // end func _renderError
+
+ /**
+ * Process an template sourced in a string with Smarty
+ *
+ * Smarty has no core function to render a template given as a string.
+ * So we use the smarty eval plugin function to do this.
+ *
+ * @param string The template source
+ * @access private
+ * @return void
+ */
+ function _tplFetch($tplSource)
+ {
+ if (!function_exists('smarty_function_eval')) {
+ require SMARTY_DIR . '/plugins/function.eval.php';
+ }
+ return smarty_function_eval(array('var' => $tplSource), $this->_tpl);
+ }// end func _tplFetch
+
+ /**
+ * Sets the way required elements are rendered
+ *
+ * You can use {$label} or {$html} placeholders to let the renderer know where
+ * where the element label or the element html are positionned according to the
+ * required tag. They will be replaced accordingly with the right value. You
+ * can use the full smarty syntax here, especially a custom modifier for I18N.
+ * For example:
+ * {if $required}<span style="color: red;">*</span>{/if}{$label|translate}
+ * will put a red star in front of the label if the element is required and
+ * translate the label.
+ *
+ *
+ * @param string The required element template
+ * @access public
+ * @return void
+ */
+ function setRequiredTemplate($template)
+ {
+ $this->_required = $template;
+ } // end func setRequiredTemplate
+
+ /**
+ * Sets the way elements with validation errors are rendered
+ *
+ * You can use {$label} or {$html} placeholders to let the renderer know where
+ * where the element label or the element html are positionned according to the
+ * error message. They will be replaced accordingly with the right value.
+ * The error message will replace the {$error} placeholder.
+ * For example:
+ * {if $error}<span style="color: red;">{$error}</span>{/if}<br />{$html}
+ * will put the error message in red on top of the element html.
+ *
+ * If you want all error messages to be output in the main error block, use
+ * the {$form.errors} part of the rendered array that collects all raw error
+ * messages.
+ *
+ * If you want to place all error messages manually, do not specify {$html}
+ * nor {$label}.
+ *
+ * Groups can have special layouts. With this kind of groups, you have to
+ * place the formated error message manually. In this case, use {$form.group.error}
+ * where you want the formated error message to appear in the form.
+ *
+ * @param string The element error template
+ * @access public
+ * @return void
+ */
+ function setErrorTemplate($template)
+ {
+ $this->_error = $template;
+ } // end func setErrorTemplate
+}
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/Rule.php b/libs/HTML/QuickForm/Rule.php
index e172a43199..4870ad1720 100755
--- a/libs/HTML/QuickForm/Rule.php
+++ b/libs/HTML/QuickForm/Rule.php
@@ -1,82 +1,82 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Abstract base class for QuickForm validation rules
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 3.2
- * @abstract
- */
-class HTML_QuickForm_Rule
-{
- /**
- * Name of the rule to use in validate method
- *
- * This property is used in more global rules like Callback and Regex
- * to determine which callback and which regex is to be used for validation
- *
- * @var string
- * @access public
- */
- var $name;
-
- /**
- * Validates a value
- *
- * @access public
- * @abstract
- */
- function validate($value)
- {
- return true;
- }
-
- /**
- * Sets the rule name
- *
- * @param string rule name
- * @access public
- */
- function setName($ruleName)
- {
- $this->name = $ruleName;
- }
-
- /**
- * Returns the javascript test (the test should return true if the value is INVALID)
- *
- * @param mixed Options for the rule
- * @access public
- * @return array first element is code to setup validation, second is the check itself
- * @abstract
- */
- function getValidationScript($options = null)
- {
- return array('', '');
- }
-}
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 3.2
+ * @abstract
+ */
+class HTML_QuickForm_Rule
+{
+ /**
+ * Name of the rule to use in validate method
+ *
+ * This property is used in more global rules like Callback and Regex
+ * to determine which callback and which regex is to be used for validation
+ *
+ * @var string
+ * @access public
+ */
+ var $name;
+
+ /**
+ * Validates a value
+ *
+ * @access public
+ * @abstract
+ */
+ function validate($value)
+ {
+ return true;
+ }
+
+ /**
+ * Sets the rule name
+ *
+ * @param string rule name
+ * @access public
+ */
+ function setName($ruleName)
+ {
+ $this->name = $ruleName;
+ }
+
+ /**
+ * Returns the javascript test (the test should return true if the value is INVALID)
+ *
+ * @param mixed Options for the rule
+ * @access public
+ * @return array first element is code to setup validation, second is the check itself
+ * @abstract
+ */
+ function getValidationScript($options = null)
+ {
+ return array('', '');
+ }
+}
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/Rule/Callback.php b/libs/HTML/QuickForm/Rule/Callback.php
index e35b79f223..d5dec846a6 100755
--- a/libs/HTML/QuickForm/Rule/Callback.php
+++ b/libs/HTML/QuickForm/Rule/Callback.php
@@ -1,124 +1,124 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Validates values using callback functions or methods
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Validates values using callback functions or methods
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Callback extends HTML_QuickForm_Rule
-{
- /**
- * Array of callbacks
- *
- * Array is in the format:
- * $_data['rulename'] = array('functionname', 'classname');
- * If the callback is not a method, then the class name is not set.
- *
- * @var array
- * @access private
- */
- var $_data = array();
-
- /**
- * Whether to use BC mode for specific rules
- *
- * Previous versions of QF passed element's name as a first parameter
- * to validation functions, but not to validation methods. This behaviour
- * is emulated if you are using 'function' as rule type when registering.
- *
- * @var array
- * @access private
- */
- var $_BCMode = array();
-
- /**
- * Validates a value using a callback
- *
- * @param string $value Value to be checked
- * @param mixed $options Options for callback
- * @access public
- * @return boolean true if value is valid
- */
- function validate($value, $options = null)
- {
- if (isset($this->_data[$this->name])) {
- $callback = $this->_data[$this->name];
- if (isset($callback[1])) {
- return call_user_func(array($callback[1], $callback[0]), $value, $options);
- } elseif ($this->_BCMode[$this->name]) {
- return $callback[0]('', $value, $options);
- } else {
- return $callback[0]($value, $options);
- }
- } elseif (is_callable($options)) {
- return call_user_func($options, $value);
- } else {
- return true;
- }
- } // end func validate
-
- /**
- * Adds new callbacks to the callbacks list
- *
- * @param string $name Name of rule
- * @param string $callback Name of function or method
- * @param string $class Name of class containing the method
- * @param bool $BCMode Backwards compatibility mode
- * @access public
- */
- function addData($name, $callback, $class = null, $BCMode = false)
- {
- if (!empty($class)) {
- $this->_data[$name] = array($callback, $class);
- } else {
- $this->_data[$name] = array($callback);
- }
- $this->_BCMode[$name] = $BCMode;
- } // end func addData
-
-
- function getValidationScript($options = null)
- {
- if (isset($this->_data[$this->name])) {
- $callback = $this->_data[$this->name][0];
- $params = ($this->_BCMode[$this->name]? "'', {jsVar}": '{jsVar}') .
- (isset($options)? ", '{$options}'": '');
- } else {
- $callback = is_array($options)? $options[1]: $options;
- $params = '{jsVar}';
- }
- return array('', "{jsVar} != '' && !{$callback}({$params})");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Callback
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Validates values using callback functions or methods
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ */
+require_once 'HTML/QuickForm/Rule.php';
+
+/**
+ * Validates values using callback functions or methods
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_Rule_Callback extends HTML_QuickForm_Rule
+{
+ /**
+ * Array of callbacks
+ *
+ * Array is in the format:
+ * $_data['rulename'] = array('functionname', 'classname');
+ * If the callback is not a method, then the class name is not set.
+ *
+ * @var array
+ * @access private
+ */
+ var $_data = array();
+
+ /**
+ * Whether to use BC mode for specific rules
+ *
+ * Previous versions of QF passed element's name as a first parameter
+ * to validation functions, but not to validation methods. This behaviour
+ * is emulated if you are using 'function' as rule type when registering.
+ *
+ * @var array
+ * @access private
+ */
+ var $_BCMode = array();
+
+ /**
+ * Validates a value using a callback
+ *
+ * @param string $value Value to be checked
+ * @param mixed $options Options for callback
+ * @access public
+ * @return boolean true if value is valid
+ */
+ function validate($value, $options = null)
+ {
+ if (isset($this->_data[$this->name])) {
+ $callback = $this->_data[$this->name];
+ if (isset($callback[1])) {
+ return call_user_func(array($callback[1], $callback[0]), $value, $options);
+ } elseif ($this->_BCMode[$this->name]) {
+ return $callback[0]('', $value, $options);
+ } else {
+ return $callback[0]($value, $options);
+ }
+ } elseif (is_callable($options)) {
+ return call_user_func($options, $value);
+ } else {
+ return true;
+ }
+ } // end func validate
+
+ /**
+ * Adds new callbacks to the callbacks list
+ *
+ * @param string $name Name of rule
+ * @param string $callback Name of function or method
+ * @param string $class Name of class containing the method
+ * @param bool $BCMode Backwards compatibility mode
+ * @access public
+ */
+ function addData($name, $callback, $class = null, $BCMode = false)
+ {
+ if (!empty($class)) {
+ $this->_data[$name] = array($callback, $class);
+ } else {
+ $this->_data[$name] = array($callback);
+ }
+ $this->_BCMode[$name] = $BCMode;
+ } // end func addData
+
+
+ function getValidationScript($options = null)
+ {
+ if (isset($this->_data[$this->name])) {
+ $callback = $this->_data[$this->name][0];
+ $params = ($this->_BCMode[$this->name]? "'', {jsVar}": '{jsVar}') .
+ (isset($options)? ", '{$options}'": '');
+ } else {
+ $callback = is_array($options)? $options[1]: $options;
+ $params = '{jsVar}';
+ }
+ return array('', "{jsVar} != '' && !{$callback}({$params})");
+ } // end func getValidationScript
+
+} // end class HTML_QuickForm_Rule_Callback
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/Rule/Compare.php b/libs/HTML/QuickForm/Rule/Compare.php
index e7d491301d..7b8ed4a283 100755
--- a/libs/HTML/QuickForm/Rule/Compare.php
+++ b/libs/HTML/QuickForm/Rule/Compare.php
@@ -1,105 +1,105 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Rule to compare two form fields
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Rule to compare two form fields
- *
- * The most common usage for this is to ensure that the password
- * confirmation field matches the password field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
-{
- /**
- * Possible operators to use
- * @var array
- * @access private
- */
- var $_operators = array(
- 'eq' => '===',
- 'neq' => '!==',
- 'gt' => '>',
- 'gte' => '>=',
- 'lt' => '<',
- 'lte' => '<=',
- '==' => '===',
- '!=' => '!=='
- );
-
-
- /**
- * Returns the operator to use for comparing the values
- *
- * @access private
- * @param string operator name
- * @return string operator to use for validation
- */
- function _findOperator($name)
- {
- if (empty($name)) {
- return '===';
- } elseif (isset($this->_operators[$name])) {
- return $this->_operators[$name];
- } elseif (in_array($name, $this->_operators)) {
- return $name;
- } else {
- return '===';
- }
- }
-
-
- function validate($values, $operator = null)
- {
- $operator = $this->_findOperator($operator);
- if ('===' != $operator && '!==' != $operator) {
- $compareFn = create_function('$a, $b', 'return floatval($a) ' . $operator . ' floatval($b);');
- } else {
- $compareFn = create_function('$a, $b', 'return strval($a) ' . $operator . ' strval($b);');
- }
-
- return $compareFn($values[0], $values[1]);
- }
-
-
- function getValidationScript($operator = null)
- {
- $operator = $this->_findOperator($operator);
- if ('===' != $operator && '!==' != $operator) {
- $check = "!(Number({jsVar}[0]) {$operator} Number({jsVar}[1]))";
- } else {
- $check = "!(String({jsVar}[0]) {$operator} String({jsVar}[1]))";
- }
- return array('', "'' != {jsVar}[0] && {$check}");
- }
-}
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Rule to compare two form fields
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ */
+require_once 'HTML/QuickForm/Rule.php';
+
+/**
+ * Rule to compare two form fields
+ *
+ * The most common usage for this is to ensure that the password
+ * confirmation field matches the password field
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
+{
+ /**
+ * Possible operators to use
+ * @var array
+ * @access private
+ */
+ var $_operators = array(
+ 'eq' => '===',
+ 'neq' => '!==',
+ 'gt' => '>',
+ 'gte' => '>=',
+ 'lt' => '<',
+ 'lte' => '<=',
+ '==' => '===',
+ '!=' => '!=='
+ );
+
+
+ /**
+ * Returns the operator to use for comparing the values
+ *
+ * @access private
+ * @param string operator name
+ * @return string operator to use for validation
+ */
+ function _findOperator($name)
+ {
+ if (empty($name)) {
+ return '===';
+ } elseif (isset($this->_operators[$name])) {
+ return $this->_operators[$name];
+ } elseif (in_array($name, $this->_operators)) {
+ return $name;
+ } else {
+ return '===';
+ }
+ }
+
+
+ function validate($values, $operator = null)
+ {
+ $operator = $this->_findOperator($operator);
+ if ('===' != $operator && '!==' != $operator) {
+ $compareFn = create_function('$a, $b', 'return floatval($a) ' . $operator . ' floatval($b);');
+ } else {
+ $compareFn = create_function('$a, $b', 'return strval($a) ' . $operator . ' strval($b);');
+ }
+
+ return $compareFn($values[0], $values[1]);
+ }
+
+
+ function getValidationScript($operator = null)
+ {
+ $operator = $this->_findOperator($operator);
+ if ('===' != $operator && '!==' != $operator) {
+ $check = "!(Number({jsVar}[0]) {$operator} Number({jsVar}[1]))";
+ } else {
+ $check = "!(String({jsVar}[0]) {$operator} String({jsVar}[1]))";
+ }
+ return array('', "'' != {jsVar}[0] && {$check}");
+ }
+}
+?>
diff --git a/libs/HTML/QuickForm/Rule/Email.php b/libs/HTML/QuickForm/Rule/Email.php
index bb30c6546c..06ca30f172 100755
--- a/libs/HTML/QuickForm/Rule/Email.php
+++ b/libs/HTML/QuickForm/Rule/Email.php
@@ -1,73 +1,73 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Email validation rule
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Email validation rule
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Email extends HTML_QuickForm_Rule
-{
- var $regex = '/^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/';
-
- /**
- * Validates an email address
- *
- * @param string $email Email address
- * @param boolean $checkDomain True if dns check should be performed
- * @access public
- * @return boolean true if email is valid
- */
- function validate($email, $checkDomain = false)
- {
- // Fix for bug #10799: add 'D' modifier to regex
- if (preg_match($this->regex . 'D', $email)) {
- if ($checkDomain && function_exists('checkdnsrr')) {
- $tokens = explode('@', $email);
- if (checkdnsrr($tokens[1], 'MX') || checkdnsrr($tokens[1], 'A')) {
- return true;
- }
- return false;
- }
- return true;
- }
- return false;
- } // end func validate
-
-
- function getValidationScript($options = null)
- {
- return array(" var regex = " . $this->regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Email
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Email validation rule
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ */
+require_once 'HTML/QuickForm/Rule.php';
+
+/**
+ * Email validation rule
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_Rule_Email extends HTML_QuickForm_Rule
+{
+ var $regex = '/^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/';
+
+ /**
+ * Validates an email address
+ *
+ * @param string $email Email address
+ * @param boolean $checkDomain True if dns check should be performed
+ * @access public
+ * @return boolean true if email is valid
+ */
+ function validate($email, $checkDomain = false)
+ {
+ // Fix for bug #10799: add 'D' modifier to regex
+ if (preg_match($this->regex . 'D', $email)) {
+ if ($checkDomain && function_exists('checkdnsrr')) {
+ $tokens = explode('@', $email);
+ if (checkdnsrr($tokens[1], 'MX') || checkdnsrr($tokens[1], 'A')) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
+ return false;
+ } // end func validate
+
+
+ function getValidationScript($options = null)
+ {
+ return array(" var regex = " . $this->regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})");
+ } // end func getValidationScript
+
+} // end class HTML_QuickForm_Rule_Email
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/Rule/Range.php b/libs/HTML/QuickForm/Rule/Range.php
index aaa32d0660..76f1837a3e 100755
--- a/libs/HTML/QuickForm/Rule/Range.php
+++ b/libs/HTML/QuickForm/Rule/Range.php
@@ -1,75 +1,75 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Checks that the length of value is within range
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Checks that the length of value is within range
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Range extends HTML_QuickForm_Rule
-{
- /**
- * Validates a value using a range comparison
- *
- * @param string $value Value to be checked
- * @param mixed $options Int for length, array for range
- * @access public
- * @return boolean true if value is valid
- */
- function validate($value, $options)
- {
- $length = strlen($value);
- switch ($this->name) {
- case 'minlength': return ($length >= $options);
- case 'maxlength': return ($length <= $options);
- default: return ($length >= $options[0] && $length <= $options[1]);
- }
- } // end func validate
-
-
- function getValidationScript($options = null)
- {
- switch ($this->name) {
- case 'minlength':
- $test = '{jsVar}.length < '.$options;
- break;
- case 'maxlength':
- $test = '{jsVar}.length > '.$options;
- break;
- default:
- $test = '({jsVar}.length < '.$options[0].' || {jsVar}.length > '.$options[1].')';
- }
- return array('', "{jsVar} != '' && {$test}");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Range
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Checks that the length of value is within range
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ */
+require_once 'HTML/QuickForm/Rule.php';
+
+/**
+ * Checks that the length of value is within range
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_Rule_Range extends HTML_QuickForm_Rule
+{
+ /**
+ * Validates a value using a range comparison
+ *
+ * @param string $value Value to be checked
+ * @param mixed $options Int for length, array for range
+ * @access public
+ * @return boolean true if value is valid
+ */
+ function validate($value, $options)
+ {
+ $length = strlen($value);
+ switch ($this->name) {
+ case 'minlength': return ($length >= $options);
+ case 'maxlength': return ($length <= $options);
+ default: return ($length >= $options[0] && $length <= $options[1]);
+ }
+ } // end func validate
+
+
+ function getValidationScript($options = null)
+ {
+ switch ($this->name) {
+ case 'minlength':
+ $test = '{jsVar}.length < '.$options;
+ break;
+ case 'maxlength':
+ $test = '{jsVar}.length > '.$options;
+ break;
+ default:
+ $test = '({jsVar}.length < '.$options[0].' || {jsVar}.length > '.$options[1].')';
+ }
+ return array('', "{jsVar} != '' && {$test}");
+ } // end func getValidationScript
+
+} // end class HTML_QuickForm_Rule_Range
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/Rule/Regex.php b/libs/HTML/QuickForm/Rule/Regex.php
index bc060b9887..2417a022e2 100755
--- a/libs/HTML/QuickForm/Rule/Regex.php
+++ b/libs/HTML/QuickForm/Rule/Regex.php
@@ -1,101 +1,101 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Validates values using regular expressions
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Validates values using regular expressions
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule
-{
- /**
- * Array of regular expressions
- *
- * Array is in the format:
- * $_data['rulename'] = 'pattern';
- *
- * @var array
- * @access private
- */
- var $_data = array(
- 'lettersonly' => '/^[a-zA-Z]+$/',
- 'alphanumeric' => '/^[a-zA-Z0-9]+$/',
- 'numeric' => '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/',
- 'nopunctuation' => '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/',
- 'nonzero' => '/^-?[1-9][0-9]*/'
- );
-
- /**
- * Validates a value using a regular expression
- *
- * @param string $value Value to be checked
- * @param string $regex Regular expression
- * @access public
- * @return boolean true if value is valid
- */
- function validate($value, $regex = null)
- {
- // Fix for bug #10799: add 'D' modifier to regex
- if (isset($this->_data[$this->name])) {
- if (!preg_match($this->_data[$this->name] . 'D', $value)) {
- return false;
- }
- } else {
- if (!preg_match($regex . 'D', $value)) {
- return false;
- }
- }
- return true;
- } // end func validate
-
- /**
- * Adds new regular expressions to the list
- *
- * @param string $name Name of rule
- * @param string $pattern Regular expression pattern
- * @access public
- */
- function addData($name, $pattern)
- {
- $this->_data[$name] = $pattern;
- } // end func addData
-
-
- function getValidationScript($options = null)
- {
- $regex = isset($this->_data[$this->name]) ? $this->_data[$this->name] : $options;
-
- return array(" var regex = " . $regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Regex
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Validates values using regular expressions
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ */
+require_once 'HTML/QuickForm/Rule.php';
+
+/**
+ * Validates values using regular expressions
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule
+{
+ /**
+ * Array of regular expressions
+ *
+ * Array is in the format:
+ * $_data['rulename'] = 'pattern';
+ *
+ * @var array
+ * @access private
+ */
+ var $_data = array(
+ 'lettersonly' => '/^[a-zA-Z]+$/',
+ 'alphanumeric' => '/^[a-zA-Z0-9]+$/',
+ 'numeric' => '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/',
+ 'nopunctuation' => '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/',
+ 'nonzero' => '/^-?[1-9][0-9]*/'
+ );
+
+ /**
+ * Validates a value using a regular expression
+ *
+ * @param string $value Value to be checked
+ * @param string $regex Regular expression
+ * @access public
+ * @return boolean true if value is valid
+ */
+ function validate($value, $regex = null)
+ {
+ // Fix for bug #10799: add 'D' modifier to regex
+ if (isset($this->_data[$this->name])) {
+ if (!preg_match($this->_data[$this->name] . 'D', $value)) {
+ return false;
+ }
+ } else {
+ if (!preg_match($regex . 'D', $value)) {
+ return false;
+ }
+ }
+ return true;
+ } // end func validate
+
+ /**
+ * Adds new regular expressions to the list
+ *
+ * @param string $name Name of rule
+ * @param string $pattern Regular expression pattern
+ * @access public
+ */
+ function addData($name, $pattern)
+ {
+ $this->_data[$name] = $pattern;
+ } // end func addData
+
+
+ function getValidationScript($options = null)
+ {
+ $regex = isset($this->_data[$this->name]) ? $this->_data[$this->name] : $options;
+
+ return array(" var regex = " . $regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})");
+ } // end func getValidationScript
+
+} // end class HTML_QuickForm_Rule_Regex
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/Rule/Required.php b/libs/HTML/QuickForm/Rule/Required.php
index 831efcf3ee..f8cc8f5924 100755
--- a/libs/HTML/QuickForm/Rule/Required.php
+++ b/libs/HTML/QuickForm/Rule/Required.php
@@ -1,63 +1,63 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Required elements validation
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Required elements validation
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Required extends HTML_QuickForm_Rule
-{
- /**
- * Checks if an element is empty
- *
- * @param string $value Value to check
- * @param mixed $options Not used yet
- * @access public
- * @return boolean true if value is not empty
- */
- function validate($value, $options = null)
- {
- if ((string)$value == '') {
- return false;
- }
- return true;
- } // end func validate
-
-
- function getValidationScript($options = null)
- {
- return array('', "{jsVar} == ''");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Required
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Required elements validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Abstract base class for QuickForm validation rules
+ */
+require_once 'HTML/QuickForm/Rule.php';
+
+/**
+ * Required elements validation
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_Rule_Required extends HTML_QuickForm_Rule
+{
+ /**
+ * Checks if an element is empty
+ *
+ * @param string $value Value to check
+ * @param mixed $options Not used yet
+ * @access public
+ * @return boolean true if value is not empty
+ */
+ function validate($value, $options = null)
+ {
+ if ((string)$value == '') {
+ return false;
+ }
+ return true;
+ } // end func validate
+
+
+ function getValidationScript($options = null)
+ {
+ return array('', "{jsVar} == ''");
+ } // end func getValidationScript
+
+} // end class HTML_QuickForm_Rule_Required
+?>
diff --git a/libs/HTML/QuickForm/RuleRegistry.php b/libs/HTML/QuickForm/RuleRegistry.php
index e77c338a25..cb1a74eb18 100755
--- a/libs/HTML/QuickForm/RuleRegistry.php
+++ b/libs/HTML/QuickForm/RuleRegistry.php
@@ -1,349 +1,349 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Registers rule objects and uses them for validation
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Registers rule objects and uses them for validation
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_RuleRegistry
-{
- /**
- * Array containing references to used rules
- * @var array
- * @access private
- */
- var $_rules = array();
-
-
- /**
- * Returns a singleton of HTML_QuickForm_RuleRegistry
- *
- * Usually, only one RuleRegistry object is needed, this is the reason
- * why it is recommended to use this method to get the validation object.
- *
- * @access public
- * @static
- * @return HTML_QuickForm_RuleRegistry
- */
- static function &singleton()
- {
- static $obj;
- if (!isset($obj)) {
- $obj = new HTML_QuickForm_RuleRegistry();
- }
- return $obj;
- } // end func singleton
-
- /**
- * Registers a new validation rule
- *
- * In order to use a custom rule in your form, you need to register it
- * first. For regular expressions, one can directly use the 'regex' type
- * rule in addRule(), this is faster than registering the rule.
- *
- * Functions and methods can be registered. Use the 'function' type.
- * When registering a method, specify the class name as second parameter.
- *
- * You can also register an HTML_QuickForm_Rule subclass with its own
- * validate() method.
- *
- * @param string $ruleName Name of validation rule
- * @param string $type Either: 'regex', 'function' or null
- * @param string $data1 Name of function, regular expression or
- * HTML_QuickForm_Rule object class name
- * @param string $data2 Object parent of above function or HTML_QuickForm_Rule file path
- * @access public
- * @return void
- */
- function registerRule($ruleName, $type, $data1, $data2 = null)
- {
- $type = strtolower($type);
- if ($type == 'regex') {
- // Regular expression
- $rule =& $this->getRule('regex');
- $rule->addData($ruleName, $data1);
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['regex'];
-
- } elseif ($type == 'function' || $type == 'callback') {
- // Callback function
- $rule =& $this->getRule('callback');
- $rule->addData($ruleName, $data1, $data2, 'function' == $type);
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['callback'];
-
- } elseif (is_object($data1)) {
- // An instance of HTML_QuickForm_Rule
- $this->_rules[strtolower(get_class($data1))] = $data1;
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower(get_class($data1)), null);
-
- } else {
- // Rule class name
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower($data1), $data2);
- }
- } // end func registerRule
-
- /**
- * Returns a reference to the requested rule object
- *
- * @param string $ruleName Name of the requested rule
- * @access public
- * @return HTML_QuickForm_Rule
- */
- function &getRule($ruleName)
- {
- list($class, $path) = $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName];
-
- if (!isset($this->_rules[$class])) {
- if (!empty($path)) {
- include_once($path);
- }
- $this->_rules[$class] = new $class();
- }
- $this->_rules[$class]->setName($ruleName);
- return $this->_rules[$class];
- } // end func getRule
-
- /**
- * Performs validation on the given values
- *
- * @param string $ruleName Name of the rule to be used
- * @param mixed $values Can be a scalar or an array of values
- * to be validated
- * @param mixed $options Options used by the rule
- * @param mixed $multiple Whether to validate an array of values altogether
- * @access public
- * @return mixed true if no error found, int of valid values (when an array of values is given) or false if error
- */
- function validate($ruleName, $values, $options = null, $multiple = false)
- {
- $rule =& $this->getRule($ruleName);
-
- if (is_array($values) && !$multiple) {
- $result = 0;
- foreach ($values as $value) {
- if ($rule->validate($value, $options) === true) {
- $result++;
- }
- }
- return ($result == 0) ? false : $result;
- } else {
- return $rule->validate($values, $options);
- }
- } // end func validate
-
- /**
- * Returns the validation test in javascript code
- *
- * @param array|HTML_QuickForm_element Element(s) the rule applies to
- * @param string Element name, in case $element is
- * not an array
- * @param array Rule data
- * @access public
- * @return string JavaScript for the rule
- */
- function getValidationScript(&$element, $elementName, $ruleData)
- {
- $reset = (isset($ruleData['reset'])) ? $ruleData['reset'] : false;
- $rule =& $this->getRule($ruleData['type']);
- if (!is_array($element)) {
- list($jsValue, $jsReset) = $this->_getJsValue($element, $elementName, $reset, null);
- } else {
- $jsValue = " value = new Array();\n";
- $jsReset = '';
- for ($i = 0; $i < count($element); $i++) {
- list($tmp_value, $tmp_reset) = $this->_getJsValue($element[$i], $element[$i]->getName(), $reset, $i);
- $jsValue .= "\n" . $tmp_value;
- $jsReset .= $tmp_reset;
- }
- }
- $jsField = isset($ruleData['group'])? $ruleData['group']: $elementName;
- list ($jsPrefix, $jsCheck) = $rule->getValidationScript($ruleData['format']);
- if (!isset($ruleData['howmany'])) {
- $js = $jsValue . "\n" . $jsPrefix .
- " if (" . str_replace('{jsVar}', 'value', $jsCheck) . " && !errFlag['{$jsField}']) {\n" .
- " errFlag['{$jsField}'] = true;\n" .
- " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" .
- $jsReset .
- " }\n";
- } else {
- $js = $jsValue . "\n" . $jsPrefix .
- " var res = 0;\n" .
- " for (var i = 0; i < value.length; i++) {\n" .
- " if (!(" . str_replace('{jsVar}', 'value[i]', $jsCheck) . ")) {\n" .
- " res++;\n" .
- " }\n" .
- " }\n" .
- " if (res < {$ruleData['howmany']} && !errFlag['{$jsField}']) {\n" .
- " errFlag['{$jsField}'] = true;\n" .
- " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" .
- $jsReset .
- " }\n";
- }
- return $js;
- } // end func getValidationScript
-
-
- /**
- * Returns JavaScript to get and to reset the element's value
- *
- * @access private
- * @param HTML_QuickForm_element element being processed
- * @param string element's name
- * @param bool whether to generate JavaScript to reset
- * the value
- * @param integer value's index in the array (only used for
- * multielement rules)
- * @return array first item is value javascript, second is reset
- */
- function _getJsValue(&$element, $elementName, $reset = false, $index = null)
- {
- $jsIndex = isset($index)? '[' . $index . ']': '';
- $tmp_reset = $reset? " var field = frm.elements['$elementName'];\n": '';
- if (is_a($element, 'html_quickform_group')) {
- $value = " _qfGroups['{$elementName}'] = {";
- $elements =& $element->getElements();
- for ($i = 0, $count = count($elements); $i < $count; $i++) {
- $append = ($elements[$i]->getType() == 'select' && $elements[$i]->getMultiple())? '[]': '';
- $value .= "'" . $element->getElementName($i) . $append . "': true" .
- ($i < $count - 1? ', ': '');
- }
- $value .=
- "};\n" .
- " value{$jsIndex} = new Array();\n" .
- " var valueIdx = 0;\n" .
- " for (var i = 0; i < frm.elements.length; i++) {\n" .
- " var _element = frm.elements[i];\n" .
- " if (_element.name in _qfGroups['{$elementName}']) {\n" .
- " switch (_element.type) {\n" .
- " case 'checkbox':\n" .
- " case 'radio':\n" .
- " if (_element.checked) {\n" .
- " value{$jsIndex}[valueIdx++] = _element.value;\n" .
- " }\n" .
- " break;\n" .
- " case 'select-one':\n" .
- " if (-1 != _element.selectedIndex) {\n" .
- " value{$jsIndex}[valueIdx++] = _element.options[_element.selectedIndex].value;\n" .
- " }\n" .
- " break;\n" .
- " case 'select-multiple':\n" .
- " var tmpVal = new Array();\n" .
- " var tmpIdx = 0;\n" .
- " for (var j = 0; j < _element.options.length; j++) {\n" .
- " if (_element.options[j].selected) {\n" .
- " tmpVal[tmpIdx++] = _element.options[j].value;\n" .
- " }\n" .
- " }\n" .
- " if (tmpIdx > 0) {\n" .
- " value{$jsIndex}[valueIdx++] = tmpVal;\n" .
- " }\n" .
- " break;\n" .
- " default:\n" .
- " value{$jsIndex}[valueIdx++] = _element.value;\n" .
- " }\n" .
- " }\n" .
- " }\n";
- if ($reset) {
- $tmp_reset =
- " for (var i = 0; i < frm.elements.length; i++) {\n" .
- " var _element = frm.elements[i];\n" .
- " if (_element.name in _qfGroups['{$elementName}']) {\n" .
- " switch (_element.type) {\n" .
- " case 'checkbox':\n" .
- " case 'radio':\n" .
- " _element.checked = _element.defaultChecked;\n" .
- " break;\n" .
- " case 'select-one':\n" .
- " case 'select-multiple':\n" .
- " for (var j = 0; j < _element.options.length; j++) {\n" .
- " _element.options[j].selected = _element.options[j].defaultSelected;\n" .
- " }\n" .
- " break;\n" .
- " default:\n" .
- " _element.value = _element.defaultValue;\n" .
- " }\n" .
- " }\n" .
- " }\n";
- }
-
- } elseif ($element->getType() == 'select') {
- if ($element->getMultiple()) {
- $elementName .= '[]';
- $value =
- " value{$jsIndex} = new Array();\n" .
- " var valueIdx = 0;\n" .
- " for (var i = 0; i < frm.elements['{$elementName}'].options.length; i++) {\n" .
- " if (frm.elements['{$elementName}'].options[i].selected) {\n" .
- " value{$jsIndex}[valueIdx++] = frm.elements['{$elementName}'].options[i].value;\n" .
- " }\n" .
- " }\n";
- } else {
- $value = " value{$jsIndex} = frm.elements['{$elementName}'].selectedIndex == -1? '': frm.elements['{$elementName}'].options[frm.elements['{$elementName}'].selectedIndex].value;\n";
- }
- if ($reset) {
- $tmp_reset .=
- " for (var i = 0; i < field.options.length; i++) {\n" .
- " field.options[i].selected = field.options[i].defaultSelected;\n" .
- " }\n";
- }
-
- } elseif ($element->getType() == 'checkbox') {
- if (is_a($element, 'html_quickform_advcheckbox')) {
- $value = " value{$jsIndex} = frm.elements['$elementName'][1].checked? frm.elements['$elementName'][1].value: frm.elements['$elementName'][0].value;\n";
- $tmp_reset .= $reset ? " field[1].checked = field[1].defaultChecked;\n" : '';
- } else {
- $value = " value{$jsIndex} = frm.elements['$elementName'].checked? '1': '';\n";
- $tmp_reset .= $reset ? " field.checked = field.defaultChecked;\n" : '';
- }
-
- } elseif ($element->getType() == 'radio') {
- $value = " value{$jsIndex} = '';\n" .
- // Fix for bug #5644
- " var els = 'length' in frm.elements['$elementName']? frm.elements['$elementName']: [ frm.elements['$elementName'] ];\n" .
- " for (var i = 0; i < els.length; i++) {\n" .
- " if (els[i].checked) {\n" .
- " value{$jsIndex} = els[i].value;\n" .
- " }\n" .
- " }";
- if ($reset) {
- $tmp_reset .= " for (var i = 0; i < field.length; i++) {\n" .
- " field[i].checked = field[i].defaultChecked;\n" .
- " }";
- }
-
- } else {
- $value = " value{$jsIndex} = frm.elements['$elementName'].value;";
- $tmp_reset .= ($reset) ? " field.value = field.defaultValue;\n" : '';
- }
- return array($value, $tmp_reset);
- }
-} // end class HTML_QuickForm_RuleRegistry
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Registers rule objects and uses them for validation
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Registers rule objects and uses them for validation
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_RuleRegistry
+{
+ /**
+ * Array containing references to used rules
+ * @var array
+ * @access private
+ */
+ var $_rules = array();
+
+
+ /**
+ * Returns a singleton of HTML_QuickForm_RuleRegistry
+ *
+ * Usually, only one RuleRegistry object is needed, this is the reason
+ * why it is recommended to use this method to get the validation object.
+ *
+ * @access public
+ * @static
+ * @return HTML_QuickForm_RuleRegistry
+ */
+ static function &singleton()
+ {
+ static $obj;
+ if (!isset($obj)) {
+ $obj = new HTML_QuickForm_RuleRegistry();
+ }
+ return $obj;
+ } // end func singleton
+
+ /**
+ * Registers a new validation rule
+ *
+ * In order to use a custom rule in your form, you need to register it
+ * first. For regular expressions, one can directly use the 'regex' type
+ * rule in addRule(), this is faster than registering the rule.
+ *
+ * Functions and methods can be registered. Use the 'function' type.
+ * When registering a method, specify the class name as second parameter.
+ *
+ * You can also register an HTML_QuickForm_Rule subclass with its own
+ * validate() method.
+ *
+ * @param string $ruleName Name of validation rule
+ * @param string $type Either: 'regex', 'function' or null
+ * @param string $data1 Name of function, regular expression or
+ * HTML_QuickForm_Rule object class name
+ * @param string $data2 Object parent of above function or HTML_QuickForm_Rule file path
+ * @access public
+ * @return void
+ */
+ function registerRule($ruleName, $type, $data1, $data2 = null)
+ {
+ $type = strtolower($type);
+ if ($type == 'regex') {
+ // Regular expression
+ $rule =& $this->getRule('regex');
+ $rule->addData($ruleName, $data1);
+ $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['regex'];
+
+ } elseif ($type == 'function' || $type == 'callback') {
+ // Callback function
+ $rule =& $this->getRule('callback');
+ $rule->addData($ruleName, $data1, $data2, 'function' == $type);
+ $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['callback'];
+
+ } elseif (is_object($data1)) {
+ // An instance of HTML_QuickForm_Rule
+ $this->_rules[strtolower(get_class($data1))] = $data1;
+ $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower(get_class($data1)), null);
+
+ } else {
+ // Rule class name
+ $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower($data1), $data2);
+ }
+ } // end func registerRule
+
+ /**
+ * Returns a reference to the requested rule object
+ *
+ * @param string $ruleName Name of the requested rule
+ * @access public
+ * @return HTML_QuickForm_Rule
+ */
+ function &getRule($ruleName)
+ {
+ list($class, $path) = $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName];
+
+ if (!isset($this->_rules[$class])) {
+ if (!empty($path)) {
+ include_once($path);
+ }
+ $this->_rules[$class] = new $class();
+ }
+ $this->_rules[$class]->setName($ruleName);
+ return $this->_rules[$class];
+ } // end func getRule
+
+ /**
+ * Performs validation on the given values
+ *
+ * @param string $ruleName Name of the rule to be used
+ * @param mixed $values Can be a scalar or an array of values
+ * to be validated
+ * @param mixed $options Options used by the rule
+ * @param mixed $multiple Whether to validate an array of values altogether
+ * @access public
+ * @return mixed true if no error found, int of valid values (when an array of values is given) or false if error
+ */
+ function validate($ruleName, $values, $options = null, $multiple = false)
+ {
+ $rule =& $this->getRule($ruleName);
+
+ if (is_array($values) && !$multiple) {
+ $result = 0;
+ foreach ($values as $value) {
+ if ($rule->validate($value, $options) === true) {
+ $result++;
+ }
+ }
+ return ($result == 0) ? false : $result;
+ } else {
+ return $rule->validate($values, $options);
+ }
+ } // end func validate
+
+ /**
+ * Returns the validation test in javascript code
+ *
+ * @param array|HTML_QuickForm_element Element(s) the rule applies to
+ * @param string Element name, in case $element is
+ * not an array
+ * @param array Rule data
+ * @access public
+ * @return string JavaScript for the rule
+ */
+ function getValidationScript(&$element, $elementName, $ruleData)
+ {
+ $reset = (isset($ruleData['reset'])) ? $ruleData['reset'] : false;
+ $rule =& $this->getRule($ruleData['type']);
+ if (!is_array($element)) {
+ list($jsValue, $jsReset) = $this->_getJsValue($element, $elementName, $reset, null);
+ } else {
+ $jsValue = " value = new Array();\n";
+ $jsReset = '';
+ for ($i = 0; $i < count($element); $i++) {
+ list($tmp_value, $tmp_reset) = $this->_getJsValue($element[$i], $element[$i]->getName(), $reset, $i);
+ $jsValue .= "\n" . $tmp_value;
+ $jsReset .= $tmp_reset;
+ }
+ }
+ $jsField = isset($ruleData['group'])? $ruleData['group']: $elementName;
+ list ($jsPrefix, $jsCheck) = $rule->getValidationScript($ruleData['format']);
+ if (!isset($ruleData['howmany'])) {
+ $js = $jsValue . "\n" . $jsPrefix .
+ " if (" . str_replace('{jsVar}', 'value', $jsCheck) . " && !errFlag['{$jsField}']) {\n" .
+ " errFlag['{$jsField}'] = true;\n" .
+ " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" .
+ $jsReset .
+ " }\n";
+ } else {
+ $js = $jsValue . "\n" . $jsPrefix .
+ " var res = 0;\n" .
+ " for (var i = 0; i < value.length; i++) {\n" .
+ " if (!(" . str_replace('{jsVar}', 'value[i]', $jsCheck) . ")) {\n" .
+ " res++;\n" .
+ " }\n" .
+ " }\n" .
+ " if (res < {$ruleData['howmany']} && !errFlag['{$jsField}']) {\n" .
+ " errFlag['{$jsField}'] = true;\n" .
+ " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" .
+ $jsReset .
+ " }\n";
+ }
+ return $js;
+ } // end func getValidationScript
+
+
+ /**
+ * Returns JavaScript to get and to reset the element's value
+ *
+ * @access private
+ * @param HTML_QuickForm_element element being processed
+ * @param string element's name
+ * @param bool whether to generate JavaScript to reset
+ * the value
+ * @param integer value's index in the array (only used for
+ * multielement rules)
+ * @return array first item is value javascript, second is reset
+ */
+ function _getJsValue(&$element, $elementName, $reset = false, $index = null)
+ {
+ $jsIndex = isset($index)? '[' . $index . ']': '';
+ $tmp_reset = $reset? " var field = frm.elements['$elementName'];\n": '';
+ if (is_a($element, 'html_quickform_group')) {
+ $value = " _qfGroups['{$elementName}'] = {";
+ $elements =& $element->getElements();
+ for ($i = 0, $count = count($elements); $i < $count; $i++) {
+ $append = ($elements[$i]->getType() == 'select' && $elements[$i]->getMultiple())? '[]': '';
+ $value .= "'" . $element->getElementName($i) . $append . "': true" .
+ ($i < $count - 1? ', ': '');
+ }
+ $value .=
+ "};\n" .
+ " value{$jsIndex} = new Array();\n" .
+ " var valueIdx = 0;\n" .
+ " for (var i = 0; i < frm.elements.length; i++) {\n" .
+ " var _element = frm.elements[i];\n" .
+ " if (_element.name in _qfGroups['{$elementName}']) {\n" .
+ " switch (_element.type) {\n" .
+ " case 'checkbox':\n" .
+ " case 'radio':\n" .
+ " if (_element.checked) {\n" .
+ " value{$jsIndex}[valueIdx++] = _element.value;\n" .
+ " }\n" .
+ " break;\n" .
+ " case 'select-one':\n" .
+ " if (-1 != _element.selectedIndex) {\n" .
+ " value{$jsIndex}[valueIdx++] = _element.options[_element.selectedIndex].value;\n" .
+ " }\n" .
+ " break;\n" .
+ " case 'select-multiple':\n" .
+ " var tmpVal = new Array();\n" .
+ " var tmpIdx = 0;\n" .
+ " for (var j = 0; j < _element.options.length; j++) {\n" .
+ " if (_element.options[j].selected) {\n" .
+ " tmpVal[tmpIdx++] = _element.options[j].value;\n" .
+ " }\n" .
+ " }\n" .
+ " if (tmpIdx > 0) {\n" .
+ " value{$jsIndex}[valueIdx++] = tmpVal;\n" .
+ " }\n" .
+ " break;\n" .
+ " default:\n" .
+ " value{$jsIndex}[valueIdx++] = _element.value;\n" .
+ " }\n" .
+ " }\n" .
+ " }\n";
+ if ($reset) {
+ $tmp_reset =
+ " for (var i = 0; i < frm.elements.length; i++) {\n" .
+ " var _element = frm.elements[i];\n" .
+ " if (_element.name in _qfGroups['{$elementName}']) {\n" .
+ " switch (_element.type) {\n" .
+ " case 'checkbox':\n" .
+ " case 'radio':\n" .
+ " _element.checked = _element.defaultChecked;\n" .
+ " break;\n" .
+ " case 'select-one':\n" .
+ " case 'select-multiple':\n" .
+ " for (var j = 0; j < _element.options.length; j++) {\n" .
+ " _element.options[j].selected = _element.options[j].defaultSelected;\n" .
+ " }\n" .
+ " break;\n" .
+ " default:\n" .
+ " _element.value = _element.defaultValue;\n" .
+ " }\n" .
+ " }\n" .
+ " }\n";
+ }
+
+ } elseif ($element->getType() == 'select') {
+ if ($element->getMultiple()) {
+ $elementName .= '[]';
+ $value =
+ " value{$jsIndex} = new Array();\n" .
+ " var valueIdx = 0;\n" .
+ " for (var i = 0; i < frm.elements['{$elementName}'].options.length; i++) {\n" .
+ " if (frm.elements['{$elementName}'].options[i].selected) {\n" .
+ " value{$jsIndex}[valueIdx++] = frm.elements['{$elementName}'].options[i].value;\n" .
+ " }\n" .
+ " }\n";
+ } else {
+ $value = " value{$jsIndex} = frm.elements['{$elementName}'].selectedIndex == -1? '': frm.elements['{$elementName}'].options[frm.elements['{$elementName}'].selectedIndex].value;\n";
+ }
+ if ($reset) {
+ $tmp_reset .=
+ " for (var i = 0; i < field.options.length; i++) {\n" .
+ " field.options[i].selected = field.options[i].defaultSelected;\n" .
+ " }\n";
+ }
+
+ } elseif ($element->getType() == 'checkbox') {
+ if (is_a($element, 'html_quickform_advcheckbox')) {
+ $value = " value{$jsIndex} = frm.elements['$elementName'][1].checked? frm.elements['$elementName'][1].value: frm.elements['$elementName'][0].value;\n";
+ $tmp_reset .= $reset ? " field[1].checked = field[1].defaultChecked;\n" : '';
+ } else {
+ $value = " value{$jsIndex} = frm.elements['$elementName'].checked? '1': '';\n";
+ $tmp_reset .= $reset ? " field.checked = field.defaultChecked;\n" : '';
+ }
+
+ } elseif ($element->getType() == 'radio') {
+ $value = " value{$jsIndex} = '';\n" .
+ // Fix for bug #5644
+ " var els = 'length' in frm.elements['$elementName']? frm.elements['$elementName']: [ frm.elements['$elementName'] ];\n" .
+ " for (var i = 0; i < els.length; i++) {\n" .
+ " if (els[i].checked) {\n" .
+ " value{$jsIndex} = els[i].value;\n" .
+ " }\n" .
+ " }";
+ if ($reset) {
+ $tmp_reset .= " for (var i = 0; i < field.length; i++) {\n" .
+ " field[i].checked = field[i].defaultChecked;\n" .
+ " }";
+ }
+
+ } else {
+ $value = " value{$jsIndex} = frm.elements['$elementName'].value;";
+ $tmp_reset .= ($reset) ? " field.value = field.defaultValue;\n" : '';
+ }
+ return array($value, $tmp_reset);
+ }
+} // end class HTML_QuickForm_RuleRegistry
+?>
diff --git a/libs/HTML/QuickForm/advcheckbox.php b/libs/HTML/QuickForm/advcheckbox.php
index 3112d4f415..adda853f90 100755
--- a/libs/HTML/QuickForm/advcheckbox.php
+++ b/libs/HTML/QuickForm/advcheckbox.php
@@ -1,286 +1,286 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an advanced checkbox type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Jason Rust <jrust@php.net>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for a checkbox type field
- */
-require_once 'HTML/QuickForm/checkbox.php';
-
-/**
- * HTML class for an advanced checkbox type field
- *
- * Basically this fixes a problem that HTML has had
- * where checkboxes can only pass a single value (the
- * value of the checkbox when checked). A value for when
- * the checkbox is not checked cannot be passed, and
- * furthermore the checkbox variable doesn't even exist if
- * the checkbox was submitted unchecked.
- *
- * It works by prepending a hidden field with the same name and
- * another "unchecked" value to the checbox. If the checkbox is
- * checked, PHP overwrites the value of the hidden field with
- * its value.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Jason Rust <jrust@php.net>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 2.0
- */
-class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
-{
- // {{{ properties
-
- /**
- * The values passed by the hidden elment
- *
- * @var array
- * @access private
- */
- var $_values = null;
-
- /**
- * The default value
- *
- * @var boolean
- * @access private
- */
- var $_currentValue = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label
- * @param string $text (optional)Text to put after the checkbox
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @param mixed $values (optional)Values to pass if checked or not checked
- *
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
- {
- $this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
- $this->setValues($values);
- } //end constructor
-
- // }}}
- // {{{ getPrivateName()
-
- /**
- * Gets the private name for the element
- *
- * @param string $elementName The element name to make private
- *
- * @access public
- * @return string
- *
- * @deprecated Deprecated since 3.2.6, both generated elements have the same name
- */
- function getPrivateName($elementName)
- {
- return '__'.$elementName;
- }
-
- // }}}
- // {{{ getOnclickJs()
-
- /**
- * Create the javascript for the onclick event which will
- * set the value of the hidden field
- *
- * @param string $elementName The element name
- *
- * @access public
- * @return string
- *
- * @deprecated Deprecated since 3.2.6, this element no longer uses any javascript
- */
- function getOnclickJs($elementName)
- {
- $onclickJs = 'if (this.checked) { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[1], '\'').'\'; }';
- $onclickJs .= 'else { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[0], '\'').'\'; }';
- return $onclickJs;
- }
-
- // }}}
- // {{{ setValues()
-
- /**
- * Sets the values used by the hidden element
- *
- * @param mixed $values The values, either a string or an array
- *
- * @access public
- * @return void
- */
- function setValues($values)
- {
- if (empty($values)) {
- // give it default checkbox behavior
- $this->_values = array('', 1);
- } elseif (is_scalar($values)) {
- // if it's string, then assume the value to
- // be passed is for when the element is checked
- $this->_values = array('', $values);
- } else {
- $this->_values = $values;
- }
- $this->updateAttributes(array('value' => $this->_values[1]));
- $this->setChecked($this->_currentValue == $this->_values[1]);
- }
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the element's value
- *
- * @param mixed Element's value
- * @access public
- */
- function setValue($value)
- {
- $this->setChecked(isset($this->_values[1]) && $value == $this->_values[1]);
- $this->_currentValue = $value;
- }
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the element's value
- *
- * @access public
- * @return mixed
- */
- function getValue()
- {
- if (is_array($this->_values)) {
- return $this->_values[$this->getChecked()? 1: 0];
- } else {
- return null;
- }
- }
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the checkbox element in HTML
- * and the additional hidden element in HTML
- *
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return parent::toHtml();
- } else {
- return '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $this->getName(),
- 'value' => $this->_values[0]
- )) . ' />' . parent::toHtml();
-
- }
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Unlike checkbox, this has to append a hidden input in both
- * checked and non-checked states
- */
- function getFrozenHtml()
- {
- return ($this->getChecked()? '<tt>[x]</tt>': '<tt>[ ]</tt>') .
- $this->_getPersistantData();
- }
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormLoad
-
- // }}}
- // {{{ exportValue()
-
- /**
- * This element has a value even if it is not checked, thus we override
- * checkbox's behaviour here
- */
- function exportValue(&$submitValues, $assoc)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getValue();
- } elseif (is_array($this->_values) && ($value != $this->_values[0]) && ($value != $this->_values[1])) {
- $value = null;
- }
- return $this->_prepareValue($value, $assoc);
- }
- // }}}
-} //end class HTML_QuickForm_advcheckbox
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for an advanced checkbox type field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Jason Rust <jrust@php.net>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * HTML class for a checkbox type field
+ */
+require_once 'HTML/QuickForm/checkbox.php';
+
+/**
+ * HTML class for an advanced checkbox type field
+ *
+ * Basically this fixes a problem that HTML has had
+ * where checkboxes can only pass a single value (the
+ * value of the checkbox when checked). A value for when
+ * the checkbox is not checked cannot be passed, and
+ * furthermore the checkbox variable doesn't even exist if
+ * the checkbox was submitted unchecked.
+ *
+ * It works by prepending a hidden field with the same name and
+ * another "unchecked" value to the checbox. If the checkbox is
+ * checked, PHP overwrites the value of the hidden field with
+ * its value.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Jason Rust <jrust@php.net>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 2.0
+ */
+class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
+{
+ // {{{ properties
+
+ /**
+ * The values passed by the hidden elment
+ *
+ * @var array
+ * @access private
+ */
+ var $_values = null;
+
+ /**
+ * The default value
+ *
+ * @var boolean
+ * @access private
+ */
+ var $_currentValue = null;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $elementLabel (optional)Input field label
+ * @param string $text (optional)Text to put after the checkbox
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @param mixed $values (optional)Values to pass if checked or not checked
+ *
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
+ {
+ $this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
+ $this->setValues($values);
+ } //end constructor
+
+ // }}}
+ // {{{ getPrivateName()
+
+ /**
+ * Gets the private name for the element
+ *
+ * @param string $elementName The element name to make private
+ *
+ * @access public
+ * @return string
+ *
+ * @deprecated Deprecated since 3.2.6, both generated elements have the same name
+ */
+ function getPrivateName($elementName)
+ {
+ return '__'.$elementName;
+ }
+
+ // }}}
+ // {{{ getOnclickJs()
+
+ /**
+ * Create the javascript for the onclick event which will
+ * set the value of the hidden field
+ *
+ * @param string $elementName The element name
+ *
+ * @access public
+ * @return string
+ *
+ * @deprecated Deprecated since 3.2.6, this element no longer uses any javascript
+ */
+ function getOnclickJs($elementName)
+ {
+ $onclickJs = 'if (this.checked) { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[1], '\'').'\'; }';
+ $onclickJs .= 'else { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[0], '\'').'\'; }';
+ return $onclickJs;
+ }
+
+ // }}}
+ // {{{ setValues()
+
+ /**
+ * Sets the values used by the hidden element
+ *
+ * @param mixed $values The values, either a string or an array
+ *
+ * @access public
+ * @return void
+ */
+ function setValues($values)
+ {
+ if (empty($values)) {
+ // give it default checkbox behavior
+ $this->_values = array('', 1);
+ } elseif (is_scalar($values)) {
+ // if it's string, then assume the value to
+ // be passed is for when the element is checked
+ $this->_values = array('', $values);
+ } else {
+ $this->_values = $values;
+ }
+ $this->updateAttributes(array('value' => $this->_values[1]));
+ $this->setChecked($this->_currentValue == $this->_values[1]);
+ }
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets the element's value
+ *
+ * @param mixed Element's value
+ * @access public
+ */
+ function setValue($value)
+ {
+ $this->setChecked(isset($this->_values[1]) && $value == $this->_values[1]);
+ $this->_currentValue = $value;
+ }
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns the element's value
+ *
+ * @access public
+ * @return mixed
+ */
+ function getValue()
+ {
+ if (is_array($this->_values)) {
+ return $this->_values[$this->getChecked()? 1: 0];
+ } else {
+ return null;
+ }
+ }
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the checkbox element in HTML
+ * and the additional hidden element in HTML
+ *
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ if ($this->_flagFrozen) {
+ return parent::toHtml();
+ } else {
+ return '<input' . $this->_getAttrString(array(
+ 'type' => 'hidden',
+ 'name' => $this->getName(),
+ 'value' => $this->_values[0]
+ )) . ' />' . parent::toHtml();
+
+ }
+ } //end func toHtml
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Unlike checkbox, this has to append a hidden input in both
+ * checked and non-checked states
+ */
+ function getFrozenHtml()
+ {
+ return ($this->getChecked()? '<tt>[x]</tt>': '<tt>[ ]</tt>') .
+ $this->_getPersistantData();
+ }
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string $event Name of event
+ * @param mixed $arg event arguments
+ * @param object &$caller calling object
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ switch ($event) {
+ case 'updateValue':
+ // constant values override both default and submitted ones
+ // default values are overriden by submitted
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_submitValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ }
+ if (null !== $value) {
+ $this->setValue($value);
+ }
+ break;
+ default:
+ parent::onQuickFormEvent($event, $arg, $caller);
+ }
+ return true;
+ } // end func onQuickFormLoad
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * This element has a value even if it is not checked, thus we override
+ * checkbox's behaviour here
+ */
+ function exportValue(&$submitValues, $assoc)
+ {
+ $value = $this->_findValue($submitValues);
+ if (null === $value) {
+ $value = $this->getValue();
+ } elseif (is_array($this->_values) && ($value != $this->_values[0]) && ($value != $this->_values[1])) {
+ $value = null;
+ }
+ return $this->_prepareValue($value, $assoc);
+ }
+ // }}}
+} //end class HTML_QuickForm_advcheckbox
+?>
diff --git a/libs/HTML/QuickForm/autocomplete.php b/libs/HTML/QuickForm/autocomplete.php
index b4b537c6db..fa10b5e435 100755
--- a/libs/HTML/QuickForm/autocomplete.php
+++ b/libs/HTML/QuickForm/autocomplete.php
@@ -1,258 +1,258 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an autocomplete element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Matteo Di Giovinazzo <matteodg@infinito.it>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for a text field
- */
-require_once 'HTML/QuickForm/text.php';
-
-/**
- * HTML class for an autocomplete element
- *
- * Creates an HTML input text element that
- * at every keypressed javascript event checks in an array of options
- * if there's a match and autocompletes the text in case of match.
- *
- * For the JavaScript code thanks to Martin Honnen and Nicholas C. Zakas
- * See {@link http://www.faqts.com/knowledge_base/view.phtml/aid/13562} and
- * {@link http://www.sitepoint.com/article/1220}
- *
- * Example:
- * <code>
- * $autocomplete =& $form->addElement('autocomplete', 'fruit', 'Favourite fruit:');
- * $options = array("Apple", "Orange", "Pear", "Strawberry");
- * $autocomplete->setOptions($options);
- * </code>
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Matteo Di Giovinazzo <matteodg@infinito.it>
- * @version Release: 3.2.9
- * @since 3.2
- */
-class HTML_QuickForm_autocomplete extends HTML_QuickForm_text
-{
- // {{{ properties
-
- /**
- * Options for the autocomplete input text element
- *
- * @var array
- * @access private
- */
- var $_options = array();
-
- /**
- * "One-time" javascript (containing functions), see bug #4611
- *
- * @var string
- * @access private
- */
- var $_js = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label in form
- * @param array $options (optional)Autocomplete options
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array. Date format is passed along the attributes.
- * @access public
- * @return void
- */
- function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null)
- {
- $this->HTML_QuickForm_text($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'autocomplete';
- if (isset($options)) {
- $this->setOptions($options);
- }
- } //end constructor
-
- // }}}
- // {{{ setOptions()
-
- /**
- * Sets the options for the autocomplete input text element
- *
- * @param array $options Array of options for the autocomplete input text element
- * @access public
- * @return void
- */
- function setOptions($options)
- {
- $this->_options = array_values($options);
- } // end func setOptions
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns Html for the autocomplete input text element
- *
- * @access public
- * @return string
- */
- function toHtml()
- {
- // prevent problems with grouped elements
- $arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values';
-
- $this->updateAttributes(array(
- 'onkeypress' => 'return autocomplete(this, event, ' . $arrayName . ');'
- ));
- if ($this->_flagFrozen) {
- $js = '';
- } else {
- $js = "<script type=\"text/javascript\">\n//<![CDATA[\n";
- if (!defined('HTML_QUICKFORM_AUTOCOMPLETE_EXISTS')) {
- $this->_js .= <<<EOS
-
-/* begin javascript for autocomplete */
-function setSelectionRange(input, selectionStart, selectionEnd) {
- if (input.setSelectionRange) {
- input.setSelectionRange(selectionStart, selectionEnd);
- }
- else if (input.createTextRange) {
- var range = input.createTextRange();
- range.collapse(true);
- range.moveEnd("character", selectionEnd);
- range.moveStart("character", selectionStart);
- range.select();
- }
- input.focus();
-}
-
-function setCaretToPosition(input, position) {
- setSelectionRange(input, position, position);
-}
-
-function replaceSelection (input, replaceString) {
- var len = replaceString.length;
- if (input.setSelectionRange) {
- var selectionStart = input.selectionStart;
- var selectionEnd = input.selectionEnd;
-
- input.value = input.value.substring(0, selectionStart) + replaceString + input.value.substring(selectionEnd);
- input.selectionStart = selectionStart + len;
- input.selectionEnd = selectionStart + len;
- }
- else if (document.selection) {
- var range = document.selection.createRange();
- var saved_range = range.duplicate();
-
- if (range.parentElement() == input) {
- range.text = replaceString;
- range.moveEnd("character", saved_range.selectionStart + len);
- range.moveStart("character", saved_range.selectionStart + len);
- range.select();
- }
- }
- input.focus();
-}
-
-
-function autocompleteMatch (text, values) {
- for (var i = 0; i < values.length; i++) {
- if (values[i].toUpperCase().indexOf(text.toUpperCase()) == 0) {
- return values[i];
- }
- }
-
- return null;
-}
-
-function autocomplete(textbox, event, values) {
- if (textbox.setSelectionRange || textbox.createTextRange) {
- switch (event.keyCode) {
- case 38: // up arrow
- case 40: // down arrow
- case 37: // left arrow
- case 39: // right arrow
- case 33: // page up
- case 34: // page down
- case 36: // home
- case 35: // end
- case 13: // enter
- case 9: // tab
- case 27: // esc
- case 16: // shift
- case 17: // ctrl
- case 18: // alt
- case 20: // caps lock
- case 8: // backspace
- case 46: // delete
- return true;
- break;
-
- default:
- var c = String.fromCharCode(
- (event.charCode == undefined) ? event.keyCode : event.charCode
- );
- replaceSelection(textbox, c);
- sMatch = autocompleteMatch(textbox.value, values);
- var len = textbox.value.length;
-
- if (sMatch != null) {
- textbox.value = sMatch;
- setSelectionRange(textbox, len, textbox.value.length);
- }
- return false;
- }
- }
- else {
- return true;
- }
-}
-/* end javascript for autocomplete */
-
-EOS;
- define('HTML_QUICKFORM_AUTOCOMPLETE_EXISTS', true);
- }
- $jsEscape = array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- );
-
- $js .= $this->_js;
- $js .= 'var ' . $arrayName . " = new Array();\n";
- for ($i = 0; $i < count($this->_options); $i++) {
- $js .= $arrayName . '[' . $i . "] = '" . strtr($this->_options[$i], $jsEscape) . "';\n";
- }
- $js .= "//]]>\n</script>";
- }
- return $js . parent::toHtml();
- }// end func toHtml
-
- // }}}
-} // end class HTML_QuickForm_autocomplete
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for an autocomplete element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Matteo Di Giovinazzo <matteodg@infinito.it>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * HTML class for a text field
+ */
+require_once 'HTML/QuickForm/text.php';
+
+/**
+ * HTML class for an autocomplete element
+ *
+ * Creates an HTML input text element that
+ * at every keypressed javascript event checks in an array of options
+ * if there's a match and autocompletes the text in case of match.
+ *
+ * For the JavaScript code thanks to Martin Honnen and Nicholas C. Zakas
+ * See {@link http://www.faqts.com/knowledge_base/view.phtml/aid/13562} and
+ * {@link http://www.sitepoint.com/article/1220}
+ *
+ * Example:
+ * <code>
+ * $autocomplete =& $form->addElement('autocomplete', 'fruit', 'Favourite fruit:');
+ * $options = array("Apple", "Orange", "Pear", "Strawberry");
+ * $autocomplete->setOptions($options);
+ * </code>
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Matteo Di Giovinazzo <matteodg@infinito.it>
+ * @version Release: 3.2.9
+ * @since 3.2
+ */
+class HTML_QuickForm_autocomplete extends HTML_QuickForm_text
+{
+ // {{{ properties
+
+ /**
+ * Options for the autocomplete input text element
+ *
+ * @var array
+ * @access private
+ */
+ var $_options = array();
+
+ /**
+ * "One-time" javascript (containing functions), see bug #4611
+ *
+ * @var string
+ * @access private
+ */
+ var $_js = '';
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $elementLabel (optional)Input field label in form
+ * @param array $options (optional)Autocomplete options
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array. Date format is passed along the attributes.
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null)
+ {
+ $this->HTML_QuickForm_text($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ $this->_type = 'autocomplete';
+ if (isset($options)) {
+ $this->setOptions($options);
+ }
+ } //end constructor
+
+ // }}}
+ // {{{ setOptions()
+
+ /**
+ * Sets the options for the autocomplete input text element
+ *
+ * @param array $options Array of options for the autocomplete input text element
+ * @access public
+ * @return void
+ */
+ function setOptions($options)
+ {
+ $this->_options = array_values($options);
+ } // end func setOptions
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns Html for the autocomplete input text element
+ *
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ // prevent problems with grouped elements
+ $arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values';
+
+ $this->updateAttributes(array(
+ 'onkeypress' => 'return autocomplete(this, event, ' . $arrayName . ');'
+ ));
+ if ($this->_flagFrozen) {
+ $js = '';
+ } else {
+ $js = "<script type=\"text/javascript\">\n//<![CDATA[\n";
+ if (!defined('HTML_QUICKFORM_AUTOCOMPLETE_EXISTS')) {
+ $this->_js .= <<<EOS
+
+/* begin javascript for autocomplete */
+function setSelectionRange(input, selectionStart, selectionEnd) {
+ if (input.setSelectionRange) {
+ input.setSelectionRange(selectionStart, selectionEnd);
+ }
+ else if (input.createTextRange) {
+ var range = input.createTextRange();
+ range.collapse(true);
+ range.moveEnd("character", selectionEnd);
+ range.moveStart("character", selectionStart);
+ range.select();
+ }
+ input.focus();
+}
+
+function setCaretToPosition(input, position) {
+ setSelectionRange(input, position, position);
+}
+
+function replaceSelection (input, replaceString) {
+ var len = replaceString.length;
+ if (input.setSelectionRange) {
+ var selectionStart = input.selectionStart;
+ var selectionEnd = input.selectionEnd;
+
+ input.value = input.value.substring(0, selectionStart) + replaceString + input.value.substring(selectionEnd);
+ input.selectionStart = selectionStart + len;
+ input.selectionEnd = selectionStart + len;
+ }
+ else if (document.selection) {
+ var range = document.selection.createRange();
+ var saved_range = range.duplicate();
+
+ if (range.parentElement() == input) {
+ range.text = replaceString;
+ range.moveEnd("character", saved_range.selectionStart + len);
+ range.moveStart("character", saved_range.selectionStart + len);
+ range.select();
+ }
+ }
+ input.focus();
+}
+
+
+function autocompleteMatch (text, values) {
+ for (var i = 0; i < values.length; i++) {
+ if (values[i].toUpperCase().indexOf(text.toUpperCase()) == 0) {
+ return values[i];
+ }
+ }
+
+ return null;
+}
+
+function autocomplete(textbox, event, values) {
+ if (textbox.setSelectionRange || textbox.createTextRange) {
+ switch (event.keyCode) {
+ case 38: // up arrow
+ case 40: // down arrow
+ case 37: // left arrow
+ case 39: // right arrow
+ case 33: // page up
+ case 34: // page down
+ case 36: // home
+ case 35: // end
+ case 13: // enter
+ case 9: // tab
+ case 27: // esc
+ case 16: // shift
+ case 17: // ctrl
+ case 18: // alt
+ case 20: // caps lock
+ case 8: // backspace
+ case 46: // delete
+ return true;
+ break;
+
+ default:
+ var c = String.fromCharCode(
+ (event.charCode == undefined) ? event.keyCode : event.charCode
+ );
+ replaceSelection(textbox, c);
+ sMatch = autocompleteMatch(textbox.value, values);
+ var len = textbox.value.length;
+
+ if (sMatch != null) {
+ textbox.value = sMatch;
+ setSelectionRange(textbox, len, textbox.value.length);
+ }
+ return false;
+ }
+ }
+ else {
+ return true;
+ }
+}
+/* end javascript for autocomplete */
+
+EOS;
+ define('HTML_QUICKFORM_AUTOCOMPLETE_EXISTS', true);
+ }
+ $jsEscape = array(
+ "\r" => '\r',
+ "\n" => '\n',
+ "\t" => '\t',
+ "'" => "\\'",
+ '"' => '\"',
+ '\\' => '\\\\'
+ );
+
+ $js .= $this->_js;
+ $js .= 'var ' . $arrayName . " = new Array();\n";
+ for ($i = 0; $i < count($this->_options); $i++) {
+ $js .= $arrayName . '[' . $i . "] = '" . strtr($this->_options[$i], $jsEscape) . "';\n";
+ }
+ $js .= "//]]>\n</script>";
+ }
+ return $js . parent::toHtml();
+ }// end func toHtml
+
+ // }}}
+} // end class HTML_QuickForm_autocomplete
+?>
diff --git a/libs/HTML/QuickForm/button.php b/libs/HTML/QuickForm/button.php
index a91f5900ca..15885503e2 100755
--- a/libs/HTML/QuickForm/button.php
+++ b/libs/HTML/QuickForm/button.php
@@ -1,80 +1,80 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an <input type="button" /> elements
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for an <input type="button" /> elements
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_button extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $value (optional)Input field value
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->_persistantFreeze = false;
- $this->setValue($value);
- $this->setType('button');
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
-
-} //end class HTML_QuickForm_button
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for an <input type="button" /> elements
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for an <input type="button" /> elements
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_button extends HTML_QuickForm_input
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $value (optional)Input field value
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ $this->_persistantFreeze = false;
+ $this->setValue($value);
+ $this->setType('button');
+ } //end constructor
+
+ // }}}
+ // {{{ freeze()
+
+ /**
+ * Freeze the element so that only its value is returned
+ *
+ * @access public
+ * @return void
+ */
+ function freeze()
+ {
+ return false;
+ } //end func freeze
+
+ // }}}
+
+} //end class HTML_QuickForm_button
+?>
diff --git a/libs/HTML/QuickForm/checkbox.php b/libs/HTML/QuickForm/checkbox.php
index 2475b43712..123a7679cd 100755
--- a/libs/HTML/QuickForm/checkbox.php
+++ b/libs/HTML/QuickForm/checkbox.php
@@ -1,277 +1,277 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a checkbox type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a checkbox type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_checkbox extends HTML_QuickForm_input
-{
- // {{{ properties
-
- /**
- * Checkbox display text
- * @var string
- * @since 1.1
- * @access private
- */
- var $_text = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field value
- * @param string $text (optional)Checkbox display text
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_text = $text;
- $this->setType('checkbox');
- $this->updateAttributes(array('value'=>1));
- $this->_generateId();
- } //end constructor
-
- // }}}
- // {{{ setChecked()
-
- /**
- * Sets whether a checkbox is checked
- *
- * @param bool $checked Whether the field is checked or not
- * @since 1.0
- * @access public
- * @return void
- */
- function setChecked($checked)
- {
- if (!$checked) {
- $this->removeAttribute('checked');
- } else {
- $this->updateAttributes(array('checked'=>'checked'));
- }
- } //end func setChecked
-
- // }}}
- // {{{ getChecked()
-
- /**
- * Returns whether a checkbox is checked
- *
- * @since 1.0
- * @access public
- * @return bool
- */
- function getChecked()
- {
- return (bool)$this->getAttribute('checked');
- } //end func getChecked
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the checkbox element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if (0 == strlen($this->_text)) {
- $label = '';
- } elseif ($this->_flagFrozen) {
- $label = $this->_text;
- } else {
- $label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>';
- }
- return HTML_QuickForm_input::toHtml() . $label;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- if ($this->getChecked()) {
- return '<tt>[x]</tt>' .
- $this->_getPersistantData();
- } else {
- return '<tt>[ ]</tt>';
- }
- } //end func getFrozenHtml
-
- // }}}
- // {{{ setText()
-
- /**
- * Sets the checkbox text
- *
- * @param string $text
- * @since 1.1
- * @access public
- * @return void
- */
- function setText($text)
- {
- $this->_text = $text;
- } //end func setText
-
- // }}}
- // {{{ getText()
-
- /**
- * Returns the checkbox text
- *
- * @since 1.1
- * @access public
- * @return string
- */
- function getText()
- {
- return $this->_text;
- } //end func getText
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param string $value Default value of the form element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- return $this->setChecked($value);
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return bool
- */
- function getValue()
- {
- return $this->getChecked();
- } // end func getValue
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- // if no boxes were checked, then there is no value in the array
- // yet we don't want to display default value in this case
- if ($caller->isSubmitted()) {
- $value = $this->_findValue($caller->_submitValues);
- } else {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value || $caller->isSubmitted()) {
- $this->setChecked($value);
- }
- break;
- case 'setGroupValue':
- $this->setChecked($arg);
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Return true if the checkbox is checked, null if it is not checked (getValue() returns false)
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getChecked()? true: null;
- }
- return $this->_prepareValue($value, $assoc);
- }
-
- // }}}
-} //end class HTML_QuickForm_checkbox
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a checkbox type field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a checkbox type field
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_checkbox extends HTML_QuickForm_input
+{
+ // {{{ properties
+
+ /**
+ * Checkbox display text
+ * @var string
+ * @since 1.1
+ * @access private
+ */
+ var $_text = '';
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $elementLabel (optional)Input field value
+ * @param string $text (optional)Checkbox display text
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ $this->_text = $text;
+ $this->setType('checkbox');
+ $this->updateAttributes(array('value'=>1));
+ $this->_generateId();
+ } //end constructor
+
+ // }}}
+ // {{{ setChecked()
+
+ /**
+ * Sets whether a checkbox is checked
+ *
+ * @param bool $checked Whether the field is checked or not
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setChecked($checked)
+ {
+ if (!$checked) {
+ $this->removeAttribute('checked');
+ } else {
+ $this->updateAttributes(array('checked'=>'checked'));
+ }
+ } //end func setChecked
+
+ // }}}
+ // {{{ getChecked()
+
+ /**
+ * Returns whether a checkbox is checked
+ *
+ * @since 1.0
+ * @access public
+ * @return bool
+ */
+ function getChecked()
+ {
+ return (bool)$this->getAttribute('checked');
+ } //end func getChecked
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the checkbox element in HTML
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ if (0 == strlen($this->_text)) {
+ $label = '';
+ } elseif ($this->_flagFrozen) {
+ $label = $this->_text;
+ } else {
+ $label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>';
+ }
+ return HTML_QuickForm_input::toHtml() . $label;
+ } //end func toHtml
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getFrozenHtml()
+ {
+ if ($this->getChecked()) {
+ return '<tt>[x]</tt>' .
+ $this->_getPersistantData();
+ } else {
+ return '<tt>[ ]</tt>';
+ }
+ } //end func getFrozenHtml
+
+ // }}}
+ // {{{ setText()
+
+ /**
+ * Sets the checkbox text
+ *
+ * @param string $text
+ * @since 1.1
+ * @access public
+ * @return void
+ */
+ function setText($text)
+ {
+ $this->_text = $text;
+ } //end func setText
+
+ // }}}
+ // {{{ getText()
+
+ /**
+ * Returns the checkbox text
+ *
+ * @since 1.1
+ * @access public
+ * @return string
+ */
+ function getText()
+ {
+ return $this->_text;
+ } //end func getText
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets the value of the form element
+ *
+ * @param string $value Default value of the form element
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setValue($value)
+ {
+ return $this->setChecked($value);
+ } // end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns the value of the form element
+ *
+ * @since 1.0
+ * @access public
+ * @return bool
+ */
+ function getValue()
+ {
+ return $this->getChecked();
+ } // end func getValue
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string $event Name of event
+ * @param mixed $arg event arguments
+ * @param object &$caller calling object
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ switch ($event) {
+ case 'updateValue':
+ // constant values override both default and submitted ones
+ // default values are overriden by submitted
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ // if no boxes were checked, then there is no value in the array
+ // yet we don't want to display default value in this case
+ if ($caller->isSubmitted()) {
+ $value = $this->_findValue($caller->_submitValues);
+ } else {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ }
+ if (null !== $value || $caller->isSubmitted()) {
+ $this->setChecked($value);
+ }
+ break;
+ case 'setGroupValue':
+ $this->setChecked($arg);
+ break;
+ default:
+ parent::onQuickFormEvent($event, $arg, $caller);
+ }
+ return true;
+ } // end func onQuickFormEvent
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * Return true if the checkbox is checked, null if it is not checked (getValue() returns false)
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ $value = $this->_findValue($submitValues);
+ if (null === $value) {
+ $value = $this->getChecked()? true: null;
+ }
+ return $this->_prepareValue($value, $assoc);
+ }
+
+ // }}}
+} //end class HTML_QuickForm_checkbox
+?>
diff --git a/libs/HTML/QuickForm/date.php b/libs/HTML/QuickForm/date.php
index 3f3e00eeef..9e897a3e3a 100755
--- a/libs/HTML/QuickForm/date.php
+++ b/libs/HTML/QuickForm/date.php
@@ -1,511 +1,511 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class for a group of elements used to input dates (and times).
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Class for a group of form elements
- */
-require_once 'HTML/QuickForm/group.php';
-/**
- * Class for <select></select> elements
- */
-require_once 'HTML/QuickForm/select.php';
-
-/**
- * Class for a group of elements used to input dates (and times).
- *
- * Inspired by original 'date' element but reimplemented as a subclass
- * of HTML_QuickForm_group
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.1
- */
-class HTML_QuickForm_date extends HTML_QuickForm_group
-{
- // {{{ properties
-
- /**
- * Various options to control the element's display.
- *
- * @access private
- * @var array
- */
- var $_options = array(
- 'language' => 'en',
- 'format' => 'dMY',
- 'minYear' => 2001,
- 'maxYear' => 2010,
- 'addEmptyOption' => false,
- 'emptyOptionValue' => '',
- 'emptyOptionText' => '&nbsp;',
- 'optionIncrement' => array('i' => 1, 's' => 1)
- );
-
- /**
- * These complement separators, they are appended to the resultant HTML
- * @access private
- * @var array
- */
- var $_wrap = array('', '');
-
- /**
- * Options in different languages
- *
- * Note to potential translators: to avoid encoding problems please send
- * your translations with "weird" letters encoded as HTML Unicode entities
- *
- * @access private
- * @var array
- */
- var $_locale = array(
- 'en' => array (
- 'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'),
- 'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
- 'months_long' => array ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
- ),
- 'de' => array (
- 'weekdays_short'=> array ('So', 'Mon', 'Di', 'Mi', 'Do', 'Fr', 'Sa'),
- 'weekdays_long' => array ('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'),
- 'months_short' => array ('Jan', 'Feb', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'),
- 'months_long' => array ('Januar', 'Februar', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember')
- ),
- 'fr' => array (
- 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'),
- 'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
- 'months_short' => array ('Jan', 'F&#xe9;v', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Ao&#xfb;t', 'Sep', 'Oct', 'Nov', 'D&#xe9;c'),
- 'months_long' => array ('Janvier', 'F&#xe9;vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao&#xfb;t', 'Septembre', 'Octobre', 'Novembre', 'D&#xe9;cembre')
- ),
- 'hu' => array (
- 'weekdays_short'=> array ('V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'),
- 'weekdays_long' => array ('vas&#xe1;rnap', 'h&#xe9;tf&#x151;', 'kedd', 'szerda', 'cs&#xfc;t&#xf6;rt&#xf6;k', 'p&#xe9;ntek', 'szombat'),
- 'months_short' => array ('jan', 'feb', 'm&#xe1;rc', '&#xe1;pr', 'm&#xe1;j', 'j&#xfa;n', 'j&#xfa;l', 'aug', 'szept', 'okt', 'nov', 'dec'),
- 'months_long' => array ('janu&#xe1;r', 'febru&#xe1;r', 'm&#xe1;rcius', '&#xe1;prilis', 'm&#xe1;jus', 'j&#xfa;nius', 'j&#xfa;lius', 'augusztus', 'szeptember', 'okt&#xf3;ber', 'november', 'december')
- ),
- 'pl' => array (
- 'weekdays_short'=> array ('Nie', 'Pn', 'Wt', '&#x15a;r', 'Czw', 'Pt', 'Sob'),
- 'weekdays_long' => array ('Niedziela', 'Poniedzia&#x142;ek', 'Wtorek', '&#x15a;roda', 'Czwartek', 'Pi&#x105;tek', 'Sobota'),
- 'months_short' => array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Pa&#x17a;', 'Lis', 'Gru'),
- 'months_long' => array ('Stycze&#x144;', 'Luty', 'Marzec', 'Kwiecie&#x144;', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpie&#x144;', 'Wrzesie&#x144;', 'Pa&#x17a;dziernik', 'Listopad', 'Grudzie&#x144;')
- ),
- 'sl' => array (
- 'weekdays_short'=> array ('Ned', 'Pon', 'Tor', 'Sre', 'Cet', 'Pet', 'Sob'),
- 'weekdays_long' => array ('Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Cetrtek', 'Petek', 'Sobota'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December')
- ),
- 'ru' => array (
- 'weekdays_short'=> array ('&#x412;&#x441;', '&#x41f;&#x43d;', '&#x412;&#x442;', '&#x421;&#x440;', '&#x427;&#x442;', '&#x41f;&#x442;', '&#x421;&#x431;'),
- 'weekdays_long' => array ('&#x412;&#x43e;&#x441;&#x43a;&#x440;&#x435;&#x441;&#x435;&#x43d;&#x44c;&#x435;', '&#x41f;&#x43e;&#x43d;&#x435;&#x434;&#x435;&#x43b;&#x44c;&#x43d;&#x438;&#x43a;', '&#x412;&#x442;&#x43e;&#x440;&#x43d;&#x438;&#x43a;', '&#x421;&#x440;&#x435;&#x434;&#x430;', '&#x427;&#x435;&#x442;&#x432;&#x435;&#x440;&#x433;', '&#x41f;&#x44f;&#x442;&#x43d;&#x438;&#x446;&#x430;', '&#x421;&#x443;&#x431;&#x431;&#x43e;&#x442;&#x430;'),
- 'months_short' => array ('&#x42f;&#x43d;&#x432;', '&#x424;&#x435;&#x432;', '&#x41c;&#x430;&#x440;', '&#x410;&#x43f;&#x440;', '&#x41c;&#x430;&#x439;', '&#x418;&#x44e;&#x43d;', '&#x418;&#x44e;&#x43b;', '&#x410;&#x432;&#x433;', '&#x421;&#x435;&#x43d;', '&#x41e;&#x43a;&#x442;', '&#x41d;&#x43e;&#x44f;', '&#x414;&#x435;&#x43a;'),
- 'months_long' => array ('&#x42f;&#x43d;&#x432;&#x430;&#x440;&#x44c;', '&#x424;&#x435;&#x432;&#x440;&#x430;&#x43b;&#x44c;', '&#x41c;&#x430;&#x440;&#x442;', '&#x410;&#x43f;&#x440;&#x435;&#x43b;&#x44c;', '&#x41c;&#x430;&#x439;', '&#x418;&#x44e;&#x43d;&#x44c;', '&#x418;&#x44e;&#x43b;&#x44c;', '&#x410;&#x432;&#x433;&#x443;&#x441;&#x442;', '&#x421;&#x435;&#x43d;&#x442;&#x44f;&#x431;&#x440;&#x44c;', '&#x41e;&#x43a;&#x442;&#x44f;&#x431;&#x440;&#x44c;', '&#x41d;&#x43e;&#x44f;&#x431;&#x440;&#x44c;', '&#x414;&#x435;&#x43a;&#x430;&#x431;&#x440;&#x44c;')
- ),
- 'es' => array (
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mi&#xe9;', 'Jue', 'Vie', 'S&#xe1;b'),
- 'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Mi&#xe9;rcoles', 'Jueves', 'Viernes', 'S&#xe1;bado'),
- 'months_short' => array ('Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'),
- 'months_long' => array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre')
- ),
- 'da' => array (
- 'weekdays_short'=> array ('S&#xf8;n', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#xf8;r'),
- 'weekdays_long' => array ('S&#xf8;ndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf8;rdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December')
- ),
- 'is' => array (
- 'weekdays_short'=> array ('Sun', 'M&#xe1;n', '&#xde;ri', 'Mi&#xf0;', 'Fim', 'F&#xf6;s', 'Lau'),
- 'weekdays_long' => array ('Sunnudagur', 'M&#xe1;nudagur', '&#xde;ri&#xf0;judagur', 'Mi&#xf0;vikudagur', 'Fimmtudagur', 'F&#xf6;studagur', 'Laugardagur'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Ma&#xed;', 'J&#xfa;n', 'J&#xfa;l', '&#xc1;g&#xfa;', 'Sep', 'Okt', 'N&#xf3;v', 'Des'),
- 'months_long' => array ('Jan&#xfa;ar', 'Febr&#xfa;ar', 'Mars', 'Apr&#xed;l', 'Ma&#xed;', 'J&#xfa;n&#xed;', 'J&#xfa;l&#xed;', '&#xc1;g&#xfa;st', 'September', 'Okt&#xf3;ber', 'N&#xf3;vember', 'Desember')
- ),
- 'it' => array (
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'),
- 'weekdays_long' => array ('Domenica', 'Luned&#xec;', 'Marted&#xec;', 'Mercoled&#xec;', 'Gioved&#xec;', 'Venerd&#xec;', 'Sabato'),
- 'months_short' => array ('Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'),
- 'months_long' => array ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre')
- ),
- 'sk' => array (
- 'weekdays_short'=> array ('Ned', 'Pon', 'Uto', 'Str', '&#x8a;tv', 'Pia', 'Sob'),
- 'weekdays_long' => array ('Nede&#x17e;a', 'Pondelok', 'Utorok', 'Streda', '&#x8a;tvrtok', 'Piatok', 'Sobota'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'M&#xe1;j', 'J&#xfa;n', 'J&#xfa;l', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Janu&#xe1;r', 'Febru&#xe1;r', 'Marec', 'Apr&#xed;l', 'M&#xe1;j', 'J&#xfa;n', 'J&#xfa;l', 'August', 'September', 'Okt&#xf3;ber', 'November', 'December')
- ),
- 'cs' => array (
- 'weekdays_short'=> array ('Ne', 'Po', '&#xda;t', 'St', '&#x10c;t', 'P&#xe1;', 'So'),
- 'weekdays_long' => array ('Ned&#x11b;le', 'Pond&#x11b;l&#xed;', '&#xda;ter&#xfd;', 'St&#x159;eda', '&#x10c;tvrtek', 'P&#xe1;tek', 'Sobota'),
- 'months_short' => array ('Led', '&#xda;no', 'B&#x159;e', 'Dub', 'Kv&#x11b;', '&#x10c;en', '&#x10c;ec', 'Srp', 'Z&#xe1;&#x159;', '&#x158;&#xed;j', 'Lis', 'Pro'),
- 'months_long' => array ('Leden', '&#xda;nor', 'B&#x159;ezen', 'Duben', 'Kv&#x11b;ten', '&#x10c;erven', '&#x10c;ervenec', 'Srpen', 'Z&#xe1;&#x159;&#xed;', '&#x158;&#xed;jen', 'Listopad', 'Prosinec')
- ),
- 'hy' => array (
- 'weekdays_short'=> array ('&#x53f;&#x580;&#x56f;', '&#x535;&#x580;&#x56f;', '&#x535;&#x580;&#x584;', '&#x549;&#x580;&#x584;', '&#x540;&#x576;&#x563;', '&#x548;&#x582;&#x580;', '&#x547;&#x562;&#x569;'),
- 'weekdays_long' => array ('&#x53f;&#x56b;&#x580;&#x561;&#x56f;&#x56b;', '&#x535;&#x580;&#x56f;&#x578;&#x582;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x535;&#x580;&#x565;&#x584;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x549;&#x578;&#x580;&#x565;&#x584;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x540;&#x56b;&#x576;&#x563;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x548;&#x582;&#x580;&#x562;&#x561;&#x569;', '&#x547;&#x561;&#x562;&#x561;&#x569;'),
- 'months_short' => array ('&#x540;&#x576;&#x57e;', '&#x553;&#x57f;&#x580;', '&#x544;&#x580;&#x57f;', '&#x531;&#x57a;&#x580;', '&#x544;&#x575;&#x57d;', '&#x540;&#x576;&#x57d;', '&#x540;&#x56c;&#x57d;', '&#x555;&#x563;&#x57d;', '&#x54d;&#x57a;&#x57f;', '&#x540;&#x56f;&#x57f;', '&#x546;&#x575;&#x574;', '&#x534;&#x56f;&#x57f;'),
- 'months_long' => array ('&#x540;&#x578;&#x582;&#x576;&#x57e;&#x561;&#x580;', '&#x553;&#x565;&#x57f;&#x580;&#x57e;&#x561;&#x580;', '&#x544;&#x561;&#x580;&#x57f;', '&#x531;&#x57a;&#x580;&#x56b;&#x56c;', '&#x544;&#x561;&#x575;&#x56b;&#x57d;', '&#x540;&#x578;&#x582;&#x576;&#x56b;&#x57d;', '&#x540;&#x578;&#x582;&#x56c;&#x56b;&#x57d;', '&#x555;&#x563;&#x578;&#x57d;&#x57f;&#x578;&#x57d;', '&#x54d;&#x565;&#x57a;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x540;&#x578;&#x56f;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x546;&#x578;&#x575;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x534;&#x565;&#x56f;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;')
- ),
- 'nl' => array (
- 'weekdays_short'=> array ('Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'),
- 'weekdays_long' => array ('Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December')
- ),
- 'et' => array (
- 'weekdays_short'=> array ('P', 'E', 'T', 'K', 'N', 'R', 'L'),
- 'weekdays_long' => array ('P&#xfc;hap&#xe4;ev', 'Esmasp&#xe4;ev', 'Teisip&#xe4;ev', 'Kolmap&#xe4;ev', 'Neljap&#xe4;ev', 'Reede', 'Laup&#xe4;ev'),
- 'months_short' => array ('Jaan', 'Veebr', 'M&#xe4;rts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'),
- 'months_long' => array ('Jaanuar', 'Veebruar', 'M&#xe4;rts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'August', 'September', 'Oktoober', 'November', 'Detsember')
- ),
- 'tr' => array (
- 'weekdays_short'=> array ('Paz', 'Pzt', 'Sal', '&#xc7;ar', 'Per', 'Cum', 'Cts'),
- 'weekdays_long' => array ('Pazar', 'Pazartesi', 'Sal&#x131;', '&#xc7;ar&#x15f;amba', 'Per&#x15f;embe', 'Cuma', 'Cumartesi'),
- 'months_short' => array ('Ock', '&#x15e;bt', 'Mrt', 'Nsn', 'Mys', 'Hzrn', 'Tmmz', 'A&#x11f;st', 'Eyl', 'Ekm', 'Ksm', 'Arlk'),
- 'months_long' => array ('Ocak', '&#x15e;ubat', 'Mart', 'Nisan', 'May&#x131;s', 'Haziran', 'Temmuz', 'A&#x11f;ustos', 'Eyl&#xfc;l', 'Ekim', 'Kas&#x131;m', 'Aral&#x131;k')
- ),
- 'no' => array (
- 'weekdays_short'=> array ('S&#xf8;n', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#xf8;r'),
- 'weekdays_long' => array ('S&#xf8;ndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf8;rdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'),
- 'months_long' => array ('Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember')
- ),
- 'eo' => array (
- 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', '&#x134;a&#x16D;', 'Ven', 'Sab'),
- 'weekdays_long' => array ('Diman&#x109;o', 'Lundo', 'Mardo', 'Merkredo', '&#x134;a&#x16D;do', 'Vendredo', 'Sabato'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'A&#x16D;g', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januaro', 'Februaro', 'Marto', 'Aprilo', 'Majo', 'Junio', 'Julio', 'A&#x16D;gusto', 'Septembro', 'Oktobro', 'Novembro', 'Decembro')
- ),
- 'ua' => array (
- 'weekdays_short'=> array('&#x41d;&#x434;&#x43b;', '&#x41f;&#x43d;&#x434;', '&#x412;&#x442;&#x440;', '&#x421;&#x440;&#x434;', '&#x427;&#x442;&#x432;', '&#x41f;&#x442;&#x43d;', '&#x421;&#x431;&#x442;'),
- 'weekdays_long' => array('&#x41d;&#x435;&#x434;&#x456;&#x43b;&#x44f;', '&#x41f;&#x43e;&#x43d;&#x435;&#x434;&#x456;&#x43b;&#x43e;&#x43a;', '&#x412;&#x456;&#x432;&#x442;&#x43e;&#x440;&#x43e;&#x43a;', '&#x421;&#x435;&#x440;&#x435;&#x434;&#x430;', '&#x427;&#x435;&#x442;&#x432;&#x435;&#x440;', '&#x41f;\'&#x44f;&#x442;&#x43d;&#x438;&#x446;&#x44f;', '&#x421;&#x443;&#x431;&#x43e;&#x442;&#x430;'),
- 'months_short' => array('&#x421;&#x456;&#x447;', '&#x41b;&#x44e;&#x442;', '&#x411;&#x435;&#x440;', '&#x41a;&#x432;&#x456;', '&#x422;&#x440;&#x430;', '&#x427;&#x435;&#x440;', '&#x41b;&#x438;&#x43f;', '&#x421;&#x435;&#x440;', '&#x412;&#x435;&#x440;', '&#x416;&#x43e;&#x432;', '&#x41b;&#x438;&#x441;', '&#x413;&#x440;&#x443;'),
- 'months_long' => array('&#x421;&#x456;&#x447;&#x435;&#x43d;&#x44c;', '&#x41b;&#x44e;&#x442;&#x438;&#x439;', '&#x411;&#x435;&#x440;&#x435;&#x437;&#x435;&#x43d;&#x44c;', '&#x41a;&#x432;&#x456;&#x442;&#x435;&#x43d;&#x44c;', '&#x422;&#x440;&#x430;&#x432;&#x435;&#x43d;&#x44c;', '&#x427;&#x435;&#x440;&#x432;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x43f;&#x435;&#x43d;&#x44c;', '&#x421;&#x435;&#x440;&#x43f;&#x435;&#x43d;&#x44c;', '&#x412;&#x435;&#x440;&#x435;&#x441;&#x435;&#x43d;&#x44c;', '&#x416;&#x43e;&#x432;&#x442;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x441;&#x442;&#x43e;&#x43f;&#x430;&#x434;', '&#x413;&#x440;&#x443;&#x434;&#x435;&#x43d;&#x44c;')
- ),
- 'ro' => array (
- 'weekdays_short'=> array ('Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'),
- 'weekdays_long' => array ('Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'),
- 'months_short' => array ('Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
- 'months_long' => array ('Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie')
- ),
- 'he' => array (
- 'weekdays_short'=> array ('&#1512;&#1488;&#1513;&#1493;&#1503;', '&#1513;&#1504;&#1497;', '&#1513;&#1500;&#1497;&#1513;&#1497;', '&#1512;&#1489;&#1497;&#1506;&#1497;', '&#1495;&#1502;&#1497;&#1513;&#1497;', '&#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
- 'weekdays_long' => array ('&#1497;&#1493;&#1501; &#1512;&#1488;&#1513;&#1493;&#1503;', '&#1497;&#1493;&#1501; &#1513;&#1504;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1500;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1512;&#1489;&#1497;&#1506;&#1497;', '&#1497;&#1493;&#1501; &#1495;&#1502;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
- 'months_short' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;'),
- 'months_long' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;')
- ),
- 'sv' => array (
- 'weekdays_short'=> array ('S&#xf6;n', 'M&#xe5;n', 'Tis', 'Ons', 'Tor', 'Fre', 'L&#xf6;r'),
- 'weekdays_long' => array ('S&#xf6;ndag', 'M&#xe5;ndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf6;rdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December')
- ),
- 'pt' => array (
- 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&aacute;b'),
- 'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'S&aacute;bado'),
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
- ),
- 'tw' => array (
- 'weekdays_short'=> array ('&#36913;&#26085;','&#36913;&#19968;', '&#36913;&#20108;','&#36913;&#19977;', '&#36913;&#22235;','&#36913;&#20116;', '&#36913;&#20845;'),
- 'weekdays_long' => array ('&#26143;&#26399;&#26085;', '&#26143;&#26399;&#19968;', '&#26143;&#26399;&#20108;', '&#26143;&#26399;&#19977;', '&#26143;&#26399;&#22235;', '&#26143;&#26399;&#20116;', '&#26143;&#26399;&#20845;'),
- 'months_short' => array ('&#19968;&#26376;', '&#20108;&#26376;', '&#19977;&#26376;', '&#22235;&#26376;', '&#20116;&#26376;', '&#20845;&#26376;', '&#19971;&#26376;', '&#20843;&#26376;', '&#20061;&#26376;', '&#21313;&#26376;', '&#21313;&#19968;&#26376;', '&#21313;&#20108;&#26376;'),
- 'months_long' => array ('&#19968;&#26376;', '&#20108;&#26376;', '&#19977;&#26376;', '&#22235;&#26376;', '&#20116;&#26376;', '&#20845;&#26376;', '&#19971;&#26376;', '&#20843;&#26376;', '&#20061;&#26376;', '&#21313;&#26376;', '&#21313;&#19968;&#26376;', '&#21313;&#20108;&#26376;')
- ),
- 'pt-br' => array (
- 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&aacute;b'),
- 'weekdays_long' => array ('Domingo', 'Segunda', 'Ter&ccedil;a', 'Quarta', 'Quinta', 'Sexta', 'S&aacute;bado'),
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
- )
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * The following keys may appear in $options array:
- * - 'language': date language
- * - 'format': Format of the date, based on PHP's date() function.
- * The following characters are currently recognised in format string:
- * <pre>
- * D => Short names of days
- * l => Long names of days
- * d => Day numbers
- * M => Short names of months
- * F => Long names of months
- * m => Month numbers
- * Y => Four digit year
- * y => Two digit year
- * h => 12 hour format
- * H => 23 hour format
- * i => Minutes
- * s => Seconds
- * a => am/pm
- * A => AM/PM
- * </pre>
- * - 'minYear': Minimum year in year select
- * - 'maxYear': Maximum year in year select
- * - 'addEmptyOption': Should an empty option be added to the top of
- * each select box?
- * - 'emptyOptionValue': The value passed by the empty option.
- * - 'emptyOptionText': The text displayed for the empty option.
- * - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
- *
- * @access public
- * @param string Element's name
- * @param mixed Label(s) for an element
- * @param array Options to control the element's display
- * @param mixed Either a typical HTML attribute string or an associative array
- */
- function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_appendName = true;
- $this->_type = 'date';
- // set the options, do not bother setting bogus ones
- if (is_array($options)) {
- foreach ($options as $name => $value) {
- if ('language' == $name) {
- $this->_options['language'] = isset($this->_locale[$value])? $value: 'en';
- } elseif (isset($this->_options[$name])) {
- if (is_array($value) && is_array($this->_options[$name])) {
- $this->_options[$name] = @array_merge($this->_options[$name], $value);
- } else {
- $this->_options[$name] = $value;
- }
- }
- }
- }
- }
-
- // }}}
- // {{{ _createElements()
-
- function _createElements()
- {
- $this->_separator = $this->_elements = array();
- $separator = '';
- $locale =& $this->_locale[$this->_options['language']];
- $backslash = false;
- for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
- $sign = $this->_options['format']{$i};
- if ($backslash) {
- $backslash = false;
- $separator .= $sign;
- } else {
- $loadSelect = true;
- switch ($sign) {
- case 'D':
- // Sunday is 0 like with 'w' in date()
- $options = $locale['weekdays_short'];
- break;
- case 'l':
- $options = $locale['weekdays_long'];
- break;
- case 'd':
- $options = $this->_createOptionList(1, 31);
- break;
- case 'M':
- $options = $locale['months_short'];
- array_unshift($options , '');
- unset($options[0]);
- break;
- case 'm':
- $options = $this->_createOptionList(1, 12);
- break;
- case 'F':
- $options = $locale['months_long'];
- array_unshift($options , '');
- unset($options[0]);
- break;
- case 'Y':
- $options = $this->_createOptionList(
- $this->_options['minYear'],
- $this->_options['maxYear'],
- $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
- );
- break;
- case 'y':
- $options = $this->_createOptionList(
- $this->_options['minYear'],
- $this->_options['maxYear'],
- $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
- );
- array_walk($options, create_function('&$v,$k','$v = substr($v,-2);'));
- break;
- case 'h':
- $options = $this->_createOptionList(1, 12);
- break;
- case 'g':
- $options = $this->_createOptionList(1, 12);
- array_walk($options, create_function('&$v,$k', '$v = intval($v);'));
- break;
- case 'H':
- $options = $this->_createOptionList(0, 23);
- break;
- case 'i':
- $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['i']);
- break;
- case 's':
- $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['s']);
- break;
- case 'a':
- $options = array('am' => 'am', 'pm' => 'pm');
- break;
- case 'A':
- $options = array('AM' => 'AM', 'PM' => 'PM');
- break;
- case 'W':
- $options = $this->_createOptionList(1, 53);
- break;
- case '\\':
- $backslash = true;
- $loadSelect = false;
- break;
- default:
- $separator .= (' ' == $sign? '&nbsp;': $sign);
- $loadSelect = false;
- }
-
- if ($loadSelect) {
- if (0 < count($this->_elements)) {
- $this->_separator[] = $separator;
- } else {
- $this->_wrap[0] = $separator;
- }
- $separator = '';
- // Should we add an empty option to the top of the select?
- if (!is_array($this->_options['addEmptyOption']) && $this->_options['addEmptyOption'] ||
- is_array($this->_options['addEmptyOption']) && !empty($this->_options['addEmptyOption'][$sign])) {
-
- // Using '+' array operator to preserve the keys
- if (is_array($this->_options['emptyOptionText']) && !empty($this->_options['emptyOptionText'][$sign])) {
- $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText'][$sign]) + $options;
- } else {
- $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options;
- }
- }
- $this->_elements[] = new HTML_QuickForm_select($sign, null, $options, $this->getAttributes());
- }
- }
- }
- $this->_wrap[1] = $separator . ($backslash? '\\': '');
- }
-
- // }}}
- // {{{ _createOptionList()
-
- /**
- * Creates an option list containing the numbers from the start number to the end, inclusive
- *
- * @param int The start number
- * @param int The end number
- * @param int Increment by this value
- * @access private
- * @return array An array of numeric options.
- */
- function _createOptionList($start, $end, $step = 1)
- {
- for ($i = $start, $options = array(); $start > $end? $i >= $end: $i <= $end; $i += $step) {
- $options[$i] = sprintf('%02d', $i);
- }
- return $options;
- }
-
- // }}}
- // {{{ setValue()
-
- function setValue($value)
- {
- $trimLeadingZeros = create_function('$a', '$b = ltrim($a, \'0\'); return strlen($b)? $b: \'0\';');
- if (empty($value)) {
- $value = array();
- } elseif (is_scalar($value)) {
- if (!is_numeric($value)) {
- $value = strtotime($value);
- }
- // might be a unix epoch, then we fill all possible values
- $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
- $value = array(
- 'D' => $arr[0],
- 'l' => $arr[0],
- 'd' => $arr[1],
- 'M' => $arr[2],
- 'm' => $arr[2],
- 'F' => $arr[2],
- 'Y' => $arr[3],
- 'y' => $arr[3],
- 'h' => $arr[4],
- 'g' => $arr[4],
- 'H' => $arr[5],
- 'i' => $trimLeadingZeros($arr[6]),
- 's' => $trimLeadingZeros($arr[7]),
- 'a' => $arr[8],
- 'A' => $arr[9],
- 'W' => $trimLeadingZeros($arr[10])
- );
- } else {
- $value = array_map($trimLeadingZeros, $value);
- }
- parent::setValue($value);
- }
-
- // }}}
- // {{{ toHtml()
-
- function toHtml()
- {
- include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer = new HTML_QuickForm_Renderer_Default();
- $renderer->setElementTemplate('{element}');
- parent::accept($renderer);
- return $this->_wrap[0] . $renderer->toHtml() . $this->_wrap[1];
- }
-
- // }}}
- // {{{ accept()
-
- function accept(&$renderer, $required = false, $error = null)
- {
- $renderer->renderElement($this, $required, $error);
- }
-
- // }}}
- // {{{ onQuickFormEvent()
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' == $event) {
- // we need to call setValue(), 'cause the default/constant value
- // may be in fact a timestamp, not an array
- return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
- } else {
- return parent::onQuickFormEvent($event, $arg, $caller);
- }
- }
-
- // }}}
-}
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Class for a group of elements used to input dates (and times).
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Class for a group of form elements
+ */
+require_once 'HTML/QuickForm/group.php';
+/**
+ * Class for <select></select> elements
+ */
+require_once 'HTML/QuickForm/select.php';
+
+/**
+ * Class for a group of elements used to input dates (and times).
+ *
+ * Inspired by original 'date' element but reimplemented as a subclass
+ * of HTML_QuickForm_group
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.1
+ */
+class HTML_QuickForm_date extends HTML_QuickForm_group
+{
+ // {{{ properties
+
+ /**
+ * Various options to control the element's display.
+ *
+ * @access private
+ * @var array
+ */
+ var $_options = array(
+ 'language' => 'en',
+ 'format' => 'dMY',
+ 'minYear' => 2001,
+ 'maxYear' => 2010,
+ 'addEmptyOption' => false,
+ 'emptyOptionValue' => '',
+ 'emptyOptionText' => '&nbsp;',
+ 'optionIncrement' => array('i' => 1, 's' => 1)
+ );
+
+ /**
+ * These complement separators, they are appended to the resultant HTML
+ * @access private
+ * @var array
+ */
+ var $_wrap = array('', '');
+
+ /**
+ * Options in different languages
+ *
+ * Note to potential translators: to avoid encoding problems please send
+ * your translations with "weird" letters encoded as HTML Unicode entities
+ *
+ * @access private
+ * @var array
+ */
+ var $_locale = array(
+ 'en' => array (
+ 'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'),
+ 'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
+ 'months_long' => array ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
+ ),
+ 'de' => array (
+ 'weekdays_short'=> array ('So', 'Mon', 'Di', 'Mi', 'Do', 'Fr', 'Sa'),
+ 'weekdays_long' => array ('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'),
+ 'months_short' => array ('Jan', 'Feb', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'),
+ 'months_long' => array ('Januar', 'Februar', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember')
+ ),
+ 'fr' => array (
+ 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'),
+ 'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
+ 'months_short' => array ('Jan', 'F&#xe9;v', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Ao&#xfb;t', 'Sep', 'Oct', 'Nov', 'D&#xe9;c'),
+ 'months_long' => array ('Janvier', 'F&#xe9;vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao&#xfb;t', 'Septembre', 'Octobre', 'Novembre', 'D&#xe9;cembre')
+ ),
+ 'hu' => array (
+ 'weekdays_short'=> array ('V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'),
+ 'weekdays_long' => array ('vas&#xe1;rnap', 'h&#xe9;tf&#x151;', 'kedd', 'szerda', 'cs&#xfc;t&#xf6;rt&#xf6;k', 'p&#xe9;ntek', 'szombat'),
+ 'months_short' => array ('jan', 'feb', 'm&#xe1;rc', '&#xe1;pr', 'm&#xe1;j', 'j&#xfa;n', 'j&#xfa;l', 'aug', 'szept', 'okt', 'nov', 'dec'),
+ 'months_long' => array ('janu&#xe1;r', 'febru&#xe1;r', 'm&#xe1;rcius', '&#xe1;prilis', 'm&#xe1;jus', 'j&#xfa;nius', 'j&#xfa;lius', 'augusztus', 'szeptember', 'okt&#xf3;ber', 'november', 'december')
+ ),
+ 'pl' => array (
+ 'weekdays_short'=> array ('Nie', 'Pn', 'Wt', '&#x15a;r', 'Czw', 'Pt', 'Sob'),
+ 'weekdays_long' => array ('Niedziela', 'Poniedzia&#x142;ek', 'Wtorek', '&#x15a;roda', 'Czwartek', 'Pi&#x105;tek', 'Sobota'),
+ 'months_short' => array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Pa&#x17a;', 'Lis', 'Gru'),
+ 'months_long' => array ('Stycze&#x144;', 'Luty', 'Marzec', 'Kwiecie&#x144;', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpie&#x144;', 'Wrzesie&#x144;', 'Pa&#x17a;dziernik', 'Listopad', 'Grudzie&#x144;')
+ ),
+ 'sl' => array (
+ 'weekdays_short'=> array ('Ned', 'Pon', 'Tor', 'Sre', 'Cet', 'Pet', 'Sob'),
+ 'weekdays_long' => array ('Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Cetrtek', 'Petek', 'Sobota'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'),
+ 'months_long' => array ('Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December')
+ ),
+ 'ru' => array (
+ 'weekdays_short'=> array ('&#x412;&#x441;', '&#x41f;&#x43d;', '&#x412;&#x442;', '&#x421;&#x440;', '&#x427;&#x442;', '&#x41f;&#x442;', '&#x421;&#x431;'),
+ 'weekdays_long' => array ('&#x412;&#x43e;&#x441;&#x43a;&#x440;&#x435;&#x441;&#x435;&#x43d;&#x44c;&#x435;', '&#x41f;&#x43e;&#x43d;&#x435;&#x434;&#x435;&#x43b;&#x44c;&#x43d;&#x438;&#x43a;', '&#x412;&#x442;&#x43e;&#x440;&#x43d;&#x438;&#x43a;', '&#x421;&#x440;&#x435;&#x434;&#x430;', '&#x427;&#x435;&#x442;&#x432;&#x435;&#x440;&#x433;', '&#x41f;&#x44f;&#x442;&#x43d;&#x438;&#x446;&#x430;', '&#x421;&#x443;&#x431;&#x431;&#x43e;&#x442;&#x430;'),
+ 'months_short' => array ('&#x42f;&#x43d;&#x432;', '&#x424;&#x435;&#x432;', '&#x41c;&#x430;&#x440;', '&#x410;&#x43f;&#x440;', '&#x41c;&#x430;&#x439;', '&#x418;&#x44e;&#x43d;', '&#x418;&#x44e;&#x43b;', '&#x410;&#x432;&#x433;', '&#x421;&#x435;&#x43d;', '&#x41e;&#x43a;&#x442;', '&#x41d;&#x43e;&#x44f;', '&#x414;&#x435;&#x43a;'),
+ 'months_long' => array ('&#x42f;&#x43d;&#x432;&#x430;&#x440;&#x44c;', '&#x424;&#x435;&#x432;&#x440;&#x430;&#x43b;&#x44c;', '&#x41c;&#x430;&#x440;&#x442;', '&#x410;&#x43f;&#x440;&#x435;&#x43b;&#x44c;', '&#x41c;&#x430;&#x439;', '&#x418;&#x44e;&#x43d;&#x44c;', '&#x418;&#x44e;&#x43b;&#x44c;', '&#x410;&#x432;&#x433;&#x443;&#x441;&#x442;', '&#x421;&#x435;&#x43d;&#x442;&#x44f;&#x431;&#x440;&#x44c;', '&#x41e;&#x43a;&#x442;&#x44f;&#x431;&#x440;&#x44c;', '&#x41d;&#x43e;&#x44f;&#x431;&#x440;&#x44c;', '&#x414;&#x435;&#x43a;&#x430;&#x431;&#x440;&#x44c;')
+ ),
+ 'es' => array (
+ 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mi&#xe9;', 'Jue', 'Vie', 'S&#xe1;b'),
+ 'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Mi&#xe9;rcoles', 'Jueves', 'Viernes', 'S&#xe1;bado'),
+ 'months_short' => array ('Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'),
+ 'months_long' => array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre')
+ ),
+ 'da' => array (
+ 'weekdays_short'=> array ('S&#xf8;n', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#xf8;r'),
+ 'weekdays_long' => array ('S&#xf8;ndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf8;rdag'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
+ 'months_long' => array ('Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December')
+ ),
+ 'is' => array (
+ 'weekdays_short'=> array ('Sun', 'M&#xe1;n', '&#xde;ri', 'Mi&#xf0;', 'Fim', 'F&#xf6;s', 'Lau'),
+ 'weekdays_long' => array ('Sunnudagur', 'M&#xe1;nudagur', '&#xde;ri&#xf0;judagur', 'Mi&#xf0;vikudagur', 'Fimmtudagur', 'F&#xf6;studagur', 'Laugardagur'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Ma&#xed;', 'J&#xfa;n', 'J&#xfa;l', '&#xc1;g&#xfa;', 'Sep', 'Okt', 'N&#xf3;v', 'Des'),
+ 'months_long' => array ('Jan&#xfa;ar', 'Febr&#xfa;ar', 'Mars', 'Apr&#xed;l', 'Ma&#xed;', 'J&#xfa;n&#xed;', 'J&#xfa;l&#xed;', '&#xc1;g&#xfa;st', 'September', 'Okt&#xf3;ber', 'N&#xf3;vember', 'Desember')
+ ),
+ 'it' => array (
+ 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'),
+ 'weekdays_long' => array ('Domenica', 'Luned&#xec;', 'Marted&#xec;', 'Mercoled&#xec;', 'Gioved&#xec;', 'Venerd&#xec;', 'Sabato'),
+ 'months_short' => array ('Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'),
+ 'months_long' => array ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre')
+ ),
+ 'sk' => array (
+ 'weekdays_short'=> array ('Ned', 'Pon', 'Uto', 'Str', '&#x8a;tv', 'Pia', 'Sob'),
+ 'weekdays_long' => array ('Nede&#x17e;a', 'Pondelok', 'Utorok', 'Streda', '&#x8a;tvrtok', 'Piatok', 'Sobota'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'M&#xe1;j', 'J&#xfa;n', 'J&#xfa;l', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
+ 'months_long' => array ('Janu&#xe1;r', 'Febru&#xe1;r', 'Marec', 'Apr&#xed;l', 'M&#xe1;j', 'J&#xfa;n', 'J&#xfa;l', 'August', 'September', 'Okt&#xf3;ber', 'November', 'December')
+ ),
+ 'cs' => array (
+ 'weekdays_short'=> array ('Ne', 'Po', '&#xda;t', 'St', '&#x10c;t', 'P&#xe1;', 'So'),
+ 'weekdays_long' => array ('Ned&#x11b;le', 'Pond&#x11b;l&#xed;', '&#xda;ter&#xfd;', 'St&#x159;eda', '&#x10c;tvrtek', 'P&#xe1;tek', 'Sobota'),
+ 'months_short' => array ('Led', '&#xda;no', 'B&#x159;e', 'Dub', 'Kv&#x11b;', '&#x10c;en', '&#x10c;ec', 'Srp', 'Z&#xe1;&#x159;', '&#x158;&#xed;j', 'Lis', 'Pro'),
+ 'months_long' => array ('Leden', '&#xda;nor', 'B&#x159;ezen', 'Duben', 'Kv&#x11b;ten', '&#x10c;erven', '&#x10c;ervenec', 'Srpen', 'Z&#xe1;&#x159;&#xed;', '&#x158;&#xed;jen', 'Listopad', 'Prosinec')
+ ),
+ 'hy' => array (
+ 'weekdays_short'=> array ('&#x53f;&#x580;&#x56f;', '&#x535;&#x580;&#x56f;', '&#x535;&#x580;&#x584;', '&#x549;&#x580;&#x584;', '&#x540;&#x576;&#x563;', '&#x548;&#x582;&#x580;', '&#x547;&#x562;&#x569;'),
+ 'weekdays_long' => array ('&#x53f;&#x56b;&#x580;&#x561;&#x56f;&#x56b;', '&#x535;&#x580;&#x56f;&#x578;&#x582;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x535;&#x580;&#x565;&#x584;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x549;&#x578;&#x580;&#x565;&#x584;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x540;&#x56b;&#x576;&#x563;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x548;&#x582;&#x580;&#x562;&#x561;&#x569;', '&#x547;&#x561;&#x562;&#x561;&#x569;'),
+ 'months_short' => array ('&#x540;&#x576;&#x57e;', '&#x553;&#x57f;&#x580;', '&#x544;&#x580;&#x57f;', '&#x531;&#x57a;&#x580;', '&#x544;&#x575;&#x57d;', '&#x540;&#x576;&#x57d;', '&#x540;&#x56c;&#x57d;', '&#x555;&#x563;&#x57d;', '&#x54d;&#x57a;&#x57f;', '&#x540;&#x56f;&#x57f;', '&#x546;&#x575;&#x574;', '&#x534;&#x56f;&#x57f;'),
+ 'months_long' => array ('&#x540;&#x578;&#x582;&#x576;&#x57e;&#x561;&#x580;', '&#x553;&#x565;&#x57f;&#x580;&#x57e;&#x561;&#x580;', '&#x544;&#x561;&#x580;&#x57f;', '&#x531;&#x57a;&#x580;&#x56b;&#x56c;', '&#x544;&#x561;&#x575;&#x56b;&#x57d;', '&#x540;&#x578;&#x582;&#x576;&#x56b;&#x57d;', '&#x540;&#x578;&#x582;&#x56c;&#x56b;&#x57d;', '&#x555;&#x563;&#x578;&#x57d;&#x57f;&#x578;&#x57d;', '&#x54d;&#x565;&#x57a;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x540;&#x578;&#x56f;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x546;&#x578;&#x575;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x534;&#x565;&#x56f;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;')
+ ),
+ 'nl' => array (
+ 'weekdays_short'=> array ('Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'),
+ 'weekdays_long' => array ('Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
+ 'months_long' => array ('Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December')
+ ),
+ 'et' => array (
+ 'weekdays_short'=> array ('P', 'E', 'T', 'K', 'N', 'R', 'L'),
+ 'weekdays_long' => array ('P&#xfc;hap&#xe4;ev', 'Esmasp&#xe4;ev', 'Teisip&#xe4;ev', 'Kolmap&#xe4;ev', 'Neljap&#xe4;ev', 'Reede', 'Laup&#xe4;ev'),
+ 'months_short' => array ('Jaan', 'Veebr', 'M&#xe4;rts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'),
+ 'months_long' => array ('Jaanuar', 'Veebruar', 'M&#xe4;rts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'August', 'September', 'Oktoober', 'November', 'Detsember')
+ ),
+ 'tr' => array (
+ 'weekdays_short'=> array ('Paz', 'Pzt', 'Sal', '&#xc7;ar', 'Per', 'Cum', 'Cts'),
+ 'weekdays_long' => array ('Pazar', 'Pazartesi', 'Sal&#x131;', '&#xc7;ar&#x15f;amba', 'Per&#x15f;embe', 'Cuma', 'Cumartesi'),
+ 'months_short' => array ('Ock', '&#x15e;bt', 'Mrt', 'Nsn', 'Mys', 'Hzrn', 'Tmmz', 'A&#x11f;st', 'Eyl', 'Ekm', 'Ksm', 'Arlk'),
+ 'months_long' => array ('Ocak', '&#x15e;ubat', 'Mart', 'Nisan', 'May&#x131;s', 'Haziran', 'Temmuz', 'A&#x11f;ustos', 'Eyl&#xfc;l', 'Ekim', 'Kas&#x131;m', 'Aral&#x131;k')
+ ),
+ 'no' => array (
+ 'weekdays_short'=> array ('S&#xf8;n', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#xf8;r'),
+ 'weekdays_long' => array ('S&#xf8;ndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf8;rdag'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'),
+ 'months_long' => array ('Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember')
+ ),
+ 'eo' => array (
+ 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', '&#x134;a&#x16D;', 'Ven', 'Sab'),
+ 'weekdays_long' => array ('Diman&#x109;o', 'Lundo', 'Mardo', 'Merkredo', '&#x134;a&#x16D;do', 'Vendredo', 'Sabato'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'A&#x16D;g', 'Sep', 'Okt', 'Nov', 'Dec'),
+ 'months_long' => array ('Januaro', 'Februaro', 'Marto', 'Aprilo', 'Majo', 'Junio', 'Julio', 'A&#x16D;gusto', 'Septembro', 'Oktobro', 'Novembro', 'Decembro')
+ ),
+ 'ua' => array (
+ 'weekdays_short'=> array('&#x41d;&#x434;&#x43b;', '&#x41f;&#x43d;&#x434;', '&#x412;&#x442;&#x440;', '&#x421;&#x440;&#x434;', '&#x427;&#x442;&#x432;', '&#x41f;&#x442;&#x43d;', '&#x421;&#x431;&#x442;'),
+ 'weekdays_long' => array('&#x41d;&#x435;&#x434;&#x456;&#x43b;&#x44f;', '&#x41f;&#x43e;&#x43d;&#x435;&#x434;&#x456;&#x43b;&#x43e;&#x43a;', '&#x412;&#x456;&#x432;&#x442;&#x43e;&#x440;&#x43e;&#x43a;', '&#x421;&#x435;&#x440;&#x435;&#x434;&#x430;', '&#x427;&#x435;&#x442;&#x432;&#x435;&#x440;', '&#x41f;\'&#x44f;&#x442;&#x43d;&#x438;&#x446;&#x44f;', '&#x421;&#x443;&#x431;&#x43e;&#x442;&#x430;'),
+ 'months_short' => array('&#x421;&#x456;&#x447;', '&#x41b;&#x44e;&#x442;', '&#x411;&#x435;&#x440;', '&#x41a;&#x432;&#x456;', '&#x422;&#x440;&#x430;', '&#x427;&#x435;&#x440;', '&#x41b;&#x438;&#x43f;', '&#x421;&#x435;&#x440;', '&#x412;&#x435;&#x440;', '&#x416;&#x43e;&#x432;', '&#x41b;&#x438;&#x441;', '&#x413;&#x440;&#x443;'),
+ 'months_long' => array('&#x421;&#x456;&#x447;&#x435;&#x43d;&#x44c;', '&#x41b;&#x44e;&#x442;&#x438;&#x439;', '&#x411;&#x435;&#x440;&#x435;&#x437;&#x435;&#x43d;&#x44c;', '&#x41a;&#x432;&#x456;&#x442;&#x435;&#x43d;&#x44c;', '&#x422;&#x440;&#x430;&#x432;&#x435;&#x43d;&#x44c;', '&#x427;&#x435;&#x440;&#x432;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x43f;&#x435;&#x43d;&#x44c;', '&#x421;&#x435;&#x440;&#x43f;&#x435;&#x43d;&#x44c;', '&#x412;&#x435;&#x440;&#x435;&#x441;&#x435;&#x43d;&#x44c;', '&#x416;&#x43e;&#x432;&#x442;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x441;&#x442;&#x43e;&#x43f;&#x430;&#x434;', '&#x413;&#x440;&#x443;&#x434;&#x435;&#x43d;&#x44c;')
+ ),
+ 'ro' => array (
+ 'weekdays_short'=> array ('Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'),
+ 'weekdays_long' => array ('Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'),
+ 'months_short' => array ('Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
+ 'months_long' => array ('Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie')
+ ),
+ 'he' => array (
+ 'weekdays_short'=> array ('&#1512;&#1488;&#1513;&#1493;&#1503;', '&#1513;&#1504;&#1497;', '&#1513;&#1500;&#1497;&#1513;&#1497;', '&#1512;&#1489;&#1497;&#1506;&#1497;', '&#1495;&#1502;&#1497;&#1513;&#1497;', '&#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
+ 'weekdays_long' => array ('&#1497;&#1493;&#1501; &#1512;&#1488;&#1513;&#1493;&#1503;', '&#1497;&#1493;&#1501; &#1513;&#1504;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1500;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1512;&#1489;&#1497;&#1506;&#1497;', '&#1497;&#1493;&#1501; &#1495;&#1502;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
+ 'months_short' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;'),
+ 'months_long' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;')
+ ),
+ 'sv' => array (
+ 'weekdays_short'=> array ('S&#xf6;n', 'M&#xe5;n', 'Tis', 'Ons', 'Tor', 'Fre', 'L&#xf6;r'),
+ 'weekdays_long' => array ('S&#xf6;ndag', 'M&#xe5;ndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf6;rdag'),
+ 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
+ 'months_long' => array ('Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December')
+ ),
+ 'pt' => array (
+ 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&aacute;b'),
+ 'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'S&aacute;bado'),
+ 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
+ 'months_long' => array ('Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
+ ),
+ 'tw' => array (
+ 'weekdays_short'=> array ('&#36913;&#26085;','&#36913;&#19968;', '&#36913;&#20108;','&#36913;&#19977;', '&#36913;&#22235;','&#36913;&#20116;', '&#36913;&#20845;'),
+ 'weekdays_long' => array ('&#26143;&#26399;&#26085;', '&#26143;&#26399;&#19968;', '&#26143;&#26399;&#20108;', '&#26143;&#26399;&#19977;', '&#26143;&#26399;&#22235;', '&#26143;&#26399;&#20116;', '&#26143;&#26399;&#20845;'),
+ 'months_short' => array ('&#19968;&#26376;', '&#20108;&#26376;', '&#19977;&#26376;', '&#22235;&#26376;', '&#20116;&#26376;', '&#20845;&#26376;', '&#19971;&#26376;', '&#20843;&#26376;', '&#20061;&#26376;', '&#21313;&#26376;', '&#21313;&#19968;&#26376;', '&#21313;&#20108;&#26376;'),
+ 'months_long' => array ('&#19968;&#26376;', '&#20108;&#26376;', '&#19977;&#26376;', '&#22235;&#26376;', '&#20116;&#26376;', '&#20845;&#26376;', '&#19971;&#26376;', '&#20843;&#26376;', '&#20061;&#26376;', '&#21313;&#26376;', '&#21313;&#19968;&#26376;', '&#21313;&#20108;&#26376;')
+ ),
+ 'pt-br' => array (
+ 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&aacute;b'),
+ 'weekdays_long' => array ('Domingo', 'Segunda', 'Ter&ccedil;a', 'Quarta', 'Quinta', 'Sexta', 'S&aacute;bado'),
+ 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
+ 'months_long' => array ('Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
+ )
+ );
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * The following keys may appear in $options array:
+ * - 'language': date language
+ * - 'format': Format of the date, based on PHP's date() function.
+ * The following characters are currently recognised in format string:
+ * <pre>
+ * D => Short names of days
+ * l => Long names of days
+ * d => Day numbers
+ * M => Short names of months
+ * F => Long names of months
+ * m => Month numbers
+ * Y => Four digit year
+ * y => Two digit year
+ * h => 12 hour format
+ * H => 23 hour format
+ * i => Minutes
+ * s => Seconds
+ * a => am/pm
+ * A => AM/PM
+ * </pre>
+ * - 'minYear': Minimum year in year select
+ * - 'maxYear': Maximum year in year select
+ * - 'addEmptyOption': Should an empty option be added to the top of
+ * each select box?
+ * - 'emptyOptionValue': The value passed by the empty option.
+ * - 'emptyOptionText': The text displayed for the empty option.
+ * - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
+ *
+ * @access public
+ * @param string Element's name
+ * @param mixed Label(s) for an element
+ * @param array Options to control the element's display
+ * @param mixed Either a typical HTML attribute string or an associative array
+ */
+ function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
+ {
+ $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ $this->_appendName = true;
+ $this->_type = 'date';
+ // set the options, do not bother setting bogus ones
+ if (is_array($options)) {
+ foreach ($options as $name => $value) {
+ if ('language' == $name) {
+ $this->_options['language'] = isset($this->_locale[$value])? $value: 'en';
+ } elseif (isset($this->_options[$name])) {
+ if (is_array($value) && is_array($this->_options[$name])) {
+ $this->_options[$name] = @array_merge($this->_options[$name], $value);
+ } else {
+ $this->_options[$name] = $value;
+ }
+ }
+ }
+ }
+ }
+
+ // }}}
+ // {{{ _createElements()
+
+ function _createElements()
+ {
+ $this->_separator = $this->_elements = array();
+ $separator = '';
+ $locale =& $this->_locale[$this->_options['language']];
+ $backslash = false;
+ for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
+ $sign = $this->_options['format']{$i};
+ if ($backslash) {
+ $backslash = false;
+ $separator .= $sign;
+ } else {
+ $loadSelect = true;
+ switch ($sign) {
+ case 'D':
+ // Sunday is 0 like with 'w' in date()
+ $options = $locale['weekdays_short'];
+ break;
+ case 'l':
+ $options = $locale['weekdays_long'];
+ break;
+ case 'd':
+ $options = $this->_createOptionList(1, 31);
+ break;
+ case 'M':
+ $options = $locale['months_short'];
+ array_unshift($options , '');
+ unset($options[0]);
+ break;
+ case 'm':
+ $options = $this->_createOptionList(1, 12);
+ break;
+ case 'F':
+ $options = $locale['months_long'];
+ array_unshift($options , '');
+ unset($options[0]);
+ break;
+ case 'Y':
+ $options = $this->_createOptionList(
+ $this->_options['minYear'],
+ $this->_options['maxYear'],
+ $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
+ );
+ break;
+ case 'y':
+ $options = $this->_createOptionList(
+ $this->_options['minYear'],
+ $this->_options['maxYear'],
+ $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
+ );
+ array_walk($options, create_function('&$v,$k','$v = substr($v,-2);'));
+ break;
+ case 'h':
+ $options = $this->_createOptionList(1, 12);
+ break;
+ case 'g':
+ $options = $this->_createOptionList(1, 12);
+ array_walk($options, create_function('&$v,$k', '$v = intval($v);'));
+ break;
+ case 'H':
+ $options = $this->_createOptionList(0, 23);
+ break;
+ case 'i':
+ $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['i']);
+ break;
+ case 's':
+ $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['s']);
+ break;
+ case 'a':
+ $options = array('am' => 'am', 'pm' => 'pm');
+ break;
+ case 'A':
+ $options = array('AM' => 'AM', 'PM' => 'PM');
+ break;
+ case 'W':
+ $options = $this->_createOptionList(1, 53);
+ break;
+ case '\\':
+ $backslash = true;
+ $loadSelect = false;
+ break;
+ default:
+ $separator .= (' ' == $sign? '&nbsp;': $sign);
+ $loadSelect = false;
+ }
+
+ if ($loadSelect) {
+ if (0 < count($this->_elements)) {
+ $this->_separator[] = $separator;
+ } else {
+ $this->_wrap[0] = $separator;
+ }
+ $separator = '';
+ // Should we add an empty option to the top of the select?
+ if (!is_array($this->_options['addEmptyOption']) && $this->_options['addEmptyOption'] ||
+ is_array($this->_options['addEmptyOption']) && !empty($this->_options['addEmptyOption'][$sign])) {
+
+ // Using '+' array operator to preserve the keys
+ if (is_array($this->_options['emptyOptionText']) && !empty($this->_options['emptyOptionText'][$sign])) {
+ $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText'][$sign]) + $options;
+ } else {
+ $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options;
+ }
+ }
+ $this->_elements[] = new HTML_QuickForm_select($sign, null, $options, $this->getAttributes());
+ }
+ }
+ }
+ $this->_wrap[1] = $separator . ($backslash? '\\': '');
+ }
+
+ // }}}
+ // {{{ _createOptionList()
+
+ /**
+ * Creates an option list containing the numbers from the start number to the end, inclusive
+ *
+ * @param int The start number
+ * @param int The end number
+ * @param int Increment by this value
+ * @access private
+ * @return array An array of numeric options.
+ */
+ function _createOptionList($start, $end, $step = 1)
+ {
+ for ($i = $start, $options = array(); $start > $end? $i >= $end: $i <= $end; $i += $step) {
+ $options[$i] = sprintf('%02d', $i);
+ }
+ return $options;
+ }
+
+ // }}}
+ // {{{ setValue()
+
+ function setValue($value)
+ {
+ $trimLeadingZeros = create_function('$a', '$b = ltrim($a, \'0\'); return strlen($b)? $b: \'0\';');
+ if (empty($value)) {
+ $value = array();
+ } elseif (is_scalar($value)) {
+ if (!is_numeric($value)) {
+ $value = strtotime($value);
+ }
+ // might be a unix epoch, then we fill all possible values
+ $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
+ $value = array(
+ 'D' => $arr[0],
+ 'l' => $arr[0],
+ 'd' => $arr[1],
+ 'M' => $arr[2],
+ 'm' => $arr[2],
+ 'F' => $arr[2],
+ 'Y' => $arr[3],
+ 'y' => $arr[3],
+ 'h' => $arr[4],
+ 'g' => $arr[4],
+ 'H' => $arr[5],
+ 'i' => $trimLeadingZeros($arr[6]),
+ 's' => $trimLeadingZeros($arr[7]),
+ 'a' => $arr[8],
+ 'A' => $arr[9],
+ 'W' => $trimLeadingZeros($arr[10])
+ );
+ } else {
+ $value = array_map($trimLeadingZeros, $value);
+ }
+ parent::setValue($value);
+ }
+
+ // }}}
+ // {{{ toHtml()
+
+ function toHtml()
+ {
+ include_once('HTML/QuickForm/Renderer/Default.php');
+ $renderer = new HTML_QuickForm_Renderer_Default();
+ $renderer->setElementTemplate('{element}');
+ parent::accept($renderer);
+ return $this->_wrap[0] . $renderer->toHtml() . $this->_wrap[1];
+ }
+
+ // }}}
+ // {{{ accept()
+
+ function accept(&$renderer, $required = false, $error = null)
+ {
+ $renderer->renderElement($this, $required, $error);
+ }
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ if ('updateValue' == $event) {
+ // we need to call setValue(), 'cause the default/constant value
+ // may be in fact a timestamp, not an array
+ return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
+ } else {
+ return parent::onQuickFormEvent($event, $arg, $caller);
+ }
+ }
+
+ // }}}
+}
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/element.php b/libs/HTML/QuickForm/element.php
index 2604d39d47..9fbe41ef1f 100755
--- a/libs/HTML/QuickForm/element.php
+++ b/libs/HTML/QuickForm/element.php
@@ -1,494 +1,494 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Base class for form elements
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for all HTML classes
- */
-require_once 'HTML/Common.php';
-
-/**
- * Base class for form elements
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 1.0
- * @abstract
- */
-class HTML_QuickForm_element extends HTML_Common
-{
- // {{{ properties
-
- /**
- * Label of the field
- * @var string
- * @since 1.3
- * @access private
- */
- var $_label = '';
-
- /**
- * Form element type
- * @var string
- * @since 1.0
- * @access private
- */
- var $_type = '';
-
- /**
- * Flag to tell if element is frozen
- * @var boolean
- * @since 1.0
- * @access private
- */
- var $_flagFrozen = false;
-
- /**
- * Does the element support persistant data when frozen
- * @var boolean
- * @since 1.3
- * @access private
- */
- var $_persistantFreeze = false;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Name of the element
- * @param mixed Label(s) for the element
- * @param mixed Associative array of tag attributes or HTML attributes name="value" pairs
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_Common::HTML_Common($attributes);
- if (isset($elementName)) {
- $this->setName($elementName);
- }
- if (isset($elementLabel)) {
- $this->setLabel($elementLabel);
- }
- } //end constructor
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Returns the current API version
- *
- * @since 1.0
- * @access public
- * @return float
- */
- function apiVersion()
- {
- return 3.2;
- } // end func apiVersion
-
- // }}}
- // {{{ getType()
-
- /**
- * Returns element type
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getType()
- {
- return $this->_type;
- } // end func getType
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- // interface method
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- // interface method
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param string $value Default value of the form element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- // interface
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return mixed
- */
- function getValue()
- {
- // interface
- return null;
- } // end func getValue
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- $this->_flagFrozen = true;
- } //end func freeze
-
- // }}}
- // {{{ unfreeze()
-
- /**
- * Unfreezes the element so that it becomes editable
- *
- * @access public
- * @return void
- * @since 3.2.4
- */
- function unfreeze()
- {
- $this->_flagFrozen = false;
- }
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $value = $this->getValue();
- return ('' != $value? htmlspecialchars($value): '&nbsp;') .
- $this->_getPersistantData();
- } //end func getFrozenHtml
-
- // }}}
- // {{{ _getPersistantData()
-
- /**
- * Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on
- *
- * @access private
- * @return string
- */
- function _getPersistantData()
- {
- if (!$this->_persistantFreeze) {
- return '';
- } else {
- $id = $this->getAttribute('id');
- return '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $this->getName(),
- 'value' => $this->getValue()
- ) + (isset($id)? array('id' => $id): array())) . ' />';
- }
- }
-
- // }}}
- // {{{ isFrozen()
-
- /**
- * Returns whether or not the element is frozen
- *
- * @since 1.3
- * @access public
- * @return bool
- */
- function isFrozen()
- {
- return $this->_flagFrozen;
- } // end func isFrozen
-
- // }}}
- // {{{ setPersistantFreeze()
-
- /**
- * Sets wether an element value should be kept in an hidden field
- * when the element is frozen or not
- *
- * @param bool $persistant True if persistant value
- * @since 2.0
- * @access public
- * @return void
- */
- function setPersistantFreeze($persistant=false)
- {
- $this->_persistantFreeze = $persistant;
- } //end func setPersistantFreeze
-
- // }}}
- // {{{ setLabel()
-
- /**
- * Sets display text for the element
- *
- * @param string $label Display text for the element
- * @since 1.3
- * @access public
- * @return void
- */
- function setLabel($label)
- {
- $this->_label = $label;
- } //end func setLabel
-
- // }}}
- // {{{ getLabel()
-
- /**
- * Returns display text for the element
- *
- * @since 1.3
- * @access public
- * @return string
- */
- function getLabel()
- {
- return $this->_label;
- } //end func getLabel
-
- // }}}
- // {{{ _findValue()
-
- /**
- * Tries to find the element value from the values array
- *
- * @since 2.7
- * @access private
- * @return mixed
- */
- function _findValue(&$values)
- {
- if (empty($values)) {
- return null;
- }
- $elementName = $this->getName();
- if (isset($values[$elementName])) {
- return $values[$elementName];
- } elseif (strpos($elementName, '[')) {
- $myVar = "['" . str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- $elementName
- ) . "']";
- return eval("return (isset(\$values$myVar)) ? \$values$myVar : null;");
- } else {
- return null;
- }
- } //end func _findValue
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'createElement':
- $className = get_class($this);
- $this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
- break;
- case 'addElement':
- $this->onQuickFormEvent('createElement', $arg, $caller);
- $this->onQuickFormEvent('updateValue', null, $caller);
- break;
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- break;
- case 'setGroupValue':
- $this->setValue($arg);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- * @access public
- * @return void
- */
- function accept(&$renderer, $required=false, $error=null)
- {
- $renderer->renderElement($this, $required, $error);
- } // end func accept
-
- // }}}
- // {{{ _generateId()
-
- /**
- * Automatically generates and assigns an 'id' attribute for the element.
- *
- * Currently used to ensure that labels work on radio buttons and
- * checkboxes. Per idea of Alexander Radivanovich.
- *
- * @access private
- * @return void
- */
- function _generateId()
- {
- static $idx = 1;
-
- if (!$this->getAttribute('id')) {
- $this->updateAttributes(array('id' => 'qf_' . substr(md5(microtime() . $idx++), 0, 6)));
- }
- } // end func _generateId
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Returns a 'safe' element's value
- *
- * @param array array of submitted values to search
- * @param bool whether to return the value as associative array
- * @access public
- * @return mixed
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getValue();
- }
- return $this->_prepareValue($value, $assoc);
- }
-
- // }}}
- // {{{ _prepareValue()
-
- /**
- * Used by exportValue() to prepare the value for returning
- *
- * @param mixed the value found in exportValue()
- * @param bool whether to return the value as associative array
- * @access private
- * @return mixed
- */
- function _prepareValue($value, $assoc)
- {
- if (null === $value) {
- return null;
- } elseif (!$assoc) {
- return $value;
- } else {
- $name = $this->getName();
- if (!strpos($name, '[')) {
- return array($name => $value);
- } else {
- $valueAry = array();
- $myIndex = "['" . str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- $name
- ) . "']";
- eval("\$valueAry$myIndex = \$value;");
- return $valueAry;
- }
- }
- }
-
- // }}}
-} // end class HTML_QuickForm_element
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Base class for form elements
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for all HTML classes
+ */
+require_once 'HTML/Common.php';
+
+/**
+ * Base class for form elements
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 1.0
+ * @abstract
+ */
+class HTML_QuickForm_element extends HTML_Common
+{
+ // {{{ properties
+
+ /**
+ * Label of the field
+ * @var string
+ * @since 1.3
+ * @access private
+ */
+ var $_label = '';
+
+ /**
+ * Form element type
+ * @var string
+ * @since 1.0
+ * @access private
+ */
+ var $_type = '';
+
+ /**
+ * Flag to tell if element is frozen
+ * @var boolean
+ * @since 1.0
+ * @access private
+ */
+ var $_flagFrozen = false;
+
+ /**
+ * Does the element support persistant data when frozen
+ * @var boolean
+ * @since 1.3
+ * @access private
+ */
+ var $_persistantFreeze = false;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Name of the element
+ * @param mixed Label(s) for the element
+ * @param mixed Associative array of tag attributes or HTML attributes name="value" pairs
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null)
+ {
+ HTML_Common::HTML_Common($attributes);
+ if (isset($elementName)) {
+ $this->setName($elementName);
+ }
+ if (isset($elementLabel)) {
+ $this->setLabel($elementLabel);
+ }
+ } //end constructor
+
+ // }}}
+ // {{{ apiVersion()
+
+ /**
+ * Returns the current API version
+ *
+ * @since 1.0
+ * @access public
+ * @return float
+ */
+ function apiVersion()
+ {
+ return 3.2;
+ } // end func apiVersion
+
+ // }}}
+ // {{{ getType()
+
+ /**
+ * Returns element type
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getType()
+ {
+ return $this->_type;
+ } // end func getType
+
+ // }}}
+ // {{{ setName()
+
+ /**
+ * Sets the input field name
+ *
+ * @param string $name Input field name attribute
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setName($name)
+ {
+ // interface method
+ } //end func setName
+
+ // }}}
+ // {{{ getName()
+
+ /**
+ * Returns the element name
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getName()
+ {
+ // interface method
+ } //end func getName
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets the value of the form element
+ *
+ * @param string $value Default value of the form element
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setValue($value)
+ {
+ // interface
+ } // end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns the value of the form element
+ *
+ * @since 1.0
+ * @access public
+ * @return mixed
+ */
+ function getValue()
+ {
+ // interface
+ return null;
+ } // end func getValue
+
+ // }}}
+ // {{{ freeze()
+
+ /**
+ * Freeze the element so that only its value is returned
+ *
+ * @access public
+ * @return void
+ */
+ function freeze()
+ {
+ $this->_flagFrozen = true;
+ } //end func freeze
+
+ // }}}
+ // {{{ unfreeze()
+
+ /**
+ * Unfreezes the element so that it becomes editable
+ *
+ * @access public
+ * @return void
+ * @since 3.2.4
+ */
+ function unfreeze()
+ {
+ $this->_flagFrozen = false;
+ }
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getFrozenHtml()
+ {
+ $value = $this->getValue();
+ return ('' != $value? htmlspecialchars($value): '&nbsp;') .
+ $this->_getPersistantData();
+ } //end func getFrozenHtml
+
+ // }}}
+ // {{{ _getPersistantData()
+
+ /**
+ * Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on
+ *
+ * @access private
+ * @return string
+ */
+ function _getPersistantData()
+ {
+ if (!$this->_persistantFreeze) {
+ return '';
+ } else {
+ $id = $this->getAttribute('id');
+ return '<input' . $this->_getAttrString(array(
+ 'type' => 'hidden',
+ 'name' => $this->getName(),
+ 'value' => $this->getValue()
+ ) + (isset($id)? array('id' => $id): array())) . ' />';
+ }
+ }
+
+ // }}}
+ // {{{ isFrozen()
+
+ /**
+ * Returns whether or not the element is frozen
+ *
+ * @since 1.3
+ * @access public
+ * @return bool
+ */
+ function isFrozen()
+ {
+ return $this->_flagFrozen;
+ } // end func isFrozen
+
+ // }}}
+ // {{{ setPersistantFreeze()
+
+ /**
+ * Sets wether an element value should be kept in an hidden field
+ * when the element is frozen or not
+ *
+ * @param bool $persistant True if persistant value
+ * @since 2.0
+ * @access public
+ * @return void
+ */
+ function setPersistantFreeze($persistant=false)
+ {
+ $this->_persistantFreeze = $persistant;
+ } //end func setPersistantFreeze
+
+ // }}}
+ // {{{ setLabel()
+
+ /**
+ * Sets display text for the element
+ *
+ * @param string $label Display text for the element
+ * @since 1.3
+ * @access public
+ * @return void
+ */
+ function setLabel($label)
+ {
+ $this->_label = $label;
+ } //end func setLabel
+
+ // }}}
+ // {{{ getLabel()
+
+ /**
+ * Returns display text for the element
+ *
+ * @since 1.3
+ * @access public
+ * @return string
+ */
+ function getLabel()
+ {
+ return $this->_label;
+ } //end func getLabel
+
+ // }}}
+ // {{{ _findValue()
+
+ /**
+ * Tries to find the element value from the values array
+ *
+ * @since 2.7
+ * @access private
+ * @return mixed
+ */
+ function _findValue(&$values)
+ {
+ if (empty($values)) {
+ return null;
+ }
+ $elementName = $this->getName();
+ if (isset($values[$elementName])) {
+ return $values[$elementName];
+ } elseif (strpos($elementName, '[')) {
+ $myVar = "['" . str_replace(
+ array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
+ $elementName
+ ) . "']";
+ return eval("return (isset(\$values$myVar)) ? \$values$myVar : null;");
+ } else {
+ return null;
+ }
+ } //end func _findValue
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string $event Name of event
+ * @param mixed $arg event arguments
+ * @param object &$caller calling object
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ switch ($event) {
+ case 'createElement':
+ $className = get_class($this);
+ $this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
+ break;
+ case 'addElement':
+ $this->onQuickFormEvent('createElement', $arg, $caller);
+ $this->onQuickFormEvent('updateValue', null, $caller);
+ break;
+ case 'updateValue':
+ // constant values override both default and submitted ones
+ // default values are overriden by submitted
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_submitValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ }
+ if (null !== $value) {
+ $this->setValue($value);
+ }
+ break;
+ case 'setGroupValue':
+ $this->setValue($arg);
+ }
+ return true;
+ } // end func onQuickFormEvent
+
+ // }}}
+ // {{{ accept()
+
+ /**
+ * Accepts a renderer
+ *
+ * @param HTML_QuickForm_Renderer renderer object
+ * @param bool Whether an element is required
+ * @param string An error message associated with an element
+ * @access public
+ * @return void
+ */
+ function accept(&$renderer, $required=false, $error=null)
+ {
+ $renderer->renderElement($this, $required, $error);
+ } // end func accept
+
+ // }}}
+ // {{{ _generateId()
+
+ /**
+ * Automatically generates and assigns an 'id' attribute for the element.
+ *
+ * Currently used to ensure that labels work on radio buttons and
+ * checkboxes. Per idea of Alexander Radivanovich.
+ *
+ * @access private
+ * @return void
+ */
+ function _generateId()
+ {
+ static $idx = 1;
+
+ if (!$this->getAttribute('id')) {
+ $this->updateAttributes(array('id' => 'qf_' . substr(md5(microtime() . $idx++), 0, 6)));
+ }
+ } // end func _generateId
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * Returns a 'safe' element's value
+ *
+ * @param array array of submitted values to search
+ * @param bool whether to return the value as associative array
+ * @access public
+ * @return mixed
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ $value = $this->_findValue($submitValues);
+ if (null === $value) {
+ $value = $this->getValue();
+ }
+ return $this->_prepareValue($value, $assoc);
+ }
+
+ // }}}
+ // {{{ _prepareValue()
+
+ /**
+ * Used by exportValue() to prepare the value for returning
+ *
+ * @param mixed the value found in exportValue()
+ * @param bool whether to return the value as associative array
+ * @access private
+ * @return mixed
+ */
+ function _prepareValue($value, $assoc)
+ {
+ if (null === $value) {
+ return null;
+ } elseif (!$assoc) {
+ return $value;
+ } else {
+ $name = $this->getName();
+ if (!strpos($name, '[')) {
+ return array($name => $value);
+ } else {
+ $valueAry = array();
+ $myIndex = "['" . str_replace(
+ array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
+ $name
+ ) . "']";
+ eval("\$valueAry$myIndex = \$value;");
+ return $valueAry;
+ }
+ }
+ }
+
+ // }}}
+} // end class HTML_QuickForm_element
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/file.php b/libs/HTML/QuickForm/file.php
index de23a1ec0e..f3cbdfa7a8 100755
--- a/libs/HTML/QuickForm/file.php
+++ b/libs/HTML/QuickForm/file.php
@@ -1,358 +1,358 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a file upload field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-// register file-related rules
-if (class_exists('HTML_QuickForm')) {
- HTML_QuickForm::registerRule('uploadedfile', 'callback', '_ruleIsUploadedFile', 'HTML_QuickForm_file');
- HTML_QuickForm::registerRule('maxfilesize', 'callback', '_ruleCheckMaxFileSize', 'HTML_QuickForm_file');
- HTML_QuickForm::registerRule('mimetype', 'callback', '_ruleCheckMimeType', 'HTML_QuickForm_file');
- HTML_QuickForm::registerRule('filename', 'callback', '_ruleCheckFileName', 'HTML_QuickForm_file');
-}
-
-/**
- * HTML class for a file upload field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_file extends HTML_QuickForm_input
-{
- // {{{ properties
-
- /**
- * Uploaded file data, from $_FILES
- * @var array
- */
- var $_value = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param string Input field label
- * @param mixed (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- */
- function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->setType('file');
- } //end constructor
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets size of file element
- *
- * @param int Size of file element
- * @since 1.0
- * @access public
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size' => $size));
- } //end func setSize
-
- // }}}
- // {{{ getSize()
-
- /**
- * Returns size of file element
- *
- * @since 1.0
- * @access public
- * @return int
- */
- function getSize()
- {
- return $this->getAttribute('size');
- } //end func getSize
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return bool
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets value for file element.
- *
- * Actually this does nothing. The function is defined here to override
- * HTML_Quickform_input's behaviour of setting the 'value' attribute. As
- * no sane user-agent uses <input type="file">'s value for anything
- * (because of security implications) we implement file's value as a
- * read-only property with a special meaning.
- *
- * @param mixed Value for file element
- * @since 3.0
- * @access public
- */
- function setValue($value)
- {
- return null;
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns information about the uploaded file
- *
- * @since 3.0
- * @access public
- * @return array
- */
- function getValue()
- {
- return $this->_value;
- } // end func getValue
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string Name of event
- * @param mixed event arguments
- * @param object calling object
- * @since 1.0
- * @access public
- * @return bool
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- if ($caller->getAttribute('method') == 'get') {
- return PEAR::raiseError('Cannot add a file upload field to a GET method form');
- }
- $this->_value = $this->_findValue();
- $caller->updateAttributes(array('enctype' => 'multipart/form-data'));
- $caller->setMaxFileSize();
- break;
- case 'addElement':
- $this->onQuickFormEvent('createElement', $arg, $caller);
- return $this->onQuickFormEvent('updateValue', null, $caller);
- break;
- case 'createElement':
- $className = get_class($this);
- $this->$className($arg[0], $arg[1], $arg[2]);
- break;
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ moveUploadedFile()
-
- /**
- * Moves an uploaded file into the destination
- *
- * @param string Destination directory path
- * @param string New file name
- * @access public
- * @return bool Whether the file was moved successfully
- */
- function moveUploadedFile($dest, $fileName = '')
- {
- if ($dest != '' && substr($dest, -1) != '/') {
- $dest .= '/';
- }
- $fileName = ($fileName != '') ? $fileName : basename($this->_value['name']);
- return move_uploaded_file($this->_value['tmp_name'], $dest . $fileName);
- } // end func moveUploadedFile
-
- // }}}
- // {{{ isUploadedFile()
-
- /**
- * Checks if the element contains an uploaded file
- *
- * @access public
- * @return bool true if file has been uploaded, false otherwise
- */
- function isUploadedFile()
- {
- return $this->_ruleIsUploadedFile($this->_value);
- } // end func isUploadedFile
-
- // }}}
- // {{{ _ruleIsUploadedFile()
-
- /**
- * Checks if the given element contains an uploaded file
- *
- * @param array Uploaded file info (from $_FILES)
- * @access private
- * @return bool true if file has been uploaded, false otherwise
- */
- function _ruleIsUploadedFile($elementValue)
- {
- if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
- (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
- return is_uploaded_file($elementValue['tmp_name']);
- } else {
- return false;
- }
- } // end func _ruleIsUploadedFile
-
- // }}}
- // {{{ _ruleCheckMaxFileSize()
-
- /**
- * Checks that the file does not exceed the max file size
- *
- * @param array Uploaded file info (from $_FILES)
- * @param int Max file size
- * @access private
- * @return bool true if filesize is lower than maxsize, false otherwise
- */
- function _ruleCheckMaxFileSize($elementValue, $maxSize)
- {
- if (!empty($elementValue['error']) &&
- (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) {
- return false;
- }
- if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
- return true;
- }
- return ($maxSize >= @filesize($elementValue['tmp_name']));
- } // end func _ruleCheckMaxFileSize
-
- // }}}
- // {{{ _ruleCheckMimeType()
-
- /**
- * Checks if the given element contains an uploaded file of the right mime type
- *
- * @param array Uploaded file info (from $_FILES)
- * @param mixed Mime Type (can be an array of allowed types)
- * @access private
- * @return bool true if mimetype is correct, false otherwise
- */
- function _ruleCheckMimeType($elementValue, $mimeType)
- {
- if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
- return true;
- }
- if (is_array($mimeType)) {
- return in_array($elementValue['type'], $mimeType);
- }
- return $elementValue['type'] == $mimeType;
- } // end func _ruleCheckMimeType
-
- // }}}
- // {{{ _ruleCheckFileName()
-
- /**
- * Checks if the given element contains an uploaded file of the filename regex
- *
- * @param array Uploaded file info (from $_FILES)
- * @param string Regular expression
- * @access private
- * @return bool true if name matches regex, false otherwise
- */
- function _ruleCheckFileName($elementValue, $regex)
- {
- if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
- return true;
- }
- return preg_match($regex, $elementValue['name']);
- } // end func _ruleCheckFileName
-
- // }}}
- // {{{ _findValue()
-
- /**
- * Tries to find the element value from the values array
- *
- * Needs to be redefined here as $_FILES is populated differently from
- * other arrays when element name is of the form foo[bar]
- *
- * @access private
- * @return mixed
- */
- function _findValue()
- {
- if (empty($_FILES)) {
- return null;
- }
- $elementName = $this->getName();
- if (isset($_FILES[$elementName])) {
- return $_FILES[$elementName];
- } elseif (false !== ($pos = strpos($elementName, '['))) {
- $base = str_replace(
- array('\\', '\''), array('\\\\', '\\\''),
- substr($elementName, 0, $pos)
- );
- $idx = "['" . str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- substr($elementName, $pos + 1, -1)
- ) . "']";
- $props = array('name', 'type', 'size', 'tmp_name', 'error');
- $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" .
- " return null;\n" .
- "} else {\n" .
- " \$value = array();\n";
- foreach ($props as $prop) {
- $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n";
- }
- return eval($code . " return \$value;\n}\n");
- } else {
- return null;
- }
- }
-
- // }}}
-} // end class HTML_QuickForm_file
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a file upload field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+// register file-related rules
+if (class_exists('HTML_QuickForm')) {
+ HTML_QuickForm::registerRule('uploadedfile', 'callback', '_ruleIsUploadedFile', 'HTML_QuickForm_file');
+ HTML_QuickForm::registerRule('maxfilesize', 'callback', '_ruleCheckMaxFileSize', 'HTML_QuickForm_file');
+ HTML_QuickForm::registerRule('mimetype', 'callback', '_ruleCheckMimeType', 'HTML_QuickForm_file');
+ HTML_QuickForm::registerRule('filename', 'callback', '_ruleCheckFileName', 'HTML_QuickForm_file');
+}
+
+/**
+ * HTML class for a file upload field
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_file extends HTML_QuickForm_input
+{
+ // {{{ properties
+
+ /**
+ * Uploaded file data, from $_FILES
+ * @var array
+ */
+ var $_value = null;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Input field name attribute
+ * @param string Input field label
+ * @param mixed (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ */
+ function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ $this->setType('file');
+ } //end constructor
+
+ // }}}
+ // {{{ setSize()
+
+ /**
+ * Sets size of file element
+ *
+ * @param int Size of file element
+ * @since 1.0
+ * @access public
+ */
+ function setSize($size)
+ {
+ $this->updateAttributes(array('size' => $size));
+ } //end func setSize
+
+ // }}}
+ // {{{ getSize()
+
+ /**
+ * Returns size of file element
+ *
+ * @since 1.0
+ * @access public
+ * @return int
+ */
+ function getSize()
+ {
+ return $this->getAttribute('size');
+ } //end func getSize
+
+ // }}}
+ // {{{ freeze()
+
+ /**
+ * Freeze the element so that only its value is returned
+ *
+ * @access public
+ * @return bool
+ */
+ function freeze()
+ {
+ return false;
+ } //end func freeze
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets value for file element.
+ *
+ * Actually this does nothing. The function is defined here to override
+ * HTML_Quickform_input's behaviour of setting the 'value' attribute. As
+ * no sane user-agent uses <input type="file">'s value for anything
+ * (because of security implications) we implement file's value as a
+ * read-only property with a special meaning.
+ *
+ * @param mixed Value for file element
+ * @since 3.0
+ * @access public
+ */
+ function setValue($value)
+ {
+ return null;
+ } //end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns information about the uploaded file
+ *
+ * @since 3.0
+ * @access public
+ * @return array
+ */
+ function getValue()
+ {
+ return $this->_value;
+ } // end func getValue
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string Name of event
+ * @param mixed event arguments
+ * @param object calling object
+ * @since 1.0
+ * @access public
+ * @return bool
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ switch ($event) {
+ case 'updateValue':
+ if ($caller->getAttribute('method') == 'get') {
+ return PEAR::raiseError('Cannot add a file upload field to a GET method form');
+ }
+ $this->_value = $this->_findValue();
+ $caller->updateAttributes(array('enctype' => 'multipart/form-data'));
+ $caller->setMaxFileSize();
+ break;
+ case 'addElement':
+ $this->onQuickFormEvent('createElement', $arg, $caller);
+ return $this->onQuickFormEvent('updateValue', null, $caller);
+ break;
+ case 'createElement':
+ $className = get_class($this);
+ $this->$className($arg[0], $arg[1], $arg[2]);
+ break;
+ }
+ return true;
+ } // end func onQuickFormEvent
+
+ // }}}
+ // {{{ moveUploadedFile()
+
+ /**
+ * Moves an uploaded file into the destination
+ *
+ * @param string Destination directory path
+ * @param string New file name
+ * @access public
+ * @return bool Whether the file was moved successfully
+ */
+ function moveUploadedFile($dest, $fileName = '')
+ {
+ if ($dest != '' && substr($dest, -1) != '/') {
+ $dest .= '/';
+ }
+ $fileName = ($fileName != '') ? $fileName : basename($this->_value['name']);
+ return move_uploaded_file($this->_value['tmp_name'], $dest . $fileName);
+ } // end func moveUploadedFile
+
+ // }}}
+ // {{{ isUploadedFile()
+
+ /**
+ * Checks if the element contains an uploaded file
+ *
+ * @access public
+ * @return bool true if file has been uploaded, false otherwise
+ */
+ function isUploadedFile()
+ {
+ return $this->_ruleIsUploadedFile($this->_value);
+ } // end func isUploadedFile
+
+ // }}}
+ // {{{ _ruleIsUploadedFile()
+
+ /**
+ * Checks if the given element contains an uploaded file
+ *
+ * @param array Uploaded file info (from $_FILES)
+ * @access private
+ * @return bool true if file has been uploaded, false otherwise
+ */
+ function _ruleIsUploadedFile($elementValue)
+ {
+ if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
+ (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
+ return is_uploaded_file($elementValue['tmp_name']);
+ } else {
+ return false;
+ }
+ } // end func _ruleIsUploadedFile
+
+ // }}}
+ // {{{ _ruleCheckMaxFileSize()
+
+ /**
+ * Checks that the file does not exceed the max file size
+ *
+ * @param array Uploaded file info (from $_FILES)
+ * @param int Max file size
+ * @access private
+ * @return bool true if filesize is lower than maxsize, false otherwise
+ */
+ function _ruleCheckMaxFileSize($elementValue, $maxSize)
+ {
+ if (!empty($elementValue['error']) &&
+ (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) {
+ return false;
+ }
+ if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
+ return true;
+ }
+ return ($maxSize >= @filesize($elementValue['tmp_name']));
+ } // end func _ruleCheckMaxFileSize
+
+ // }}}
+ // {{{ _ruleCheckMimeType()
+
+ /**
+ * Checks if the given element contains an uploaded file of the right mime type
+ *
+ * @param array Uploaded file info (from $_FILES)
+ * @param mixed Mime Type (can be an array of allowed types)
+ * @access private
+ * @return bool true if mimetype is correct, false otherwise
+ */
+ function _ruleCheckMimeType($elementValue, $mimeType)
+ {
+ if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
+ return true;
+ }
+ if (is_array($mimeType)) {
+ return in_array($elementValue['type'], $mimeType);
+ }
+ return $elementValue['type'] == $mimeType;
+ } // end func _ruleCheckMimeType
+
+ // }}}
+ // {{{ _ruleCheckFileName()
+
+ /**
+ * Checks if the given element contains an uploaded file of the filename regex
+ *
+ * @param array Uploaded file info (from $_FILES)
+ * @param string Regular expression
+ * @access private
+ * @return bool true if name matches regex, false otherwise
+ */
+ function _ruleCheckFileName($elementValue, $regex)
+ {
+ if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
+ return true;
+ }
+ return preg_match($regex, $elementValue['name']);
+ } // end func _ruleCheckFileName
+
+ // }}}
+ // {{{ _findValue()
+
+ /**
+ * Tries to find the element value from the values array
+ *
+ * Needs to be redefined here as $_FILES is populated differently from
+ * other arrays when element name is of the form foo[bar]
+ *
+ * @access private
+ * @return mixed
+ */
+ function _findValue()
+ {
+ if (empty($_FILES)) {
+ return null;
+ }
+ $elementName = $this->getName();
+ if (isset($_FILES[$elementName])) {
+ return $_FILES[$elementName];
+ } elseif (false !== ($pos = strpos($elementName, '['))) {
+ $base = str_replace(
+ array('\\', '\''), array('\\\\', '\\\''),
+ substr($elementName, 0, $pos)
+ );
+ $idx = "['" . str_replace(
+ array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
+ substr($elementName, $pos + 1, -1)
+ ) . "']";
+ $props = array('name', 'type', 'size', 'tmp_name', 'error');
+ $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" .
+ " return null;\n" .
+ "} else {\n" .
+ " \$value = array();\n";
+ foreach ($props as $prop) {
+ $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n";
+ }
+ return eval($code . " return \$value;\n}\n");
+ } else {
+ return null;
+ }
+ }
+
+ // }}}
+} // end class HTML_QuickForm_file
+?>
diff --git a/libs/HTML/QuickForm/group.php b/libs/HTML/QuickForm/group.php
index 9c1cd9b476..f90641b7d9 100755
--- a/libs/HTML/QuickForm/group.php
+++ b/libs/HTML/QuickForm/group.php
@@ -1,588 +1,588 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a form element group
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * HTML class for a form element group
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_group extends HTML_QuickForm_element
-{
- // {{{ properties
-
- /**
- * Name of the element
- * @var string
- * @since 1.0
- * @access private
- */
- var $_name = '';
-
- /**
- * Array of grouped elements
- * @var array
- * @since 1.0
- * @access private
- */
- var $_elements = array();
-
- /**
- * String to separate elements
- * @var mixed
- * @since 2.5
- * @access private
- */
- var $_separator = null;
-
- /**
- * Required elements in this group
- * @var array
- * @since 2.5
- * @access private
- */
- var $_required = array();
-
- /**
- * Whether to change elements' names to $groupName[$elementName] or leave them as is
- * @var bool
- * @since 3.0
- * @access private
- */
- var $_appendName = true;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Group name
- * @param array $elementLabel (optional)Group label
- * @param array $elements (optional)Group elements
- * @param mixed $separator (optional)Use a string for one separator,
- * use an array to alternate the separators.
- * @param bool $appendName (optional)whether to change elements' names to
- * the form $groupName[$elementName] or leave
- * them as is.
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel);
- $this->_type = 'group';
- if (isset($elements) && is_array($elements)) {
- $this->setElements($elements);
- }
- if (isset($separator)) {
- $this->_separator = $separator;
- }
- if (isset($appendName)) {
- $this->_appendName = $appendName;
- }
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the group name
- *
- * @param string $name Group name
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->_name = $name;
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the group name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->_name;
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets values for group's elements
- *
- * @param mixed Values for group's elements
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->_createElementsIfNotExist();
- foreach (array_keys($this->_elements) as $key) {
- if (!$this->_appendName) {
- $v = $this->_elements[$key]->_findValue($value);
- if (null !== $v) {
- $this->_elements[$key]->onQuickFormEvent('setGroupValue', $v, $this);
- }
-
- } else {
- $elementName = $this->_elements[$key]->getName();
- $index = strlen($elementName) ? $elementName : $key;
- if (is_array($value)) {
- if (isset($value[$index])) {
- $this->_elements[$key]->onQuickFormEvent('setGroupValue', $value[$index], $this);
- }
- } elseif (isset($value)) {
- $this->_elements[$key]->onQuickFormEvent('setGroupValue', $value, $this);
- }
- }
- }
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the group
- *
- * @since 1.0
- * @access public
- * @return mixed
- */
- function getValue()
- {
- $value = null;
- foreach (array_keys($this->_elements) as $key) {
- $element =& $this->_elements[$key];
- switch ($element->getType()) {
- case 'radio':
- $v = $element->getChecked()? $element->getValue(): null;
- break;
- case 'checkbox':
- $v = $element->getChecked()? true: null;
- break;
- default:
- $v = $element->getValue();
- }
- if (null !== $v) {
- $elementName = $element->getName();
- if (is_null($elementName)) {
- $value = $v;
- } else {
- if (!is_array($value)) {
- $value = is_null($value)? array(): array($value);
- }
- if ('' === $elementName) {
- $value[] = $v;
- } else {
- $value[$elementName] = $v;
- }
- }
- }
- }
- return $value;
- } // end func getValue
-
- // }}}
- // {{{ setElements()
-
- /**
- * Sets the grouped elements
- *
- * @param array $elements Array of elements
- * @since 1.1
- * @access public
- * @return void
- */
- function setElements($elements)
- {
- $this->_elements = array_values($elements);
- if ($this->_flagFrozen) {
- $this->freeze();
- }
- } // end func setElements
-
- // }}}
- // {{{ getElements()
-
- /**
- * Gets the grouped elements
- *
- * @since 2.4
- * @access public
- * @return array
- */
- function &getElements()
- {
- $this->_createElementsIfNotExist();
- return $this->_elements;
- } // end func getElements
-
- // }}}
- // {{{ getGroupType()
-
- /**
- * Gets the group type based on its elements
- * Will return 'mixed' if elements contained in the group
- * are of different types.
- *
- * @access public
- * @return string group elements type
- */
- function getGroupType()
- {
- $this->_createElementsIfNotExist();
- $prevType = '';
- foreach (array_keys($this->_elements) as $key) {
- $type = $this->_elements[$key]->getType();
- if ($type != $prevType && $prevType != '') {
- return 'mixed';
- }
- $prevType = $type;
- }
- return $type;
- } // end func getGroupType
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns Html for the group
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer = new HTML_QuickForm_Renderer_Default();
- $renderer->setElementTemplate('{element}');
- $this->accept($renderer);
- return $renderer->toHtml();
- } //end func toHtml
-
- // }}}
- // {{{ getElementName()
-
- /**
- * Returns the element name inside the group such as found in the html form
- *
- * @param mixed $index Element name or element index in the group
- * @since 3.0
- * @access public
- * @return mixed string with element name, false if not found
- */
- function getElementName($index)
- {
- $this->_createElementsIfNotExist();
- $elementName = false;
- if (is_int($index) && isset($this->_elements[$index])) {
- $elementName = $this->_elements[$index]->getName();
- if (isset($elementName) && $elementName == '') {
- $elementName = $index;
- }
- if ($this->_appendName) {
- if (is_null($elementName)) {
- $elementName = $this->getName();
- } else {
- $elementName = $this->getName().'['.$elementName.']';
- }
- }
-
- } elseif (is_string($index)) {
- foreach (array_keys($this->_elements) as $key) {
- $elementName = $this->_elements[$key]->getName();
- if ($index == $elementName) {
- if ($this->_appendName) {
- $elementName = $this->getName().'['.$elementName.']';
- }
- break;
- } elseif ($this->_appendName && $this->getName().'['.$elementName.']' == $index) {
- break;
- }
- }
- }
- return $elementName;
- } //end func getElementName
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.3
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $flags = array();
- $this->_createElementsIfNotExist();
- foreach (array_keys($this->_elements) as $key) {
- if (false === ($flags[$key] = $this->_elements[$key]->isFrozen())) {
- $this->_elements[$key]->freeze();
- }
- }
- $html = $this->toHtml();
- foreach (array_keys($this->_elements) as $key) {
- if (!$flags[$key]) {
- $this->_elements[$key]->unfreeze();
- }
- }
- return $html;
- } //end func getFrozenHtml
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- $this->_createElementsIfNotExist();
- foreach (array_keys($this->_elements) as $key) {
- if ($this->_appendName) {
- $elementName = $this->_elements[$key]->getName();
- if (is_null($elementName)) {
- $this->_elements[$key]->setName($this->getName());
- } elseif ('' === $elementName) {
- $this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
- } else {
- $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
- }
- }
- $this->_elements[$key]->onQuickFormEvent('updateValue', $arg, $caller);
- if ($this->_appendName) {
- $this->_elements[$key]->setName($elementName);
- }
- }
- break;
-
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- */
- function accept(&$renderer, $required = false, $error = null)
- {
- $this->_createElementsIfNotExist();
- $renderer->startGroup($this, $required, $error);
- $name = $this->getName();
- foreach (array_keys($this->_elements) as $key) {
- $element =& $this->_elements[$key];
-
- if ($this->_appendName) {
- $elementName = $element->getName();
- if (isset($elementName)) {
- $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']');
- } else {
- $element->setName($name);
- }
- }
-
- $required = !$element->isFrozen() && in_array($element->getName(), $this->_required);
-
- $element->accept($renderer, $required);
-
- // restore the element's name
- if ($this->_appendName) {
- $element->setName($elementName);
- }
- }
- $renderer->finishGroup($this);
- } // end func accept
-
- // }}}
- // {{{ exportValue()
-
- /**
- * As usual, to get the group's value we access its elements and call
- * their exportValue() methods
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = null;
- foreach (array_keys($this->_elements) as $key) {
- $elementName = $this->_elements[$key]->getName();
- if ($this->_appendName) {
- if (is_null($elementName)) {
- $this->_elements[$key]->setName($this->getName());
- } elseif ('' === $elementName) {
- $this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
- } else {
- $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
- }
- }
- $v = $this->_elements[$key]->exportValue($submitValues, $assoc);
- if ($this->_appendName) {
- $this->_elements[$key]->setName($elementName);
- }
- if (null !== $v) {
- // Make $value an array, we will use it like one
- if (null === $value) {
- $value = array();
- }
- if ($assoc) {
- // just like HTML_QuickForm::exportValues()
- $value = HTML_QuickForm::arrayMerge($value, $v);
- } else {
- // just like getValue(), but should work OK every time here
- if (is_null($elementName)) {
- $value = $v;
- } elseif ('' === $elementName) {
- $value[] = $v;
- } else {
- $value[$elementName] = $v;
- }
- }
- }
- }
- // do not pass the value through _prepareValue, we took care of this already
- return $value;
- }
-
- // }}}
- // {{{ _createElements()
-
- /**
- * Creates the group's elements.
- *
- * This should be overriden by child classes that need to create their
- * elements. The method will be called automatically when needed, calling
- * it from the constructor is discouraged as the constructor is usually
- * called _twice_ on element creation, first time with _no_ parameters.
- *
- * @access private
- * @abstract
- */
- function _createElements()
- {
- // abstract
- }
-
- // }}}
- // {{{ _createElementsIfNotExist()
-
- /**
- * A wrapper around _createElements()
- *
- * This method calls _createElements() if the group's _elements array
- * is empty. It also performs some updates, e.g. freezes the created
- * elements if the group is already frozen.
- *
- * @access private
- */
- function _createElementsIfNotExist()
- {
- if (empty($this->_elements)) {
- $this->_createElements();
- if ($this->_flagFrozen) {
- $this->freeze();
- }
- }
- }
-
- // }}}
- // {{{ freeze()
-
- function freeze()
- {
- parent::freeze();
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->freeze();
- }
- }
-
- // }}}
- // {{{ unfreeze()
-
- function unfreeze()
- {
- parent::unfreeze();
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->unfreeze();
- }
- }
-
- // }}}
- // {{{ setPersistantFreeze()
-
- function setPersistantFreeze($persistant = false)
- {
- parent::setPersistantFreeze($persistant);
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->setPersistantFreeze($persistant);
- }
- }
-
- // }}}
-} //end class HTML_QuickForm_group
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a form element group
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for form elements
+ */
+require_once 'HTML/QuickForm/element.php';
+
+/**
+ * HTML class for a form element group
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_group extends HTML_QuickForm_element
+{
+ // {{{ properties
+
+ /**
+ * Name of the element
+ * @var string
+ * @since 1.0
+ * @access private
+ */
+ var $_name = '';
+
+ /**
+ * Array of grouped elements
+ * @var array
+ * @since 1.0
+ * @access private
+ */
+ var $_elements = array();
+
+ /**
+ * String to separate elements
+ * @var mixed
+ * @since 2.5
+ * @access private
+ */
+ var $_separator = null;
+
+ /**
+ * Required elements in this group
+ * @var array
+ * @since 2.5
+ * @access private
+ */
+ var $_required = array();
+
+ /**
+ * Whether to change elements' names to $groupName[$elementName] or leave them as is
+ * @var bool
+ * @since 3.0
+ * @access private
+ */
+ var $_appendName = true;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Group name
+ * @param array $elementLabel (optional)Group label
+ * @param array $elements (optional)Group elements
+ * @param mixed $separator (optional)Use a string for one separator,
+ * use an array to alternate the separators.
+ * @param bool $appendName (optional)whether to change elements' names to
+ * the form $groupName[$elementName] or leave
+ * them as is.
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)
+ {
+ $this->HTML_QuickForm_element($elementName, $elementLabel);
+ $this->_type = 'group';
+ if (isset($elements) && is_array($elements)) {
+ $this->setElements($elements);
+ }
+ if (isset($separator)) {
+ $this->_separator = $separator;
+ }
+ if (isset($appendName)) {
+ $this->_appendName = $appendName;
+ }
+ } //end constructor
+
+ // }}}
+ // {{{ setName()
+
+ /**
+ * Sets the group name
+ *
+ * @param string $name Group name
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setName($name)
+ {
+ $this->_name = $name;
+ } //end func setName
+
+ // }}}
+ // {{{ getName()
+
+ /**
+ * Returns the group name
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getName()
+ {
+ return $this->_name;
+ } //end func getName
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets values for group's elements
+ *
+ * @param mixed Values for group's elements
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setValue($value)
+ {
+ $this->_createElementsIfNotExist();
+ foreach (array_keys($this->_elements) as $key) {
+ if (!$this->_appendName) {
+ $v = $this->_elements[$key]->_findValue($value);
+ if (null !== $v) {
+ $this->_elements[$key]->onQuickFormEvent('setGroupValue', $v, $this);
+ }
+
+ } else {
+ $elementName = $this->_elements[$key]->getName();
+ $index = strlen($elementName) ? $elementName : $key;
+ if (is_array($value)) {
+ if (isset($value[$index])) {
+ $this->_elements[$key]->onQuickFormEvent('setGroupValue', $value[$index], $this);
+ }
+ } elseif (isset($value)) {
+ $this->_elements[$key]->onQuickFormEvent('setGroupValue', $value, $this);
+ }
+ }
+ }
+ } //end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns the value of the group
+ *
+ * @since 1.0
+ * @access public
+ * @return mixed
+ */
+ function getValue()
+ {
+ $value = null;
+ foreach (array_keys($this->_elements) as $key) {
+ $element =& $this->_elements[$key];
+ switch ($element->getType()) {
+ case 'radio':
+ $v = $element->getChecked()? $element->getValue(): null;
+ break;
+ case 'checkbox':
+ $v = $element->getChecked()? true: null;
+ break;
+ default:
+ $v = $element->getValue();
+ }
+ if (null !== $v) {
+ $elementName = $element->getName();
+ if (is_null($elementName)) {
+ $value = $v;
+ } else {
+ if (!is_array($value)) {
+ $value = is_null($value)? array(): array($value);
+ }
+ if ('' === $elementName) {
+ $value[] = $v;
+ } else {
+ $value[$elementName] = $v;
+ }
+ }
+ }
+ }
+ return $value;
+ } // end func getValue
+
+ // }}}
+ // {{{ setElements()
+
+ /**
+ * Sets the grouped elements
+ *
+ * @param array $elements Array of elements
+ * @since 1.1
+ * @access public
+ * @return void
+ */
+ function setElements($elements)
+ {
+ $this->_elements = array_values($elements);
+ if ($this->_flagFrozen) {
+ $this->freeze();
+ }
+ } // end func setElements
+
+ // }}}
+ // {{{ getElements()
+
+ /**
+ * Gets the grouped elements
+ *
+ * @since 2.4
+ * @access public
+ * @return array
+ */
+ function &getElements()
+ {
+ $this->_createElementsIfNotExist();
+ return $this->_elements;
+ } // end func getElements
+
+ // }}}
+ // {{{ getGroupType()
+
+ /**
+ * Gets the group type based on its elements
+ * Will return 'mixed' if elements contained in the group
+ * are of different types.
+ *
+ * @access public
+ * @return string group elements type
+ */
+ function getGroupType()
+ {
+ $this->_createElementsIfNotExist();
+ $prevType = '';
+ foreach (array_keys($this->_elements) as $key) {
+ $type = $this->_elements[$key]->getType();
+ if ($type != $prevType && $prevType != '') {
+ return 'mixed';
+ }
+ $prevType = $type;
+ }
+ return $type;
+ } // end func getGroupType
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns Html for the group
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ include_once('HTML/QuickForm/Renderer/Default.php');
+ $renderer = new HTML_QuickForm_Renderer_Default();
+ $renderer->setElementTemplate('{element}');
+ $this->accept($renderer);
+ return $renderer->toHtml();
+ } //end func toHtml
+
+ // }}}
+ // {{{ getElementName()
+
+ /**
+ * Returns the element name inside the group such as found in the html form
+ *
+ * @param mixed $index Element name or element index in the group
+ * @since 3.0
+ * @access public
+ * @return mixed string with element name, false if not found
+ */
+ function getElementName($index)
+ {
+ $this->_createElementsIfNotExist();
+ $elementName = false;
+ if (is_int($index) && isset($this->_elements[$index])) {
+ $elementName = $this->_elements[$index]->getName();
+ if (isset($elementName) && $elementName == '') {
+ $elementName = $index;
+ }
+ if ($this->_appendName) {
+ if (is_null($elementName)) {
+ $elementName = $this->getName();
+ } else {
+ $elementName = $this->getName().'['.$elementName.']';
+ }
+ }
+
+ } elseif (is_string($index)) {
+ foreach (array_keys($this->_elements) as $key) {
+ $elementName = $this->_elements[$key]->getName();
+ if ($index == $elementName) {
+ if ($this->_appendName) {
+ $elementName = $this->getName().'['.$elementName.']';
+ }
+ break;
+ } elseif ($this->_appendName && $this->getName().'['.$elementName.']' == $index) {
+ break;
+ }
+ }
+ }
+ return $elementName;
+ } //end func getElementName
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags
+ *
+ * @since 1.3
+ * @access public
+ * @return string
+ */
+ function getFrozenHtml()
+ {
+ $flags = array();
+ $this->_createElementsIfNotExist();
+ foreach (array_keys($this->_elements) as $key) {
+ if (false === ($flags[$key] = $this->_elements[$key]->isFrozen())) {
+ $this->_elements[$key]->freeze();
+ }
+ }
+ $html = $this->toHtml();
+ foreach (array_keys($this->_elements) as $key) {
+ if (!$flags[$key]) {
+ $this->_elements[$key]->unfreeze();
+ }
+ }
+ return $html;
+ } //end func getFrozenHtml
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string $event Name of event
+ * @param mixed $arg event arguments
+ * @param object &$caller calling object
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ switch ($event) {
+ case 'updateValue':
+ $this->_createElementsIfNotExist();
+ foreach (array_keys($this->_elements) as $key) {
+ if ($this->_appendName) {
+ $elementName = $this->_elements[$key]->getName();
+ if (is_null($elementName)) {
+ $this->_elements[$key]->setName($this->getName());
+ } elseif ('' === $elementName) {
+ $this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
+ } else {
+ $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
+ }
+ }
+ $this->_elements[$key]->onQuickFormEvent('updateValue', $arg, $caller);
+ if ($this->_appendName) {
+ $this->_elements[$key]->setName($elementName);
+ }
+ }
+ break;
+
+ default:
+ parent::onQuickFormEvent($event, $arg, $caller);
+ }
+ return true;
+ } // end func onQuickFormEvent
+
+ // }}}
+ // {{{ accept()
+
+ /**
+ * Accepts a renderer
+ *
+ * @param HTML_QuickForm_Renderer renderer object
+ * @param bool Whether a group is required
+ * @param string An error message associated with a group
+ * @access public
+ * @return void
+ */
+ function accept(&$renderer, $required = false, $error = null)
+ {
+ $this->_createElementsIfNotExist();
+ $renderer->startGroup($this, $required, $error);
+ $name = $this->getName();
+ foreach (array_keys($this->_elements) as $key) {
+ $element =& $this->_elements[$key];
+
+ if ($this->_appendName) {
+ $elementName = $element->getName();
+ if (isset($elementName)) {
+ $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']');
+ } else {
+ $element->setName($name);
+ }
+ }
+
+ $required = !$element->isFrozen() && in_array($element->getName(), $this->_required);
+
+ $element->accept($renderer, $required);
+
+ // restore the element's name
+ if ($this->_appendName) {
+ $element->setName($elementName);
+ }
+ }
+ $renderer->finishGroup($this);
+ } // end func accept
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * As usual, to get the group's value we access its elements and call
+ * their exportValue() methods
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ $value = null;
+ foreach (array_keys($this->_elements) as $key) {
+ $elementName = $this->_elements[$key]->getName();
+ if ($this->_appendName) {
+ if (is_null($elementName)) {
+ $this->_elements[$key]->setName($this->getName());
+ } elseif ('' === $elementName) {
+ $this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
+ } else {
+ $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
+ }
+ }
+ $v = $this->_elements[$key]->exportValue($submitValues, $assoc);
+ if ($this->_appendName) {
+ $this->_elements[$key]->setName($elementName);
+ }
+ if (null !== $v) {
+ // Make $value an array, we will use it like one
+ if (null === $value) {
+ $value = array();
+ }
+ if ($assoc) {
+ // just like HTML_QuickForm::exportValues()
+ $value = HTML_QuickForm::arrayMerge($value, $v);
+ } else {
+ // just like getValue(), but should work OK every time here
+ if (is_null($elementName)) {
+ $value = $v;
+ } elseif ('' === $elementName) {
+ $value[] = $v;
+ } else {
+ $value[$elementName] = $v;
+ }
+ }
+ }
+ }
+ // do not pass the value through _prepareValue, we took care of this already
+ return $value;
+ }
+
+ // }}}
+ // {{{ _createElements()
+
+ /**
+ * Creates the group's elements.
+ *
+ * This should be overriden by child classes that need to create their
+ * elements. The method will be called automatically when needed, calling
+ * it from the constructor is discouraged as the constructor is usually
+ * called _twice_ on element creation, first time with _no_ parameters.
+ *
+ * @access private
+ * @abstract
+ */
+ function _createElements()
+ {
+ // abstract
+ }
+
+ // }}}
+ // {{{ _createElementsIfNotExist()
+
+ /**
+ * A wrapper around _createElements()
+ *
+ * This method calls _createElements() if the group's _elements array
+ * is empty. It also performs some updates, e.g. freezes the created
+ * elements if the group is already frozen.
+ *
+ * @access private
+ */
+ function _createElementsIfNotExist()
+ {
+ if (empty($this->_elements)) {
+ $this->_createElements();
+ if ($this->_flagFrozen) {
+ $this->freeze();
+ }
+ }
+ }
+
+ // }}}
+ // {{{ freeze()
+
+ function freeze()
+ {
+ parent::freeze();
+ foreach (array_keys($this->_elements) as $key) {
+ $this->_elements[$key]->freeze();
+ }
+ }
+
+ // }}}
+ // {{{ unfreeze()
+
+ function unfreeze()
+ {
+ parent::unfreeze();
+ foreach (array_keys($this->_elements) as $key) {
+ $this->_elements[$key]->unfreeze();
+ }
+ }
+
+ // }}}
+ // {{{ setPersistantFreeze()
+
+ function setPersistantFreeze($persistant = false)
+ {
+ parent::setPersistantFreeze($persistant);
+ foreach (array_keys($this->_elements) as $key) {
+ $this->_elements[$key]->setPersistantFreeze($persistant);
+ }
+ }
+
+ // }}}
+} //end class HTML_QuickForm_group
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/header.php b/libs/HTML/QuickForm/header.php
index 9cb0f364c6..dbbbcc07ea 100755
--- a/libs/HTML/QuickForm/header.php
+++ b/libs/HTML/QuickForm/header.php
@@ -1,74 +1,74 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A pseudo-element used for adding headers to form
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for static data
- */
-require_once 'HTML/QuickForm/static.php';
-
-/**
- * A pseudo-element used for adding headers to form
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.0
- */
-class HTML_QuickForm_header extends HTML_QuickForm_static
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName Header name
- * @param string $text Header text
- * @access public
- * @return void
- */
- function HTML_QuickForm_header($elementName = null, $text = null)
- {
- $this->HTML_QuickForm_static($elementName, null, $text);
- $this->_type = 'header';
- }
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @access public
- * @return void
- */
- function accept(&$renderer)
- {
- $renderer->renderHeader($this);
- } // end func accept
-
- // }}}
-
-} //end class HTML_QuickForm_header
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * A pseudo-element used for adding headers to form
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * HTML class for static data
+ */
+require_once 'HTML/QuickForm/static.php';
+
+/**
+ * A pseudo-element used for adding headers to form
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.0
+ */
+class HTML_QuickForm_header extends HTML_QuickForm_static
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName Header name
+ * @param string $text Header text
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_header($elementName = null, $text = null)
+ {
+ $this->HTML_QuickForm_static($elementName, null, $text);
+ $this->_type = 'header';
+ }
+
+ // }}}
+ // {{{ accept()
+
+ /**
+ * Accepts a renderer
+ *
+ * @param HTML_QuickForm_Renderer renderer object
+ * @access public
+ * @return void
+ */
+ function accept(&$renderer)
+ {
+ $renderer->renderHeader($this);
+ } // end func accept
+
+ // }}}
+
+} //end class HTML_QuickForm_header
+?>
diff --git a/libs/HTML/QuickForm/hidden.php b/libs/HTML/QuickForm/hidden.php
index b0fb3d9669..b3f5737f0c 100755
--- a/libs/HTML/QuickForm/hidden.php
+++ b/libs/HTML/QuickForm/hidden.php
@@ -1,94 +1,94 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a hidden type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a hidden type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_hidden extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $value (optional)Input field value
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setType('hidden');
- $this->setValue($value);
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @access public
- * @return void
- */
- function accept(&$renderer)
- {
- $renderer->renderHidden($this);
- } // end func accept
-
- // }}}
-
-} //end class HTML_QuickForm_hidden
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a hidden type element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a hidden type element
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_hidden extends HTML_QuickForm_input
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $value (optional)Input field value
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ $this->setType('hidden');
+ $this->setValue($value);
+ } //end constructor
+
+ // }}}
+ // {{{ freeze()
+
+ /**
+ * Freeze the element so that only its value is returned
+ *
+ * @access public
+ * @return void
+ */
+ function freeze()
+ {
+ return false;
+ } //end func freeze
+
+ // }}}
+ // {{{ accept()
+
+ /**
+ * Accepts a renderer
+ *
+ * @param HTML_QuickForm_Renderer renderer object
+ * @access public
+ * @return void
+ */
+ function accept(&$renderer)
+ {
+ $renderer->renderHidden($this);
+ } // end func accept
+
+ // }}}
+
+} //end class HTML_QuickForm_hidden
+?>
diff --git a/libs/HTML/QuickForm/hiddenselect.php b/libs/HTML/QuickForm/hiddenselect.php
index d3ed8dc954..8f411ed9d4 100755
--- a/libs/HTML/QuickForm/hiddenselect.php
+++ b/libs/HTML/QuickForm/hiddenselect.php
@@ -1,118 +1,118 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Hidden select pseudo-element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Isaac Shepard <ishepard@bsiweb.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Class for <select></select> elements
- */
-require_once 'HTML/QuickForm/select.php';
-
-/**
- * Hidden select pseudo-element
- *
- * This class takes the same arguments as a select element, but instead
- * of creating a select ring it creates hidden elements for all values
- * already selected with setDefault or setConstant. This is useful if
- * you have a select ring that you don't want visible, but you need all
- * selected values to be passed.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Isaac Shepard <ishepard@bsiweb.com>
- * @version Release: 3.2.9
- * @since 2.1
- */
-class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Select name attribute
- * @param mixed Label(s) for the select (not used)
- * @param mixed Data to be used to populate options
- * @param mixed Either a typical HTML attribute string or an associative array (not used)
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'hiddenselect';
- if (isset($options)) {
- $this->load($options);
- }
- } //end constructor
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the SELECT in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function toHtml()
- {
- if (empty($this->_values)) {
- return '';
- }
-
- $tabs = $this->_getTabs();
- $name = $this->getPrivateName();
- $strHtml = '';
-
- foreach ($this->_values as $key => $val) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if ($val == $this->_options[$i]['attr']['value']) {
- $strHtml .= $tabs . '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $name,
- 'value' => $val
- )) . " />\n" ;
- }
- }
- }
-
- return $strHtml;
- } //end func toHtml
-
- // }}}
- // {{{ accept()
-
- /**
- * This is essentially a hidden element and should be rendered as one
- */
- function accept(&$renderer)
- {
- $renderer->renderHidden($this);
- }
-
- // }}}
-} //end class HTML_QuickForm_hiddenselect
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Hidden select pseudo-element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Isaac Shepard <ishepard@bsiweb.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Class for <select></select> elements
+ */
+require_once 'HTML/QuickForm/select.php';
+
+/**
+ * Hidden select pseudo-element
+ *
+ * This class takes the same arguments as a select element, but instead
+ * of creating a select ring it creates hidden elements for all values
+ * already selected with setDefault or setConstant. This is useful if
+ * you have a select ring that you don't want visible, but you need all
+ * selected values to be passed.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Isaac Shepard <ishepard@bsiweb.com>
+ * @version Release: 3.2.9
+ * @since 2.1
+ */
+class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Select name attribute
+ * @param mixed Label(s) for the select (not used)
+ * @param mixed Data to be used to populate options
+ * @param mixed Either a typical HTML attribute string or an associative array (not used)
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null)
+ {
+ HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ $this->_type = 'hiddenselect';
+ if (isset($options)) {
+ $this->load($options);
+ }
+ } //end constructor
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the SELECT in HTML
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ * @throws
+ */
+ function toHtml()
+ {
+ if (empty($this->_values)) {
+ return '';
+ }
+
+ $tabs = $this->_getTabs();
+ $name = $this->getPrivateName();
+ $strHtml = '';
+
+ foreach ($this->_values as $key => $val) {
+ for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
+ if ($val == $this->_options[$i]['attr']['value']) {
+ $strHtml .= $tabs . '<input' . $this->_getAttrString(array(
+ 'type' => 'hidden',
+ 'name' => $name,
+ 'value' => $val
+ )) . " />\n" ;
+ }
+ }
+ }
+
+ return $strHtml;
+ } //end func toHtml
+
+ // }}}
+ // {{{ accept()
+
+ /**
+ * This is essentially a hidden element and should be rendered as one
+ */
+ function accept(&$renderer)
+ {
+ $renderer->renderHidden($this);
+ }
+
+ // }}}
+} //end class HTML_QuickForm_hiddenselect
+?>
diff --git a/libs/HTML/QuickForm/hierselect.php b/libs/HTML/QuickForm/hierselect.php
index 0879aa9a72..89a9500806 100755
--- a/libs/HTML/QuickForm/hierselect.php
+++ b/libs/HTML/QuickForm/hierselect.php
@@ -1,593 +1,593 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Hierarchical select element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Herim Vasquez <vasquezh@iro.umontreal.ca>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Class for a group of form elements
- */
-require_once 'HTML/QuickForm/group.php';
-/**
- * Class for <select></select> elements
- */
-require_once 'HTML/QuickForm/select.php';
-
-/**
- * Hierarchical select element
- *
- * Class to dynamically create two or more HTML Select elements
- * The first select changes the content of the second select and so on.
- * This element is considered as a group. Selects will be named
- * groupName[0], groupName[1], groupName[2]...
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Herim Vasquez <vasquezh@iro.umontreal.ca>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.1
- */
-class HTML_QuickForm_hierselect extends HTML_QuickForm_group
-{
- // {{{ properties
-
- /**
- * Options for all the select elements
- *
- * @see setOptions()
- * @var array
- * @access private
- */
- var $_options = array();
-
- /**
- * Number of select elements on this group
- *
- * @var int
- * @access private
- */
- var $_nbElements = 0;
-
- /**
- * The javascript used to set and change the options
- *
- * @var string
- * @access private
- */
- var $_js = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label in form
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array. Date format is passed along the attributes.
- * @param mixed $separator (optional)Use a string for one separator,
- * use an array to alternate the separators.
- * @access public
- * @return void
- */
- function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- if (isset($separator)) {
- $this->_separator = $separator;
- }
- $this->_type = 'hierselect';
- $this->_appendName = true;
- } //end constructor
-
- // }}}
- // {{{ setOptions()
-
- /**
- * Initialize the array structure containing the options for each select element.
- * Call the functions that actually do the magic.
- *
- * Format is a bit more complex than for a simple select as we need to know
- * which options are related to the ones in the previous select:
- *
- * Ex:
- * <code>
- * // first select
- * $select1[0] = 'Pop';
- * $select1[1] = 'Classical';
- * $select1[2] = 'Funeral doom';
- *
- * // second select
- * $select2[0][0] = 'Red Hot Chil Peppers';
- * $select2[0][1] = 'The Pixies';
- * $select2[1][0] = 'Wagner';
- * $select2[1][1] = 'Strauss';
- * $select2[2][0] = 'Pantheist';
- * $select2[2][1] = 'Skepticism';
- *
- * // If only need two selects
- * // - and using the deprecated functions
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setMainOptions($select1);
- * $sel->setSecOptions($select2);
- *
- * // - and using the new setOptions function
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setOptions(array($select1, $select2));
- *
- * // If you have a third select with prices for the cds
- * $select3[0][0][0] = '15.00$';
- * $select3[0][0][1] = '17.00$';
- * // etc
- *
- * // You can now use
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setOptions(array($select1, $select2, $select3));
- * </code>
- *
- * @param array $options Array of options defining each element
- * @access public
- * @return void
- */
- function setOptions($options)
- {
- $this->_options = $options;
-
- if (empty($this->_elements)) {
- $this->_nbElements = count($this->_options);
- $this->_createElements();
- } else {
- // setDefaults has probably been called before this function
- // check if all elements have been created
- $totalNbElements = count($this->_options);
- for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
- $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
- $this->_nbElements++;
- }
- }
-
- $this->_setOptions();
- } // end func setMainOptions
-
- // }}}
- // {{{ setMainOptions()
-
- /**
- * Sets the options for the first select element. Deprecated. setOptions() should be used.
- *
- * @param array $array Options for the first select element
- *
- * @access public
- * @deprecated Deprecated since release 3.2.2
- * @return void
- */
- function setMainOptions($array)
- {
- $this->_options[0] = $array;
-
- if (empty($this->_elements)) {
- $this->_nbElements = 2;
- $this->_createElements();
- }
- } // end func setMainOptions
-
- // }}}
- // {{{ setSecOptions()
-
- /**
- * Sets the options for the second select element. Deprecated. setOptions() should be used.
- * The main _options array is initialized and the _setOptions function is called.
- *
- * @param array $array Options for the second select element
- *
- * @access public
- * @deprecated Deprecated since release 3.2.2
- * @return void
- */
- function setSecOptions($array)
- {
- $this->_options[1] = $array;
-
- if (empty($this->_elements)) {
- $this->_nbElements = 2;
- $this->_createElements();
- } else {
- // setDefaults has probably been called before this function
- // check if all elements have been created
- $totalNbElements = 2;
- for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
- $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
- $this->_nbElements++;
- }
- }
-
- $this->_setOptions();
- } // end func setSecOptions
-
- // }}}
- // {{{ _setOptions()
-
- /**
- * Sets the options for each select element
- *
- * @access private
- * @return void
- */
- function _setOptions()
- {
- $toLoad = '';
- foreach (array_keys($this->_elements) AS $key) {
- $array = eval("return isset(\$this->_options[{$key}]{$toLoad})? \$this->_options[{$key}]{$toLoad}: null;");
- if (is_array($array)) {
- $select =& $this->_elements[$key];
- $select->_options = array();
- $select->loadArray($array);
-
- $value = is_array($v = $select->getValue()) ? $v[0] : key($array);
- $toLoad .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $value) . '\']';
- }
- }
- } // end func _setOptions
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets values for group's elements
- *
- * @param array $value An array of 2 or more values, for the first,
- * the second, the third etc. select
- *
- * @access public
- * @return void
- */
- function setValue($value)
- {
- // fix for bug #6766. Hope this doesn't break anything more
- // after bug #7961. Forgot that _nbElements was used in
- // _createElements() called in several places...
- $this->_nbElements = max($this->_nbElements, count($value));
- parent::setValue($value);
- $this->_setOptions();
- } // end func setValue
-
- // }}}
- // {{{ _createElements()
-
- /**
- * Creates all the elements for the group
- *
- * @access private
- * @return void
- */
- function _createElements()
- {
- for ($i = 0; $i < $this->_nbElements; $i++) {
- $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
- }
- } // end func _createElements
-
- // }}}
- // {{{ toHtml()
-
- function toHtml()
- {
- $this->_js = '';
- if (!$this->_flagFrozen) {
- // set the onchange attribute for each element except last
- $keys = array_keys($this->_elements);
- $onChange = array();
- for ($i = 0; $i < count($keys) - 1; $i++) {
- $select =& $this->_elements[$keys[$i]];
- $onChange[$i] = $select->getAttribute('onchange');
- $select->updateAttributes(
- array('onchange' => '_hs_swapOptions(this.form, \'' . $this->_escapeString($this->getName()) . '\', ' . $keys[$i] . ');' . $onChange[$i])
- );
- }
-
- // create the js function to call
- if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) {
- $this->_js .= <<<JAVASCRIPT
-function _hs_findOptions(ary, keys)
-{
- var key = keys.shift();
- if (!key in ary) {
- return {};
- } else if (0 == keys.length) {
- return ary[key];
- } else {
- return _hs_findOptions(ary[key], keys);
- }
-}
-
-function _hs_findSelect(form, groupName, selectIndex)
-{
- if (groupName+'['+ selectIndex +']' in form) {
- return form[groupName+'['+ selectIndex +']'];
- } else {
- return form[groupName+'['+ selectIndex +'][]'];
- }
-}
-
-function _hs_unescapeEntities(str)
-{
- var div = document.createElement('div');
- div.innerHTML = str;
- return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
-}
-
-function _hs_replaceOptions(ctl, optionList)
-{
- var j = 0;
- ctl.options.length = 0;
- for (i in optionList) {
- var optionText = (-1 == String(optionList[i]).indexOf('&'))? optionList[i]: _hs_unescapeEntities(optionList[i]);
- ctl.options[j++] = new Option(optionText, i, false, false);
- }
-}
-
-function _hs_setValue(ctl, value)
-{
- var testValue = {};
- if (value instanceof Array) {
- for (var i = 0; i < value.length; i++) {
- testValue[value[i]] = true;
- }
- } else {
- testValue[value] = true;
- }
- for (var i = 0; i < ctl.options.length; i++) {
- if (ctl.options[i].value in testValue) {
- ctl.options[i].selected = true;
- }
- }
-}
-
-function _hs_swapOptions(form, groupName, selectIndex)
-{
- var hsValue = [];
- for (var i = 0; i <= selectIndex; i++) {
- hsValue[i] = _hs_findSelect(form, groupName, i).value;
- }
-
- _hs_replaceOptions(_hs_findSelect(form, groupName, selectIndex + 1),
- _hs_findOptions(_hs_options[groupName][selectIndex], hsValue));
- if (selectIndex + 1 < _hs_options[groupName].length) {
- _hs_swapOptions(form, groupName, selectIndex + 1);
- }
-}
-
-function _hs_onReset(form, groupNames)
-{
- for (var i = 0; i < groupNames.length; i++) {
- try {
- for (var j = 0; j <= _hs_options[groupNames[i]].length; j++) {
- _hs_setValue(_hs_findSelect(form, groupNames[i], j), _hs_defaults[groupNames[i]][j]);
- if (j < _hs_options[groupNames[i]].length) {
- _hs_replaceOptions(_hs_findSelect(form, groupNames[i], j + 1),
- _hs_findOptions(_hs_options[groupNames[i]][j], _hs_defaults[groupNames[i]].slice(0, j + 1)));
- }
- }
- } catch (e) {
- if (!(e instanceof TypeError)) {
- throw e;
- }
- }
- }
-}
-
-function _hs_setupOnReset(form, groupNames)
-{
- setTimeout(function() { _hs_onReset(form, groupNames); }, 25);
-}
-
-function _hs_onReload()
-{
- var ctl;
- for (var i = 0; i < document.forms.length; i++) {
- for (var j in _hs_defaults) {
- if (ctl = _hs_findSelect(document.forms[i], j, 0)) {
- for (var k = 0; k < _hs_defaults[j].length; k++) {
- _hs_setValue(_hs_findSelect(document.forms[i], j, k), _hs_defaults[j][k]);
- }
- }
- }
- }
-
- if (_hs_prevOnload) {
- _hs_prevOnload();
- }
-}
-
-var _hs_prevOnload = null;
-if (window.onload) {
- _hs_prevOnload = window.onload;
-}
-window.onload = _hs_onReload;
-
-var _hs_options = {};
-var _hs_defaults = {};
-
-JAVASCRIPT;
- define('HTML_QUICKFORM_HIERSELECT_EXISTS', true);
- }
- // option lists
- $jsParts = array();
- for ($i = 1; $i < $this->_nbElements; $i++) {
- $jsParts[] = $this->_convertArrayToJavascript($this->_options[$i]);
- }
- $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" .
- implode(",\n", $jsParts) .
- "\n];\n";
- // default value; if we don't actually have any values yet just use
- // the first option (for single selects) or empty array (for multiple)
- $values = array();
- foreach (array_keys($this->_elements) as $key) {
- if (is_array($v = $this->_elements[$key]->getValue())) {
- $values[] = count($v) > 1? $v: $v[0];
- } else {
- // XXX: accessing the supposedly private _options array
- $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0])?
- array():
- $this->_elements[$key]->_options[0]['attr']['value'];
- }
- }
- $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " .
- $this->_convertArrayToJavascript($values, false) . ";\n";
- }
- include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer = new HTML_QuickForm_Renderer_Default();
- $renderer->setElementTemplate('{element}');
- parent::accept($renderer);
-
- if (!empty($onChange)) {
- $keys = array_keys($this->_elements);
- for ($i = 0; $i < count($keys) - 1; $i++) {
- $this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i]));
- }
- }
- return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") .
- $renderer->toHtml();
- } // end func toHtml
-
- // }}}
- // {{{ accept()
-
- function accept(&$renderer, $required = false, $error = null)
- {
- $renderer->renderElement($this, $required, $error);
- } // end func accept
-
- // }}}
- // {{{ onQuickFormEvent()
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' == $event) {
- // we need to call setValue() so that the secondary option
- // matches the main option
- return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
- } else {
- $ret = parent::onQuickFormEvent($event, $arg, $caller);
- // add onreset handler to form to properly reset hierselect (see bug #2970)
- if ('addElement' == $event) {
- $onReset = $caller->getAttribute('onreset');
- if (strlen($onReset)) {
- if (strpos($onReset, '_hs_setupOnReset')) {
- $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset)));
- } else {
- $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
- }
- } else {
- $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
- }
- }
- return $ret;
- }
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ _convertArrayToJavascript()
-
- /**
- * Converts PHP array to its Javascript analog
- *
- * @access private
- * @param array PHP array to convert
- * @param bool Generate Javascript object literal (default, works like PHP's associative array) or array literal
- * @return string Javascript representation of the value
- */
- function _convertArrayToJavascript($array, $assoc = true)
- {
- if (!is_array($array)) {
- return $this->_convertScalarToJavascript($array);
- } else {
- $items = array();
- foreach ($array as $key => $val) {
- $item = $assoc? "'" . $this->_escapeString($key) . "': ": '';
- if (is_array($val)) {
- $item .= $this->_convertArrayToJavascript($val, $assoc);
- } else {
- $item .= $this->_convertScalarToJavascript($val);
- }
- $items[] = $item;
- }
- }
- $js = implode(', ', $items);
- return $assoc? '{ ' . $js . ' }': '[' . $js . ']';
- }
-
- // }}}
- // {{{ _convertScalarToJavascript()
-
- /**
- * Converts PHP's scalar value to its Javascript analog
- *
- * @access private
- * @param mixed PHP value to convert
- * @return string Javascript representation of the value
- */
- function _convertScalarToJavascript($val)
- {
- if (is_bool($val)) {
- return $val ? 'true' : 'false';
- } elseif (is_int($val) || is_double($val)) {
- return $val;
- } elseif (is_string($val)) {
- return "'" . $this->_escapeString($val) . "'";
- } elseif (is_null($val)) {
- return 'null';
- } else {
- // don't bother
- return '{}';
- }
- }
-
- // }}}
- // {{{ _escapeString()
-
- /**
- * Quotes the string so that it can be used in Javascript string constants
- *
- * @access private
- * @param string
- * @return string
- */
- function _escapeString($str)
- {
- return strtr($str,array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- ));
- }
-
- // }}}
-} // end class HTML_QuickForm_hierselect
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Hierarchical select element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Herim Vasquez <vasquezh@iro.umontreal.ca>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Class for a group of form elements
+ */
+require_once 'HTML/QuickForm/group.php';
+/**
+ * Class for <select></select> elements
+ */
+require_once 'HTML/QuickForm/select.php';
+
+/**
+ * Hierarchical select element
+ *
+ * Class to dynamically create two or more HTML Select elements
+ * The first select changes the content of the second select and so on.
+ * This element is considered as a group. Selects will be named
+ * groupName[0], groupName[1], groupName[2]...
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Herim Vasquez <vasquezh@iro.umontreal.ca>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.1
+ */
+class HTML_QuickForm_hierselect extends HTML_QuickForm_group
+{
+ // {{{ properties
+
+ /**
+ * Options for all the select elements
+ *
+ * @see setOptions()
+ * @var array
+ * @access private
+ */
+ var $_options = array();
+
+ /**
+ * Number of select elements on this group
+ *
+ * @var int
+ * @access private
+ */
+ var $_nbElements = 0;
+
+ /**
+ * The javascript used to set and change the options
+ *
+ * @var string
+ * @access private
+ */
+ var $_js = '';
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $elementLabel (optional)Input field label in form
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array. Date format is passed along the attributes.
+ * @param mixed $separator (optional)Use a string for one separator,
+ * use an array to alternate the separators.
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null)
+ {
+ $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ if (isset($separator)) {
+ $this->_separator = $separator;
+ }
+ $this->_type = 'hierselect';
+ $this->_appendName = true;
+ } //end constructor
+
+ // }}}
+ // {{{ setOptions()
+
+ /**
+ * Initialize the array structure containing the options for each select element.
+ * Call the functions that actually do the magic.
+ *
+ * Format is a bit more complex than for a simple select as we need to know
+ * which options are related to the ones in the previous select:
+ *
+ * Ex:
+ * <code>
+ * // first select
+ * $select1[0] = 'Pop';
+ * $select1[1] = 'Classical';
+ * $select1[2] = 'Funeral doom';
+ *
+ * // second select
+ * $select2[0][0] = 'Red Hot Chil Peppers';
+ * $select2[0][1] = 'The Pixies';
+ * $select2[1][0] = 'Wagner';
+ * $select2[1][1] = 'Strauss';
+ * $select2[2][0] = 'Pantheist';
+ * $select2[2][1] = 'Skepticism';
+ *
+ * // If only need two selects
+ * // - and using the deprecated functions
+ * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
+ * $sel->setMainOptions($select1);
+ * $sel->setSecOptions($select2);
+ *
+ * // - and using the new setOptions function
+ * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
+ * $sel->setOptions(array($select1, $select2));
+ *
+ * // If you have a third select with prices for the cds
+ * $select3[0][0][0] = '15.00$';
+ * $select3[0][0][1] = '17.00$';
+ * // etc
+ *
+ * // You can now use
+ * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
+ * $sel->setOptions(array($select1, $select2, $select3));
+ * </code>
+ *
+ * @param array $options Array of options defining each element
+ * @access public
+ * @return void
+ */
+ function setOptions($options)
+ {
+ $this->_options = $options;
+
+ if (empty($this->_elements)) {
+ $this->_nbElements = count($this->_options);
+ $this->_createElements();
+ } else {
+ // setDefaults has probably been called before this function
+ // check if all elements have been created
+ $totalNbElements = count($this->_options);
+ for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
+ $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
+ $this->_nbElements++;
+ }
+ }
+
+ $this->_setOptions();
+ } // end func setMainOptions
+
+ // }}}
+ // {{{ setMainOptions()
+
+ /**
+ * Sets the options for the first select element. Deprecated. setOptions() should be used.
+ *
+ * @param array $array Options for the first select element
+ *
+ * @access public
+ * @deprecated Deprecated since release 3.2.2
+ * @return void
+ */
+ function setMainOptions($array)
+ {
+ $this->_options[0] = $array;
+
+ if (empty($this->_elements)) {
+ $this->_nbElements = 2;
+ $this->_createElements();
+ }
+ } // end func setMainOptions
+
+ // }}}
+ // {{{ setSecOptions()
+
+ /**
+ * Sets the options for the second select element. Deprecated. setOptions() should be used.
+ * The main _options array is initialized and the _setOptions function is called.
+ *
+ * @param array $array Options for the second select element
+ *
+ * @access public
+ * @deprecated Deprecated since release 3.2.2
+ * @return void
+ */
+ function setSecOptions($array)
+ {
+ $this->_options[1] = $array;
+
+ if (empty($this->_elements)) {
+ $this->_nbElements = 2;
+ $this->_createElements();
+ } else {
+ // setDefaults has probably been called before this function
+ // check if all elements have been created
+ $totalNbElements = 2;
+ for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
+ $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
+ $this->_nbElements++;
+ }
+ }
+
+ $this->_setOptions();
+ } // end func setSecOptions
+
+ // }}}
+ // {{{ _setOptions()
+
+ /**
+ * Sets the options for each select element
+ *
+ * @access private
+ * @return void
+ */
+ function _setOptions()
+ {
+ $toLoad = '';
+ foreach (array_keys($this->_elements) AS $key) {
+ $array = eval("return isset(\$this->_options[{$key}]{$toLoad})? \$this->_options[{$key}]{$toLoad}: null;");
+ if (is_array($array)) {
+ $select =& $this->_elements[$key];
+ $select->_options = array();
+ $select->loadArray($array);
+
+ $value = is_array($v = $select->getValue()) ? $v[0] : key($array);
+ $toLoad .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $value) . '\']';
+ }
+ }
+ } // end func _setOptions
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets values for group's elements
+ *
+ * @param array $value An array of 2 or more values, for the first,
+ * the second, the third etc. select
+ *
+ * @access public
+ * @return void
+ */
+ function setValue($value)
+ {
+ // fix for bug #6766. Hope this doesn't break anything more
+ // after bug #7961. Forgot that _nbElements was used in
+ // _createElements() called in several places...
+ $this->_nbElements = max($this->_nbElements, count($value));
+ parent::setValue($value);
+ $this->_setOptions();
+ } // end func setValue
+
+ // }}}
+ // {{{ _createElements()
+
+ /**
+ * Creates all the elements for the group
+ *
+ * @access private
+ * @return void
+ */
+ function _createElements()
+ {
+ for ($i = 0; $i < $this->_nbElements; $i++) {
+ $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
+ }
+ } // end func _createElements
+
+ // }}}
+ // {{{ toHtml()
+
+ function toHtml()
+ {
+ $this->_js = '';
+ if (!$this->_flagFrozen) {
+ // set the onchange attribute for each element except last
+ $keys = array_keys($this->_elements);
+ $onChange = array();
+ for ($i = 0; $i < count($keys) - 1; $i++) {
+ $select =& $this->_elements[$keys[$i]];
+ $onChange[$i] = $select->getAttribute('onchange');
+ $select->updateAttributes(
+ array('onchange' => '_hs_swapOptions(this.form, \'' . $this->_escapeString($this->getName()) . '\', ' . $keys[$i] . ');' . $onChange[$i])
+ );
+ }
+
+ // create the js function to call
+ if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) {
+ $this->_js .= <<<JAVASCRIPT
+function _hs_findOptions(ary, keys)
+{
+ var key = keys.shift();
+ if (!key in ary) {
+ return {};
+ } else if (0 == keys.length) {
+ return ary[key];
+ } else {
+ return _hs_findOptions(ary[key], keys);
+ }
+}
+
+function _hs_findSelect(form, groupName, selectIndex)
+{
+ if (groupName+'['+ selectIndex +']' in form) {
+ return form[groupName+'['+ selectIndex +']'];
+ } else {
+ return form[groupName+'['+ selectIndex +'][]'];
+ }
+}
+
+function _hs_unescapeEntities(str)
+{
+ var div = document.createElement('div');
+ div.innerHTML = str;
+ return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
+}
+
+function _hs_replaceOptions(ctl, optionList)
+{
+ var j = 0;
+ ctl.options.length = 0;
+ for (i in optionList) {
+ var optionText = (-1 == String(optionList[i]).indexOf('&'))? optionList[i]: _hs_unescapeEntities(optionList[i]);
+ ctl.options[j++] = new Option(optionText, i, false, false);
+ }
+}
+
+function _hs_setValue(ctl, value)
+{
+ var testValue = {};
+ if (value instanceof Array) {
+ for (var i = 0; i < value.length; i++) {
+ testValue[value[i]] = true;
+ }
+ } else {
+ testValue[value] = true;
+ }
+ for (var i = 0; i < ctl.options.length; i++) {
+ if (ctl.options[i].value in testValue) {
+ ctl.options[i].selected = true;
+ }
+ }
+}
+
+function _hs_swapOptions(form, groupName, selectIndex)
+{
+ var hsValue = [];
+ for (var i = 0; i <= selectIndex; i++) {
+ hsValue[i] = _hs_findSelect(form, groupName, i).value;
+ }
+
+ _hs_replaceOptions(_hs_findSelect(form, groupName, selectIndex + 1),
+ _hs_findOptions(_hs_options[groupName][selectIndex], hsValue));
+ if (selectIndex + 1 < _hs_options[groupName].length) {
+ _hs_swapOptions(form, groupName, selectIndex + 1);
+ }
+}
+
+function _hs_onReset(form, groupNames)
+{
+ for (var i = 0; i < groupNames.length; i++) {
+ try {
+ for (var j = 0; j <= _hs_options[groupNames[i]].length; j++) {
+ _hs_setValue(_hs_findSelect(form, groupNames[i], j), _hs_defaults[groupNames[i]][j]);
+ if (j < _hs_options[groupNames[i]].length) {
+ _hs_replaceOptions(_hs_findSelect(form, groupNames[i], j + 1),
+ _hs_findOptions(_hs_options[groupNames[i]][j], _hs_defaults[groupNames[i]].slice(0, j + 1)));
+ }
+ }
+ } catch (e) {
+ if (!(e instanceof TypeError)) {
+ throw e;
+ }
+ }
+ }
+}
+
+function _hs_setupOnReset(form, groupNames)
+{
+ setTimeout(function() { _hs_onReset(form, groupNames); }, 25);
+}
+
+function _hs_onReload()
+{
+ var ctl;
+ for (var i = 0; i < document.forms.length; i++) {
+ for (var j in _hs_defaults) {
+ if (ctl = _hs_findSelect(document.forms[i], j, 0)) {
+ for (var k = 0; k < _hs_defaults[j].length; k++) {
+ _hs_setValue(_hs_findSelect(document.forms[i], j, k), _hs_defaults[j][k]);
+ }
+ }
+ }
+ }
+
+ if (_hs_prevOnload) {
+ _hs_prevOnload();
+ }
+}
+
+var _hs_prevOnload = null;
+if (window.onload) {
+ _hs_prevOnload = window.onload;
+}
+window.onload = _hs_onReload;
+
+var _hs_options = {};
+var _hs_defaults = {};
+
+JAVASCRIPT;
+ define('HTML_QUICKFORM_HIERSELECT_EXISTS', true);
+ }
+ // option lists
+ $jsParts = array();
+ for ($i = 1; $i < $this->_nbElements; $i++) {
+ $jsParts[] = $this->_convertArrayToJavascript($this->_options[$i]);
+ }
+ $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" .
+ implode(",\n", $jsParts) .
+ "\n];\n";
+ // default value; if we don't actually have any values yet just use
+ // the first option (for single selects) or empty array (for multiple)
+ $values = array();
+ foreach (array_keys($this->_elements) as $key) {
+ if (is_array($v = $this->_elements[$key]->getValue())) {
+ $values[] = count($v) > 1? $v: $v[0];
+ } else {
+ // XXX: accessing the supposedly private _options array
+ $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0])?
+ array():
+ $this->_elements[$key]->_options[0]['attr']['value'];
+ }
+ }
+ $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " .
+ $this->_convertArrayToJavascript($values, false) . ";\n";
+ }
+ include_once('HTML/QuickForm/Renderer/Default.php');
+ $renderer = new HTML_QuickForm_Renderer_Default();
+ $renderer->setElementTemplate('{element}');
+ parent::accept($renderer);
+
+ if (!empty($onChange)) {
+ $keys = array_keys($this->_elements);
+ for ($i = 0; $i < count($keys) - 1; $i++) {
+ $this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i]));
+ }
+ }
+ return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") .
+ $renderer->toHtml();
+ } // end func toHtml
+
+ // }}}
+ // {{{ accept()
+
+ function accept(&$renderer, $required = false, $error = null)
+ {
+ $renderer->renderElement($this, $required, $error);
+ } // end func accept
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ if ('updateValue' == $event) {
+ // we need to call setValue() so that the secondary option
+ // matches the main option
+ return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
+ } else {
+ $ret = parent::onQuickFormEvent($event, $arg, $caller);
+ // add onreset handler to form to properly reset hierselect (see bug #2970)
+ if ('addElement' == $event) {
+ $onReset = $caller->getAttribute('onreset');
+ if (strlen($onReset)) {
+ if (strpos($onReset, '_hs_setupOnReset')) {
+ $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset)));
+ } else {
+ $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
+ }
+ } else {
+ $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
+ }
+ }
+ return $ret;
+ }
+ } // end func onQuickFormEvent
+
+ // }}}
+ // {{{ _convertArrayToJavascript()
+
+ /**
+ * Converts PHP array to its Javascript analog
+ *
+ * @access private
+ * @param array PHP array to convert
+ * @param bool Generate Javascript object literal (default, works like PHP's associative array) or array literal
+ * @return string Javascript representation of the value
+ */
+ function _convertArrayToJavascript($array, $assoc = true)
+ {
+ if (!is_array($array)) {
+ return $this->_convertScalarToJavascript($array);
+ } else {
+ $items = array();
+ foreach ($array as $key => $val) {
+ $item = $assoc? "'" . $this->_escapeString($key) . "': ": '';
+ if (is_array($val)) {
+ $item .= $this->_convertArrayToJavascript($val, $assoc);
+ } else {
+ $item .= $this->_convertScalarToJavascript($val);
+ }
+ $items[] = $item;
+ }
+ }
+ $js = implode(', ', $items);
+ return $assoc? '{ ' . $js . ' }': '[' . $js . ']';
+ }
+
+ // }}}
+ // {{{ _convertScalarToJavascript()
+
+ /**
+ * Converts PHP's scalar value to its Javascript analog
+ *
+ * @access private
+ * @param mixed PHP value to convert
+ * @return string Javascript representation of the value
+ */
+ function _convertScalarToJavascript($val)
+ {
+ if (is_bool($val)) {
+ return $val ? 'true' : 'false';
+ } elseif (is_int($val) || is_double($val)) {
+ return $val;
+ } elseif (is_string($val)) {
+ return "'" . $this->_escapeString($val) . "'";
+ } elseif (is_null($val)) {
+ return 'null';
+ } else {
+ // don't bother
+ return '{}';
+ }
+ }
+
+ // }}}
+ // {{{ _escapeString()
+
+ /**
+ * Quotes the string so that it can be used in Javascript string constants
+ *
+ * @access private
+ * @param string
+ * @return string
+ */
+ function _escapeString($str)
+ {
+ return strtr($str,array(
+ "\r" => '\r',
+ "\n" => '\n',
+ "\t" => '\t',
+ "'" => "\\'",
+ '"' => '\"',
+ '\\' => '\\\\'
+ ));
+ }
+
+ // }}}
+} // end class HTML_QuickForm_hierselect
?> \ No newline at end of file
diff --git a/libs/HTML/QuickForm/html.php b/libs/HTML/QuickForm/html.php
index 32894d1682..359c4bfbb5 100755
--- a/libs/HTML/QuickForm/html.php
+++ b/libs/HTML/QuickForm/html.php
@@ -1,77 +1,77 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A pseudo-element used for adding raw HTML to form
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for static data
- */
-require_once 'HTML/QuickForm/static.php';
-
-/**
- * A pseudo-element used for adding raw HTML to form
- *
- * Intended for use with the default renderer only, template-based
- * ones may (and probably will) completely ignore this
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.0
- * @deprecated Please use the templates rather than add raw HTML via this element
- */
-class HTML_QuickForm_html extends HTML_QuickForm_static
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $text raw HTML to add
- * @access public
- * @return void
- */
- function HTML_QuickForm_html($text = null)
- {
- $this->HTML_QuickForm_static(null, null, $text);
- $this->_type = 'html';
- }
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!)
- * @access public
- * @return void
- */
- function accept(&$renderer)
- {
- $renderer->renderHtml($this);
- } // end func accept
-
- // }}}
-
-} //end class HTML_QuickForm_html
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * A pseudo-element used for adding raw HTML to form
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * HTML class for static data
+ */
+require_once 'HTML/QuickForm/static.php';
+
+/**
+ * A pseudo-element used for adding raw HTML to form
+ *
+ * Intended for use with the default renderer only, template-based
+ * ones may (and probably will) completely ignore this
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.0
+ * @deprecated Please use the templates rather than add raw HTML via this element
+ */
+class HTML_QuickForm_html extends HTML_QuickForm_static
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $text raw HTML to add
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_html($text = null)
+ {
+ $this->HTML_QuickForm_static(null, null, $text);
+ $this->_type = 'html';
+ }
+
+ // }}}
+ // {{{ accept()
+
+ /**
+ * Accepts a renderer
+ *
+ * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!)
+ * @access public
+ * @return void
+ */
+ function accept(&$renderer)
+ {
+ $renderer->renderHtml($this);
+ } // end func accept
+
+ // }}}
+
+} //end class HTML_QuickForm_html
+?>
diff --git a/libs/HTML/QuickForm/image.php b/libs/HTML/QuickForm/image.php
index 513f3beacd..5ee9547fdb 100755
--- a/libs/HTML/QuickForm/image.php
+++ b/libs/HTML/QuickForm/image.php
@@ -1,127 +1,127 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an <input type="image" /> element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for an <input type="image" /> element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_image extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Element name attribute
- * @param string $src (optional)Image source
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_image($elementName=null, $src='', $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setType('image');
- $this->setSource($src);
- } // end class constructor
-
- // }}}
- // {{{ setSource()
-
- /**
- * Sets source for image element
- *
- * @param string $src source for image element
- * @since 1.0
- * @access public
- * @return void
- */
- function setSource($src)
- {
- $this->updateAttributes(array('src' => $src));
- } // end func setSource
-
- // }}}
- // {{{ setBorder()
-
- /**
- * Sets border size for image element
- *
- * @param string $border border for image element
- * @since 1.0
- * @access public
- * @return void
- */
- function setBorder($border)
- {
- $this->updateAttributes(array('border' => $border));
- } // end func setBorder
-
- // }}}
- // {{{ setAlign()
-
- /**
- * Sets alignment for image element
- *
- * @param string $align alignment for image element
- * @since 1.0
- * @access public
- * @return void
- */
- function setAlign($align)
- {
- $this->updateAttributes(array('align' => $align));
- } // end func setAlign
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
-
-} // end class HTML_QuickForm_image
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for an <input type="image" /> element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for an <input type="image" /> element
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_image extends HTML_QuickForm_input
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Element name attribute
+ * @param string $src (optional)Image source
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_image($elementName=null, $src='', $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ $this->setType('image');
+ $this->setSource($src);
+ } // end class constructor
+
+ // }}}
+ // {{{ setSource()
+
+ /**
+ * Sets source for image element
+ *
+ * @param string $src source for image element
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setSource($src)
+ {
+ $this->updateAttributes(array('src' => $src));
+ } // end func setSource
+
+ // }}}
+ // {{{ setBorder()
+
+ /**
+ * Sets border size for image element
+ *
+ * @param string $border border for image element
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setBorder($border)
+ {
+ $this->updateAttributes(array('border' => $border));
+ } // end func setBorder
+
+ // }}}
+ // {{{ setAlign()
+
+ /**
+ * Sets alignment for image element
+ *
+ * @param string $align alignment for image element
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setAlign($align)
+ {
+ $this->updateAttributes(array('align' => $align));
+ } // end func setAlign
+
+ // }}}
+ // {{{ freeze()
+
+ /**
+ * Freeze the element so that only its value is returned
+ *
+ * @access public
+ * @return void
+ */
+ function freeze()
+ {
+ return false;
+ } //end func freeze
+
+ // }}}
+
+} // end class HTML_QuickForm_image
+?>
diff --git a/libs/HTML/QuickForm/input.php b/libs/HTML/QuickForm/input.php
index 8166864a87..d4b7f1fdab 100755
--- a/libs/HTML/QuickForm/input.php
+++ b/libs/HTML/QuickForm/input.php
@@ -1,209 +1,209 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Base class for <input /> form elements
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * Base class for <input /> form elements
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- * @abstract
- */
-class HTML_QuickForm_input extends HTML_QuickForm_element
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param mixed Label(s) for the input field
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- } //end constructor
-
- // }}}
- // {{{ setType()
-
- /**
- * Sets the element type
- *
- * @param string $type Element type
- * @since 1.0
- * @access public
- * @return void
- */
- function setType($type)
- {
- $this->_type = $type;
- $this->updateAttributes(array('type'=>$type));
- } // end func setType
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param string $value Default value of the form element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->updateAttributes(array('value'=>$value));
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getValue()
- {
- return $this->getAttribute('value');
- } // end func getValue
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the input field in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return $this->getFrozenHtml();
- } else {
- return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />';
- }
- } //end func toHtml
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- // do not use submit values for button-type elements
- $type = $this->getType();
- if (('updateValue' != $event) ||
- ('submit' != $type && 'reset' != $type && 'image' != $type && 'button' != $type)) {
- parent::onQuickFormEvent($event, $arg, $caller);
- } else {
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ exportValue()
-
- /**
- * We don't need values from button-type elements (except submit) and files
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $type = $this->getType();
- if ('reset' == $type || 'image' == $type || 'button' == $type || 'file' == $type) {
- return null;
- } else {
- return parent::exportValue($submitValues, $assoc);
- }
- }
-
- // }}}
-} // end class HTML_QuickForm_element
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Base class for <input /> form elements
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for form elements
+ */
+require_once 'HTML/QuickForm/element.php';
+
+/**
+ * Base class for <input /> form elements
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ * @abstract
+ */
+class HTML_QuickForm_input extends HTML_QuickForm_element
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Input field name attribute
+ * @param mixed Label(s) for the input field
+ * @param mixed Either a typical HTML attribute string or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null)
+ {
+ $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ } //end constructor
+
+ // }}}
+ // {{{ setType()
+
+ /**
+ * Sets the element type
+ *
+ * @param string $type Element type
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setType($type)
+ {
+ $this->_type = $type;
+ $this->updateAttributes(array('type'=>$type));
+ } // end func setType
+
+ // }}}
+ // {{{ setName()
+
+ /**
+ * Sets the input field name
+ *
+ * @param string $name Input field name attribute
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setName($name)
+ {
+ $this->updateAttributes(array('name'=>$name));
+ } //end func setName
+
+ // }}}
+ // {{{ getName()
+
+ /**
+ * Returns the element name
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getName()
+ {
+ return $this->getAttribute('name');
+ } //end func getName
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets the value of the form element
+ *
+ * @param string $value Default value of the form element
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setValue($value)
+ {
+ $this->updateAttributes(array('value'=>$value));
+ } // end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns the value of the form element
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getValue()
+ {
+ return $this->getAttribute('value');
+ } // end func getValue
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the input field in HTML
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ if ($this->_flagFrozen) {
+ return $this->getFrozenHtml();
+ } else {
+ return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />';
+ }
+ } //end func toHtml
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string $event Name of event
+ * @param mixed $arg event arguments
+ * @param object &$caller calling object
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ // do not use submit values for button-type elements
+ $type = $this->getType();
+ if (('updateValue' != $event) ||
+ ('submit' != $type && 'reset' != $type && 'image' != $type && 'button' != $type)) {
+ parent::onQuickFormEvent($event, $arg, $caller);
+ } else {
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ if (null !== $value) {
+ $this->setValue($value);
+ }
+ }
+ return true;
+ } // end func onQuickFormEvent
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * We don't need values from button-type elements (except submit) and files
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ $type = $this->getType();
+ if ('reset' == $type || 'image' == $type || 'button' == $type || 'file' == $type) {
+ return null;
+ } else {
+ return parent::exportValue($submitValues, $assoc);
+ }
+ }
+
+ // }}}
+} // end class HTML_QuickForm_element
+?>
diff --git a/libs/HTML/QuickForm/link.php b/libs/HTML/QuickForm/link.php
index 17e0276d74..db88be2229 100755
--- a/libs/HTML/QuickForm/link.php
+++ b/libs/HTML/QuickForm/link.php
@@ -1,200 +1,200 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a link type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for static data
- */
-require_once 'HTML/QuickForm/static.php';
-
-/**
- * HTML class for a link type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 2.0
- */
-class HTML_QuickForm_link extends HTML_QuickForm_static
-{
- // {{{ properties
-
- /**
- * Link display text
- * @var string
- * @since 1.0
- * @access private
- */
- var $_text = "";
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementLabel (optional)Link label
- * @param string $href (optional)Link href
- * @param string $text (optional)Link display text
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = false;
- $this->_type = 'link';
- $this->setHref($href);
- $this->_text = $text;
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets value for textarea element
- *
- * @param string $value Value for password element
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function setValue($value)
- {
- return;
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function getValue()
- {
- return;
- } // end func getValue
-
-
- // }}}
- // {{{ setHref()
-
- /**
- * Sets the links href
- *
- * @param string $href
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function setHref($href)
- {
- $this->updateAttributes(array('href'=>$href));
- } // end func setHref
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the textarea element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function toHtml()
- {
- $tabs = $this->_getTabs();
- $html = "$tabs<a".$this->_getAttrString($this->_attributes).">";
- $html .= $this->_text;
- $html .= "</a>";
- return $html;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags (in this case, value is changed to a mask)
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function getFrozenHtml()
- {
- return;
- } //end func getFrozenHtml
-
- // }}}
-
-} //end class HTML_QuickForm_textarea
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a link type field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * HTML class for static data
+ */
+require_once 'HTML/QuickForm/static.php';
+
+/**
+ * HTML class for a link type field
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 2.0
+ */
+class HTML_QuickForm_link extends HTML_QuickForm_static
+{
+ // {{{ properties
+
+ /**
+ * Link display text
+ * @var string
+ * @since 1.0
+ * @access private
+ */
+ var $_text = "";
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementLabel (optional)Link label
+ * @param string $href (optional)Link href
+ * @param string $text (optional)Link display text
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
+ {
+ HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = false;
+ $this->_type = 'link';
+ $this->setHref($href);
+ $this->_text = $text;
+ } //end constructor
+
+ // }}}
+ // {{{ setName()
+
+ /**
+ * Sets the input field name
+ *
+ * @param string $name Input field name attribute
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function setName($name)
+ {
+ $this->updateAttributes(array('name'=>$name));
+ } //end func setName
+
+ // }}}
+ // {{{ getName()
+
+ /**
+ * Returns the element name
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ * @throws
+ */
+ function getName()
+ {
+ return $this->getAttribute('name');
+ } //end func getName
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets value for textarea element
+ *
+ * @param string $value Value for password element
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function setValue($value)
+ {
+ return;
+ } //end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns the value of the form element
+ *
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function getValue()
+ {
+ return;
+ } // end func getValue
+
+
+ // }}}
+ // {{{ setHref()
+
+ /**
+ * Sets the links href
+ *
+ * @param string $href
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function setHref($href)
+ {
+ $this->updateAttributes(array('href'=>$href));
+ } // end func setHref
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the textarea element in HTML
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ * @throws
+ */
+ function toHtml()
+ {
+ $tabs = $this->_getTabs();
+ $html = "$tabs<a".$this->_getAttrString($this->_attributes).">";
+ $html .= $this->_text;
+ $html .= "</a>";
+ return $html;
+ } //end func toHtml
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags (in this case, value is changed to a mask)
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ * @throws
+ */
+ function getFrozenHtml()
+ {
+ return;
+ } //end func getFrozenHtml
+
+ // }}}
+
+} //end class HTML_QuickForm_textarea
+?>
diff --git a/libs/HTML/QuickForm/password.php b/libs/HTML/QuickForm/password.php
index 2f606b358c..1ce247926a 100755
--- a/libs/HTML/QuickForm/password.php
+++ b/libs/HTML/QuickForm/password.php
@@ -1,115 +1,115 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a password type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a password type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_password extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->setType('password');
- } //end constructor
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets size of password element
- *
- * @param string $size Size of password field
- * @since 1.0
- * @access public
- * @return void
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size'=>$size));
- } //end func setSize
-
- // }}}
- // {{{ setMaxlength()
-
- /**
- * Sets maxlength of password element
- *
- * @param string $maxlength Maximum length of password field
- * @since 1.0
- * @access public
- * @return void
- */
- function setMaxlength($maxlength)
- {
- $this->updateAttributes(array('maxlength'=>$maxlength));
- } //end func setMaxlength
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags (in this case, value is changed to a mask)
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function getFrozenHtml()
- {
- $value = $this->getValue();
- return ('' != $value? '**********': '&nbsp;') .
- $this->_getPersistantData();
- } //end func getFrozenHtml
-
- // }}}
-
-} //end class HTML_QuickForm_password
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a password type field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a password type field
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_password extends HTML_QuickForm_input
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $elementLabel (optional)Input field label
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ $this->setType('password');
+ } //end constructor
+
+ // }}}
+ // {{{ setSize()
+
+ /**
+ * Sets size of password element
+ *
+ * @param string $size Size of password field
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setSize($size)
+ {
+ $this->updateAttributes(array('size'=>$size));
+ } //end func setSize
+
+ // }}}
+ // {{{ setMaxlength()
+
+ /**
+ * Sets maxlength of password element
+ *
+ * @param string $maxlength Maximum length of password field
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setMaxlength($maxlength)
+ {
+ $this->updateAttributes(array('maxlength'=>$maxlength));
+ } //end func setMaxlength
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags (in this case, value is changed to a mask)
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ * @throws
+ */
+ function getFrozenHtml()
+ {
+ $value = $this->getValue();
+ return ('' != $value? '**********': '&nbsp;') .
+ $this->_getPersistantData();
+ } //end func getFrozenHtml
+
+ // }}}
+
+} //end class HTML_QuickForm_password
+?>
diff --git a/libs/HTML/QuickForm/radio.php b/libs/HTML/QuickForm/radio.php
index 702a255af8..969ba88c51 100755
--- a/libs/HTML/QuickForm/radio.php
+++ b/libs/HTML/QuickForm/radio.php
@@ -1,251 +1,251 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a radio type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a radio type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_radio extends HTML_QuickForm_input
-{
- // {{{ properties
-
- /**
- * Radio display text
- * @var string
- * @since 1.1
- * @access private
- */
- var $_text = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param mixed Label(s) for a field
- * @param string Text to display near the radio
- * @param string Input field value
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- if (isset($value)) {
- $this->setValue($value);
- }
- $this->_persistantFreeze = true;
- $this->setType('radio');
- $this->_text = $text;
- $this->_generateId();
- } //end constructor
-
- // }}}
- // {{{ setChecked()
-
- /**
- * Sets whether radio button is checked
- *
- * @param bool $checked Whether the field is checked or not
- * @since 1.0
- * @access public
- * @return void
- */
- function setChecked($checked)
- {
- if (!$checked) {
- $this->removeAttribute('checked');
- } else {
- $this->updateAttributes(array('checked'=>'checked'));
- }
- } //end func setChecked
-
- // }}}
- // {{{ getChecked()
-
- /**
- * Returns whether radio button is checked
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getChecked()
- {
- return $this->getAttribute('checked');
- } //end func getChecked
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the radio element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if (0 == strlen($this->_text)) {
- $label = '';
- } elseif ($this->_flagFrozen) {
- $label = $this->_text;
- } else {
- $label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>';
- }
- return HTML_QuickForm_input::toHtml() . $label;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- if ($this->getChecked()) {
- return '<tt>(x)</tt>' .
- $this->_getPersistantData();
- } else {
- return '<tt>( )</tt>';
- }
- } //end func getFrozenHtml
-
- // }}}
- // {{{ setText()
-
- /**
- * Sets the radio text
- *
- * @param string $text Text to display near the radio button
- * @since 1.1
- * @access public
- * @return void
- */
- function setText($text)
- {
- $this->_text = $text;
- } //end func setText
-
- // }}}
- // {{{ getText()
-
- /**
- * Returns the radio text
- *
- * @since 1.1
- * @access public
- * @return string
- */
- function getText()
- {
- return $this->_text;
- } //end func getText
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (!is_null($value) && $value == $this->getValue()) {
- $this->setChecked(true);
- } else {
- $this->setChecked(false);
- }
- break;
- case 'setGroupValue':
- if ($arg == $this->getValue()) {
- $this->setChecked(true);
- } else {
- $this->setChecked(false);
- }
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormLoad
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Returns the value attribute if the radio is checked, null if it is not
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getChecked()? $this->getValue(): null;
- } elseif ($value != $this->getValue()) {
- $value = null;
- }
- return $this->_prepareValue($value, $assoc);
- }
-
- // }}}
-} //end class HTML_QuickForm_radio
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a radio type element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a radio type element
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_radio extends HTML_QuickForm_input
+{
+ // {{{ properties
+
+ /**
+ * Radio display text
+ * @var string
+ * @since 1.1
+ * @access private
+ */
+ var $_text = '';
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Input field name attribute
+ * @param mixed Label(s) for a field
+ * @param string Text to display near the radio
+ * @param string Input field value
+ * @param mixed Either a typical HTML attribute string or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null)
+ {
+ $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ if (isset($value)) {
+ $this->setValue($value);
+ }
+ $this->_persistantFreeze = true;
+ $this->setType('radio');
+ $this->_text = $text;
+ $this->_generateId();
+ } //end constructor
+
+ // }}}
+ // {{{ setChecked()
+
+ /**
+ * Sets whether radio button is checked
+ *
+ * @param bool $checked Whether the field is checked or not
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setChecked($checked)
+ {
+ if (!$checked) {
+ $this->removeAttribute('checked');
+ } else {
+ $this->updateAttributes(array('checked'=>'checked'));
+ }
+ } //end func setChecked
+
+ // }}}
+ // {{{ getChecked()
+
+ /**
+ * Returns whether radio button is checked
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getChecked()
+ {
+ return $this->getAttribute('checked');
+ } //end func getChecked
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the radio element in HTML
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ if (0 == strlen($this->_text)) {
+ $label = '';
+ } elseif ($this->_flagFrozen) {
+ $label = $this->_text;
+ } else {
+ $label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>';
+ }
+ return HTML_QuickForm_input::toHtml() . $label;
+ } //end func toHtml
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getFrozenHtml()
+ {
+ if ($this->getChecked()) {
+ return '<tt>(x)</tt>' .
+ $this->_getPersistantData();
+ } else {
+ return '<tt>( )</tt>';
+ }
+ } //end func getFrozenHtml
+
+ // }}}
+ // {{{ setText()
+
+ /**
+ * Sets the radio text
+ *
+ * @param string $text Text to display near the radio button
+ * @since 1.1
+ * @access public
+ * @return void
+ */
+ function setText($text)
+ {
+ $this->_text = $text;
+ } //end func setText
+
+ // }}}
+ // {{{ getText()
+
+ /**
+ * Returns the radio text
+ *
+ * @since 1.1
+ * @access public
+ * @return string
+ */
+ function getText()
+ {
+ return $this->_text;
+ } //end func getText
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string $event Name of event
+ * @param mixed $arg event arguments
+ * @param object &$caller calling object
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ switch ($event) {
+ case 'updateValue':
+ // constant values override both default and submitted ones
+ // default values are overriden by submitted
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_submitValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ }
+ if (!is_null($value) && $value == $this->getValue()) {
+ $this->setChecked(true);
+ } else {
+ $this->setChecked(false);
+ }
+ break;
+ case 'setGroupValue':
+ if ($arg == $this->getValue()) {
+ $this->setChecked(true);
+ } else {
+ $this->setChecked(false);
+ }
+ break;
+ default:
+ parent::onQuickFormEvent($event, $arg, $caller);
+ }
+ return true;
+ } // end func onQuickFormLoad
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * Returns the value attribute if the radio is checked, null if it is not
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ $value = $this->_findValue($submitValues);
+ if (null === $value) {
+ $value = $this->getChecked()? $this->getValue(): null;
+ } elseif ($value != $this->getValue()) {
+ $value = null;
+ }
+ return $this->_prepareValue($value, $assoc);
+ }
+
+ // }}}
+} //end class HTML_QuickForm_radio
+?>
diff --git a/libs/HTML/QuickForm/reset.php b/libs/HTML/QuickForm/reset.php
index 7146fd858b..1f61b14afe 100755
--- a/libs/HTML/QuickForm/reset.php
+++ b/libs/HTML/QuickForm/reset.php
@@ -1,79 +1,79 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a reset type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a reset type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_reset extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $value (optional)Input field value
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setValue($value);
- $this->setType('reset');
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
-
-} //end class HTML_QuickForm_reset
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a reset type element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a reset type element
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_reset extends HTML_QuickForm_input
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $value (optional)Input field value
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ $this->setValue($value);
+ $this->setType('reset');
+ } //end constructor
+
+ // }}}
+ // {{{ freeze()
+
+ /**
+ * Freeze the element so that only its value is returned
+ *
+ * @access public
+ * @return void
+ */
+ function freeze()
+ {
+ return false;
+ } //end func freeze
+
+ // }}}
+
+} //end class HTML_QuickForm_reset
+?>
diff --git a/libs/HTML/QuickForm/select.php b/libs/HTML/QuickForm/select.php
index ed97672a21..1178a042d9 100755
--- a/libs/HTML/QuickForm/select.php
+++ b/libs/HTML/QuickForm/select.php
@@ -1,614 +1,614 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class to dynamically create an HTML SELECT
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * Class to dynamically create an HTML SELECT
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_select extends HTML_QuickForm_element {
-
- // {{{ properties
-
- /**
- * Contains the select options
- *
- * @var array
- * @since 1.0
- * @access private
- */
- var $_options = array();
-
- /**
- * Default values of the SELECT
- *
- * @var string
- * @since 1.0
- * @access private
- */
- var $_values = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Select name attribute
- * @param mixed Label(s) for the select
- * @param mixed Data to be used to populate options
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'select';
- if (isset($options)) {
- $this->load($options);
- }
- } //end constructor
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Returns the current API version
- *
- * @since 1.0
- * @access public
- * @return double
- */
- function apiVersion()
- {
- return 2.3;
- } //end func apiVersion
-
- // }}}
- // {{{ setSelected()
-
- /**
- * Sets the default values of the select box
- *
- * @param mixed $values Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return void
- */
- function setSelected($values)
- {
- if (is_string($values) && $this->getMultiple()) {
- $values = split("[ ]?,[ ]?", $values);
- }
- if (is_array($values)) {
- $this->_values = array_values($values);
- } else {
- $this->_values = array($values);
- }
- } //end func setSelected
-
- // }}}
- // {{{ getSelected()
-
- /**
- * Returns an array of the selected values
- *
- * @since 1.0
- * @access public
- * @return array of selected values
- */
- function getSelected()
- {
- return $this->_values;
- } // end func getSelected
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name' => $name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ getPrivateName()
-
- /**
- * Returns the element name (possibly with brackets appended)
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getPrivateName()
- {
- if ($this->getAttribute('multiple')) {
- return $this->getName() . '[]';
- } else {
- return $this->getName();
- }
- } //end func getPrivateName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param mixed $values Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->setSelected($value);
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns an array of the selected values
- *
- * @since 1.0
- * @access public
- * @return array of selected values
- */
- function getValue()
- {
- return $this->_values;
- } // end func getValue
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets the select field size, only applies to 'multiple' selects
- *
- * @param int $size Size of select field
- * @since 1.0
- * @access public
- * @return void
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size' => $size));
- } //end func setSize
-
- // }}}
- // {{{ getSize()
-
- /**
- * Returns the select field size
- *
- * @since 1.0
- * @access public
- * @return int
- */
- function getSize()
- {
- return $this->getAttribute('size');
- } //end func getSize
-
- // }}}
- // {{{ setMultiple()
-
- /**
- * Sets the select mutiple attribute
- *
- * @param bool $multiple Whether the select supports multi-selections
- * @since 1.2
- * @access public
- * @return void
- */
- function setMultiple($multiple)
- {
- if ($multiple) {
- $this->updateAttributes(array('multiple' => 'multiple'));
- } else {
- $this->removeAttribute('multiple');
- }
- } //end func setMultiple
-
- // }}}
- // {{{ getMultiple()
-
- /**
- * Returns the select mutiple attribute
- *
- * @since 1.2
- * @access public
- * @return bool true if multiple select, false otherwise
- */
- function getMultiple()
- {
- return (bool)$this->getAttribute('multiple');
- } //end func getMultiple
-
- // }}}
- // {{{ addOption()
-
- /**
- * Adds a new OPTION to the SELECT
- *
- * @param string $text Display text for the OPTION
- * @param string $value Value for the OPTION
- * @param mixed $attributes Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function addOption($text, $value, $attributes=null)
- {
- if (null === $attributes) {
- $attributes = array('value' => (string)$value);
- } else {
- $attributes = $this->_parseAttributes($attributes);
- if (isset($attributes['selected'])) {
- // the 'selected' attribute will be set in toHtml()
- $this->_removeAttr('selected', $attributes);
- if (is_null($this->_values)) {
- $this->_values = array($value);
- } elseif (!in_array($value, $this->_values)) {
- $this->_values[] = $value;
- }
- }
- $this->_updateAttrArray($attributes, array('value' => (string)$value));
- }
- $this->_options[] = array('text' => $text, 'attr' => $attributes);
- } // end func addOption
-
- // }}}
- // {{{ loadArray()
-
- /**
- * Loads the options from an associative array
- *
- * @param array $arr Associative array of options
- * @param mixed $values (optional) Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return PEAR_Error on error or true
- * @throws PEAR_Error
- */
- function loadArray($arr, $values=null)
- {
- if (!is_array($arr)) {
- return PEAR::raiseError('Argument 1 of HTML_Select::loadArray is not a valid array');
- }
- if (isset($values)) {
- $this->setSelected($values);
- }
- foreach ($arr as $key => $val) {
- // Warning: new API since release 2.3
- $this->addOption($val, $key);
- }
- return true;
- } // end func loadArray
-
- // }}}
- // {{{ loadDbResult()
-
- /**
- * Loads the options from DB_result object
- *
- * If no column names are specified the first two columns of the result are
- * used as the text and value columns respectively
- * @param object $result DB_result object
- * @param string $textCol (optional) Name of column to display as the OPTION text
- * @param string $valueCol (optional) Name of column to use as the OPTION value
- * @param mixed $values (optional) Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return PEAR_Error on error or true
- * @throws PEAR_Error
- */
- function loadDbResult(&$result, $textCol=null, $valueCol=null, $values=null)
- {
- if (!is_object($result) || !is_a($result, 'db_result')) {
- return PEAR::raiseError('Argument 1 of HTML_Select::loadDbResult is not a valid DB_result');
- }
- if (isset($values)) {
- $this->setValue($values);
- }
- $fetchMode = ($textCol && $valueCol) ? DB_FETCHMODE_ASSOC : DB_FETCHMODE_ORDERED;
- while (is_array($row = $result->fetchRow($fetchMode)) ) {
- if ($fetchMode == DB_FETCHMODE_ASSOC) {
- $this->addOption($row[$textCol], $row[$valueCol]);
- } else {
- $this->addOption($row[0], $row[1]);
- }
- }
- return true;
- } // end func loadDbResult
-
- // }}}
- // {{{ loadQuery()
-
- /**
- * Queries a database and loads the options from the results
- *
- * @param mixed $conn Either an existing DB connection or a valid dsn
- * @param string $sql SQL query string
- * @param string $textCol (optional) Name of column to display as the OPTION text
- * @param string $valueCol (optional) Name of column to use as the OPTION value
- * @param mixed $values (optional) Array or comma delimited string of selected values
- * @since 1.1
- * @access public
- * @return void
- * @throws PEAR_Error
- */
- function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
- {
- if (is_string($conn)) {
- require_once('DB.php');
- $dbConn = &DB::connect($conn, true);
- if (DB::isError($dbConn)) {
- return $dbConn;
- }
- } elseif (is_subclass_of($conn, "db_common")) {
- $dbConn = &$conn;
- } else {
- return PEAR::raiseError('Argument 1 of HTML_Select::loadQuery is not a valid type');
- }
- $result = $dbConn->query($sql);
- if (DB::isError($result)) {
- return $result;
- }
- $this->loadDbResult($result, $textCol, $valueCol, $values);
- $result->free();
- if (is_string($conn)) {
- $dbConn->disconnect();
- }
- return true;
- } // end func loadQuery
-
- // }}}
- // {{{ load()
-
- /**
- * Loads options from different types of data sources
- *
- * This method is a simulated overloaded method. The arguments, other than the
- * first are optional and only mean something depending on the type of the first argument.
- * If the first argument is an array then all arguments are passed in order to loadArray.
- * If the first argument is a db_result then all arguments are passed in order to loadDbResult.
- * If the first argument is a string or a DB connection then all arguments are
- * passed in order to loadQuery.
- * @param mixed $options Options source currently supports assoc array or DB_result
- * @param mixed $param1 (optional) See function detail
- * @param mixed $param2 (optional) See function detail
- * @param mixed $param3 (optional) See function detail
- * @param mixed $param4 (optional) See function detail
- * @since 1.1
- * @access public
- * @return PEAR_Error on error or true
- * @throws PEAR_Error
- */
- function load(&$options, $param1=null, $param2=null, $param3=null, $param4=null)
- {
- switch (true) {
- case is_array($options):
- return $this->loadArray($options, $param1);
- break;
- case (is_a($options, 'db_result')):
- return $this->loadDbResult($options, $param1, $param2, $param3);
- break;
- case (is_string($options) && !empty($options) || is_subclass_of($options, "db_common")):
- return $this->loadQuery($options, $param1, $param2, $param3, $param4);
- break;
- }
- } // end func load
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the SELECT in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return $this->getFrozenHtml();
- } else {
- $tabs = $this->_getTabs();
- $strHtml = '';
-
- if ($this->getComment() != '') {
- $strHtml .= $tabs . '<!-- ' . $this->getComment() . " //-->\n";
- }
-
- if (!$this->getMultiple()) {
- $attrString = $this->_getAttrString($this->_attributes);
- } else {
- $myName = $this->getName();
- $this->setName($myName . '[]');
- $attrString = $this->_getAttrString($this->_attributes);
- $this->setName($myName);
- }
- $strHtml .= $tabs . '<select' . $attrString . ">\n";
-
- $strValues = is_array($this->_values)? array_map('strval', $this->_values): array();
- foreach ($this->_options as $option) {
- if (!empty($strValues) && in_array($option['attr']['value'], $strValues, true)) {
- $option['attr']['selected'] = 'selected';
- }
- $strHtml .= $tabs . "\t<option" . $this->_getAttrString($option['attr']) . '>' .
- $option['text'] . "</option>\n";
- }
-
- return $strHtml . $tabs . '</select>';
- }
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $value = array();
- if (is_array($this->_values)) {
- foreach ($this->_values as $key => $val) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if (0 == strcmp($val, $this->_options[$i]['attr']['value'])) {
- $value[$key] = $this->_options[$i]['text'];
- break;
- }
- }
- }
- }
- $html = empty($value)? '&nbsp;': join('<br />', $value);
- if ($this->_persistantFreeze) {
- $name = $this->getPrivateName();
- // Only use id attribute if doing single hidden input
- if (1 == count($value)) {
- $id = $this->getAttribute('id');
- $idAttr = isset($id)? array('id' => $id): array();
- } else {
- $idAttr = array();
- }
- foreach ($value as $key => $item) {
- $html .= '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $name,
- 'value' => $this->_values[$key]
- ) + $idAttr) . ' />';
- }
- }
- return $html;
- } //end func getFrozenHtml
-
- // }}}
- // {{{ exportValue()
-
- /**
- * We check the options and return only the values that _could_ have been
- * selected. We also return a scalar value if select is not "multiple"
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (is_null($value)) {
- $value = $this->getValue();
- } elseif(!is_array($value)) {
- $value = array($value);
- }
- if (is_array($value) && !empty($this->_options)) {
- $cleanValue = null;
- foreach ($value as $v) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if (0 == strcmp($v, $this->_options[$i]['attr']['value'])) {
- $cleanValue[] = $v;
- break;
- }
- }
- }
- } else {
- $cleanValue = $value;
- }
- if (is_array($cleanValue) && !$this->getMultiple()) {
- return $this->_prepareValue($cleanValue[0], $assoc);
- } else {
- return $this->_prepareValue($cleanValue, $assoc);
- }
- }
-
- // }}}
- // {{{ onQuickFormEvent()
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' == $event) {
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- // Fix for bug #4465 & #5269
- // XXX: should we push this to element::onQuickFormEvent()?
- if (null === $value && (!$caller->isSubmitted() || !$this->getMultiple())) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- return true;
- } else {
- return parent::onQuickFormEvent($event, $arg, $caller);
- }
- }
-
- // }}}
-} //end class HTML_QuickForm_select
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Class to dynamically create an HTML SELECT
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for form elements
+ */
+require_once 'HTML/QuickForm/element.php';
+
+/**
+ * Class to dynamically create an HTML SELECT
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_select extends HTML_QuickForm_element {
+
+ // {{{ properties
+
+ /**
+ * Contains the select options
+ *
+ * @var array
+ * @since 1.0
+ * @access private
+ */
+ var $_options = array();
+
+ /**
+ * Default values of the SELECT
+ *
+ * @var string
+ * @since 1.0
+ * @access private
+ */
+ var $_values = null;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Select name attribute
+ * @param mixed Label(s) for the select
+ * @param mixed Data to be used to populate options
+ * @param mixed Either a typical HTML attribute string or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null)
+ {
+ HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ $this->_type = 'select';
+ if (isset($options)) {
+ $this->load($options);
+ }
+ } //end constructor
+
+ // }}}
+ // {{{ apiVersion()
+
+ /**
+ * Returns the current API version
+ *
+ * @since 1.0
+ * @access public
+ * @return double
+ */
+ function apiVersion()
+ {
+ return 2.3;
+ } //end func apiVersion
+
+ // }}}
+ // {{{ setSelected()
+
+ /**
+ * Sets the default values of the select box
+ *
+ * @param mixed $values Array or comma delimited string of selected values
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setSelected($values)
+ {
+ if (is_string($values) && $this->getMultiple()) {
+ $values = split("[ ]?,[ ]?", $values);
+ }
+ if (is_array($values)) {
+ $this->_values = array_values($values);
+ } else {
+ $this->_values = array($values);
+ }
+ } //end func setSelected
+
+ // }}}
+ // {{{ getSelected()
+
+ /**
+ * Returns an array of the selected values
+ *
+ * @since 1.0
+ * @access public
+ * @return array of selected values
+ */
+ function getSelected()
+ {
+ return $this->_values;
+ } // end func getSelected
+
+ // }}}
+ // {{{ setName()
+
+ /**
+ * Sets the input field name
+ *
+ * @param string $name Input field name attribute
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setName($name)
+ {
+ $this->updateAttributes(array('name' => $name));
+ } //end func setName
+
+ // }}}
+ // {{{ getName()
+
+ /**
+ * Returns the element name
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getName()
+ {
+ return $this->getAttribute('name');
+ } //end func getName
+
+ // }}}
+ // {{{ getPrivateName()
+
+ /**
+ * Returns the element name (possibly with brackets appended)
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getPrivateName()
+ {
+ if ($this->getAttribute('multiple')) {
+ return $this->getName() . '[]';
+ } else {
+ return $this->getName();
+ }
+ } //end func getPrivateName
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets the value of the form element
+ *
+ * @param mixed $values Array or comma delimited string of selected values
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setValue($value)
+ {
+ $this->setSelected($value);
+ } // end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns an array of the selected values
+ *
+ * @since 1.0
+ * @access public
+ * @return array of selected values
+ */
+ function getValue()
+ {
+ return $this->_values;
+ } // end func getValue
+
+ // }}}
+ // {{{ setSize()
+
+ /**
+ * Sets the select field size, only applies to 'multiple' selects
+ *
+ * @param int $size Size of select field
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setSize($size)
+ {
+ $this->updateAttributes(array('size' => $size));
+ } //end func setSize
+
+ // }}}
+ // {{{ getSize()
+
+ /**
+ * Returns the select field size
+ *
+ * @since 1.0
+ * @access public
+ * @return int
+ */
+ function getSize()
+ {
+ return $this->getAttribute('size');
+ } //end func getSize
+
+ // }}}
+ // {{{ setMultiple()
+
+ /**
+ * Sets the select mutiple attribute
+ *
+ * @param bool $multiple Whether the select supports multi-selections
+ * @since 1.2
+ * @access public
+ * @return void
+ */
+ function setMultiple($multiple)
+ {
+ if ($multiple) {
+ $this->updateAttributes(array('multiple' => 'multiple'));
+ } else {
+ $this->removeAttribute('multiple');
+ }
+ } //end func setMultiple
+
+ // }}}
+ // {{{ getMultiple()
+
+ /**
+ * Returns the select mutiple attribute
+ *
+ * @since 1.2
+ * @access public
+ * @return bool true if multiple select, false otherwise
+ */
+ function getMultiple()
+ {
+ return (bool)$this->getAttribute('multiple');
+ } //end func getMultiple
+
+ // }}}
+ // {{{ addOption()
+
+ /**
+ * Adds a new OPTION to the SELECT
+ *
+ * @param string $text Display text for the OPTION
+ * @param string $value Value for the OPTION
+ * @param mixed $attributes Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function addOption($text, $value, $attributes=null)
+ {
+ if (null === $attributes) {
+ $attributes = array('value' => (string)$value);
+ } else {
+ $attributes = $this->_parseAttributes($attributes);
+ if (isset($attributes['selected'])) {
+ // the 'selected' attribute will be set in toHtml()
+ $this->_removeAttr('selected', $attributes);
+ if (is_null($this->_values)) {
+ $this->_values = array($value);
+ } elseif (!in_array($value, $this->_values)) {
+ $this->_values[] = $value;
+ }
+ }
+ $this->_updateAttrArray($attributes, array('value' => (string)$value));
+ }
+ $this->_options[] = array('text' => $text, 'attr' => $attributes);
+ } // end func addOption
+
+ // }}}
+ // {{{ loadArray()
+
+ /**
+ * Loads the options from an associative array
+ *
+ * @param array $arr Associative array of options
+ * @param mixed $values (optional) Array or comma delimited string of selected values
+ * @since 1.0
+ * @access public
+ * @return PEAR_Error on error or true
+ * @throws PEAR_Error
+ */
+ function loadArray($arr, $values=null)
+ {
+ if (!is_array($arr)) {
+ return PEAR::raiseError('Argument 1 of HTML_Select::loadArray is not a valid array');
+ }
+ if (isset($values)) {
+ $this->setSelected($values);
+ }
+ foreach ($arr as $key => $val) {
+ // Warning: new API since release 2.3
+ $this->addOption($val, $key);
+ }
+ return true;
+ } // end func loadArray
+
+ // }}}
+ // {{{ loadDbResult()
+
+ /**
+ * Loads the options from DB_result object
+ *
+ * If no column names are specified the first two columns of the result are
+ * used as the text and value columns respectively
+ * @param object $result DB_result object
+ * @param string $textCol (optional) Name of column to display as the OPTION text
+ * @param string $valueCol (optional) Name of column to use as the OPTION value
+ * @param mixed $values (optional) Array or comma delimited string of selected values
+ * @since 1.0
+ * @access public
+ * @return PEAR_Error on error or true
+ * @throws PEAR_Error
+ */
+ function loadDbResult(&$result, $textCol=null, $valueCol=null, $values=null)
+ {
+ if (!is_object($result) || !is_a($result, 'db_result')) {
+ return PEAR::raiseError('Argument 1 of HTML_Select::loadDbResult is not a valid DB_result');
+ }
+ if (isset($values)) {
+ $this->setValue($values);
+ }
+ $fetchMode = ($textCol && $valueCol) ? DB_FETCHMODE_ASSOC : DB_FETCHMODE_ORDERED;
+ while (is_array($row = $result->fetchRow($fetchMode)) ) {
+ if ($fetchMode == DB_FETCHMODE_ASSOC) {
+ $this->addOption($row[$textCol], $row[$valueCol]);
+ } else {
+ $this->addOption($row[0], $row[1]);
+ }
+ }
+ return true;
+ } // end func loadDbResult
+
+ // }}}
+ // {{{ loadQuery()
+
+ /**
+ * Queries a database and loads the options from the results
+ *
+ * @param mixed $conn Either an existing DB connection or a valid dsn
+ * @param string $sql SQL query string
+ * @param string $textCol (optional) Name of column to display as the OPTION text
+ * @param string $valueCol (optional) Name of column to use as the OPTION value
+ * @param mixed $values (optional) Array or comma delimited string of selected values
+ * @since 1.1
+ * @access public
+ * @return void
+ * @throws PEAR_Error
+ */
+ function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
+ {
+ if (is_string($conn)) {
+ require_once('DB.php');
+ $dbConn = &DB::connect($conn, true);
+ if (DB::isError($dbConn)) {
+ return $dbConn;
+ }
+ } elseif (is_subclass_of($conn, "db_common")) {
+ $dbConn = &$conn;
+ } else {
+ return PEAR::raiseError('Argument 1 of HTML_Select::loadQuery is not a valid type');
+ }
+ $result = $dbConn->query($sql);
+ if (DB::isError($result)) {
+ return $result;
+ }
+ $this->loadDbResult($result, $textCol, $valueCol, $values);
+ $result->free();
+ if (is_string($conn)) {
+ $dbConn->disconnect();
+ }
+ return true;
+ } // end func loadQuery
+
+ // }}}
+ // {{{ load()
+
+ /**
+ * Loads options from different types of data sources
+ *
+ * This method is a simulated overloaded method. The arguments, other than the
+ * first are optional and only mean something depending on the type of the first argument.
+ * If the first argument is an array then all arguments are passed in order to loadArray.
+ * If the first argument is a db_result then all arguments are passed in order to loadDbResult.
+ * If the first argument is a string or a DB connection then all arguments are
+ * passed in order to loadQuery.
+ * @param mixed $options Options source currently supports assoc array or DB_result
+ * @param mixed $param1 (optional) See function detail
+ * @param mixed $param2 (optional) See function detail
+ * @param mixed $param3 (optional) See function detail
+ * @param mixed $param4 (optional) See function detail
+ * @since 1.1
+ * @access public
+ * @return PEAR_Error on error or true
+ * @throws PEAR_Error
+ */
+ function load(&$options, $param1=null, $param2=null, $param3=null, $param4=null)
+ {
+ switch (true) {
+ case is_array($options):
+ return $this->loadArray($options, $param1);
+ break;
+ case (is_a($options, 'db_result')):
+ return $this->loadDbResult($options, $param1, $param2, $param3);
+ break;
+ case (is_string($options) && !empty($options) || is_subclass_of($options, "db_common")):
+ return $this->loadQuery($options, $param1, $param2, $param3, $param4);
+ break;
+ }
+ } // end func load
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the SELECT in HTML
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ if ($this->_flagFrozen) {
+ return $this->getFrozenHtml();
+ } else {
+ $tabs = $this->_getTabs();
+ $strHtml = '';
+
+ if ($this->getComment() != '') {
+ $strHtml .= $tabs . '<!-- ' . $this->getComment() . " //-->\n";
+ }
+
+ if (!$this->getMultiple()) {
+ $attrString = $this->_getAttrString($this->_attributes);
+ } else {
+ $myName = $this->getName();
+ $this->setName($myName . '[]');
+ $attrString = $this->_getAttrString($this->_attributes);
+ $this->setName($myName);
+ }
+ $strHtml .= $tabs . '<select' . $attrString . ">\n";
+
+ $strValues = is_array($this->_values)? array_map('strval', $this->_values): array();
+ foreach ($this->_options as $option) {
+ if (!empty($strValues) && in_array($option['attr']['value'], $strValues, true)) {
+ $option['attr']['selected'] = 'selected';
+ }
+ $strHtml .= $tabs . "\t<option" . $this->_getAttrString($option['attr']) . '>' .
+ $option['text'] . "</option>\n";
+ }
+
+ return $strHtml . $tabs . '</select>';
+ }
+ } //end func toHtml
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getFrozenHtml()
+ {
+ $value = array();
+ if (is_array($this->_values)) {
+ foreach ($this->_values as $key => $val) {
+ for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
+ if (0 == strcmp($val, $this->_options[$i]['attr']['value'])) {
+ $value[$key] = $this->_options[$i]['text'];
+ break;
+ }
+ }
+ }
+ }
+ $html = empty($value)? '&nbsp;': join('<br />', $value);
+ if ($this->_persistantFreeze) {
+ $name = $this->getPrivateName();
+ // Only use id attribute if doing single hidden input
+ if (1 == count($value)) {
+ $id = $this->getAttribute('id');
+ $idAttr = isset($id)? array('id' => $id): array();
+ } else {
+ $idAttr = array();
+ }
+ foreach ($value as $key => $item) {
+ $html .= '<input' . $this->_getAttrString(array(
+ 'type' => 'hidden',
+ 'name' => $name,
+ 'value' => $this->_values[$key]
+ ) + $idAttr) . ' />';
+ }
+ }
+ return $html;
+ } //end func getFrozenHtml
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * We check the options and return only the values that _could_ have been
+ * selected. We also return a scalar value if select is not "multiple"
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ $value = $this->_findValue($submitValues);
+ if (is_null($value)) {
+ $value = $this->getValue();
+ } elseif(!is_array($value)) {
+ $value = array($value);
+ }
+ if (is_array($value) && !empty($this->_options)) {
+ $cleanValue = null;
+ foreach ($value as $v) {
+ for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
+ if (0 == strcmp($v, $this->_options[$i]['attr']['value'])) {
+ $cleanValue[] = $v;
+ break;
+ }
+ }
+ }
+ } else {
+ $cleanValue = $value;
+ }
+ if (is_array($cleanValue) && !$this->getMultiple()) {
+ return $this->_prepareValue($cleanValue[0], $assoc);
+ } else {
+ return $this->_prepareValue($cleanValue, $assoc);
+ }
+ }
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ if ('updateValue' == $event) {
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_submitValues);
+ // Fix for bug #4465 & #5269
+ // XXX: should we push this to element::onQuickFormEvent()?
+ if (null === $value && (!$caller->isSubmitted() || !$this->getMultiple())) {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ }
+ if (null !== $value) {
+ $this->setValue($value);
+ }
+ return true;
+ } else {
+ return parent::onQuickFormEvent($event, $arg, $caller);
+ }
+ }
+
+ // }}}
+} //end class HTML_QuickForm_select
+?>
diff --git a/libs/HTML/QuickForm/static.php b/libs/HTML/QuickForm/static.php
index cbe6c964a9..20f45b8e72 100755
--- a/libs/HTML/QuickForm/static.php
+++ b/libs/HTML/QuickForm/static.php
@@ -1,201 +1,201 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for static data
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Wojciech Gdela <eltehaem@poczta.onet.pl>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * HTML class for static data
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Wojciech Gdela <eltehaem@poczta.onet.pl>
- * @version Release: 3.2.9
- * @since 2.7
- */
-class HTML_QuickForm_static extends HTML_QuickForm_element {
-
- // {{{ properties
-
- /**
- * Display text
- * @var string
- * @access private
- */
- var $_text = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementLabel (optional)Label
- * @param string $text (optional)Display text
- * @access public
- * @return void
- */
- function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel);
- $this->_persistantFreeze = false;
- $this->_type = 'static';
- $this->_text = $text;
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the element name
- *
- * @param string $name Element name
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setText()
-
- /**
- * Sets the text
- *
- * @param string $text
- * @access public
- * @return void
- */
- function setText($text)
- {
- $this->_text = $text;
- } // end func setText
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the text (uses the standard setValue call to emulate a form element.
- *
- * @param string $text
- * @access public
- * @return void
- */
- function setValue($text)
- {
- $this->setText($text);
- } // end func setValue
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the static text element in HTML
- *
- * @access public
- * @return string
- */
- function toHtml()
- {
- return $this->_getTabs() . $this->_text;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- return $this->toHtml();
- } //end func getFrozenHtml
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // do NOT use submitted values for static elements
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ exportValue()
-
- /**
- * We override this here because we don't want any values from static elements
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- return null;
- }
-
- // }}}
-} //end class HTML_QuickForm_static
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for static data
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Wojciech Gdela <eltehaem@poczta.onet.pl>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for form elements
+ */
+require_once 'HTML/QuickForm/element.php';
+
+/**
+ * HTML class for static data
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Wojciech Gdela <eltehaem@poczta.onet.pl>
+ * @version Release: 3.2.9
+ * @since 2.7
+ */
+class HTML_QuickForm_static extends HTML_QuickForm_element {
+
+ // {{{ properties
+
+ /**
+ * Display text
+ * @var string
+ * @access private
+ */
+ var $_text = null;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementLabel (optional)Label
+ * @param string $text (optional)Display text
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null)
+ {
+ HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel);
+ $this->_persistantFreeze = false;
+ $this->_type = 'static';
+ $this->_text = $text;
+ } //end constructor
+
+ // }}}
+ // {{{ setName()
+
+ /**
+ * Sets the element name
+ *
+ * @param string $name Element name
+ * @access public
+ * @return void
+ */
+ function setName($name)
+ {
+ $this->updateAttributes(array('name'=>$name));
+ } //end func setName
+
+ // }}}
+ // {{{ getName()
+
+ /**
+ * Returns the element name
+ *
+ * @access public
+ * @return string
+ */
+ function getName()
+ {
+ return $this->getAttribute('name');
+ } //end func getName
+
+ // }}}
+ // {{{ setText()
+
+ /**
+ * Sets the text
+ *
+ * @param string $text
+ * @access public
+ * @return void
+ */
+ function setText($text)
+ {
+ $this->_text = $text;
+ } // end func setText
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets the text (uses the standard setValue call to emulate a form element.
+ *
+ * @param string $text
+ * @access public
+ * @return void
+ */
+ function setValue($text)
+ {
+ $this->setText($text);
+ } // end func setValue
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the static text element in HTML
+ *
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ return $this->_getTabs() . $this->_text;
+ } //end func toHtml
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags
+ *
+ * @access public
+ * @return string
+ */
+ function getFrozenHtml()
+ {
+ return $this->toHtml();
+ } //end func getFrozenHtml
+
+ // }}}
+ // {{{ onQuickFormEvent()
+
+ /**
+ * Called by HTML_QuickForm whenever form event is made on this element
+ *
+ * @param string $event Name of event
+ * @param mixed $arg event arguments
+ * @param object &$caller calling object
+ * @since 1.0
+ * @access public
+ * @return void
+ * @throws
+ */
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ switch ($event) {
+ case 'updateValue':
+ // do NOT use submitted values for static elements
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ if (null !== $value) {
+ $this->setValue($value);
+ }
+ break;
+ default:
+ parent::onQuickFormEvent($event, $arg, $caller);
+ }
+ return true;
+ } // end func onQuickFormEvent
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * We override this here because we don't want any values from static elements
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ return null;
+ }
+
+ // }}}
+} //end class HTML_QuickForm_static
+?>
diff --git a/libs/HTML/QuickForm/submit.php b/libs/HTML/QuickForm/submit.php
index 97bddede83..caa692dd16 100755
--- a/libs/HTML/QuickForm/submit.php
+++ b/libs/HTML/QuickForm/submit.php
@@ -1,89 +1,89 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a submit type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a submit type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_submit extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param string Input field value
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setValue($value);
- $this->setType('submit');
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Only return the value if it is found within $submitValues (i.e. if
- * this particular submit button was clicked)
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- return $this->_prepareValue($this->_findValue($submitValues), $assoc);
- }
-
- // }}}
-} //end class HTML_QuickForm_submit
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a submit type element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a submit type element
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_submit extends HTML_QuickForm_input
+{
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Input field name attribute
+ * @param string Input field value
+ * @param mixed Either a typical HTML attribute string or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ $this->setValue($value);
+ $this->setType('submit');
+ } //end constructor
+
+ // }}}
+ // {{{ freeze()
+
+ /**
+ * Freeze the element so that only its value is returned
+ *
+ * @access public
+ * @return void
+ */
+ function freeze()
+ {
+ return false;
+ } //end func freeze
+
+ // }}}
+ // {{{ exportValue()
+
+ /**
+ * Only return the value if it is found within $submitValues (i.e. if
+ * this particular submit button was clicked)
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ return $this->_prepareValue($this->_findValue($submitValues), $assoc);
+ }
+
+ // }}}
+} //end class HTML_QuickForm_submit
+?>
diff --git a/libs/HTML/QuickForm/text.php b/libs/HTML/QuickForm/text.php
index afb38d07de..0696122b99 100755
--- a/libs/HTML/QuickForm/text.php
+++ b/libs/HTML/QuickForm/text.php
@@ -1,98 +1,98 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a text field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a text field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_text extends HTML_QuickForm_input
-{
-
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->setType('text');
- } //end constructor
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets size of text field
- *
- * @param string $size Size of text field
- * @since 1.3
- * @access public
- * @return void
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size'=>$size));
- } //end func setSize
-
- // }}}
- // {{{ setMaxlength()
-
- /**
- * Sets maxlength of text field
- *
- * @param string $maxlength Maximum length of text field
- * @since 1.3
- * @access public
- * @return void
- */
- function setMaxlength($maxlength)
- {
- $this->updateAttributes(array('maxlength'=>$maxlength));
- } //end func setMaxlength
-
- // }}}
-
-} //end class HTML_QuickForm_text
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a text field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
+
+/**
+ * HTML class for a text field
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_text extends HTML_QuickForm_input
+{
+
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string $elementName (optional)Input field name attribute
+ * @param string $elementLabel (optional)Input field label
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null)
+ {
+ HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ $this->setType('text');
+ } //end constructor
+
+ // }}}
+ // {{{ setSize()
+
+ /**
+ * Sets size of text field
+ *
+ * @param string $size Size of text field
+ * @since 1.3
+ * @access public
+ * @return void
+ */
+ function setSize($size)
+ {
+ $this->updateAttributes(array('size'=>$size));
+ } //end func setSize
+
+ // }}}
+ // {{{ setMaxlength()
+
+ /**
+ * Sets maxlength of text field
+ *
+ * @param string $maxlength Maximum length of text field
+ * @since 1.3
+ * @access public
+ * @return void
+ */
+ function setMaxlength($maxlength)
+ {
+ $this->updateAttributes(array('maxlength'=>$maxlength));
+ } //end func setMaxlength
+
+ // }}}
+
+} //end class HTML_QuickForm_text
+?>
diff --git a/libs/HTML/QuickForm/textarea.php b/libs/HTML/QuickForm/textarea.php
index 5e3de74c6f..b499a9418a 100755
--- a/libs/HTML/QuickForm/textarea.php
+++ b/libs/HTML/QuickForm/textarea.php
@@ -1,229 +1,229 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a textarea type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * HTML class for a textarea type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.9
- * @since 1.0
- */
-class HTML_QuickForm_textarea extends HTML_QuickForm_element
-{
- // {{{ properties
-
- /**
- * Field value
- * @var string
- * @since 1.0
- * @access private
- */
- var $_value = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param mixed Label(s) for a field
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'textarea';
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets value for textarea element
- *
- * @param string $value Value for textarea element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->_value = $value;
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getValue()
- {
- return $this->_value;
- } // end func getValue
-
- // }}}
- // {{{ setWrap()
-
- /**
- * Sets wrap type for textarea element
- *
- * @param string $wrap Wrap type
- * @since 1.0
- * @access public
- * @return void
- */
- function setWrap($wrap)
- {
- $this->updateAttributes(array('wrap' => $wrap));
- } //end func setWrap
-
- // }}}
- // {{{ setRows()
-
- /**
- * Sets height in rows for textarea element
- *
- * @param string $rows Height expressed in rows
- * @since 1.0
- * @access public
- * @return void
- */
- function setRows($rows)
- {
- $this->updateAttributes(array('rows' => $rows));
- } //end func setRows
-
- // }}}
- // {{{ setCols()
-
- /**
- * Sets width in cols for textarea element
- *
- * @param string $cols Width expressed in cols
- * @since 1.0
- * @access public
- * @return void
- */
- function setCols($cols)
- {
- $this->updateAttributes(array('cols' => $cols));
- } //end func setCols
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the textarea element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return $this->getFrozenHtml();
- } else {
- return $this->_getTabs() .
- '<textarea' . $this->_getAttrString($this->_attributes) . '>' .
- // because we wrap the form later we don't want the text indented
- preg_replace("/(\r\n|\n|\r)/", '&#010;', htmlspecialchars($this->_value)) .
- '</textarea>';
- }
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags (in this case, value is changed to a mask)
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $value = htmlspecialchars($this->getValue());
- if ($this->getAttribute('wrap') == 'off') {
- $html = $this->_getTabs() . '<pre>' . $value."</pre>\n";
- } else {
- $html = nl2br($value)."\n";
- }
- return $html . $this->_getPersistantData();
- } //end func getFrozenHtml
-
- // }}}
-
-} //end class HTML_QuickForm_textarea
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * HTML class for a textarea type field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for form elements
+ */
+require_once 'HTML/QuickForm/element.php';
+
+/**
+ * HTML class for a textarea type field
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author Bertrand Mansion <bmansion@mamasam.com>
+ * @version Release: 3.2.9
+ * @since 1.0
+ */
+class HTML_QuickForm_textarea extends HTML_QuickForm_element
+{
+ // {{{ properties
+
+ /**
+ * Field value
+ * @var string
+ * @since 1.0
+ * @access private
+ */
+ var $_value = null;
+
+ // }}}
+ // {{{ constructor
+
+ /**
+ * Class constructor
+ *
+ * @param string Input field name attribute
+ * @param mixed Label(s) for a field
+ * @param mixed Either a typical HTML attribute string or an associative array
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null)
+ {
+ HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ $this->_persistantFreeze = true;
+ $this->_type = 'textarea';
+ } //end constructor
+
+ // }}}
+ // {{{ setName()
+
+ /**
+ * Sets the input field name
+ *
+ * @param string $name Input field name attribute
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setName($name)
+ {
+ $this->updateAttributes(array('name'=>$name));
+ } //end func setName
+
+ // }}}
+ // {{{ getName()
+
+ /**
+ * Returns the element name
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getName()
+ {
+ return $this->getAttribute('name');
+ } //end func getName
+
+ // }}}
+ // {{{ setValue()
+
+ /**
+ * Sets value for textarea element
+ *
+ * @param string $value Value for textarea element
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setValue($value)
+ {
+ $this->_value = $value;
+ } //end func setValue
+
+ // }}}
+ // {{{ getValue()
+
+ /**
+ * Returns the value of the form element
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getValue()
+ {
+ return $this->_value;
+ } // end func getValue
+
+ // }}}
+ // {{{ setWrap()
+
+ /**
+ * Sets wrap type for textarea element
+ *
+ * @param string $wrap Wrap type
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setWrap($wrap)
+ {
+ $this->updateAttributes(array('wrap' => $wrap));
+ } //end func setWrap
+
+ // }}}
+ // {{{ setRows()
+
+ /**
+ * Sets height in rows for textarea element
+ *
+ * @param string $rows Height expressed in rows
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setRows($rows)
+ {
+ $this->updateAttributes(array('rows' => $rows));
+ } //end func setRows
+
+ // }}}
+ // {{{ setCols()
+
+ /**
+ * Sets width in cols for textarea element
+ *
+ * @param string $cols Width expressed in cols
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function setCols($cols)
+ {
+ $this->updateAttributes(array('cols' => $cols));
+ } //end func setCols
+
+ // }}}
+ // {{{ toHtml()
+
+ /**
+ * Returns the textarea element in HTML
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function toHtml()
+ {
+ if ($this->_flagFrozen) {
+ return $this->getFrozenHtml();
+ } else {
+ return $this->_getTabs() .
+ '<textarea' . $this->_getAttrString($this->_attributes) . '>' .
+ // because we wrap the form later we don't want the text indented
+ preg_replace("/(\r\n|\n|\r)/", '&#010;', htmlspecialchars($this->_value)) .
+ '</textarea>';
+ }
+ } //end func toHtml
+
+ // }}}
+ // {{{ getFrozenHtml()
+
+ /**
+ * Returns the value of field without HTML tags (in this case, value is changed to a mask)
+ *
+ * @since 1.0
+ * @access public
+ * @return string
+ */
+ function getFrozenHtml()
+ {
+ $value = htmlspecialchars($this->getValue());
+ if ($this->getAttribute('wrap') == 'off') {
+ $html = $this->_getTabs() . '<pre>' . $value."</pre>\n";
+ } else {
+ $html = nl2br($value)."\n";
+ }
+ return $html . $this->_getPersistantData();
+ } //end func getFrozenHtml
+
+ // }}}
+
+} //end class HTML_QuickForm_textarea
+?>
diff --git a/libs/HTML/QuickForm/xbutton.php b/libs/HTML/QuickForm/xbutton.php
index aaa339c85f..b0769ad136 100755
--- a/libs/HTML/QuickForm/xbutton.php
+++ b/libs/HTML/QuickForm/xbutton.php
@@ -1,153 +1,153 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class for HTML 4.0 <button> element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2007 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * Class for HTML 4.0 <button> element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.9
- * @since 3.2.3
- */
-class HTML_QuickForm_xbutton extends HTML_QuickForm_element
-{
- /**
- * Contents of the <button> tag
- * @var string
- * @access private
- */
- var $_content;
-
- /**
- * Class constructor
- *
- * @param string Button name
- * @param string Button content (HTML to add between <button></button> tags)
- * @param mixed Either a typical HTML attribute string or an associative array
- * @access public
- */
- function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null)
- {
- $this->HTML_QuickForm_element($elementName, null, $attributes);
- $this->setContent($elementContent);
- $this->setPersistantFreeze(false);
- $this->_type = 'xbutton';
- }
-
-
- function toHtml()
- {
- return '<button' . $this->getAttributes(true) . '>' . $this->_content . '</button>';
- }
-
-
- function getFrozenHtml()
- {
- return $this->toHtml();
- }
-
-
- function freeze()
- {
- return false;
- }
-
-
- function setName($name)
- {
- $this->updateAttributes(array(
- 'name' => $name
- ));
- }
-
-
- function getName()
- {
- return $this->getAttribute('name');
- }
-
-
- function setValue($value)
- {
- $this->updateAttributes(array(
- 'value' => $value
- ));
- }
-
-
- function getValue()
- {
- return $this->getAttribute('value');
- }
-
-
- /**
- * Sets the contents of the button element
- *
- * @param string Button content (HTML to add between <button></button> tags)
- */
- function setContent($content)
- {
- $this->_content = $content;
- }
-
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' != $event) {
- return parent::onQuickFormEvent($event, $arg, $caller);
- } else {
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- }
- return true;
- }
-
-
- /**
- * Returns a 'safe' element's value
- *
- * The value is only returned if the button's type is "submit" and if this
- * particlular button was clicked
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- if ('submit' == $this->getAttribute('type')) {
- return $this->_prepareValue($this->_findValue($submitValues), $assoc);
- } else {
- return null;
- }
- }
-}
-?>
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Class for HTML 4.0 <button> element
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @copyright 2001-2007 The PHP Group
+ * @license http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for form elements
+ */
+require_once 'HTML/QuickForm/element.php';
+
+/**
+ * Class for HTML 4.0 <button> element
+ *
+ * @category HTML
+ * @package HTML_QuickForm
+ * @author Alexey Borzov <avb@php.net>
+ * @version Release: 3.2.9
+ * @since 3.2.3
+ */
+class HTML_QuickForm_xbutton extends HTML_QuickForm_element
+{
+ /**
+ * Contents of the <button> tag
+ * @var string
+ * @access private
+ */
+ var $_content;
+
+ /**
+ * Class constructor
+ *
+ * @param string Button name
+ * @param string Button content (HTML to add between <button></button> tags)
+ * @param mixed Either a typical HTML attribute string or an associative array
+ * @access public
+ */
+ function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null)
+ {
+ $this->HTML_QuickForm_element($elementName, null, $attributes);
+ $this->setContent($elementContent);
+ $this->setPersistantFreeze(false);
+ $this->_type = 'xbutton';
+ }
+
+
+ function toHtml()
+ {
+ return '<button' . $this->getAttributes(true) . '>' . $this->_content . '</button>';
+ }
+
+
+ function getFrozenHtml()
+ {
+ return $this->toHtml();
+ }
+
+
+ function freeze()
+ {
+ return false;
+ }
+
+
+ function setName($name)
+ {
+ $this->updateAttributes(array(
+ 'name' => $name
+ ));
+ }
+
+
+ function getName()
+ {
+ return $this->getAttribute('name');
+ }
+
+
+ function setValue($value)
+ {
+ $this->updateAttributes(array(
+ 'value' => $value
+ ));
+ }
+
+
+ function getValue()
+ {
+ return $this->getAttribute('value');
+ }
+
+
+ /**
+ * Sets the contents of the button element
+ *
+ * @param string Button content (HTML to add between <button></button> tags)
+ */
+ function setContent($content)
+ {
+ $this->_content = $content;
+ }
+
+
+ function onQuickFormEvent($event, $arg, &$caller)
+ {
+ if ('updateValue' != $event) {
+ return parent::onQuickFormEvent($event, $arg, $caller);
+ } else {
+ $value = $this->_findValue($caller->_constantValues);
+ if (null === $value) {
+ $value = $this->_findValue($caller->_defaultValues);
+ }
+ if (null !== $value) {
+ $this->setValue($value);
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * Returns a 'safe' element's value
+ *
+ * The value is only returned if the button's type is "submit" and if this
+ * particlular button was clicked
+ */
+ function exportValue(&$submitValues, $assoc = false)
+ {
+ if ('submit' == $this->getAttribute('type')) {
+ return $this->_prepareValue($this->_findValue($submitValues), $assoc);
+ } else {
+ return null;
+ }
+ }
+}
+?>