From: <gem...@li...> - 2012-01-03 10:54:57
|
Revision: 394 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=394&view=rev Author: mennodekker Date: 2012-01-03 10:54:48 +0000 (Tue, 03 Jan 2012) Log Message: ----------- Minor fixes for better display of tabforms Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php trunk/library/classes/Gems/TabForm.php trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.php trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-01-02 13:07:44 UTC (rev 393) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-01-03 10:54:48 UTC (rev 394) @@ -110,11 +110,6 @@ //Add the group as usual parent::addDisplayGroup($elements, $name, $options); - //Fix alternation when number of elements is not even - if (count($elements) % 2) { - $dropMe = $this->_alternate->__toString(); - } - //Retrieve it and set decorators $group = $this->getDisplayGroup($name); $group->setDecorators( array('FormElements', @@ -123,7 +118,7 @@ 'Tooltip', array('Description', array('tag'=>'label', 'class'=>'optional', 'placement'=> Zend_Form_Decorator_Abstract::PREPEND, 'escape'=>false)), array(array('labelCellOpen' => 'HtmlTag'), array('tag' => 'td', 'class'=>'label', 'placement'=> Zend_Form_Decorator_Abstract::PREPEND, 'openOnly'=>true)), - array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $this->_alternate . ' ' . $group->getName(). ' ' . $group->getAttrib('class'))) + array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $group->getName(). ' ' . $group->getAttrib('class'))) )); //Now add the right decorators to the elements @@ -217,16 +212,6 @@ if (!is_null($dec1)) array_unshift($decorators, $dec1); $element->setDecorators($decorators); - if ($element instanceof Zend_Form_Element_Hidden) { - //Make row hidden so it takes no height - $decorator = $element->getDecorator('row'); - $decorator->setOption('style', 'display:none;'); - - } else { - $decorator = $element->getDecorator('row'); - $decorator->setOption('class', $this->_alternate . ' ' . $element->getName()); - } - return $this; } @@ -250,4 +235,23 @@ } return $this; } + + public function setView(Zend_View_Interface $view = null) + { + //If we set the view, fix the alternating rows + if ($view) { + foreach($this as $name => $element) { + $decorator = $element->getDecorator('row'); + if ($decorator) { + if ($element instanceof Zend_Form_Element_Hidden) { + $decorator->setOption('style', 'display:none;'); + } else { + $decorator->setOption('class', $this->_alternate . ' ' . $name); + } + } + } + } + + return parent::setView($view); + } } \ No newline at end of file Modified: trunk/library/classes/Gems/TabForm.php =================================================================== --- trunk/library/classes/Gems/TabForm.php 2012-01-02 13:07:44 UTC (rev 393) +++ trunk/library/classes/Gems/TabForm.php 2012-01-03 10:54:48 UTC (rev 394) @@ -324,8 +324,8 @@ $decorators = $this->getDecorators(); if (empty($decorators)) { $this->setDecorators(array( - array('TabErrors'), - array('decorator' => array('SubformElements' => 'FormElements')), + 'TabErrors', + array(array('SubformElements' => 'FormElements')), array('HtmlTag', array('tag' => 'div', 'id' => 'tabContainer', 'class' => 'mainForm')), array('TabContainer', array('id' => 'tabContainer', 'style' => 'width: 99%;')), 'FormElements', Modified: trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.php =================================================================== --- trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.php 2012-01-02 13:07:44 UTC (rev 393) +++ trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.php 2012-01-03 10:54:48 UTC (rev 394) @@ -70,7 +70,8 @@ $js[] = " });"; $js[] = '}'; - $this->view->inlineScript()->appendScript(implode("\n", $js)); // */ + $this->jquery->addOnLoad(implode("\n", $js)); + //$this->view->inlineScript()->appendScript(implode("\n", $js)); // */ } return $result; } Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-01-02 13:07:44 UTC (rev 393) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-01-03 10:54:48 UTC (rev 394) @@ -465,7 +465,7 @@ } $element = new Zend_Form_Element_Password($name, $options); - $this->form->addElement($element); + $this->_applyValidators($name, $element); if ($stringlength) { $element->addValidator('StringLength', true, $stringlength); @@ -483,7 +483,7 @@ $repeatElement->addValidator(new MUtil_Validate_IsConfirmed($name, isset($options['label']) ? $options['label'] : null)); } - return $this->_addToForm($name, $element); + return $element; } public function addRadio($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |