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  
    44* @subpackage   jtpl_plugin 
    55* @author       Laurent Jouanneau 
    66* @contributor  Dominique Papin 
     7* @contributor  Bastien Jaillot 
    78* @copyright    2007-2008 Laurent Jouanneau, 2007 Dominique Papin 
     9* @copyright    2008 Bastien Jaillot 
    810* @link         http://www.jelix.org 
    911* @licence      GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    1012*/ 
     
    2426 *                     3=>name of your javascript object for error listener 
    2527 *                     4=>name of your javascript object for help listener 
    2628 *                     5=>name of the method : POST or GET 
     29 *                     6=>name of the builder : default is html 
    2730 * @return string the php code corresponding to the begin or end of the block 
    2831 */ 
    2932function jtpl_cfunction_html_formfull($compiler, $params=array()) 
    3033{ 
    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'); 
    3336    } 
    3437 
    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'"; 
    3642 
     43    $compiler->addMetaContent('if(isset('.$params[0].')) { '.$params[0].'->getBuilder('.$builder.')->outputMetaContent($t);}'); 
     44 
    3745    if(count($params) == 2){ 
    3846        $params[2] = 'array()'; 
    3947    } 
     
    5260        $method='post'; 
    5361 
    5462    $content = ' $formfull = '.$params[0].'; 
    55     $formfullBuilder = $formfull->getBuilder(\'html\'); 
     63    $formfullBuilder = $formfull->getBuilder('.$builder.'); 
    5664    $formfullBuilder->setAction('.$params[1].','.$params[2].'); 
    5765    $formfullBuilder->outputHeader(array('.$errdecorator.','.$helpdecorator.',\''.$method.'\')); 
    5866    $formfullBuilder->outputAllControls(); 
  • lib/jelix/plugins/tpl/html/block.form.php

    old new  
    33* @package     jelix 
    44* @subpackage  jtpl_plugin 
    55* @author      Jouanneau Laurent 
     6* @contributor  Bastien Jaillot 
    67* @copyright   2006-2008 Jouanneau laurent 
     8* @copyright    2008 Bastien Jaillot 
    79* @link        http://www.jelix.org 
    810* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 
    911*/ 
     
    2628 *                     3=>name of your javascript object for error listener 
    2729 *                     4=>name of your javascript object for help listener 
    2830 *                     5=>name of the method : 'post' or 'get' 
     31 *                     6=>name of the builder : default is html 
    2932 * @return string the php code corresponding to the begin or end of the block 
    3033 * @see jForms 
    3134 */ 
     
    3942unset($t->_privateVars[\'__displayed_ctrl\']);'; 
    4043    } 
    4144 
    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'); 
    4447        return ''; 
    4548    } 
    4649    if(count($param) == 2){ 
     
    6063    $method = strtolower(isset($param[5])?$param[5]:'post'); 
    6164    if($method!='get' && $method!='post') 
    6265        $method='post'; 
     66         
     67    if(isset($param[6]) && $param[6] != '""'  && $param[6] != "''") 
     68        $builder = $param[6]; 
     69    else 
     70        $builder = "'html'"; 
    6371 
    6472    $content = ' $t->_privateVars[\'__form\'] = '.$param[0].'; 
    65 $t->_privateVars[\'__formbuilder\'] = $t->_privateVars[\'__form\']->getBuilder(\'html\'); 
     73$t->_privateVars[\'__formbuilder\'] = $t->_privateVars[\'__form\']->getBuilder('.$builder.'); 
    6674$t->_privateVars[\'__formbuilder\']->setAction('.$param[1].','.$param[2].'); 
    6775$t->_privateVars[\'__formbuilder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.',\''.$method.'\')); 
    6876$t->_privateVars[\'__displayed_ctrl\'] = array(); 
    6977'; 
    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);}'); 
    7179 
    7280    return $content; 
    7381} 
  • lib/jelix/CREDITS

    old new  
    2727 - default template and response generated by createapp (#496, #480, #515) 
    2828 - fixed bug in jFile::removeDir which crash if they are link inside (#519) 
    2929 - add a jFormBase prepareDaoFromControls which return a DAO filled by form (#497) 
     30 - jforms tpl plugins : choice of builder (#583) 
    3031 
    3132Laurent Jouanneau (laurentj): 
    3233 - Conceptor and main developer of Jelix 
Download in other formats: Original Format