Changeset 441
- Timestamp:
- 05/21/07 23:23:21 (2 years ago)
- Files:
-
- branches/experimental/jforms/build/manifests/jelix-lib.mn (modified) (2 diffs)
- branches/experimental/jforms/build/manifests/jelix-lib.mn (modified) (2 diffs)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.UTF-8.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.UTF-8.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.UTF-8.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.UTF-8.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.UTF-8.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.UTF-8.properties (modified) (1 diff)
- branches/experimental/jforms/lib/jelix/core/jSelector.class.php (modified) (1 diff)
- branches/experimental/jforms/lib/jelix/core/jSelector.class.php (modified) (1 diff)
- branches/experimental/jforms/lib/jelix/forms/jFormsBase.class.php (modified) (1 diff)
- branches/experimental/jforms/lib/jelix/forms/jFormsBase.class.php (modified) (1 diff)
- branches/experimental/jforms/lib/jelix/forms/jFormsBuilderBase.class.php (modified) (4 diffs)
- branches/experimental/jforms/lib/jelix/forms/jFormsBuilderBase.class.php (modified) (4 diffs)
- branches/experimental/jforms/lib/jelix/forms/jFormsCompiler.class.php (modified) (4 diffs)
- branches/experimental/jforms/lib/jelix/forms/jFormsCompiler.class.php (modified) (4 diffs)
- branches/experimental/jforms/lib/jelix/forms/jforms_jstemplate.php (deleted)
- branches/experimental/jforms/lib/jelix/forms/jforms_jstemplate.php (deleted)
- branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifacl.php (modified) (2 diffs)
- branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifacl.php (modified) (2 diffs)
- branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifnotacl.php (modified) (2 diffs)
- branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifnotacl.php (modified) (2 diffs)
- branches/experimental/jforms/lib/jelix/tpl/plugins/html/block.form.php (modified) (4 diffs)
- branches/experimental/jforms/lib/jelix/tpl/plugins/html/block.form.php (modified) (4 diffs)
- branches/experimental/jforms/testapp/modules/testapp/controllers/sampleform.classic.php (modified) (2 diffs)
- branches/experimental/jforms/testapp/modules/testapp/controllers/sampleform.classic.php (modified) (2 diffs)
- branches/experimental/jforms/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
- branches/experimental/jforms/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/experimental/jforms/build/manifests/jelix-lib.mn
r439 r441 116 116 jFormsDataContainer.class.php 117 117 jFormsDatasource.class.php 118 jforms_jstemplate.php119 118 120 119 cd lib/jelix/tpl/ … … 155 154 function.formurlparam.php 156 155 function.diff.php 156 block.form.php 157 157 158 158 cd lib/jelix/tpl/plugins/ltx2pdf branches/experimental/jforms/build/manifests/jelix-lib.mn
r439 r441 116 116 jFormsDataContainer.class.php 117 117 jFormsDatasource.class.php 118 jforms_jstemplate.php119 118 120 119 cd lib/jelix/tpl/ … … 155 154 function.formurlparam.php 156 155 function.diff.php 156 block.form.php 157 157 158 158 cd lib/jelix/tpl/plugins/ltx2pdf branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 6 7 branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 6 7 branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.UTF-8.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 6 7 branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_EN/formserr.UTF-8.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 6 7 branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.UTF-8.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) branches/experimental/jforms/lib/jelix-modules/jelix/locales/en_US/formserr.UTF-8.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 5 5 datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 6 invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) 6 7 7 branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 5 5 datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 6 invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) 6 7 7 branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.UTF-8.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 5 5 datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 6 6 invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) branches/experimental/jforms/lib/jelix-modules/jelix/locales/fr_FR/formserr.UTF-8.properties
r439 r441 4 4 attribute.not.allowed=(803) attribut %1$s non permis sur %2$s (fichier %3$s) 5 5 datatype.unknow=(804) datatype inconnu %1$s sur %2$s (fichier %3$s) 6 6 invalid.xml.file=(805) erreur de syntaxe xml dans un fichier jforms (fichier %s) branches/experimental/jforms/lib/jelix/core/jSelector.class.php
r437 r441 652 652 } 653 653 654 public function getCompiledBuilder Path ($type){654 public function getCompiledBuilderFilePath ($type){ 655 655 return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 656 656 } branches/experimental/jforms/lib/jelix/core/jSelector.class.php
r437 r441 652 652 } 653 653 654 public function getCompiledBuilder Path ($type){654 public function getCompiledBuilderFilePath ($type){ 655 655 return JELIX_APP_TEMP_PATH.'compiled/'.$this->_dirname.$this->module.'~'.$this->resource.'_builder_'.$type.$this->_cacheSuffix; 656 656 } branches/experimental/jforms/lib/jelix/forms/jFormsBase.class.php
r439 r441 201 201 /** 202 202 * @param string $buildertype the type name of a form builder 203 * @param string $action action selector where form will be submit 204 * @param array $actionParams parameters for the action 203 205 * @return jFormsBuilderBase 204 206 */ 205 public function getBuilder($buildertype ){207 public function getBuilder($buildertype, $action, $actionParams){ 206 208 if(isset($this->_builders[$buildertype])){ 209 include_once(JELIX_LIB_FORMS_PATH.'jFormsBuilderBase.class.php'); 207 210 include_once ($this->_builders[$buildertype][0]); 208 211 $c = $this->_builders[$buildertype][1]; 209 return new $c($this );212 return new $c($this, $action, $actionParams); 210 213 }else{ 211 214 throw new Exception('invalid form builder type'); branches/experimental/jforms/lib/jelix/forms/jFormsBase.class.php
r439 r441 201 201 /** 202 202 * @param string $buildertype the type name of a form builder 203 * @param string $action action selector where form will be submit 204 * @param array $actionParams parameters for the action 203 205 * @return jFormsBuilderBase 204 206 */ 205 public function getBuilder($buildertype ){207 public function getBuilder($buildertype, $action, $actionParams){ 206 208 if(isset($this->_builders[$buildertype])){ 209 include_once(JELIX_LIB_FORMS_PATH.'jFormsBuilderBase.class.php'); 207 210 include_once ($this->_builders[$buildertype][0]); 208 211 $c = $this->_builders[$buildertype][1]; 209 return new $c($this );212 return new $c($this, $action, $actionParams); 210 213 }else{ 211 214 throw new Exception('invalid form builder type'); branches/experimental/jforms/lib/jelix/forms/jFormsBuilderBase.class.php
r437 r441 39 39 40 40 /** 41 * form name 42 */ 43 protected $_name; 44 45 /** 41 46 * @param jFormsBase $form a form object 42 47 * @param string $action action selector where form will be submit … … 47 52 $this->_action = $action; 48 53 $this->_actionParams = $actionParams; 54 $this->_name = jFormsBuilderBase::generateFormName(); 49 55 } 50 56 … … 54 60 abstract public function outputFooter(); 55 61 56 public static function ge tFormName(){62 public static function generateFormName(){ 57 63 static $number = 0; 58 64 $number++; … … 66 72 $url = jUrl::get($this->_action, $this->_actionParams, 2); // retourne le jurl correspondant 67 73 68 echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. jFormsBuilderBase::getFormName().'">';74 echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. $this->_name.'">'; 69 75 if(count($url->params)){ 70 76 echo '<div>'; branches/experimental/jforms/lib/jelix/forms/jFormsBuilderBase.class.php
r437 r441 39 39 40 40 /** 41 * form name 42 */ 43 protected $_name; 44 45 /** 41 46 * @param jFormsBase $form a form object 42 47 * @param string $action action selector where form will be submit … … 47 52 $this->_action = $action; 48 53 $this->_actionParams = $actionParams; 54 $this->_name = jFormsBuilderBase::generateFormName(); 49 55 } 50 56 … … 54 60 abstract public function outputFooter(); 55 61 56 public static function ge tFormName(){62 public static function generateFormName(){ 57 63 static $number = 0; 58 64 $number++; … … 66 72 $url = jUrl::get($this->_action, $this->_actionParams, 2); // retourne le jurl correspondant 67 73 68 echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. jFormsBuilderBase::getFormName().'">';74 echo '<form action="'.$url->scriptName . $url->pathInfo.'" method="POST" name="'. $this->_name.'">'; 69 75 if(count($url->params)){ 70 76 echo '<div>'; branches/experimental/jforms/lib/jelix/forms/jFormsCompiler.class.php
r439 r441 32 32 $this->sourceFile = $selector->getPath(); 33 33 $cachefile = $selector->getCompiledFilePath(); 34 $cacheHtmlBuilderFile = $selector->getCompiledBuild FilePath ('html');34 $cacheHtmlBuilderFile = $selector->getCompiledBuilderFilePath ('html'); 35 35 36 36 // compilation du fichier xml 37 $xml = simplexml_load_file ( $ sourceFile);37 $xml = simplexml_load_file ( $this->sourceFile); 38 38 if(!$xml){ 39 return false;39 throw new jException('jelix~formserr.invalid.xml.file',array($this->sourceFile)); 40 40 } 41 41 … … 55 55 $source[]=' parent::__construct($container, $reset); '; 56 56 57 58 57 $srcHtmlBuilder=array(); 59 58 $srcHtmlBuilder[]='<?php class '.$selector->getClass().'_builder_html extends jFormsHtmlBuilderBase {'; 60 $srcHtmlBuilder[]=' public function __construct($form, $action ){';61 $srcHtmlBuilder[]=' parent::__construct($form, $action ); ';59 $srcHtmlBuilder[]=' public function __construct($form, $action, $actionParams){'; 60 $srcHtmlBuilder[]=' parent::__construct($form, $action, $actionParams); '; 62 61 $srcHtmlBuilder[]=' }'; 63 62 64 63 $srcjs=array(); 65 66 64 $srcjs[]='$js="gForm = new jFormsForm(\'".$this->_name."\');\n";'; 65 $srcjs[]='$js.="gForm.setDecorator(new jFormsErrorDecoratorAlert());\n";'; 67 66 foreach($xml->children() as $controltype=>$control){ 68 67 $source[] = $this->generatePHPControl($controltype, $control); 69 68 $srcjs[] = $this->generateJsControl($control); 70 69 } 71 72 70 $source[]=' }'; 73 71 … … 77 75 78 76 jFile::write($cachefile, implode("\n", $source)); 79 77 $srcjs[]='$js.="jForms.declareForm(gForm);\n";'; 80 78 81 79 $srcHtmlBuilder[]=' public function getJavascriptCheck(){'; … … 85 83 86 84 jFile::write($cacheHtmlBuilderFile, implode("\n", $srcHtmlBuilder)); 87 88 85 return true; 89 86 } branches/experimental/jforms/lib/jelix/forms/jFormsCompiler.class.php
r439 r441 32 32 $this->sourceFile = $selector->getPath(); 33 33 $cachefile = $selector->getCompiledFilePath(); 34 $cacheHtmlBuilderFile = $selector->getCompiledBuild FilePath ('html');34 $cacheHtmlBuilderFile = $selector->getCompiledBuilderFilePath ('html'); 35 35 36 36 // compilation du fichier xml 37 $xml = simplexml_load_file ( $ sourceFile);37 $xml = simplexml_load_file ( $this->sourceFile); 38 38 if(!$xml){ 39 return false;39 throw new jException('jelix~formserr.invalid.xml.file',array($this->sourceFile)); 40 40 } 41 41 … … 55 55 $source[]=' parent::__construct($container, $reset); '; 56 56 57 58 57 $srcHtmlBuilder=array(); 59 58 $srcHtmlBuilder[]='<?php class '.$selector->getClass().'_builder_html extends jFormsHtmlBuilderBase {'; 60 $srcHtmlBuilder[]=' public function __construct($form, $action ){';61 $srcHtmlBuilder[]=' parent::__construct($form, $action ); ';59 $srcHtmlBuilder[]=' public function __construct($form, $action, $actionParams){'; 60 $srcHtmlBuilder[]=' parent::__construct($form, $action, $actionParams); '; 62 61 $srcHtmlBuilder[]=' }'; 63 62 64 63 $srcjs=array(); 65 66 64 $srcjs[]='$js="gForm = new jFormsForm(\'".$this->_name."\');\n";'; 65 $srcjs[]='$js.="gForm.setDecorator(new jFormsErrorDecoratorAlert());\n";'; 67 66 foreach($xml->children() as $controltype=>$control){ 68 67 $source[] = $this->generatePHPControl($controltype, $control); 69 68 $srcjs[] = $this->generateJsControl($control); 70 69 } 71 72 70 $source[]=' }'; 73 71 … … 77 75 78 76 jFile::write($cachefile, implode("\n", $source)); 79 77 $srcjs[]='$js.="jForms.declareForm(gForm);\n";'; 80 78 81 79 $srcHtmlBuilder[]=' public function getJavascriptCheck(){'; … … 85 83 86 84 jFile::write($cacheHtmlBuilderFile, implode("\n", $srcHtmlBuilder)); 87 88 85 return true; 89 86 } branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifacl.php
r312 r441 3 3 * @package jelix 4 4 * @subpackage jtpl_plugin 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 * @copyright 2006Jouanneau laurent8 * @link http://www.jelix.org6 * @copyright 2006-2007 Jouanneau laurent 7 * @link http://www.jelix.org 9 8 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 9 */ … … 16 15 * @param jTplCompiler $compiler the template compiler 17 16 * @param boolean true if it is the begin of block, else false 18 * @param $param array 1=>subject 2=>right value 3=>optional resource17 * @param $param array 0=>subject 1=>right value 2=>optional resource 19 18 * @return string the php code corresponding to the begin or end of the block 20 19 */ branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifacl.php
r312 r441 3 3 * @package jelix 4 4 * @subpackage jtpl_plugin 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 * @copyright 2006Jouanneau laurent8 * @link http://www.jelix.org6 * @copyright 2006-2007 Jouanneau laurent 7 * @link http://www.jelix.org 9 8 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 9 */ … … 16 15 * @param jTplCompiler $compiler the template compiler 17 16 * @param boolean true if it is the begin of block, else false 18 * @param $param array 1=>subject 2=>right value 3=>optional resource17 * @param $param array 0=>subject 1=>right value 2=>optional resource 19 18 * @return string the php code corresponding to the begin or end of the block 20 19 */ branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifnotacl.php
r329 r441 3 3 * @package jelix 4 4 * @subpackage jtpl_plugin 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 * @copyright 2006Jouanneau laurent8 * @link http://www.jelix.org6 * @copyright 2006-2007 Jouanneau laurent 7 * @link http://www.jelix.org 9 8 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 9 */ … … 16 15 * @param jTplCompiler $compiler the template compiler 17 16 * @param boolean true if it is the begin of block, else false 18 * @param $params array 1=>subject 2=>right value 3=>optional resource17 * @param $params array 0=>subject 1=>right value 2=>optional resource 19 18 * @return string the php code corresponding to the begin or end of the block 20 19 */ branches/experimental/jforms/lib/jelix/tpl/plugins/common/block.ifnotacl.php
r329 r441 3 3 * @package jelix 4 4 * @subpackage jtpl_plugin 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 * @copyright 2006Jouanneau laurent8 * @link http://www.jelix.org6 * @copyright 2006-2007 Jouanneau laurent 7 * @link http://www.jelix.org 9 8 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 9 */ … … 16 15 * @param jTplCompiler $compiler the template compiler 17 16 * @param boolean true if it is the begin of block, else false 18 * @param $params array 1=>subject 2=>right value 3=>optional resource17 * @param $params array 0=>subject 1=>right value 2=>optional resource 19 18 * @return string the php code corresponding to the begin or end of the block 20 19 */ branches/experimental/jforms/lib/jelix/tpl/plugins/html/block.form.php
r437 r441 4 4 * @subpackage jtpl_plugin 5 5 * @author Jouanneau Laurent 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 16 16 * @param jTplCompiler $compiler the template compiler 17 17 * @param boolean true if it is the begin of block, else false 18 * @param $param array 1=>subject 2=>right value 3=>optional resource18 * @param $param array 0=>form object 1=>selector of submit action 2=>array of parameters for submit action 19 19 * @return string the php code corresponding to the begin or end of the block 20 20 * @see jForms … … 24 24 25 25 if(!$begin){ 26 return '$builder->outputFooter(); ';26 return '$builder->outputFooter(); $form = null; $builder=null;'; 27 27 } 28 28 29 if(count($param) !=3){29 if(count($param) < 2 || count($param) > 3){ 30 30 $compiler->doError2('errors.tplplugin.block.bad.argument.number','form',2); 31 31 return ''; 32 } 33 if(count($param) == 2){ 34 $param[2] = 'array()'; 32 35 } 33 36 … … 36 39 $builder->outputHeader(); 37 40 '; 41 42 $rep = $GLOBALS['gJCoord']->response; 43 if($rep!= null){ 44 $rep->addJSLink($GLOBALS['gJConfig']->urlengine['basePath'].'jelix/js/jforms.js'); 45 } 46 38 47 return $content; 39 48 } branches/experimental/jforms/lib/jelix/tpl/plugins/html/block.form.php
r437 r441 4 4 * @subpackage jtpl_plugin 5 5 * @author Jouanneau Laurent 6 * @copyright 2006 Jouanneau laurent6 * @copyright 2006-2007 Jouanneau laurent 7 7 * @link http://www.jelix.org 8 8 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 16 16 * @param jTplCompiler $compiler the template compiler 17 17 * @param boolean true if it is the begin of block, else false 18 * @param $param array 1=>subject 2=>right value 3=>optional resource18 * @param $param array 0=>form object 1=>selector of submit action 2=>array of parameters for submit action 19 19 * @return string the php code corresponding to the begin or end of the block 20 20 * @see jForms … … 24 24 25 25 if(!$begin){ 26 return '$builder->outputFooter(); ';26 return '$builder->outputFooter(); $form = null; $builder=null;'; 27 27 } 28 28 29 if(count($param) !=3){29 if(count($param) < 2 || count($param) > 3){ 30 30 $compiler->doError2('errors.tplplugin.block.bad.argument.number','form',2); 31 31 return ''; 32 } 33 if(count($param) == 2){ 34 $param[2] = 'array()'; 32 35 } 33 36 … … 36 39 $builder->outputHeader(); 37 40 '; 41 42 $rep = $GLOBALS['gJCoord']->response; 43 if($rep!= null){ 44 $rep->addJSLink($GLOBALS['gJConfig']->urlengine['basePath'].'jelix/js/jforms.js'); 45 } 46 38 47 return $content; 39 48 } branches/experimental/jforms/testapp/modules/testapp/controllers/sampleform.classic.php
r436 r441 3 3 * @package testapp 4 4 * @subpackage testapp module 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 6 * @contributor 8 * @copyright 2005-200 6Jouanneau laurent7 * @copyright 2005-2007 Jouanneau laurent 9 8 * @link http://www.jelix.org 10 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 31 30 32 31 $tpl = new jTpl(); 33 $tpl->assign('form', $form ->getContainer());32 $tpl->assign('form', $form); 34 33 $rep->body->assign('MAIN',$tpl->fetch('sampleform')); 35 34 $rep->body->assign('page_title','formulaires'); branches/experimental/jforms/testapp/modules/testapp/controllers/sampleform.classic.php
r436 r441 3 3 * @package testapp 4 4 * @subpackage testapp module 5 * @version $Id$6 5 * @author Jouanneau Laurent 7 6 * @contributor 8 * @copyright 2005-200 6Jouanneau laurent7 * @copyright 2005-2007 Jouanneau laurent 9 8 * @link http://www.jelix.org 10 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html … … 31 30 32 31 $tpl = new jTpl(); 33 $tpl->assign('form', $form ->getContainer());32 $tpl->assign('form', $form); 34 33 $rep->body->assign('MAIN',$tpl->fetch('sampleform')); 35 34 $rep->body->assign('page_title','formulaires'); branches/experimental/jforms/testapp/modules/testapp/templates/sampleform.tpl
r436 r441 1 1 <h1>Test de formulaire</h1> 2 2 <p>Voici un formulaire de test</p> 3 4 <form action="{jurl 'sampleform_save'}" method="POST"> 3 {form $form,'sampleform_save'} 5 4 <fieldset> 6 5 <legend>Votre identité</legend> 7 <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form-> datas['nom']}"/></p>8 <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form-> datas['prenom']}" /></p>6 <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form->getData('nom')}"/></p> 7 <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form->getData('prenom')}" /></p> 9 8 10 9 </fieldset> 11 10 <p><input type="submit" value="ok" /></p> 12 </form> 11 {/form} branches/experimental/jforms/testapp/modules/testapp/templates/sampleform.tpl
r436 r441 1 1 <h1>Test de formulaire</h1> 2 2 <p>Voici un formulaire de test</p> 3 4 <form action="{jurl 'sampleform_save'}" method="POST"> 3 {form $form,'sampleform_save'} 5 4 <fieldset> 6 5 <legend>Votre identité</legend> 7 <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form-> datas['nom']}"/></p>8 <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form-> datas['prenom']}" /></p>6 <p><label for="nom">Nom :</label> <input type="text" name="nom" id="nom" value="{$form->getData('nom')}"/></p> 7 <p><label for="prenom">Prenom :</label> <input type="text" name="prenom" id="prenom" value="{$form->getData('prenom')}" /></p> 9 8 10 9 </fieldset> 11 10 <p><input type="submit" value="ok" /></p> 12 </form> 11 {/form}
