cvs: pear(QUICKFORM_3_1_STABLE) /HTML_QuickForm/QuickForm advcheckbox.php date.php hierselect.php select.php

From: Date: Tue, 09 Sep 2003 13:30:34 +0000
Subject: cvs: pear(QUICKFORM_3_1_STABLE) /HTML_QuickForm/QuickForm advcheckbox.php date.php hierselect.php select.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-12574@lists.php.net to get a copy of this message
avb Tue Sep 9 09:30:34 2003 EDT Modified files: (Branch: QUICKFORM_3_1_STABLE) /pear/HTML_QuickForm/QuickForm advcheckbox.php date.php hierselect.php select.php Log: Moved misc. elements fixes and additions from HEAD to stable branch Index: pear/HTML_QuickForm/QuickForm/advcheckbox.php diff -u pear/HTML_QuickForm/QuickForm/advcheckbox.php:1.9 pear/HTML_QuickForm/QuickForm/advcheckbox.php:1.9.2.1 --- pear/HTML_QuickForm/QuickForm/advcheckbox.php:1.9 Wed Jun 18 15:36:20 2003 +++ pear/HTML_QuickForm/QuickForm/advcheckbox.php Tue Sep 9 09:30:34 2003 @@ -17,7 +17,7 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: advcheckbox.php,v 1.9 2003/06/18 19:36:20 avb Exp $ +// $Id: advcheckbox.php,v 1.9.2.1 2003/09/09 13:30:34 avb Exp $ require_once('HTML/QuickForm/checkbox.php'); @@ -192,7 +192,7 @@ $oldJs = $this->getAttribute('onclick'); $this->updateAttributes(array( 'name' => $this->getPrivateName($oldName), - 'onclick' => $oldJs . $this->getOnclickJs($oldName) + 'onclick' => $this->getOnclickJs($oldName) . ' ' . $oldJs )); $html = parent::toHtml() . '<input type="hidden" name="' . $oldName . '" value="' . $this->_values[$this->getChecked()? 1: 0] . '" />'; Index: pear/HTML_QuickForm/QuickForm/date.php diff -u pear/HTML_QuickForm/QuickForm/date.php:1.28 pear/HTML_QuickForm/QuickForm/date.php:1.28.2.1 --- pear/HTML_QuickForm/QuickForm/date.php:1.28 Sat Jul 19 04:53:39 2003 +++ pear/HTML_QuickForm/QuickForm/date.php Tue Sep 9 09:30:34 2003 @@ -18,7 +18,7 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: date.php,v 1.28 2003/07/19 08:53:39 mansion Exp $ +// $Id: date.php,v 1.28.2.1 2003/09/09 13:30:34 avb Exp $ require_once 'HTML/QuickForm/group.php'; require_once 'HTML/QuickForm/select.php'; @@ -58,15 +58,22 @@ * A => AM/PM * 'minYear': Minimum year in year select * 'maxYear': Maximum year in year select + * 'addEmptyOption': Should an empty option be added to the top of + * each select box? + * 'emptyOptionVal': The value passed by the empty option. + * 'emptyOptionText': The text displayed for the empty option. * * @access private * @var array */ var $_options = array( - 'language' => 'en', - 'format' => 'dMY', - 'minYear' => 2001, - 'maxYear' => 2010 + 'language' => 'en', + 'format' => 'dMY', + 'minYear' => 2001, + 'maxYear' => 2010, + 'addEmptyOption' => false, + 'emptyOptionValue' => '', + 'emptyOptionText' => '&nbsp;', ); /** @@ -153,6 +160,12 @@ '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', 'Ferbruá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') ) ); @@ -267,6 +280,11 @@ $this->_wrap[0] = $separator; } $separator = ''; + // Should we add an empty option to the top of the select? + if ($this->_options['addEmptyOption']) { + // Preserve the keys + $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options; + } $this->_elements[] =& new HTML_QuickForm_select($sign, null, $options, $this->getAttributes()); } } @@ -356,4 +374,4 @@ // }}} } -?> \ No newline at end of file +?> Index: pear/HTML_QuickForm/QuickForm/hierselect.php diff -u pear/HTML_QuickForm/QuickForm/hierselect.php:1.2 pear/HTML_QuickForm/QuickForm/hierselect.php:1.2.2.1 --- pear/HTML_QuickForm/QuickForm/hierselect.php:1.2 Sat Jul 5 12:05:57 2003 +++ pear/HTML_QuickForm/QuickForm/hierselect.php Tue Sep 9 09:30:34 2003 @@ -16,7 +16,7 @@ // | Author: Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: hierselect.php,v 1.2 2003/07/05 16:05:57 mansion Exp $ +// $Id: hierselect.php,v 1.2.2.1 2003/09/09 13:30:34 avb Exp $ require_once('HTML/QuickForm/group.php'); require_once('HTML/QuickForm/select.php'); @@ -172,10 +172,15 @@ function setValue($value) { parent::setValue($value); + // Reload the options in the second selects if (sizeof($this->_secOptions) > 0) { if (is_array($value)) { - $curKey = isset($this->_secOptions[$value[0][0]]) ? $value[0][0] : key($this->_secOptions); + if (isset($this->_secOptions[$value[0]][$value[1]])) { + $curKey = $value[0]; + } else { + $curKey = key($this->_secOptions); + } } else { $curKey = key($this->_secOptions); } @@ -249,6 +254,20 @@ { $renderer->renderElement($this, $required, $error); } // end func accept + + // }}} + // {{{ onQuickFormEvent() + + function onQuickFormEvent($event, $arg, &$caller) + { + if ('updateValue' == $event) { + // we need to call setValue() so that the secondary option + // matches the main option + return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller); + } else { + return parent::onQuickFormEvent($event, $arg, $caller); + } + } // end func onQuickFormEvent // }}} } // end class HTML_QuickForm_hierselect Index: pear/HTML_QuickForm/QuickForm/select.php diff -u pear/HTML_QuickForm/QuickForm/select.php:1.21 pear/HTML_QuickForm/QuickForm/select.php:1.21.2.1 --- pear/HTML_QuickForm/QuickForm/select.php:1.21 Fri Jul 4 14:55:36 2003 +++ pear/HTML_QuickForm/QuickForm/select.php Tue Sep 9 09:30:34 2003 @@ -17,7 +17,7 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: select.php,v 1.21 2003/07/04 18:55:36 avb Exp $ +// $Id: select.php,v 1.21.2.1 2003/09/09 13:30:34 avb Exp $ require_once('HTML/QuickForm/element.php'); @@ -486,7 +486,7 @@ $strHtml .= $tabs . '<select' . $attrString . ">\n"; foreach ($this->_options as $option) { - if (is_array($this->_values) && in_array($option['attr']['value'], $this->_values)) { + if (is_array($this->_values) && in_array((string)$option['attr']['value'], $this->_values)) { $this->_updateAttrArray($option['attr'], array('selected' => 'selected')); } $strHtml .= $tabs . "\t<option" . $this->_getAttrString($option['attr']) . '>' .

« previous php.pear.cvs (#12574) next »