Ticket #583: choix_builder.diff
| File choix_builder.diff, 5.2 kB (added by bastnic, 6 months ago) |
|---|
-
lib/jelix/plugins/tpl/html/cfunction.formfull.php
old new 4 4 * @subpackage jtpl_plugin 5 5 * @author Laurent Jouanneau 6 6 * @contributor Dominique Papin 7 * @contributor Bastien Jaillot 7 8 * @copyright 2007-2008 Laurent Jouanneau, 2007 Dominique Papin 9 * @copyright 2008 Bastien Jaillot 8 10 * @link http://www.jelix.org 9 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 12 */ … … 24 26 * 3=>name of your javascript object for error listener 25 27 * 4=>name of your javascript object for help listener 26 28 * 5=>name of the method : POST or GET 29 * 6=>name of the builder : default is html 27 30 * @return string the php code corresponding to the begin or end of the block 28 31 */ 29 32 function jtpl_cfunction_html_formfull($compiler, $params=array()) 30 33 { 31 if (count($params) < 2 || count($params) > 6) {32 $compiler->doError2('errors.tplplugin.cfunction.bad.argument.number','formfull','2- 6');34 if (count($params) < 2 || count($params) > 7) { 35 $compiler->doError2('errors.tplplugin.cfunction.bad.argument.number','formfull','2-7'); 33 36 } 34 37 35 $compiler->addMetaContent('if(isset('.$params[0].')) { '.$params[0].'->getBuilder(\'html\')->outputMetaContent($t);}'); 38 if(isset($params[6]) && $params[6] != '""' && $params[6] != "''") 39 $builder = $params[6]; 40 else 41 $builder = "'html'"; 36 42 43 $compiler->addMetaContent('if(isset('.$params[0].')) { '.$params[0].'->getBuilder('.$builder.')->outputMetaContent($t);}'); 44 37 45 if(count($params) == 2){ 38 46 $params[2] = 'array()'; 39 47 } … … 52 60 $method='post'; 53 61 54 62 $content = ' $formfull = '.$params[0].'; 55 $formfullBuilder = $formfull->getBuilder( \'html\');63 $formfullBuilder = $formfull->getBuilder('.$builder.'); 56 64 $formfullBuilder->setAction('.$params[1].','.$params[2].'); 57 65 $formfullBuilder->outputHeader(array('.$errdecorator.','.$helpdecorator.',\''.$method.'\')); 58 66 $formfullBuilder->outputAllControls(); -
lib/jelix/plugins/tpl/html/block.form.php
old new 3 3 * @package jelix 4 4 * @subpackage jtpl_plugin 5 5 * @author Jouanneau Laurent 6 * @contributor Bastien Jaillot 6 7 * @copyright 2006-2008 Jouanneau laurent 8 * @copyright 2008 Bastien Jaillot 7 9 * @link http://www.jelix.org 8 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 9 11 */ … … 26 28 * 3=>name of your javascript object for error listener 27 29 * 4=>name of your javascript object for help listener 28 30 * 5=>name of the method : 'post' or 'get' 31 * 6=>name of the builder : default is html 29 32 * @return string the php code corresponding to the begin or end of the block 30 33 * @see jForms 31 34 */ … … 39 42 unset($t->_privateVars[\'__displayed_ctrl\']);'; 40 43 } 41 44 42 if(count($param) < 2 || count($param) > 6){43 $compiler->doError2('errors.tplplugin.block.bad.argument.number','form','2- 6');45 if(count($param) < 2 || count($param) > 7){ 46 $compiler->doError2('errors.tplplugin.block.bad.argument.number','form','2-7'); 44 47 return ''; 45 48 } 46 49 if(count($param) == 2){ … … 60 63 $method = strtolower(isset($param[5])?$param[5]:'post'); 61 64 if($method!='get' && $method!='post') 62 65 $method='post'; 66 67 if(isset($param[6]) && $param[6] != '""' && $param[6] != "''") 68 $builder = $param[6]; 69 else 70 $builder = "'html'"; 63 71 64 72 $content = ' $t->_privateVars[\'__form\'] = '.$param[0].'; 65 $t->_privateVars[\'__formbuilder\'] = $t->_privateVars[\'__form\']->getBuilder( \'html\');73 $t->_privateVars[\'__formbuilder\'] = $t->_privateVars[\'__form\']->getBuilder('.$builder.'); 66 74 $t->_privateVars[\'__formbuilder\']->setAction('.$param[1].','.$param[2].'); 67 75 $t->_privateVars[\'__formbuilder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.',\''.$method.'\')); 68 76 $t->_privateVars[\'__displayed_ctrl\'] = array(); 69 77 '; 70 $compiler->addMetaContent('if(isset('.$param[0].')) { '.$param[0].'->getBuilder( \'html\')->outputMetaContent($t);}');78 $compiler->addMetaContent('if(isset('.$param[0].')) { '.$param[0].'->getBuilder('.$builder.')->outputMetaContent($t);}'); 71 79 72 80 return $content; 73 81 } -
lib/jelix/CREDITS
old new 27 27 - default template and response generated by createapp (#496, #480, #515) 28 28 - fixed bug in jFile::removeDir which crash if they are link inside (#519) 29 29 - add a jFormBase prepareDaoFromControls which return a DAO filled by form (#497) 30 - jforms tpl plugins : choice of builder (#583) 30 31 31 32 Laurent Jouanneau (laurentj): 32 33 - Conceptor and main developer of Jelix
