From: <gem...@li...> - 2011-09-28 12:56:47
|
Revision: 84 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=84&view=rev Author: mennodekker Date: 2011-09-28 12:56:41 +0000 (Wed, 28 Sep 2011) Log Message: ----------- Fixed error when no label decorator found Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2011-09-28 10:11:45 UTC (rev 83) +++ trunk/library/classes/Gems/Form/TableForm.php 2011-09-28 12:56:41 UTC (rev 84) @@ -146,7 +146,9 @@ $element->setDecorators($decorators); if ($element instanceof Zend_Form_Element_Checkbox) { $decorator = $element->getDecorator('Label'); - $decorator->setOption('placement', Zend_Form_Decorator_Label::APPEND); + if ($decorator) { + $decorator->setOption('placement', Zend_Form_Decorator_Label::APPEND); + } } } return $this; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-11-02 08:14:57
|
Revision: 163 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=163&view=rev Author: mennodekker Date: 2011-11-02 08:14:50 +0000 (Wed, 02 Nov 2011) Log Message: ----------- Performance improvement for huge tabforms Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2011-11-01 14:40:39 UTC (rev 162) +++ trunk/library/classes/Gems/Form/TableForm.php 2011-11-02 08:14:50 UTC (rev 163) @@ -61,25 +61,28 @@ /** * Get a ViewHelper or ZendX decorator to add in front of the decorator chain * - * @param array $decorators + * @param Zend_Form_Element $element * @return null|Zend_Form_Decorator_Abstract */ - private function _getImportantDecorator($decorators) { + private function _getImportantDecorator($element) { $dec1 = null; - if (isset($decorators['Zend_Form_Decorator_ViewHelper'])) { - $dec1 = $decorators['Zend_Form_Decorator_ViewHelper']; - } elseif (isset($decorators['Zend_Form_Decorator_File'])) { - $dec1 = $decorators['Zend_Form_Decorator_File']; + if ($dec1 = $element->getDecorator('ViewHelper')) { + return $dec1; + } elseif ($dec1 = $element->getDecorator('UiWidgetElement')) { + return $dec1; + } elseif ($dec1 = $element->getDecorator('File')) { + return $dec1; } else { + $decorators = $element->getDecorators(); foreach($decorators as $name=>$decorator) { if (substr($name, 0, 5) == 'ZendX') { $dec1 = $decorator; break; } } + return $dec1; } - return $dec1; } /** @@ -126,8 +129,7 @@ //Now add the right decorators to the elements $groupElements = $group->getElements(); foreach ($groupElements as $element) { - $decorators = $element->getDecorators(); - $dec1 = $this->_getImportantDecorator($decorators); + $dec1 = $this->_getImportantDecorator($element); $decorators = array( array('Description', array('class'=>'description')), 'Errors', @@ -170,8 +172,7 @@ $element = $this->getElement($name); } - $decorators = $element->getDecorators(); - $dec1 = $this->_getImportantDecorator($decorators); + $dec1 = $this->_getImportantDecorator($element); if ($element instanceof MUtil_Form_Element_Html) { //Colspan 2 @@ -244,4 +245,4 @@ } return $this; } -} +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-06-28 14:21:01
|
Revision: 797 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=797&view=rev Author: mennodekker Date: 2012-06-28 14:20:55 +0000 (Thu, 28 Jun 2012) Log Message: ----------- Not all form elements play by the rules... Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-06-28 14:17:45 UTC (rev 796) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-06-28 14:20:55 UTC (rev 797) @@ -68,13 +68,15 @@ $class = get_class($element); if (strpos($class, 'JQuery')) { - return $element->getDecorator('UiWidgetElement'); + $dec = $element->getDecorator('UiWidgetElement'); } if (strpos($class, 'File')) { - return $element->getDecorator('File'); + $dec = $element->getDecorator('File'); } - return $element->getDecorator('ViewHelper'); + if (!isset($dec) || $dec == null) { + return 'ViewHelper'; + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-02 08:52:01
|
Revision: 803 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=803&view=rev Author: mennodekker Date: 2012-07-02 08:51:54 +0000 (Mon, 02 Jul 2012) Log Message: ----------- All forms should work again now Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-06-29 12:52:01 UTC (rev 802) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-07-02 08:51:54 UTC (rev 803) @@ -74,9 +74,11 @@ $dec = $element->getDecorator('File'); } - if (!isset($dec) || $dec == null) { + if (!isset($dec) || $dec == false) { return 'ViewHelper'; } + + return $dec; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-02 08:54:40
|
Revision: 804 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=804&view=rev Author: mennodekker Date: 2012-07-02 08:54:34 +0000 (Mon, 02 Jul 2012) Log Message: ----------- Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-07-02 08:51:54 UTC (rev 803) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-07-02 08:54:34 UTC (rev 804) @@ -75,7 +75,7 @@ } if (!isset($dec) || $dec == false) { - return 'ViewHelper'; + $dec = $element->getDecorator('ViewHelper'); } return $dec; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-02 14:37:51
|
Revision: 805 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=805&view=rev Author: mennodekker Date: 2012-07-02 14:37:45 +0000 (Mon, 02 Jul 2012) Log Message: ----------- Allow for better styling and preserve custom classname when setting alternating rows Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-07-02 08:54:34 UTC (rev 804) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-07-02 14:37:45 UTC (rev 805) @@ -178,7 +178,7 @@ 'Tooltip', array('Label', array('escape'=>false)), array(array('labelCell' => 'HtmlTag'), array('tag' => 'td', 'class'=>'label', 'colspan'=>2)), - array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $element->getName())) + array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $element->getAttrib('class') . ' ' . $element->getName())) ); } elseif ($element instanceof Zend_Form_Element_Hidden || $element instanceof Zend_Form_Element_Submit) { @@ -247,7 +247,7 @@ if ($element instanceof Zend_Form_Element_Hidden) { $decorator->setOption('style', 'display:none;'); } else { - $decorator->setOption('class', $this->_alternate . ' ' . $name); + $decorator->setOption('class', $this->_alternate . ' ' . $decorator->getOption('class')); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-23 10:49:02
|
Revision: 866 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=866&view=rev Author: mennodekker Date: 2012-07-23 10:48:56 +0000 (Mon, 23 Jul 2012) Log Message: ----------- Only apply alternating rows once Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-07-20 17:01:00 UTC (rev 865) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-07-23 10:48:56 UTC (rev 866) @@ -241,7 +241,7 @@ public function setView(Zend_View_Interface $view = null) { //If we set the view, fix the alternating rows - if ($view) { + if ($this->_view !== $view) { foreach($this as $name => $element) { $decorator = $element->getDecorator('row'); if ($decorator) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-24 10:38:03
|
Revision: 873 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=873&view=rev Author: mennodekker Date: 2012-07-24 10:37:54 +0000 (Tue, 24 Jul 2012) Log Message: ----------- Fixed missing submit button Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-07-24 09:49:55 UTC (rev 872) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-07-24 10:37:54 UTC (rev 873) @@ -114,7 +114,17 @@ protected function _fixDecoratorHiddenSubmit(&$element) { - //No label and tooltip + // No label and tooltip + $rowOptions = array( + 'tag' => 'tr', + 'class' => $element->getName() + ); + + // Don't display if hidden + if ($element instanceof Zend_Form_Element_Hidden) { + $rowOptions['style'] = 'display:none;'; + } + $decorators = array( 'ViewHelper', array('Description', array('class' => 'description')), @@ -123,7 +133,7 @@ array(array('labelCellClose' => 'HtmlTag'), array('tag' => 'td', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'closeOnly' => true)), 'Tooltip', 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' => $element->getName(), 'style' => 'display:none;')) + array(array('row' => 'HtmlTag'), $rowOptions) ); $element->setDecorators($decorators); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 12:18:59
|
Revision: 922 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=922&view=rev Author: mennodekker Date: 2012-09-04 12:18:48 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Saving time by using a callback instead of multiple decorators Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 09:31:21 UTC (rev 921) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 12:18:48 UTC (rev 922) @@ -53,16 +53,51 @@ private $_alternate = null; + /** + * + * @param string $content + * @param Zend_Form_Element $element + * @param array $options + * @return string + */ + public static function doRowElement($content, $element, array $options) + { + return self::doRow($content, $element->getLabel(), $options['class'], $element); + + return $content; + } + + public static function doRowDisplayGroup($content, $element, array $options) + { + return self::doRow($content, $element->getDescription(), $options['class'], $element); + } + + public static function doRow($content, $label, $class, $element) { + if ($element->getAttrib('tooltip')) { + $dec = new Gems_Form_Decorator_Tooltip(); + $dec->setElement($element); + $label .= $dec->render(''); + } + $content = sprintf('<tr class="%s"><td class="label">%s</td><td class="element">%s</td></tr>', $class, $label, $content); + return $content; + } + protected function _fixDecoratorDisplayGroup(&$element) { // Display group - $element->setDecorators(array('FormElements', + $element->setDecorators( + array('FormElements', + array('Callback', array('callback' => array($this, 'doRowDisplayGroup'), 'class' => $this->_alternate . ' ' . $element->getName(), 'placement'=>false)) + + /* + array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array(array('labelCellClose' => 'HtmlTag'), array('tag' => 'td', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'closeOnly' => true)), '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 . ' ' . $element->getName() . ' ' . $element->getAttrib('class'))) + */ )); //Now add the right decorators to the elements @@ -99,12 +134,16 @@ $decorators = array( array('Description', array('class' => 'description')), 'Errors', - array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), - array(array('labelCellClose' => 'HtmlTag'), array('tag' => 'td', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'closeOnly' => true)), - 'Tooltip', - array('Label', array('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 . ' ' . $element->getName())) + array('Callback', array('callback' => array($this, 'doRowElement'), 'class' => $this->_alternate . ' ' . $element->getName(), 'placement'=>false)) + + //array('Description', array('class' => 'description')), + //'Errors', + //array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), + //array(array('labelCellClose' => 'HtmlTag'), array('tag' => 'td', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'closeOnly' => true)), + //'Tooltip', + //array('Label', array('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 . ' ' . $element->getName())) ); if (!is_null($dec1)) { array_unshift($decorators, $dec1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 14:14:14
|
Revision: 923 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=923&view=rev Author: mennodekker Date: 2012-09-04 14:14:03 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Fixed label rendering broken by last commit Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 12:18:48 UTC (rev 922) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 14:14:03 UTC (rev 923) @@ -78,7 +78,7 @@ $dec->setElement($element); $label .= $dec->render(''); } - $content = sprintf('<tr class="%s"><td class="label">%s</td><td class="element">%s</td></tr>', $class, $label, $content); + $content = sprintf('<tr class="%s"><td class="label"><label for="%s">%s</label></td><td class="element">%s</td></tr>', $class, $element->getName(), $label, $content); return $content; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-05 12:24:38
|
Revision: 927 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=927&view=rev Author: mennodekker Date: 2012-09-05 12:24:28 +0000 (Wed, 05 Sep 2012) Log Message: ----------- Set required / optional again for labels Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-09-05 10:21:17 UTC (rev 926) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-09-05 12:24:28 UTC (rev 927) @@ -78,7 +78,13 @@ $dec->setElement($element); $label .= $dec->render(''); } - $content = sprintf('<tr class="%s"><td class="label"><label for="%s">%s</label></td><td class="element">%s</td></tr>', $class, $element->getName(), $label, $content); + if ($element instanceof Zend_Form_Element) { + $style = $element->isRequired() ? 'required' : 'optional'; + $labelClass = sprintf(' class="%s"', $style); + } else { + $labelClass = ''; + } + $content = sprintf('<tr class="%s"><td class="label"><label for="%s"%s>%s</label></td><td class="element">%s</td></tr>', $class, $element->getName(), $labelClass, $label, $content); return $content; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |