From: <gem...@li...> - 2011-11-04 11:18:31
|
Revision: 181 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=181&view=rev Author: matijsdejong Date: 2011-11-04 11:18:25 +0000 (Fri, 04 Nov 2011) Log Message: ----------- Small fix in attributes used with a text area Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-04 09:59:31 UTC (rev 180) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-04 11:18:25 UTC (rev 181) @@ -112,31 +112,6 @@ return $element; } - public static function applyFixedOptions($type, array &$options) - { - static $typeOptions; - - if (! $typeOptions) { - $typeOptions = Zend_Registry::get('MUtil_Model_FormBridge'); - } - - if (substr($type, 0, 3) == 'add') { - $type = strtolower(substr($type, 3)); - } - // MUtil_Echo::rs($type, $options); - - if (isset($typeOptions[$type])) { - foreach ($typeOptions[$type] as $key => $value) { - if (is_array($value) && isset($options[$key])) { - $options[$key] = $value + $options[$key]; - } else { - $options[$key] = $value; - } - } - } - // MUtil_Echo::rs('After', $options, $typeOptions); - } - protected function _applyValidators($name, Zend_Form_Element $element) { $validators = $this->model->get($name, 'validators'); @@ -656,6 +631,8 @@ self::DISPLAY_OPTIONS, self::TEXT_OPTIONS, self::TEXTAREA_OPTIONS); $stringlength = $this->_getStringLength($options); + // Remove as size and maxlength are not used for textarea's + unset($options['size'], $options['maxlength']); $element = new Zend_Form_Element_Textarea($name, $options); @@ -682,6 +659,31 @@ return $this; } + public static function applyFixedOptions($type, array &$options) + { + static $typeOptions; + + if (! $typeOptions) { + $typeOptions = Zend_Registry::get('MUtil_Model_FormBridge'); + } + + if (substr($type, 0, 3) == 'add') { + $type = strtolower(substr($type, 3)); + } + // MUtil_Echo::rs($type, $options); + + if (isset($typeOptions[$type])) { + foreach ($typeOptions[$type] as $key => $value) { + if (is_array($value) && isset($options[$key])) { + $options[$key] = $value + $options[$key]; + } else { + $options[$key] = $value; + } + } + } + // MUtil_Echo::rs('After', $options, $typeOptions); + } + /** * * @return Zend_Form This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-01-23 08:33:06
|
Revision: 414 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=414&view=rev Author: mennodekker Date: 2012-01-23 08:33:00 +0000 (Mon, 23 Jan 2012) Log Message: ----------- Fixed missing 'password' element while the 'repeat password' element was visible (introduced in [394]) Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-01-20 17:06:04 UTC (rev 413) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-01-23 08:33:00 UTC (rev 414) @@ -477,6 +477,7 @@ $element = new Zend_Form_Element_Password($name, $options); $this->_applyValidators($name, $element); + $this->form->addElement($element); if ($stringlength) { $element->addValidator('StringLength', true, $stringlength); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-18 14:35:22
|
Revision: 690 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=690&view=rev Author: michieltcs Date: 2012-05-18 14:35:15 +0000 (Fri, 18 May 2012) Log Message: ----------- Call _mergeOptions after the local parameters are filled Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-05-18 13:56:46 UTC (rev 689) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-05-18 14:35:15 UTC (rev 690) @@ -426,14 +426,14 @@ $options = func_get_args(); $options = MUtil_Ra::pairs($options, 1); - $options = $this->_mergeOptions($name, $options, - self::DISPLAY_OPTIONS, self::FILE_OPTIONS, self::TEXT_OPTIONS); - $filename = $this->_moveOption('filename', $options); $count = $this->_moveOption('count', $options); $size = $this->_moveOption('size', $options); $extension = $this->_moveOption('extension', $options); + $options = $this->_mergeOptions($name, $options, + self::DISPLAY_OPTIONS, self::FILE_OPTIONS, self::TEXT_OPTIONS); + $element = new Zend_Form_Element_File($name, $options); if ($filename) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-27 11:57:41
|
Revision: 882 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=882&view=rev Author: mennodekker Date: 2012-07-27 11:57:32 +0000 (Fri, 27 Jul 2012) Log Message: ----------- Allow to change the allowed options from outside the formbridge Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-07-26 12:33:37 UTC (rev 881) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-07-27 11:57:32 UTC (rev 882) @@ -775,7 +775,25 @@ } /** + * Returns the allowed options for a certain key or all options if no + * key specified * + * @param string $key + * @return array + */ + public function getAllowedOptions($key = null) + { + if (is_null($key)) return $this->_allowedOptions; + + if (array_key_exists($key, $this->_allowedOptions)) { + return $key; + } else { + return array(); + } + } + + /** + * * @return Zend_Form */ public function getForm() @@ -804,4 +822,21 @@ return $this->form->getTab($name); } } + + /** + * Set the allowed options for a certain key to the specified options array + * + * @param string $key + * @param array $options + * @return MUtil_Model_FormBridge + */ + public function setAllowedOptions($key, $options) + { + if (!is_string($options)) { + $options = array($options); + } + + $this->_allowedOptions[$key] = $options; + return $this; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-27 12:08:11
|
Revision: 883 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=883&view=rev Author: mennodekker Date: 2012-07-27 12:08:05 +0000 (Fri, 27 Jul 2012) Log Message: ----------- Fixing previous commit Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-07-27 11:57:32 UTC (rev 882) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-07-27 12:08:05 UTC (rev 883) @@ -786,7 +786,7 @@ if (is_null($key)) return $this->_allowedOptions; if (array_key_exists($key, $this->_allowedOptions)) { - return $key; + return $this->_allowedOptions[$key]; } else { return array(); } @@ -832,7 +832,7 @@ */ public function setAllowedOptions($key, $options) { - if (!is_string($options)) { + if (is_string($options)) { $options = array($options); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-28 09:14:20
|
Revision: 902 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=902&view=rev Author: mennodekker Date: 2012-08-28 09:14:08 +0000 (Tue, 28 Aug 2012) Log Message: ----------- Allow to set labelplacement for radio elements Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-08-23 13:37:41 UTC (rev 901) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-08-28 09:14:08 UTC (rev 902) @@ -85,7 +85,7 @@ self::AUTO_OPTIONS => array('elementClass', 'multiOptions'), self::CHECK_OPTIONS => array('checkedValue', 'uncheckedValue'), self::DATE_OPTIONS => array('dateFormat', 'storageFormat'), - self::DISPLAY_OPTIONS => array('accesskey', 'autoInsertNotEmptyValidator', 'class', 'disabled', 'description', 'escape', 'label', 'onclick', 'readonly', 'required', 'tabindex', 'value', 'showLabels'), + self::DISPLAY_OPTIONS => array('accesskey', 'autoInsertNotEmptyValidator', 'class', 'disabled', 'description', 'escape', 'label', 'onclick', 'readonly', 'required', 'tabindex', 'value', 'showLabels', 'labelplacement'), self::EXHIBIT_OPTIONS => array('formatFunction'), self::FILE_OPTIONS => array('accept', 'count', 'destination', 'valueDisabled'), self::GROUP_OPTIONS => array('elements', 'legend', 'separator'), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 09:31:32
|
Revision: 921 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=921&view=rev Author: mennodekker Date: 2012-09-04 09:31:21 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Made formbridge more flexible by not creating specific elements but have the form create them (can be improved some more) Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-04 08:50:20 UTC (rev 920) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-04 09:31:21 UTC (rev 921) @@ -114,9 +114,12 @@ * @param Zend_Form_Element $element * @return Zend_Form_Element */ - protected function _addToForm($name, Zend_Form_Element $element) + protected function _addToForm($name, $element, $options = null) { - $this->form->addElement($element); + $this->form->addElement($element, $name, $options); + if (is_string($element)) { + $element = $this->form->getElement($name); + } $this->_applyFilters($name, $element); $this->_applyValidators($name, $element); @@ -319,9 +322,7 @@ self::applyFixedOptions(__FUNCTION__, $options); - $element = new Zend_Form_Element_Checkbox($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Checkbox', $options); } /** @@ -339,8 +340,6 @@ $options = $this->_mergeOptions($name, $options, self::DATE_OPTIONS, self::DISPLAY_OPTIONS, self::JQUERY_OPTIONS, self::TEXT_OPTIONS); - $elementName = $name; - // Allow centrally set options self::applyFixedOptions(__FUNCTION__, $options); @@ -349,9 +348,7 @@ $this->getModel()->set($name, 'dateFormat', $options['dateFormat']); } - $element = new MUtil_JQuery_Form_Element_DatePicker($elementName, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'DatePicker', $options); } /** @@ -521,9 +518,7 @@ $options['size'] = $count > 5 ? 5 : $count + 1; } - $element = new Zend_Form_Element_Select($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Select', $options); } public function addPassword($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) @@ -578,11 +573,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new Zend_Form_Element_Radio($name, $options); - - return $this->_addToForm($name, $element); - // $this->form->addDisplayGroup(array($name), $name . '__group', array('Legend' => 'Hi')); - // return $element; + return $this->_addToForm($name, 'Radio', $options); } public function addSelect($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) @@ -596,9 +587,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new MUtil_Form_Element_Select($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Select', $options); } @@ -622,9 +611,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new Zend_Form_Element_MultiCheckbox($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'MultiCheckbox', $options); } /** @@ -646,9 +633,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new MUtil_Form_Element_Multiselect($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Multiselect', $options); } /** @@ -697,13 +682,11 @@ $stringlength = $this->_getStringLength($options); - $element = new Zend_Form_Element_Text($name, $options); - if ($stringlength) { - $element->addValidator('StringLength', true, $stringlength); + $this->model->set($name, 'validators[]', array('StringLength', true, $stringlength)); } - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Text', $options); } public function addTextarea($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) @@ -718,13 +701,11 @@ // Remove as size and maxlength are not used for textarea's unset($options['size'], $options['maxlength']); - $element = new Zend_Form_Element_Textarea($name, $options); - if ($stringlength) { - $element->addValidator('StringLength', true, $stringlength); + $this->model->set($name, 'validators[]', array('StringLength', true, $stringlength)); } - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Textarea', $options); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-06 08:02:14
|
Revision: 928 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=928&view=rev Author: mennodekker Date: 2012-09-06 08:02:08 +0000 (Thu, 06 Sep 2012) Log Message: ----------- Fixed jQuery activation when adding jQuery element Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-05 12:24:28 UTC (rev 927) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-06 08:02:08 UTC (rev 928) @@ -348,6 +348,9 @@ $this->getModel()->set($name, 'dateFormat', $options['dateFormat']); } + // Make sure form knows it is a jQuery form + $this->form->activateJQuery(); + return $this->_addToForm($name, 'DatePicker', $options); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |