Last active
August 24, 2021 23:27
-
-
Save seamuslee001/0bc090be3643e1b965c9429e5c924ed4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Back.php HTML/QuickForm/Action/Back.php | |
--- _ORIGINAL_/HTML/QuickForm/Action/Back.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Action/Back.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -15,9 +15,9 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Back.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Back.php,v 1.6 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -32,7 +32,7 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Action_Back extends HTML_QuickForm_Action | |
{ | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Direct.php HTML/QuickForm/Action/Direct.php | |
--- _ORIGINAL_/HTML/QuickForm/Action/Direct.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Action/Direct.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -15,9 +15,9 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Direct.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Direct.php,v 1.4 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -35,7 +35,7 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Action_Direct extends HTML_QuickForm_Action | |
{ | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Display.php HTML/QuickForm/Action/Display.php | |
--- _ORIGINAL_/HTML/QuickForm/Action/Display.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Action/Display.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -15,9 +15,9 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Display.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Display.php,v 1.7 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -36,7 +36,7 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Action_Display extends HTML_QuickForm_Action | |
{ | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Jump.php HTML/QuickForm/Action/Jump.php | |
--- _ORIGINAL_/HTML/QuickForm/Action/Jump.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Action/Jump.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -15,9 +15,9 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Jump.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Jump.php,v 1.6 2008/07/22 11:05:20 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -32,7 +32,7 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Action_Jump extends HTML_QuickForm_Action | |
{ | |
@@ -102,7 +102,7 @@ | |
*/ | |
function _resolveRelativeURL($url) | |
{ | |
- $https = !empty($_SERVER['HTTPS']) && ('off' != strtolower($_SERVER['HTTPS'])); | |
+ $https = !empty($_SERVER['HTTPS']) && ('off' != $_SERVER['HTTPS']); | |
$scheme = ($https? 'https:': 'http:'); | |
if ('//' == substr($url, 0, 2)) { | |
return $scheme . $url; | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Next.php HTML/QuickForm/Action/Next.php | |
--- _ORIGINAL_/HTML/QuickForm/Action/Next.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Action/Next.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -15,9 +15,9 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Next.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Next.php,v 1.6 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -32,7 +32,7 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Action_Next extends HTML_QuickForm_Action | |
{ | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Submit.php HTML/QuickForm/Action/Submit.php | |
--- _ORIGINAL_/HTML/QuickForm/Action/Submit.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Action/Submit.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -15,9 +15,9 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Submit.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Submit.php,v 1.5 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -32,7 +32,7 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Action_Submit extends HTML_QuickForm_Action | |
{ | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action.php HTML/QuickForm/Action.php | |
--- _ORIGINAL_/HTML/QuickForm/Action.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Action.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -15,9 +15,9 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Action.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Action.php,v 1.3 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -31,7 +31,7 @@ | |
* @category HTML | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
* @abstract | |
*/ | |
class HTML_QuickForm_Action | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/advcheckbox.php HTML/QuickForm/advcheckbox.php | |
--- _ORIGINAL_/HTML/QuickForm/advcheckbox.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/advcheckbox.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -86,9 +86,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) | |
+ function __construct($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) | |
{ | |
- $this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $text, $attributes); | |
$this->setValues($values); | |
} //end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/advmultiselect.php HTML/QuickForm/advmultiselect.php | |
--- _ORIGINAL_/HTML/QuickForm/advmultiselect.php 2021-08-25 09:24:31.906785905 +1000 | |
+++ HTML/QuickForm/advmultiselect.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -63,7 +63,7 @@ | |
* @author Laurent Laville <pear@laurent-laville.org> | |
* @copyright 2005-2009 Laurent Laville | |
* @license http://www.opensource.org/licenses/bsd-license.php BSD | |
- * @version Release: @package_version@ | |
+ * @version Release: 1.5.1 | |
* @link http://pear.php.net/package/HTML_QuickForm_advmultiselect | |
* @since Class available since Release 0.4.0 | |
*/ | |
@@ -272,13 +272,13 @@ | |
* @return void | |
* @since version 0.4.0 (2005-06-25) | |
*/ | |
- function HTML_QuickForm_advmultiselect($elementName = null, $elementLabel = null, | |
+ function __construct($elementName = null, $elementLabel = null, | |
$options = null, $attributes = null, | |
$sort = null) | |
{ | |
$opts = $options; | |
$options = null; // prevent to use the default select element load options | |
- $this->HTML_QuickForm_select($elementName, $elementLabel, | |
+ parent::__construct($elementName, $elementLabel, | |
$options, $attributes); | |
// allow to load options at once and take care of fancy attributes | |
@@ -725,7 +725,7 @@ | |
$attrHidden = $this->_getAttrString($this->_attributesHidden); | |
// prepare option tables to be displayed as in POST order | |
- $append = count($this->_values); | |
+ $append = ($this->_values === NULL ? 0 : count($this->_values)); | |
if ($append > 0) { | |
$arrHtmlSelected = array_fill(0, $append, ' '); | |
} else { | |
@@ -1010,8 +1010,7 @@ | |
*/ | |
function getElementJs($raw = true, $min = false) | |
{ | |
- $js = '@data_dir@' . DIRECTORY_SEPARATOR | |
- . '@package_name@' . DIRECTORY_SEPARATOR; | |
+ $js = Civi::paths()->getPath('[civicrm.packages]/data/HTML_QuickForm_advmultiselect/'); | |
if ($min) { | |
$js .= 'qfamsHandler-min.js'; | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/autocomplete.php HTML/QuickForm/autocomplete.php | |
--- _ORIGINAL_/HTML/QuickForm/autocomplete.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/autocomplete.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -84,9 +84,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null) | |
+ function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) | |
{ | |
- $this->HTML_QuickForm_text($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_persistantFreeze = true; | |
$this->_type = 'autocomplete'; | |
if (isset($options)) { | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/button.php HTML/QuickForm/button.php | |
--- _ORIGINAL_/HTML/QuickForm/button.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/button.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -52,9 +52,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null) | |
+ function __construct($elementName=null, $value=null, $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); | |
+ parent::__construct($elementName, null, $attributes); | |
$this->_persistantFreeze = false; | |
$this->setValue($value); | |
$this->setType('button'); | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/checkbox.php HTML/QuickForm/checkbox.php | |
--- _ORIGINAL_/HTML/QuickForm/checkbox.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/checkbox.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -66,9 +66,19 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $text='', $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); | |
+ //hack to add 'id' for checkbox | |
+ if ( !$attributes ) { | |
+ $attributes = array( 'id' => $elementName ); | |
+ } else { | |
+ // set element id only if its not set | |
+ if ( !isset( $attributes['id'] ) ) { | |
+ $attributes['id'] = $elementName; | |
+ } | |
+ } | |
+ | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_persistantFreeze = true; | |
$this->_text = $text; | |
$this->setType('checkbox'); | |
@@ -123,13 +133,17 @@ | |
*/ | |
function toHtml() | |
{ | |
+ $attributes = $this->getAttributes(); | |
+ | |
if (0 == strlen($this->_text)) { | |
$label = ''; | |
- } elseif ($this->_flagFrozen) { | |
+ } elseif ($this->_flagFrozen || isset( $attributes['skiplabel']) ) { | |
$label = $this->_text; | |
} else { | |
$label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>'; | |
} | |
+ | |
+ unset( $attributes['skipLabel'] ); | |
return HTML_QuickForm_input::toHtml() . $label; | |
} //end func toHtml | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Controller.php HTML/QuickForm/Controller.php | |
--- _ORIGINAL_/HTML/QuickForm/Controller.php 2021-08-25 09:24:31.902785868 +1000 | |
+++ HTML/QuickForm/Controller.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -16,9 +16,9 @@ | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
* @author Bertrand Mansion <bmansion@mamasam.com> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Controller.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Controller.php,v 1.13 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -40,7 +40,7 @@ | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
* @author Bertrand Mansion <bmansion@mamasam.com> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Controller | |
{ | |
@@ -86,7 +86,7 @@ | |
* @param string form name | |
* @param bool whether the form is modal | |
*/ | |
- function HTML_QuickForm_Controller($name, $modal = true) | |
+ function __construct($name, $modal = true) | |
{ | |
$this->_name = $name; | |
$this->_modal = $modal; | |
@@ -149,9 +149,9 @@ | |
* @param string name of the action | |
* @param HTML_QuickForm_Action the handler for the action | |
*/ | |
- function addAction($actionName, &$action) | |
+ function addAction($actionName, $action) | |
{ | |
- $this->_actions[$actionName] =& $action; | |
+ $this->_actions[$actionName] = $action; | |
} | |
@@ -210,7 +210,7 @@ | |
case 'jump': | |
include_once 'HTML/QuickForm/Action/' . ucfirst($actionName) . '.php'; | |
$className = 'HTML_QuickForm_Action_' . $actionName; | |
- $this->_actions[$actionName] =& new $className(); | |
+ $this->_actions[$actionName] = new $className(); | |
return $this->_actions[$actionName]->perform($page, $actionName); | |
break; | |
default: | |
@@ -218,7 +218,6 @@ | |
} // switch | |
} | |
- | |
/** | |
* Checks whether the form is modal. | |
* | |
@@ -347,9 +346,15 @@ | |
return $this->_actionName; | |
} | |
$names = array_map('preg_quote', array_keys($this->_pages)); | |
- $regex = '/^_qf_(' . implode('|', $names) . ')_(.+?)(_x)?$/'; | |
+ $regex = '/^_qf_(' . implode('|', $names) . ')_(.+?)(_.+?)?(_x)?$/'; | |
+ $data =& $this->container(); | |
+ unset( $data['_qf_button_name'] ); | |
foreach (array_keys($_REQUEST) as $key) { | |
if (preg_match($regex, $key, $matches)) { | |
+ $data['_qf_button_name'] = $key; | |
+ if ( array_key_exists( 3, $matches ) ) { | |
+ $key = preg_replace( '/_(x|y)$/', '', $key ); | |
+ } | |
return array($matches[1], $matches[2]); | |
} | |
} | |
@@ -514,5 +519,23 @@ | |
$data =& $this->container(); | |
return isset($data['values'][$pageName][$elementName])? $data['values'][$pageName][$elementName]: null; | |
} | |
+ | |
+ /** | |
+ * resets a specifc page in the container | |
+ * | |
+ * @access public | |
+ * @param string name of the page | |
+ * @return void | |
+ */ | |
+ function resetPage($pageName, $valid = null) | |
+ { | |
+ $data =& $this->container(); | |
+ if (isset($data['values'][$pageName]) || | |
+ isset($data['valid'][$pageName])) { | |
+ $data['values'][$pageName] = array( ); | |
+ $data['valid'][$pageName] = $valid; | |
+ } | |
+ } | |
+ | |
} | |
?> | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/date.php HTML/QuickForm/date.php | |
--- _ORIGINAL_/HTML/QuickForm/date.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/date.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -53,7 +53,6 @@ | |
* @var array | |
*/ | |
var $_options = array( | |
- 'language' => 'en', | |
'format' => 'dMY', | |
'minYear' => 2001, | |
'maxYear' => null, // set in the constructor | |
@@ -71,184 +70,12 @@ | |
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 | |
+ * Locale array build from CRM_Utils_Date-provided names | |
* | |
* @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ärz', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'), | |
- 'months_long' => array ('Januar', 'Februar', 'Mä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év', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Déc'), | |
- 'months_long' => array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre') | |
- ), | |
- 'hu' => array ( | |
- 'weekdays_short'=> array ('V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'), | |
- 'weekdays_long' => array ('vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'), | |
- 'months_short' => array ('jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'), | |
- 'months_long' => array ('január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december') | |
- ), | |
- 'pl' => array ( | |
- 'weekdays_short'=> array ('Nie', 'Pn', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'), | |
- 'weekdays_long' => array ('Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'), | |
- 'months_short' => array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'), | |
- 'months_long' => array ('Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień') | |
- ), | |
- '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 ('Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'), | |
- 'weekdays_long' => array ('Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'), | |
- 'months_short' => array ('Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'), | |
- 'months_long' => array ('Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь') | |
- ), | |
- 'es' => array ( | |
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'), | |
- 'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sá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øn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'), | |
- 'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lø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án', 'Þri', 'Mið', 'Fim', 'Fös', 'Lau'), | |
- 'weekdays_long' => array ('Sunnudagur', 'Mánudagur', 'Þriðjudagur', 'Miðvikudagur', 'Fimmtudagur', 'Föstudagur', 'Laugardagur'), | |
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maí', 'Jún', 'Júl', 'Ágú', 'Sep', 'Okt', 'Nóv', 'Des'), | |
- 'months_long' => array ('Janúar', 'Febrúar', 'Mars', 'Apríl', 'Maí', 'Júní', 'Júlí', 'Ágúst', 'September', 'Október', 'Nóvember', 'Desember') | |
- ), | |
- 'it' => array ( | |
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'), | |
- 'weekdays_long' => array ('Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', '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', 'Štv', 'Pia', 'Sob'), | |
- 'weekdays_long' => array ('Nedeža', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'), | |
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún', 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), | |
- 'months_long' => array ('Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December') | |
- ), | |
- 'cs' => array ( | |
- 'weekdays_short'=> array ('Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'), | |
- 'weekdays_long' => array ('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'), | |
- 'months_short' => array ('Led', 'Úno', 'Bře', 'Dub', 'Kvě', 'Čen', 'Čec', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'), | |
- 'months_long' => array ('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec') | |
- ), | |
- 'hy' => array ( | |
- 'weekdays_short'=> array ('Կրկ', 'Երկ', 'Երք', 'Չրք', 'Հնգ', 'Ուր', 'Շբթ'), | |
- 'weekdays_long' => array ('Կիրակի', 'Երկուշաբթի', 'Երեքշաբթի', 'Չորեքշաբթի', 'Հինգշաբթի', 'Ուրբաթ', 'Շաբաթ'), | |
- 'months_short' => array ('Հնվ', 'Փտր', 'Մրտ', 'Ապր', 'Մյս', 'Հնս', 'Հլս', 'Օգս', 'Սպտ', 'Հկտ', 'Նյմ', 'Դկտ'), | |
- 'months_long' => array ('Հունվար', 'Փետրվար', 'Մարտ', 'Ապրիլ', 'Մայիս', 'Հունիս', 'Հուլիս', 'Օգոստոս', 'Սեպտեմբեր', 'Հոկտեմբեր', 'Նոյեմբեր', 'Դեկտեմբեր') | |
- ), | |
- '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ühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'), | |
- 'months_short' => array ('Jaan', 'Veebr', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'), | |
- 'months_long' => array ('Jaanuar', 'Veebruar', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'August', 'September', 'Oktoober', 'November', 'Detsember') | |
- ), | |
- 'tr' => array ( | |
- 'weekdays_short'=> array ('Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'), | |
- 'weekdays_long' => array ('Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'), | |
- 'months_short' => array ('Ock', 'Şbt', 'Mrt', 'Nsn', 'Mys', 'Hzrn', 'Tmmz', 'Ağst', 'Eyl', 'Ekm', 'Ksm', 'Arlk'), | |
- 'months_long' => array ('Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık') | |
- ), | |
- 'no' => array ( | |
- 'weekdays_short'=> array ('Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'), | |
- 'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lø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', 'Ĵaŭ', 'Ven', 'Sab'), | |
- 'weekdays_long' => array ('Dimanĉo', 'Lundo', 'Mardo', 'Merkredo', 'Ĵaŭdo', 'Vendredo', 'Sabato'), | |
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aŭg', 'Sep', 'Okt', 'Nov', 'Dec'), | |
- 'months_long' => array ('Januaro', 'Februaro', 'Marto', 'Aprilo', 'Majo', 'Junio', 'Julio', 'Aŭgusto', 'Septembro', 'Oktobro', 'Novembro', 'Decembro') | |
- ), | |
- 'ua' => array ( | |
- 'weekdays_short'=> array('Ндл', 'Пнд', 'Втр', 'Срд', 'Чтв', 'Птн', 'Сбт'), | |
- 'weekdays_long' => array('Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'), | |
- 'months_short' => array('Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'), | |
- 'months_long' => array('Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень') | |
- ), | |
- '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 ('ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'), | |
- 'weekdays_long' => array ('יום ראשון', 'יום שני', 'יום שלישי', 'יום רביעי', 'יום חמישי', 'יום שישי', 'שבת'), | |
- 'months_short' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'), | |
- 'months_long' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר') | |
- ), | |
- 'sv' => array ( | |
- 'weekdays_short'=> array ('Sön', 'Mån', 'Tis', 'Ons', 'Tor', 'Fre', 'Lör'), | |
- 'weekdays_long' => array ('Söndag', 'Måndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lö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áb'), | |
- 'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'), | |
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'), | |
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro') | |
- ), | |
- 'tw' => array ( | |
- 'weekdays_short'=> array ('週日','週一', '週二','週三', '週四','週五', '週六'), | |
- 'weekdays_long' => array ('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'), | |
- 'months_short' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'), | |
- 'months_long' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月') | |
- ), | |
- 'pt-br' => array ( | |
- 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'), | |
- 'weekdays_long' => array ('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'), | |
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'), | |
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro') | |
- ), | |
- 'sr' => array ( | |
- 'weekdays_short'=> array ('Нед', 'Пон', 'Уто', 'Сре', 'Чет', 'Пет', 'Суб'), | |
- 'weekdays_long' => array ('Недеља', 'Понедељак', 'Уторак', 'Среда', 'Четвртак', 'Петак', 'Субота'), | |
- 'months_short' => array ('Јан', 'Феб', 'Мар', 'Апр', 'Мај', 'Јун', 'Јул', 'Авг', 'Сеп', 'Окт', 'Нов', 'Дец'), | |
- 'months_long' => array ('Јануар', 'Фебруар', 'Март', 'Април', 'Мај', 'Јун', 'Јул', 'Август', 'Септембар', 'Октобар', 'Новембар', 'Децембар') | |
- ), | |
- 'el' => array ( | |
- 'weekdays_short'=> array ('Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ', 'Κυρ'), | |
- 'weekdays_long' => array ('Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο', 'Κυριακή'), | |
- 'months_short' => array ('Ιαν', 'Φεβ', 'Μάρ', 'Απρ', 'Μάϊ', 'Ioύν', 'Ιούλ', 'Αύγ', 'Σεπ', 'Οκτ', 'Νοέ', 'Δεκ'), | |
- 'months_long' => array ('Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάϊος', 'Ιούνιος', 'Ioύλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος') | |
- ) | |
- ); | |
+ var $_locale = array(); | |
// }}} | |
// {{{ constructor | |
@@ -290,9 +117,15 @@ | |
* @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) | |
+ function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) | |
{ | |
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ $this->_locale = array( | |
+ 'weekdays_short'=> CRM_Utils_Date::getAbbrWeekdayNames(), | |
+ 'weekdays_long' => CRM_Utils_Date::getFullWeekdayNames(), | |
+ 'months_short' => CRM_Utils_Date::getAbbrMonthNames(), | |
+ 'months_long' => CRM_Utils_Date::getFullMonthNames() | |
+ ); | |
+ parent::__construct($elementName, $elementLabel, null, null, null, $attributes); | |
$this->_persistantFreeze = true; | |
$this->_appendName = true; | |
$this->_type = 'date'; | |
@@ -303,9 +136,7 @@ | |
// 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 (isset($this->_options[$name])) { | |
if (is_array($value) && is_array($this->_options[$name])) { | |
$this->_options[$name] = @array_merge($this->_options[$name], $value); | |
} else { | |
@@ -323,38 +154,57 @@ | |
{ | |
$this->_separator = $this->_elements = array(); | |
$separator = ''; | |
- $locale =& $this->_locale[$this->_options['language']]; | |
+ $locale =& $this->_locale; | |
$backslash = false; | |
for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) { | |
- $sign = $this->_options['format']{$i}; | |
+ $sign = $this->_options['format'][$i]; | |
if ($backslash) { | |
$backslash = false; | |
$separator .= $sign; | |
} else { | |
$loadSelect = true; | |
+ $ariaLabel = $this->getLabel() ?: ''; | |
switch ($sign) { | |
case 'D': | |
// Sunday is 0 like with 'w' in date() | |
$options = $locale['weekdays_short']; | |
+ $emptyText = ts('-day of week-'); | |
+ $ariaLabel .= ts(' day of week'); | |
break; | |
case 'l': | |
$options = $locale['weekdays_long']; | |
+ $emptyText = ts('-day of week-'); | |
+ $ariaLabel .= ts(' day of week'); | |
break; | |
case 'd': | |
$options = $this->_createOptionList(1, 31); | |
+ $emptyText = ts('-day-'); | |
+ $ariaLabel .= ts(' day'); | |
+ break; | |
+ case 'j': | |
+ // the no-zero-padding option (CRM-2793) | |
+ $options = $this->_createOptionList(1, 31, 1, false); | |
+ $emptyText = ts('-day-'); | |
+ $ariaLabel .= ts(' day'); | |
break; | |
case 'M': | |
$options = $locale['months_short']; | |
array_unshift($options , ''); | |
unset($options[0]); | |
+ $emptyText = ts('-month-'); | |
+ $ariaLabel .= ts(' month'); | |
break; | |
case 'm': | |
$options = $this->_createOptionList(1, 12); | |
+ $emptyText = ts('-month-'); | |
+ $ariaLabel .= ts(' month'); | |
break; | |
case 'F': | |
$options = $locale['months_long']; | |
array_unshift($options , ''); | |
unset($options[0]); | |
+ $emptyText = ts('-month-'); | |
+ $ariaLabel .= ts(' month'); | |
break; | |
case 'Y': | |
$options = $this->_createOptionList( | |
@@ -362,6 +212,8 @@ | |
$this->_options['maxYear'], | |
$this->_options['minYear'] > $this->_options['maxYear']? -1: 1 | |
); | |
+ $emptyText = ts('-year-'); | |
+ $ariaLabel .= ts(' year'); | |
break; | |
case 'y': | |
$options = $this->_createOptionList( | |
@@ -370,9 +222,13 @@ | |
$this->_options['minYear'] > $this->_options['maxYear']? -1: 1 | |
); | |
array_walk($options, create_function('&$v,$k','$v = substr($v,-2);')); | |
+ $emptyText = ts('-year-'); | |
+ $ariaLabel .= ts(' year'); | |
break; | |
case 'h': | |
$options = $this->_createOptionList(1, 12); | |
+ $emptyText = ts('-hour-'); | |
+ $ariaLabel .= ts(' hour'); | |
break; | |
case 'g': | |
$options = $this->_createOptionList(1, 12); | |
@@ -380,18 +236,28 @@ | |
break; | |
case 'H': | |
$options = $this->_createOptionList(0, 23); | |
+ $emptyText = ts('-hour-'); | |
+ $ariaLabel .= ts(' hour'); | |
break; | |
case 'i': | |
$options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['i']); | |
+ $emptyText = ts('-min-'); | |
+ $ariaLabel .= ts(' minute'); | |
break; | |
case 's': | |
$options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['s']); | |
+ $emptyText = ts('-sec-'); | |
+ $ariaLabel .= ts(' second'); | |
break; | |
case 'a': | |
$options = array('am' => 'am', 'pm' => 'pm'); | |
+ $emptyText = '-am/pm-'; | |
+ $ariaLabel .= ts(' am or pm'); | |
break; | |
case 'A': | |
$options = array('AM' => 'AM', 'PM' => 'PM'); | |
+ $emptyText = '-AM/PM-'; | |
+ $ariaLabel .= ts(' AM or PM'); | |
break; | |
case 'W': | |
$options = $this->_createOptionList(1, 53); | |
@@ -418,12 +284,23 @@ | |
// 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; | |
+ $text = $emptyText ? $emptyText : $this->_options['emptyOptionText'][$sign]; | |
+ $options = array($this->_options['emptyOptionValue'] => $text) + $options; | |
} else { | |
- $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options; | |
+ $text = $emptyText ? $emptyText : $this->_options['emptyOptionText']; | |
+ $options = array($this->_options['emptyOptionValue'] => $text) + $options; | |
} | |
} | |
- $this->_elements[] =& new HTML_QuickForm_select($sign, null, $options, $this->getAttributes()); | |
+ | |
+ //modified autogenerated id for date select boxes. | |
+ $attribs = $this->getAttributes(); | |
+ $elementName = $this->getName(); | |
+ $attribs['id'] = $elementName.'['.$sign.']'; | |
+ if ($ariaLabel !== '') { | |
+ $attribs['aria-label'] = $ariaLabel; | |
+ } | |
+ | |
+ $this->_elements[] = new HTML_QuickForm_select($sign, null, $options, $attribs); | |
} | |
} | |
} | |
@@ -439,13 +316,14 @@ | |
* @param int The start number | |
* @param int The end number | |
* @param int Increment by this value | |
+ * @param bool Whether to pad the result with leading zero (CRM-2793) | |
* @access private | |
* @return array An array of numeric options. | |
*/ | |
- function _createOptionList($start, $end, $step = 1) | |
+ function _createOptionList($start, $end, $step = 1, $pad = true) | |
{ | |
for ($i = $start, $options = array(); $start > $end? $i >= $end: $i <= $end; $i += $step) { | |
- $options[$i] = sprintf('%02d', $i); | |
+ $options[$i] = $pad ? sprintf('%02d', $i) : sprintf('%d', $i); | |
} | |
return $options; | |
} | |
@@ -511,7 +389,7 @@ | |
function toHtml() | |
{ | |
include_once('HTML/QuickForm/Renderer/Default.php'); | |
- $renderer =& new HTML_QuickForm_Renderer_Default(); | |
+ $renderer = new HTML_QuickForm_Renderer_Default(); | |
$renderer->setElementTemplate('{element}'); | |
parent::accept($renderer); | |
return $this->_wrap[0] . $renderer->toHtml() . $this->_wrap[1]; | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/element.php HTML/QuickForm/element.php | |
--- _ORIGINAL_/HTML/QuickForm/element.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/element.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -93,9 +93,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $attributes=null) | |
{ | |
- HTML_Common::HTML_Common($attributes); | |
+ parent::__construct($attributes); | |
if (isset($elementName)) { | |
$this->setName($elementName); | |
} | |
@@ -348,14 +348,8 @@ | |
if (isset($values[$elementName])) { | |
return $values[$elementName]; | |
} elseif (strpos($elementName, '[')) { | |
- | |
- $keys = str_replace( | |
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), | |
- $elementName | |
- ); | |
- $arrayKeys = explode("']['", $keys); | |
- return HTML_QuickForm_utils::recursiveValue($values, $arrayKeys); | |
- | |
+ $keys = explode('[', str_replace(']', '', $elementName)); | |
+ return CRM_Utils_Array::pathGet($values, $keys); | |
} else { | |
return null; | |
} | |
@@ -378,8 +372,7 @@ | |
{ | |
switch ($event) { | |
case 'createElement': | |
- $className = get_class($this); | |
- $this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]); | |
+ $this->__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]); | |
break; | |
case 'addElement': | |
$this->onQuickFormEvent('createElement', $arg, $caller); | |
@@ -485,13 +478,10 @@ | |
if (!strpos($name, '[')) { | |
return array($name => $value); | |
} else { | |
- | |
- $keys = str_replace( | |
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), | |
- $name | |
- ); | |
- $keysArray = explode("']['", $keys); | |
- return HTML_QuickForm_utils::recursiveBuild($keysArray, $value); | |
+ $keys = explode('[', str_replace(']', '', $name)); | |
+ $preparedValue = []; | |
+ CRM_Utils_Array::pathSet($preparedValue, $keys, $value); | |
+ return $preparedValue; | |
} | |
} | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/file.php HTML/QuickForm/file.php | |
--- _ORIGINAL_/HTML/QuickForm/file.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/file.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -70,9 +70,9 @@ | |
* @since 1.0 | |
* @access public | |
*/ | |
- function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->setType('file'); | |
} //end constructor | |
@@ -176,7 +176,8 @@ | |
if ($caller->getAttribute('method') == 'get') { | |
return PEAR::raiseError('Cannot add a file upload field to a GET method form'); | |
} | |
- $this->_value = $this->_findValue(); | |
+ $placeholder = array(); | |
+ $this->_value = $this->_findValue($placeholder); | |
$caller->updateAttributes(array('enctype' => 'multipart/form-data')); | |
$caller->setMaxFileSize(); | |
break; | |
@@ -186,7 +187,7 @@ | |
break; | |
case 'createElement': | |
$className = get_class($this); | |
- $this->$className($arg[0], $arg[1], $arg[2]); | |
+ $this->__construct($arg[0], $arg[1], $arg[2]); | |
break; | |
} | |
return true; | |
@@ -236,7 +237,7 @@ | |
* @access private | |
* @return bool true if file has been uploaded, false otherwise | |
*/ | |
- function _ruleIsUploadedFile($elementValue) | |
+ static function _ruleIsUploadedFile($elementValue) | |
{ | |
if ((isset($elementValue['error']) && $elementValue['error'] == 0) || | |
(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) { | |
@@ -257,7 +258,7 @@ | |
* @access private | |
* @return bool true if filesize is lower than maxsize, false otherwise | |
*/ | |
- function _ruleCheckMaxFileSize($elementValue, $maxSize) | |
+ static function _ruleCheckMaxFileSize($elementValue, $maxSize) | |
{ | |
if (!empty($elementValue['error']) && | |
(UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) { | |
@@ -280,7 +281,7 @@ | |
* @access private | |
* @return bool true if mimetype is correct, false otherwise | |
*/ | |
- function _ruleCheckMimeType($elementValue, $mimeType) | |
+ static function _ruleCheckMimeType($elementValue, $mimeType) | |
{ | |
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { | |
return true; | |
@@ -302,7 +303,7 @@ | |
* @access private | |
* @return bool true if name matches regex, false otherwise | |
*/ | |
- function _ruleCheckFileName($elementValue, $regex) | |
+ static function _ruleCheckFileName($elementValue, $regex) | |
{ | |
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { | |
return true; | |
@@ -333,23 +334,21 @@ | |
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"; | |
+ $base = substr($elementName, 0, $pos); | |
+ $idx = explode('][', str_replace(["['", "']", '["', '"]'], ['[', ']', '[', ']'], substr($elementName, $pos + 1, -1))); | |
+ $idx = array_merge([$base, 'name'], $idx); | |
+ if (!CRM_Utils_Array::pathIsset($_FILES, $idx)) { | |
+ return NULL; | |
+ } | |
+ else { | |
+ $props = ['name', 'type', 'size', 'tmp_name', 'error']; | |
+ $value = []; | |
foreach ($props as $prop) { | |
- $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n"; | |
+ $idx[1] = $prop; | |
+ $value[$prop] = CRM_Utils_Array::pathGet($_FILES, $idx); | |
+ } | |
+ return $value; | |
} | |
- return eval($code . " return \$value;\n}\n"); | |
} else { | |
return null; | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/group.php HTML/QuickForm/group.php | |
--- _ORIGINAL_/HTML/QuickForm/group.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/group.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -97,13 +97,15 @@ | |
* @param bool $appendName (optional)whether to change elements' names to | |
* the form $groupName[$elementName] or leave | |
* them as is. | |
+ * @param mixed $attributes (optional)Either a typical HTML attribute string | |
+ * or an associative array. Date format is passed along the attributes. | |
* @since 1.0 | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) | |
+ function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true, $attributes = null) | |
{ | |
- $this->HTML_QuickForm_element($elementName, $elementLabel); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_type = 'group'; | |
if (isset($elements) && is_array($elements)) { | |
$this->setElements($elements); | |
@@ -299,7 +301,7 @@ | |
function toHtml() | |
{ | |
include_once('HTML/QuickForm/Renderer/Default.php'); | |
- $renderer =& new HTML_QuickForm_Renderer_Default(); | |
+ $renderer = new HTML_QuickForm_Renderer_Default(); | |
$renderer->setElementTemplate('{element}'); | |
$this->accept($renderer); | |
return $renderer->toHtml(); | |
@@ -442,7 +444,10 @@ | |
if ($this->_appendName) { | |
$elementName = $element->getName(); | |
if (isset($elementName)) { | |
- $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']'); | |
+ $newName = $name . '['. (strlen($elementName)? $elementName: $key) .']'; | |
+ $newID = str_replace(array(']', '['), array('', '_'), $newName); | |
+ $element->setName($newName); | |
+ $element->updateAttributes( array( 'id' => $newID ) ); | |
} else { | |
$element->setName($name); | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/header.php HTML/QuickForm/header.php | |
--- _ORIGINAL_/HTML/QuickForm/header.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/header.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -47,9 +47,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_header($elementName = null, $text = null) | |
+ function __construct($elementName = null, $text = null) | |
{ | |
- $this->HTML_QuickForm_static($elementName, null, $text); | |
+ parent::__construct($elementName, null, $text); | |
$this->_type = 'header'; | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/hidden.php HTML/QuickForm/hidden.php | |
--- _ORIGINAL_/HTML/QuickForm/hidden.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/hidden.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -52,9 +52,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null) | |
+ function __construct($elementName=null, $value='', $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); | |
+ parent::__construct($elementName, null, $attributes); | |
$this->setType('hidden'); | |
$this->setValue($value); | |
} //end constructor | |
@@ -79,15 +79,15 @@ | |
/** | |
* Accepts a renderer | |
* | |
- * @param HTML_QuickForm_Renderer renderer object | |
- * @param bool $sc1 unused, for signature compatibility | |
- * @param bool $sc2 unused, for signature compatibility | |
+ * @param HTML_QuickForm_Renderer $renderer object | |
+ * @param bool $required Whether an element is required | |
+ * @param string $error An error message associated with an element | |
* @access public | |
* @return void | |
*/ | |
- function accept(&$renderer, $sc1 = false, $sc2 = null) | |
+ function accept(&$renderer, $required=false, $error=null) | |
{ | |
- $renderer->renderHidden($this); | |
+ $renderer->renderHidden($this, $required, $error); | |
} // end func accept | |
// }}} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/hiddenselect.php HTML/QuickForm/hiddenselect.php | |
--- _ORIGINAL_/HTML/QuickForm/hiddenselect.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/hiddenselect.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -56,9 +56,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) | |
{ | |
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_persistantFreeze = true; | |
$this->_type = 'hiddenselect'; | |
if (isset($options)) { | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/hierselect.php HTML/QuickForm/hierselect.php | |
--- _ORIGINAL_/HTML/QuickForm/hierselect.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/hierselect.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -1,56 +1,38 @@ | |
<?php | |
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ | |
+/* vim: set expandtab tabstop=4 shiftwidth=4: */ | |
+// +----------------------------------------------------------------------+ | |
+// | PHP version 4.0 | | |
+// +----------------------------------------------------------------------+ | |
+// | Copyright (c) 1997-2004 The PHP Group | | |
+// +----------------------------------------------------------------------+ | |
+// | This source file is subject to version 2.0 of the PHP license, | | |
+// | that is bundled with this package in the file LICENSE, and is | | |
+// | available at through the world-wide-web at | | |
+// | http://www.php.net/license/2_02.txt. | | |
+// | If you did not receive a copy of the PHP license and are unable to | | |
+// | obtain it through the world-wide-web, please send a note to | | |
+// | license@php.net so we can mail you a copy immediately. | | |
+// +----------------------------------------------------------------------+ | |
+// | Authors: Herim Vasquez <vasquezh@iro.umontreal.ca> | | |
+// | Bertrand Mansion <bmansion@mamasam.com> | | |
+// +----------------------------------------------------------------------+ | |
+// | |
+// $Id: hierselect.php,v 1.12 2004/10/20 10:03:49 avb Exp $ | |
-/** | |
- * 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-2011 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 | |
- */ | |
+require_once('HTML/QuickForm/group.php'); | |
+require_once('HTML/QuickForm/select.php'); | |
/** | |
- * Class for a group of form elements | |
- */ | |
-require_once 'HTML/QuickForm/group.php'; | |
-/** | |
- * Class for <select></select> elements | |
- */ | |
-require_once 'HTML/QuickForm/select.php'; | |
-/** | |
- * Static utility methods | |
- */ | |
-require_once 'HTML/QuickForm/utils.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.16 | |
- * @since 3.1 | |
+ * @version 1.0 | |
+ * @since PHP4.04pl1 | |
+ * @access public | |
*/ | |
class HTML_QuickForm_hierselect extends HTML_QuickForm_group | |
{ | |
@@ -59,7 +41,42 @@ | |
/** | |
* Options for all the select elements | |
* | |
- * @see setOptions() | |
+ * Format is a bit more complex as we need to know which options | |
+ * are related to the ones in the previous select: | |
+ * | |
+ * Ex: | |
+ * // 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 depracated 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)); | |
+ * | |
* @var array | |
* @access private | |
*/ | |
@@ -81,6 +98,11 @@ | |
*/ | |
var $_js = ''; | |
+ /** | |
+ * The javascript array name | |
+ */ | |
+ var $_jsArrayName = ''; | |
+ | |
// }}} | |
// {{{ constructor | |
@@ -96,9 +118,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null) | |
+ function __construct($elementName=null, $elementLabel=null, $attributes=null, $separator=null) | |
{ | |
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, null, null, null, $attributes); | |
$this->_persistantFreeze = true; | |
if (isset($separator)) { | |
$this->_separator = $separator; | |
@@ -114,45 +136,8 @@ | |
* 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 | |
*/ | |
@@ -168,12 +153,13 @@ | |
// 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->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); | |
$this->_nbElements++; | |
} | |
} | |
$this->_setOptions(); | |
+ $this->_setJS(); | |
} // end func setMainOptions | |
// }}} | |
@@ -185,7 +171,6 @@ | |
* @param array $array Options for the first select element | |
* | |
* @access public | |
- * @deprecated Deprecated since release 3.2.2 | |
* @return void | |
*/ | |
function setMainOptions($array) | |
@@ -208,7 +193,6 @@ | |
* @param array $array Options for the second select element | |
* | |
* @access public | |
- * @deprecated Deprecated since release 3.2.2 | |
* @return void | |
*/ | |
function setSecOptions($array) | |
@@ -223,12 +207,13 @@ | |
// 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->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); | |
$this->_nbElements++; | |
} | |
} | |
$this->_setOptions(); | |
+ $this->_setJS(); | |
} // end func setSecOptions | |
// }}} | |
@@ -242,11 +227,11 @@ | |
*/ | |
function _setOptions() | |
{ | |
- $arrayKeys = array(); | |
+ $arrayKeys = []; | |
foreach (array_keys($this->_elements) AS $key) { | |
if (isset($this->_options[$key])) { | |
- if ((empty($arrayKeys)) || HTML_QuickForm_utils::recursiveIsset($this->_options[$key], $arrayKeys)) { | |
- $array = empty($arrayKeys) ? $this->_options[$key] : HTML_QuickForm_utils::recursiveValue($this->_options[$key], $arrayKeys); | |
+ if ((empty($arrayKeys)) || CRM_Utils_Array::pathIsset($this->_options[$key], $arrayKeys)) { | |
+ $array = empty($arrayKeys) ? $this->_options[$key] : CRM_Utils_Array::pathGet($this->_options[$key], $arrayKeys); | |
if (is_array($array)) { | |
$select =& $this->_elements[$key]; | |
$select->_options = array(); | |
@@ -274,10 +259,10 @@ | |
*/ | |
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)); | |
+ // $value could be a string or an array - prior to php 7.2 count handled both, returning 0 for NULL | |
+ // or an empty array. | |
+ // https://stackoverflow.com/questions/20257983/why-the-count-function-returns-1-for-false-and-0-for-null | |
+ $this->_nbElements = is_array($value) ? count($value) : ($value === NULL ? 0 : 1); | |
parent::setValue($value); | |
$this->_setOptions(); | |
} // end func setValue | |
@@ -293,202 +278,196 @@ | |
*/ | |
function _createElements() | |
{ | |
+ //hack to add id attribute for hier select | |
+ $attributes = $this->getAttributes(); | |
+ $id = null; | |
+ if ( isset( $attributes['id'] ) ) { | |
+ $id = "{$attributes['id']}"; | |
+ } | |
+ | |
for ($i = 0; $i < $this->_nbElements; $i++) { | |
- $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); | |
+ if ( isset( $id ) ) { | |
+ $attributes['id'] = "{$id}_{$i}"; | |
+ } | |
+ | |
+ $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $attributes); | |
} | |
} // end func _createElements | |
// }}} | |
- // {{{ toHtml() | |
+ // {{{ _setJS() | |
- function toHtml() | |
+ /** | |
+ * Set the JavaScript for each select element (excluding de main one). | |
+ * | |
+ * @access private | |
+ * @return void | |
+ */ | |
+ function _setJS() | |
{ | |
- $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]) | |
- ); | |
- } | |
+ static $jsArrayName = null; | |
- // create the js function to call | |
- if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) { | |
- $this->_js .= <<<JAVASCRIPT | |
-function _hs_findOptions(ary, keys) | |
-{ | |
- if (ary == undefined) { | |
- return {}; | |
+ $this->_js = $js = ''; | |
+ if ( ! $jsArrayName ) { | |
+ $this->_jsArrayName = 'hs_' . preg_replace('/\[|\]/', '_', $this->getName()); | |
+ for ($i = 1; $i < $this->_nbElements; $i++) { | |
+ $this->_setJSArray($this->_jsArrayName, $this->_options[$i], $js); | |
} | |
- var key = keys.shift(); | |
- if (!key in ary) { | |
- return {}; | |
- } else if (0 == keys.length) { | |
- return ary[key]; | |
+ $jsArrayName = $this->_jsArrayName; | |
} else { | |
- return _hs_findOptions(ary[key], keys); | |
- } | |
+ $this->_jsArrayName = $jsArrayName; | |
} | |
+ } // end func _setJS | |
-function _hs_findSelect(form, groupName, selectIndex) | |
-{ | |
- if (groupName+'['+ selectIndex +']' in form) { | |
- return form[groupName+'['+ selectIndex +']']; | |
- } else { | |
- return form[groupName+'['+ selectIndex +'][]']; | |
- } | |
-} | |
+ // }}} | |
+ // {{{ _setJSArray() | |
-function _hs_unescapeEntities(str) | |
+ /** | |
+ * Recursively builds the JavaScript array defining the options that a select | |
+ * element can have. | |
+ * | |
+ * @param string $grpName Group Name attribute | |
+ * @param array $options Select element options | |
+ * @param string $js JavaScript definition is build using this variable | |
+ * @param string $optValue The value for the current JavaScript option | |
+ * | |
+ * @access private | |
+ * @return void | |
+ */ | |
+ function _setJSArray($grpName, $options, &$js, $optValue = '') | |
{ | |
- var div = document.createElement('div'); | |
- div.innerHTML = str; | |
- return div.childNodes[0] ? div.childNodes[0].nodeValue : ''; | |
+ static $jsNameCache = array( ); | |
+ if (is_array($options)) { | |
+ $js = ''; | |
+ // For a hierselect containing 3 elements: | |
+ // if option 1 has been selected for the 1st element | |
+ // and option 3 has been selected for the 2nd element, | |
+ // then the javascript array containing the values to load | |
+ // on the 3rd element will have the following name: grpName_1_3 | |
+ $name = ($optValue === '') ? $grpName : $grpName.'_'.$optValue; | |
+ foreach($options AS $k => $v) { | |
+ $this->_setJSArray($name, $v, $js, $k); | |
} | |
-function _hs_replaceOptions(ctl, options) | |
-{ | |
- var j = 0; | |
- ctl.options.length = 0; | |
- for (var i = 0; i < options.values.length; i++) { | |
- ctl.options[i] = new Option( | |
- (-1 == String(options.texts[i]).indexOf('&'))? options.texts[i]: _hs_unescapeEntities(options.texts[i]), | |
- options.values[i], false, false | |
- ); | |
- } | |
-} | |
+ // if $js !== '' add it to the JavaScript | |
-function _hs_setValue(ctl, value) | |
-{ | |
- var testValue = {}; | |
- if (value instanceof Array) { | |
- for (var i = 0; i < value.length; i++) { | |
- testValue[value[i]] = true; | |
- } | |
+ if ( $js !== '' ) { | |
+ // check if we have already this js in cache, if so reuse it | |
+ $cacheKey = md5( $js ); | |
+ if ( array_key_exists( $cacheKey, $jsNameCache ) ) { | |
+ $this->_js .= "$name = {$jsNameCache[$cacheKey]}\n"; | |
} 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))); | |
+ $this->_js .= $name." = {\n".$js."\n}\n"; | |
+ $jsNameCache[$cacheKey] = $name; | |
} | |
} | |
- } catch (e) { | |
- if (!(e instanceof TypeError)) { | |
- throw e; | |
- } | |
+ $js = ''; | |
+ } else { | |
+ // $js empty means that we are adding the first element to the JavaScript. | |
+ if ($js != '') { | |
+ $js .= ",\n"; | |
} | |
+ $js .= '"'.$optValue.'":'.json_encode($options, JSON_UNESCAPED_UNICODE); | |
} | |
} | |
-function _hs_setupOnReset(form, groupNames) | |
-{ | |
- setTimeout(function() { _hs_onReset(form, groupNames); }, 25); | |
-} | |
+ // }}} | |
+ // {{{ toHtml() | |
-function _hs_onReload() | |
+ /** | |
+ * Returns Html for the group | |
+ * | |
+ * @access public | |
+ * @return string | |
+ */ | |
+ function toHtml() | |
{ | |
- 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; | |
+ if ($this->_flagFrozen) { | |
+ $this->_js = ''; | |
+ } else { | |
+ // set the onchange attribute for each element | |
+ $keys = array_keys($this->_elements); | |
+ $nbElements = count($keys); | |
+ $nbElementsUsingFnc = $nbElements - 1; // last element doesn't need it | |
+ for ($i = 0; $i < $nbElementsUsingFnc; $i++) { | |
+ $select =& $this->_elements[$keys[$i]]; | |
+ $select->updateAttributes( | |
+ array('onChange' => 'swapOptions(this.form, \''.$this->getName().'\', '.$keys[$i].', '.$nbElements.', \''.$this->_jsArrayName.'\');') | |
+ ); | |
} | |
-window.onload = _hs_onReload; | |
- | |
-var _hs_options = {}; | |
-var _hs_defaults = {}; | |
-JAVASCRIPT; | |
+ // create the js function to call | |
+ if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) { | |
+ $this->_js .= "function swapOptions(frm, grpName, eleIndex, nbElements, arName)\n" | |
+ ."{\n" | |
+ ." var n = \"\";\n" | |
+ ." var ctl;\n\n" | |
+ ." for (var i = 0; i < nbElements; i++) {\n" | |
+ ." ctl = frm[grpName+'['+i+']'];\n" | |
+ ." if (!ctl) {\n" | |
+ ." ctl = frm[grpName+'['+i+'][]'];\n" | |
+ ." }\n" | |
+ ." if (i <= eleIndex) {\n" | |
+ ." n += \"_\"+ctl.value;\n" | |
+ ." } else {\n" | |
+ ." ctl.length = 0;\n" | |
+ ." }\n" | |
+ ." }\n\n" | |
+ ." var t = eval(\"typeof(\"+arName + n +\")\");\n" | |
+ ." if (t != 'undefined') {\n" | |
+ ." var the_array = eval(arName+n);\n" | |
+ ." var j = 0;\n" | |
+ ." n = eleIndex + 1;\n" | |
+ ." ctl = frm[grpName+'['+ n +']'];\n" | |
+ ." if (!ctl) {\n" | |
+ ." ctl = frm[grpName+'['+ n +'][]'];\n" | |
+ ." }\n" | |
+ ." ctl.style.display = 'inline';\n" | |
+ ." for (var i in the_array) {\n" | |
+ ." opt = new Option(the_array[i], i, false, false);\n" | |
+ ." ctl.options[j++] = opt;\n" | |
+ ." }\n" | |
+ ." } else {\n" | |
+ ." n = eleIndex + 1;\n" | |
+ ." ctl = frm[grpName+'['+n+']'];\n" | |
+ ." if (!ctl) {\n" | |
+ ." ctl = frm[grpName+'['+ n +'][]'];\n" | |
+ ." }\n" | |
+ ." if (ctl) {\n" | |
+ ." ctl.style.display = 'none';\n" | |
+ ." }\n" | |
+ ." }\n" | |
+ ." if (eleIndex+1 < nbElements) {\n" | |
+ ." swapOptions(frm, grpName, eleIndex+1, nbElements, arName);\n" | |
+ ." }\n" | |
+ ."}\n"; | |
define('HTML_QUICKFORM_HIERSELECT_EXISTS', true); | |
} | |
- // option lists | |
- $jsParts = array(); | |
- for ($i = 1; $i < $this->_nbElements; $i++) { | |
- $jsParts[] = $this->_convertArrayToJavascript($this->_prepareOptions($this->_options[$i], $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) . ";\n"; | |
} | |
include_once('HTML/QuickForm/Renderer/Default.php'); | |
- $renderer =& new HTML_QuickForm_Renderer_Default(); | |
+ $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])); | |
- } | |
+ $result = null; | |
+ if ( ! empty( $this->_js ) ) { | |
+ $result .= "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>"; | |
} | |
- return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") . | |
+ return $result . | |
$renderer->toHtml(); | |
} // end func toHtml | |
// }}} | |
// {{{ accept() | |
+ /** | |
+ * Accepts a renderer | |
+ * | |
+ * @param object An HTML_QuickForm_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) | |
{ | |
$renderer->renderElement($this, $required, $error); | |
@@ -504,147 +483,10 @@ | |
// 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; | |
+ return parent::onQuickFormEvent($event, $arg, $caller); | |
} | |
} // end func onQuickFormEvent | |
// }}} | |
- // {{{ _prepareOptions() | |
- | |
- /** | |
- * Prepares options for JS encoding | |
- * | |
- * We need to preserve order of options when adding them via javascript, so | |
- * cannot use object literal and for/in loop (see bug #16603). Therefore we | |
- * convert an associative array of options to two arrays of their values | |
- * and texts. Backport from HTML_QuickForm2. | |
- * | |
- * @param array Options array | |
- * @param int Depth within options array | |
- * @link http://pear.php.net/bugs/bug.php?id=16603 | |
- * @return array | |
- * @access private | |
- */ | |
- function _prepareOptions($ary, $depth) | |
- { | |
- if (!is_array($ary)) { | |
- $ret = $ary; | |
- } elseif (0 == $depth) { | |
- $ret = array('values' => array_keys($ary), 'texts' => array_values($ary)); | |
- } else { | |
- $ret = array(); | |
- foreach ($ary as $k => $v) { | |
- $ret[$k] = $this->_prepareOptions($v, $depth - 1); | |
- } | |
- } | |
- return $ret; | |
- } | |
- | |
- // }}} | |
- // {{{ _convertArrayToJavascript() | |
- | |
- /** | |
- * Converts PHP array to its Javascript analog | |
- * | |
- * @access private | |
- * @param array PHP array to convert | |
- * @return string Javascript representation of the value | |
- */ | |
- function _convertArrayToJavascript($array) | |
- { | |
- if (!is_array($array)) { | |
- return $this->_convertScalarToJavascript($array); | |
- } elseif (count($array) && array_keys($array) != range(0, count($array) - 1)) { | |
- return '{' . implode(',', array_map( | |
- array($this, '_encodeNameValue'), | |
- array_keys($array), array_values($array) | |
- )) . '}'; | |
- } else { | |
- return '[' . implode(',', array_map( | |
- array($this, '_convertArrayToJavascript'), | |
- $array | |
- )) . ']'; | |
- } | |
- } | |
- | |
- // }}} | |
- // {{{ _encodeNameValue() | |
- | |
- /** | |
- * Callback for array_map used to generate JS name-value pairs | |
- * | |
- * @param mixed | |
- * @param mixed | |
- * @return string | |
- */ | |
- function _encodeNameValue($name, $value) | |
- { | |
- return $this->_convertScalarToJavascript((string)$name) . ':' | |
- . $this->_convertArrayToJavascript($value); | |
- } | |
- | |
- // }}} | |
- // {{{ _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 -ruwN _ORIGINAL_/HTML/QuickForm/html.php HTML/QuickForm/html.php | |
--- _ORIGINAL_/HTML/QuickForm/html.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/html.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -50,9 +50,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_html($text = null) | |
+ function __construct($text = null) | |
{ | |
- $this->HTML_QuickForm_static(null, null, $text); | |
+ parent::__construct(null, null, $text); | |
$this->_type = 'html'; | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/image.php HTML/QuickForm/image.php | |
--- _ORIGINAL_/HTML/QuickForm/image.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/image.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -52,9 +52,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_image($elementName=null, $src='', $attributes=null) | |
+ function __construct($elementName=null, $src='', $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); | |
+ parent::__construct($elementName, null, $attributes); | |
$this->setType('image'); | |
$this->setSource($src); | |
} // end class constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/input.php HTML/QuickForm/input.php | |
--- _ORIGINAL_/HTML/QuickForm/input.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/input.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -52,9 +52,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $attributes=null) | |
{ | |
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
} //end constructor | |
// }}} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/link.php HTML/QuickForm/link.php | |
--- _ORIGINAL_/HTML/QuickForm/link.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/link.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -65,9 +65,9 @@ | |
* @return void | |
* @throws | |
*/ | |
- function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null) | |
{ | |
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_persistantFreeze = false; | |
$this->_type = 'link'; | |
$this->setHref($href); | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Page.php HTML/QuickForm/Page.php | |
--- _ORIGINAL_/HTML/QuickForm/Page.php 2021-08-25 09:24:31.906785905 +1000 | |
+++ HTML/QuickForm/Page.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -16,9 +16,9 @@ | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
* @author Bertrand Mansion <bmansion@mamasam.com> | |
- * @copyright 2003-2009 The PHP Group | |
+ * @copyright 2003-2007 The PHP Group | |
* @license http://www.php.net/license/3_01.txt PHP License 3.01 | |
- * @version SVN: $Id: Page.php 289084 2009-10-02 06:53:09Z avb $ | |
+ * @version CVS: $Id: Page.php,v 1.7 2007/05/18 09:34:18 avb Exp $ | |
* @link http://pear.php.net/package/HTML_QuickForm_Controller | |
*/ | |
@@ -38,7 +38,7 @@ | |
* @package HTML_QuickForm_Controller | |
* @author Alexey Borzov <avb@php.net> | |
* @author Bertrand Mansion <bmansion@mamasam.com> | |
- * @version Release: 1.0.10 | |
+ * @version Release: 1.0.9 | |
*/ | |
class HTML_QuickForm_Page extends HTML_QuickForm | |
{ | |
@@ -66,9 +66,9 @@ | |
* | |
* @access public | |
*/ | |
- function HTML_QuickForm_Page($formName, $method = 'post', $target = '', $attributes = null) | |
+ function __construct($formName, $method = 'post', $target = '', $attributes = null) | |
{ | |
- $this->HTML_QuickForm($formName, $method, '', $target, $attributes); | |
+ parent::__construct($formName, $method, '', $target, $attributes); | |
} | |
@@ -112,10 +112,14 @@ | |
* @param string Name of the action | |
* @return string "name" attribute for a submit button | |
*/ | |
- function getButtonName($actionName) | |
+ function getButtonName($actionName, $subActionName = null) | |
{ | |
+ if ( $subActionName != null ) { | |
+ return '_qf_' . $this->getAttribute('id') . '_' . $actionName . '_' . $subActionName; | |
+ } else { | |
return '_qf_' . $this->getAttribute('id') . '_' . $actionName; | |
} | |
+ } | |
/** | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/password.php HTML/QuickForm/password.php | |
--- _ORIGINAL_/HTML/QuickForm/password.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/password.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -53,9 +53,9 @@ | |
* @return void | |
* @throws | |
*/ | |
- function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->setType('password'); | |
} //end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/radio.php HTML/QuickForm/radio.php | |
--- _ORIGINAL_/HTML/QuickForm/radio.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/radio.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -64,16 +64,31 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null) | |
{ | |
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
if (isset($value)) { | |
$this->setValue($value); | |
} | |
$this->_persistantFreeze = true; | |
$this->setType('radio'); | |
$this->_text = $text; | |
- $this->_generateId(); | |
+ // $this->_generateId(); | |
+ if ( ! $this->getAttribute('id') ) { | |
+ //hack to add 'id' for radio | |
+ static $idTextStr = 1; | |
+ if (!empty($attributes['id_suffix'])) { | |
+ $idSuffix = $attributes['id_suffix']; | |
+ $this->removeAttribute('id_suffix'); | |
+ } | |
+ else { | |
+ $idSuffix = $idTextStr; | |
+ $idTextStr++; | |
+ } | |
+ | |
+ $this->updateAttributes( array('id' => CRM_Utils_String::munge( "CIVICRM_QFID_{$value}_{$idSuffix}" ) ) ); | |
+ } | |
} //end constructor | |
// }}} | |
@@ -202,11 +217,13 @@ | |
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) { | |
+ // we should retrieve value from submitted values when form is submitted, | |
+ // else set value from defaults values | |
+ if ( $caller->isSubmitted( ) ) { | |
$value = $this->_findValue($caller->_submitValues); | |
- if (null === $value) { | |
+ } else { | |
$value = $this->_findValue($caller->_defaultValues); | |
} | |
} | |
@@ -239,7 +256,10 @@ | |
{ | |
$value = $this->_findValue($submitValues); | |
if (null === $value) { | |
- $value = $this->getChecked()? $this->getValue(): null; | |
+ // fix to return blank value when all radio's are unselected / not selected | |
+ // always use submitted values rather than defaults | |
+ //$value = $this->getChecked()? $this->getValue(): null; | |
+ $value = ''; | |
} elseif ($value != $this->getValue()) { | |
$value = null; | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/Array.php HTML/QuickForm/Renderer/Array.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/Array.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/Array.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -168,9 +168,9 @@ | |
* @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) | |
+ function __construct($collectHidden = false, $staticLabels = false) | |
{ | |
- $this->HTML_QuickForm_Renderer(); | |
+ parent::__construct(); | |
$this->_collectHidden = $collectHidden; | |
$this->_staticLabels = $staticLabels; | |
} // end constructor | |
@@ -226,12 +226,16 @@ | |
} // end func renderElement | |
- function renderHidden(&$element) | |
+ function renderHidden(&$element, $required = FALSE, $error = FALSE) | |
{ | |
if ($this->_collectHidden) { | |
+ // add to error array | |
+ if (!empty($error)) { | |
+ $this->_ary['errors']['hidden'] = $error; | |
+ } | |
$this->_ary['hidden'] .= $element->toHtml() . "\n"; | |
} else { | |
- $this->renderElement($element, false, null); | |
+ $this->renderElement($element, $required, $error); | |
} | |
} // end func renderHidden | |
@@ -271,6 +275,12 @@ | |
'required' => $required, | |
'error' => $error | |
); | |
+ | |
+ $id = $element->getAttribute('id'); | |
+ if ( $id ) { | |
+ $ret['id'] = $id; | |
+ } | |
+ | |
// render label(s) | |
$labels = $element->getLabel(); | |
if (is_array($labels) && $this->_staticLabels) { | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ArraySmarty.php HTML/QuickForm/Renderer/ArraySmarty.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/ArraySmarty.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/ArraySmarty.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -136,9 +136,9 @@ | |
* @param bool true: collect all hidden elements into string; false: process them as usual form elements | |
* @access public | |
*/ | |
- function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false, $collectHidden = true) | |
+ function __construct(&$tpl, $staticLabels = false, $collectHidden = true) | |
{ | |
- $this->HTML_QuickForm_Renderer_Array($collectHidden, $staticLabels); | |
+ parent::__construct($collectHidden, $staticLabels); | |
$this->_tpl =& $tpl; | |
} // end constructor | |
@@ -257,15 +257,14 @@ | |
function _storeArray($elAry) | |
{ | |
if ($elAry) { | |
- $sKeys = $elAry['keys']; | |
+ $keys = explode('][', substr(str_replace(["['", "']", '["', '"]'], ['[', ']', '[', ']'], $elAry['keys']), 1, -1)); | |
unset($elAry['keys']); | |
// where should we put this element... | |
if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) { | |
- $toEval = '$this->_currentGroup' . $sKeys . ' = $elAry;'; | |
+ CRM_Utils_Array::pathSet($this->_currentGroup, $keys, $elAry); | |
} else { | |
- $toEval = '$this->_ary' . $sKeys . ' = $elAry;'; | |
+ CRM_Utils_Array::pathSet($this->_ary, $keys, $elAry); | |
} | |
- eval($toEval); | |
} | |
return; | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/Default.php HTML/QuickForm/Renderer/Default.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/Default.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/Default.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -152,9 +152,9 @@ | |
* | |
* @access public | |
*/ | |
- function HTML_QuickForm_Renderer_Default() | |
+ function __construct() | |
{ | |
- $this->HTML_QuickForm_Renderer(); | |
+ parent::__construct(); | |
} // end constructor | |
/** | |
@@ -291,6 +291,10 @@ | |
*/ | |
function renderElement(&$element, $required, $error) | |
{ | |
+ // make sure that all elements are id'ed even in a group! | |
+ | |
+ CRM_Core_Form_Renderer::updateAttributes( $element, $required, $error ); | |
+ | |
if (!$this->_inGroup) { | |
$html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error); | |
$this->_html .= str_replace('{element}', $element->toHtml(), $html); | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ITDynamic.php HTML/QuickForm/Renderer/ITDynamic.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/ITDynamic.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/ITDynamic.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -97,9 +97,9 @@ | |
* | |
* @param HTML_Template_ITX|HTML_Template_Sigma Template object to use | |
*/ | |
- function HTML_QuickForm_Renderer_ITDynamic(&$tpl) | |
+ function __construct(&$tpl) | |
{ | |
- $this->HTML_QuickForm_Renderer(); | |
+ parent::__construct(); | |
$this->_tpl =& $tpl; | |
$this->_tpl->setCurrentBlock('qf_main_loop'); | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ITStatic.php HTML/QuickForm/Renderer/ITStatic.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/ITStatic.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/ITStatic.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -112,9 +112,9 @@ | |
* | |
* @param HTML_Template_IT|HTML_Template_Sigma Template object to use | |
*/ | |
- function HTML_QuickForm_Renderer_ITStatic(&$tpl) | |
+ function __construct(&$tpl) | |
{ | |
- $this->HTML_QuickForm_Renderer(); | |
+ parent::__construct(); | |
$this->_tpl =& $tpl; | |
} // end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ObjectFlexy.php HTML/QuickForm/Renderer/ObjectFlexy.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/ObjectFlexy.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/ObjectFlexy.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -104,9 +104,9 @@ | |
* @param HTML_Template_Flexy template object to use | |
* @public | |
*/ | |
- function HTML_QuickForm_Renderer_ObjectFlexy(&$flexy) | |
+ function __construct(&$flexy) | |
{ | |
- $this->HTML_QuickForm_Renderer_Object(true); | |
+ parent::__construct(true); | |
$this->_obj = new QuickformFlexyForm(); | |
$this->_flexy =& $flexy; | |
} // end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/Object.php HTML/QuickForm/Renderer/Object.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/Object.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/Object.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -92,9 +92,9 @@ | |
* @param bool true: collect all hidden elements | |
* @access public | |
*/ | |
- function HTML_QuickForm_Renderer_Object($collecthidden = false) | |
+ function __construct($collecthidden = false) | |
{ | |
- $this->HTML_QuickForm_Renderer(); | |
+ parent::__construct(); | |
$this->_collectHidden = $collecthidden; | |
$this->_obj = new QuickformForm; | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/QuickHtml.php HTML/QuickForm/Renderer/QuickHtml.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer/QuickHtml.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer/QuickHtml.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -59,9 +59,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_Renderer_QuickHtml() | |
+ function __construct() | |
{ | |
- $this->HTML_QuickForm_Renderer_Default(); | |
+ parent::__construct(); | |
// The default templates aren't used for this renderer | |
$this->clearAllTemplates(); | |
} // end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer.php HTML/QuickForm/Renderer.php | |
--- _ORIGINAL_/HTML/QuickForm/Renderer.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Renderer.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -40,7 +40,7 @@ | |
* | |
* @access public | |
*/ | |
- function HTML_QuickForm_Renderer() | |
+ function __construct() | |
{ | |
} // end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/reset.php HTML/QuickForm/reset.php | |
--- _ORIGINAL_/HTML/QuickForm/reset.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/reset.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -52,9 +52,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null) | |
+ function __construct($elementName=null, $value=null, $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); | |
+ parent::__construct($elementName, null, $attributes); | |
$this->setValue($value); | |
$this->setType('reset'); | |
} //end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/Rule/Required.php HTML/QuickForm/Rule/Required.php | |
--- _ORIGINAL_/HTML/QuickForm/Rule/Required.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/Rule/Required.php 2021-05-23 06:58:15.325915587 +1000 | |
@@ -48,7 +48,28 @@ | |
function validate($value, $options = null) | |
{ | |
if (is_array($value)) { | |
- return (bool) $value; | |
+ // check if file type, if so permit empty type | |
+ $fileType = | |
+ array_key_exists( 'name', $value ) && | |
+ array_key_exists( 'tmp_name', $value ); | |
+ // hack to fix required issue with advcheckbox, but in general if any value is present then | |
+ // it should pass required check | |
+ $return = false; | |
+ foreach ( $value as $k => $v ) { | |
+ // dont check type field. Safari3 Beta does not set this | |
+ if ( $fileType && $k == 'type' ) { | |
+ continue; | |
+ } | |
+ if ( is_array($v) ) { | |
+ if ( $v ) { | |
+ $return = true; | |
+ } | |
+ } | |
+ elseif ( ( string ) $v != '' ) { | |
+ $return = true; | |
+ } | |
+ } | |
+ return $return; | |
} else if ((string)$value == '') { | |
return false; | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/RuleRegistry.php HTML/QuickForm/RuleRegistry.php | |
--- _ORIGINAL_/HTML/QuickForm/RuleRegistry.php 2021-08-25 09:24:31.890785757 +1000 | |
+++ HTML/QuickForm/RuleRegistry.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -54,7 +54,7 @@ | |
* @static | |
* @return HTML_QuickForm_RuleRegistry | |
*/ | |
- function &singleton() | |
+ static function &singleton() | |
{ | |
static $obj; | |
if (!isset($obj)) { | |
@@ -125,7 +125,7 @@ | |
if (!empty($path)) { | |
include_once($path); | |
} | |
- $this->_rules[$class] =& new $class(); | |
+ $this->_rules[$class] = new $class(); | |
} | |
$this->_rules[$class]->setName($ruleName); | |
return $this->_rules[$class]; | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/select.php HTML/QuickForm/select.php | |
--- _ORIGINAL_/HTML/QuickForm/select.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/select.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -75,9 +75,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) | |
{ | |
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_persistantFreeze = true; | |
$this->_type = 'select'; | |
if (isset($options)) { | |
@@ -403,7 +403,7 @@ | |
{ | |
if (is_string($conn)) { | |
require_once('DB.php'); | |
- $dbConn = &DB::connect($conn, true); | |
+ $dbConn = DB::connect($conn, true); | |
if (DB::isError($dbConn)) { | |
return $dbConn; | |
} | |
@@ -521,14 +521,16 @@ | |
$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']; | |
+ if ( $val || is_numeric($val) ) { | |
+ foreach ($this->_options as $oKey => $oVal ) { | |
+ if (0 == strcmp($val, $this->_options[$oKey]['attr']['value'])) { | |
+ $value[$key] = $oVal['text']; | |
break; | |
} | |
} | |
} | |
} | |
+ } | |
$html = empty($value)? ' ': join('<br />', $value); | |
if ($this->_persistantFreeze) { | |
$name = $this->getPrivateName(); | |
@@ -561,7 +563,9 @@ | |
{ | |
$value = $this->_findValue($submitValues); | |
if (is_null($value)) { | |
- $value = $this->getValue(); | |
+ // if value is null, default value is set for advselect | |
+ // fix for CRM-1431 - kurund | |
+ //$value = $this->getValue(); | |
} elseif(!is_array($value)) { | |
$value = array($value); | |
} | |
@@ -576,10 +580,19 @@ | |
} | |
} | |
} else { | |
+ //if value is null make it empty array, checked most of | |
+ // the stuff, value is null for advselect | |
+ // fix for CRM-1431 - kurund | |
+ if (is_null($value)) { | |
+ $cleanValue = array(); | |
+ } else { | |
$cleanValue = $value; | |
} | |
+ } | |
if (is_array($cleanValue) && !$this->getMultiple()) { | |
+ if ( isset( $cleanValue[0] ) ) { | |
return $this->_prepareValue($cleanValue[0], $assoc); | |
+ } | |
} else { | |
return $this->_prepareValue($cleanValue, $assoc); | |
} | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/static.php HTML/QuickForm/static.php | |
--- _ORIGINAL_/HTML/QuickForm/static.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/static.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -57,9 +57,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null) | |
+ function __construct($elementName=null, $elementLabel=null, $text=null) | |
{ | |
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel); | |
+ parent::__construct($elementName, $elementLabel); | |
$this->_persistantFreeze = false; | |
$this->_type = 'static'; | |
$this->_text = $text; | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/submit.php HTML/QuickForm/submit.php | |
--- _ORIGINAL_/HTML/QuickForm/submit.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/submit.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -51,9 +51,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null) | |
+ function __construct($elementName=null, $value=null, $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes); | |
+ parent::__construct($elementName, null, $attributes); | |
$this->setValue($value); | |
$this->setType('submit'); | |
} //end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/textarea.php HTML/QuickForm/textarea.php | |
--- _ORIGINAL_/HTML/QuickForm/textarea.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/textarea.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -62,9 +62,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $attributes=null) | |
{ | |
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_persistantFreeze = true; | |
$this->_type = 'textarea'; | |
} //end constructor | |
@@ -197,7 +197,7 @@ | |
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)/", '
', htmlspecialchars($this->_value)) . | |
+ preg_replace("/(\r\n|\n|\r)/", '
', htmlspecialchars($this->_value)) . | |
'</textarea>'; | |
} | |
} //end func toHtml | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/text.php HTML/QuickForm/text.php | |
--- _ORIGINAL_/HTML/QuickForm/text.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/text.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -53,9 +53,9 @@ | |
* @access public | |
* @return void | |
*/ | |
- function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null) | |
+ function __construct($elementName=null, $elementLabel=null, $attributes=null) | |
{ | |
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes); | |
+ parent::__construct($elementName, $elementLabel, $attributes); | |
$this->_persistantFreeze = true; | |
$this->setType('text'); | |
} //end constructor | |
diff -ruwN _ORIGINAL_/HTML/QuickForm/xbutton.php HTML/QuickForm/xbutton.php | |
--- _ORIGINAL_/HTML/QuickForm/xbutton.php 2021-08-25 09:24:31.894785793 +1000 | |
+++ HTML/QuickForm/xbutton.php 2021-05-23 06:58:15.329915618 +1000 | |
@@ -52,9 +52,9 @@ | |
* @param mixed Either a typical HTML attribute string or an associative array | |
* @access public | |
*/ | |
- function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null) | |
+ function __construct($elementName = null, $elementContent = null, $attributes = null) | |
{ | |
- $this->HTML_QuickForm_element($elementName, null, $attributes); | |
+ parent::__construct($elementName, null, $attributes); | |
$this->setContent($elementContent); | |
$this->setPersistantFreeze(false); | |
$this->_type = 'xbutton'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment