Changeset 522
- Timestamp:
- 08/06/07 22:36:08 (1 year ago)
- Files:
-
- trunk/lib/jelix-www/js/jforms.js (modified) (10 diffs)
- trunk/lib/jelix-www/js/jforms.js (modified) (10 diffs)
- trunk/lib/jelix/docs/ns/jforms-controls.rng (modified) (4 diffs)
- trunk/lib/jelix/docs/ns/jforms-controls.rng (modified) (4 diffs)
- trunk/lib/jelix/forms/jFormsBuilderBase.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsBuilderBase.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsCompiler.class.php (modified) (5 diffs)
- trunk/lib/jelix/forms/jFormsCompiler.class.php (modified) (5 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (1 diff)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (1 diff)
- trunk/lib/jelix/plugins/tpl/html/block.form.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/tpl/html/block.form.php (modified) (2 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php (modified) (3 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php (modified) (4 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix-www/js/jforms.js
r473 r522 14 14 15 15 gForm = new jFormsForm('name'); // create a form descriptor 16 gForm.set Decorator(new jFormsErrorDecoratorAlert()); // declare an error handler16 gForm.setErrorDecorator(new jFormsErrorDecoratorAlert()); // declare an error handler 17 17 18 18 // declare a form control … … 53 53 var msg = ''; 54 54 var valid = true; 55 f. decorator.start();55 f.errorDecorator.start(); 56 56 for(var i =0; i < f.controls.length; i++){ 57 57 var c = f.controls[i]; … … 59 59 if(val == ''){ 60 60 if(c.required){ 61 f. decorator.addError(c, 1);61 f.errorDecorator.addError(c, 1); 62 62 valid = false; 63 63 } … … 153 153 } 154 154 if(!ok){ 155 f. decorator.addError(c, 2);155 f.errorDecorator.addError(c, 2); 156 156 valid = false; 157 157 } … … 159 159 } 160 160 if(!valid) 161 f. decorator.end();161 f.errorDecorator.end(); 162 162 return valid; 163 163 }, … … 199 199 } 200 200 return value; 201 }, 202 203 showHelp : function(aForm, aControl){ 204 var frm = this._forms[aForm.name]; 205 var ctrls = frm.controls; 206 var ctrl = null; 207 for(var i=0; i < ctrls.length; i++){ 208 if (ctrls[i].name == aControl) { 209 ctrl = ctrls[i]; 210 break; 211 } 212 } 213 if (ctrl) { 214 frm.helpDecorator.show(ctrl.help); 215 } 201 216 } 202 203 217 } 204 218 … … 208 222 function jFormsForm(name){ 209 223 this.name = name; 210 this.controls = [] 211 this.decorator = new jFormsErrorDecoratorAlert(); 224 this.controls = []; 225 this.errorDecorator = new jFormsErrorDecoratorAlert(); 226 this.helpDecorator = new jFormsHelpDecoratorAlert(); 212 227 } 213 228 … … 217 232 }, 218 233 219 setDecorator : function (decorator){ 220 this.decorator = decorator; 234 setErrorDecorator : function (decorator){ 235 this.errorDecorator = decorator; 236 }, 237 238 setHelpDecorator : function (decorator){ 239 this.helpDecorator = decorator; 221 240 } 222 241 } … … 236 255 this.errInvalid = ''; 237 256 this.errRequired = ''; 238 } 239 240 241 /* 242 decorateur pour l'affichage des erreurs, sous forme d'alertes 243 */ 257 this.help=''; 258 } 259 260 261 /** 262 * Decorator to display errors in an alert dialog box 263 */ 244 264 function jFormsErrorDecoratorAlert(){ 245 265 this.message = ''; … … 266 286 } 267 287 288 289 /** 290 * Decorator to display help messages in an alert dialog box 291 */ 292 function jFormsHelpDecoratorAlert() { 293 294 } 295 jFormsHelpDecoratorAlert.prototype = { 296 show : function( message){ 297 alert(message); 298 } 299 } 300 trunk/lib/jelix-www/js/jforms.js
r473 r522 14 14 15 15 gForm = new jFormsForm('name'); // create a form descriptor 16 gForm.set Decorator(new jFormsErrorDecoratorAlert()); // declare an error handler16 gForm.setErrorDecorator(new jFormsErrorDecoratorAlert()); // declare an error handler 17 17 18 18 // declare a form control … … 53 53 var msg = ''; 54 54 var valid = true; 55 f. decorator.start();55 f.errorDecorator.start(); 56 56 for(var i =0; i < f.controls.length; i++){ 57 57 var c = f.controls[i]; … … 59 59 if(val == ''){ 60 60 if(c.required){ 61 f. decorator.addError(c, 1);61 f.errorDecorator.addError(c, 1); 62 62 valid = false; 63 63 } … … 153 153 } 154 154 if(!ok){ 155 f. decorator.addError(c, 2);155 f.errorDecorator.addError(c, 2); 156 156 valid = false; 157 157 } … … 159 159 } 160 160 if(!valid) 161 f. decorator.end();161 f.errorDecorator.end(); 162 162 return valid; 163 163 }, … … 199 199 } 200 200 return value; 201 }, 202 203 showHelp : function(aForm, aControl){ 204 var frm = this._forms[aForm.name]; 205 var ctrls = frm.controls; 206 var ctrl = null; 207 for(var i=0; i < ctrls.length; i++){ 208 if (ctrls[i].name == aControl) { 209 ctrl = ctrls[i]; 210 break; 211 } 212 } 213 if (ctrl) { 214 frm.helpDecorator.show(ctrl.help); 215 } 201 216 } 202 203 217 } 204 218 … … 208 222 function jFormsForm(name){ 209 223 this.name = name; 210 this.controls = [] 211 this.decorator = new jFormsErrorDecoratorAlert(); 224 this.controls = []; 225 this.errorDecorator = new jFormsErrorDecoratorAlert(); 226 this.helpDecorator = new jFormsHelpDecoratorAlert(); 212 227 } 213 228 … … 217 232 }, 218 233 219 setDecorator : function (decorator){ 220 this.decorator = decorator; 234 setErrorDecorator : function (decorator){ 235 this.errorDecorator = decorator; 236 }, 237 238 setHelpDecorator : function (decorator){ 239 this.helpDecorator = decorator; 221 240 } 222 241 } … … 236 255 this.errInvalid = ''; 237 256 this.errRequired = ''; 238 } 239 240 241 /* 242 decorateur pour l'affichage des erreurs, sous forme d'alertes 243 */ 257 this.help=''; 258 } 259 260 261 /** 262 * Decorator to display errors in an alert dialog box 263 */ 244 264 function jFormsErrorDecoratorAlert(){ 245 265 this.message = ''; … … 266 286 } 267 287 288 289 /** 290 * Decorator to display help messages in an alert dialog box 291 */ 292 function jFormsHelpDecoratorAlert() { 293 294 } 295 jFormsHelpDecoratorAlert.prototype = { 296 show : function( message){ 297 alert(message); 298 } 299 } 300 trunk/lib/jelix/docs/ns/jforms-controls.rng
r504 r522 6 6 <attribute name="ref" /> 7 7 <ref name="label" /> 8 <!--<zeroOrMore> 9 <choice> 10 <ref name="help" /> 11 <ref name="hint" /> 12 <ref name="alert" /> 13 <ref name="actions" /> 14 </choice> 15 </zeroOrMore>--> 8 <optional> 9 <ref name="help" /> 10 </optional> 11 12 <!-- 13 <optional> 14 <ref name="hint" /> 15 </optional> 16 <optional> 17 <ref name="alert" /> 18 </optional> 19 <optional> 20 <ref name="help" /> 21 </optional>--> 16 22 </define> 17 23 <!-- … … 307 313 </define> 308 314 309 <!-- 315 <define name="help"> 316 <element name="help"> 317 <ref name="message.content" /> 318 </element> 319 </define> 320 <!-- 310 321 <define name="hint"> 311 322 <element name="hint"> … … 314 325 </define> 315 326 316 <define name="help">317 <element name="help">318 <ref name="message.content" />319 </element>320 </define>321 322 327 <define name="alert"> 323 328 <element name="alert"> … … 326 331 </define> 327 332 --> 328 329 330 333 </grammar> trunk/lib/jelix/docs/ns/jforms-controls.rng
r504 r522 6 6 <attribute name="ref" /> 7 7 <ref name="label" /> 8 <!--<zeroOrMore> 9 <choice> 10 <ref name="help" /> 11 <ref name="hint" /> 12 <ref name="alert" /> 13 <ref name="actions" /> 14 </choice> 15 </zeroOrMore>--> 8 <optional> 9 <ref name="help" /> 10 </optional> 11 12 <!-- 13 <optional> 14 <ref name="hint" /> 15 </optional> 16 <optional> 17 <ref name="alert" /> 18 </optional> 19 <optional> 20 <ref name="help" /> 21 </optional>--> 16 22 </define> 17 23 <!-- … … 307 313 </define> 308 314 309 <!-- 315 <define name="help"> 316 <element name="help"> 317 <ref name="message.content" /> 318 </element> 319 </define> 320 <!-- 310 321 <define name="hint"> 311 322 <element name="hint"> … … 314 325 </define> 315 326 316 <define name="help">317 <element name="help">318 <ref name="message.content" />319 </element>320 </define>321 322 327 <define name="alert"> 323 328 <element name="alert"> … … 326 331 </define> 327 332 --> 328 329 330 333 </grammar> trunk/lib/jelix/forms/jFormsBuilderBase.class.php
r518 r522 92 92 echo '<script type="text/javascript"> 93 93 //<[CDATA[ 94 ', $this->getJavascriptCheck($params ),'94 ', $this->getJavascriptCheck($params[0],$params[1]),' 95 95 //]]> 96 96 </script>'; … … 251 251 break; 252 252 } 253 } 254 255 256 abstract public function getJavascriptCheck($params); 253 254 if ($ctrl->hasHelp) { 255 if($ctrl->type == 'checkboxes' || ($ctrl->type == 'listbox' && $ctrl->multiple)){ 256 $name=$ctrl->ref.'[]'; 257 }else{ 258 $name=$ctrl->ref; 259 } 260 echo '<span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->_name.'\',\''.$name.'\')">?</a></span>'; 261 } 262 } 263 264 265 abstract public function getJavascriptCheck($errDecorator,$helpDecorator); 257 266 } 258 267 trunk/lib/jelix/forms/jFormsBuilderBase.class.php
r518 r522 92 92 echo '<script type="text/javascript"> 93 93 //<[CDATA[ 94 ', $this->getJavascriptCheck($params ),'94 ', $this->getJavascriptCheck($params[0],$params[1]),' 95 95 //]]> 96 96 </script>'; … … 251 251 break; 252 252 } 253 } 254 255 256 abstract public function getJavascriptCheck($params); 253 254 if ($ctrl->hasHelp) { 255 if($ctrl->type == 'checkboxes' || ($ctrl->type == 'listbox' && $ctrl->multiple)){ 256 $name=$ctrl->ref.'[]'; 257 }else{ 258 $name=$ctrl->ref; 259 } 260 echo '<span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->_name.'\',\''.$name.'\')">?</a></span>'; 261 } 262 } 263 264 265 abstract public function getJavascriptCheck($errDecorator,$helpDecorator); 257 266 } 258 267 trunk/lib/jelix/forms/jFormsCompiler.class.php
r518 r522 63 63 $srcjs=array(); 64 64 $srcjs[]='$js="gForm = new jFormsForm(\'".$this->_name."\');\n";'; 65 $srcjs[]='$js.="gForm.setDecorator(new ".$errorDecoratorName."());\n";'; 65 $srcjs[]='$js.="gForm.setErrorDecorator(new ".$errorDecoratorName."());\n";'; 66 $srcjs[]='$js.="gForm.setHelpDecorator(new ".$helpDecoratorName."());\n";'; 66 67 foreach($xml->children() as $controltype=>$control){ 67 68 $source[] = $this->generatePHPControl($controltype, $control); … … 77 78 $srcjs[]='$js.="jForms.declareForm(gForm);\n";'; 78 79 79 $srcHtmlBuilder[]=' public function getJavascriptCheck($errorDecoratorName ){';80 $srcHtmlBuilder[]=' public function getJavascriptCheck($errorDecoratorName, $helpDecoratorName){'; 80 81 $srcHtmlBuilder[]= implode("\n", $srcjs); 81 82 $srcHtmlBuilder[]=' return $js; }'; … … 109 110 110 111 $dt = (string)$control['type']; 111 if(!in_array(strtolower($dt), array('string','boolean','decimal','integer','hexadecimal','datetime','date','time','localedatetime','localedate','localetime', 'url','email','ipv4','ipv6'))){ 112 if(!in_array(strtolower($dt), array('string','boolean','decimal','integer','hexadecimal', 113 'datetime','date','time','localedatetime','localedate','localetime', 114 'url','email','ipv4','ipv6'))){ 112 115 throw new jException('jelix~formserr.datatype.unknow',array($dt,$controltype,$this->sourceFile)); 113 116 } … … 157 160 $source[]='$ctrl->label=\''.str_replace("'","\\'",$label).'\';'; 158 161 } 162 if(isset($control->help)){ 163 $source[]='$ctrl->hasHelp=true;'; 164 } 165 159 166 // support of static datas or daos 160 167 switch($controltype){ … … 277 284 } 278 285 286 if(isset($control->help)){ 287 if(isset($control->help['locale'])){ 288 $help='str_replace("\'","\\\'",jLocale::get(\''.(string)$control->help['locale'].'\'))'; 289 }else{ 290 $help='str_replace("\'","\\\'",\''.str_replace("'","\\'",(string)$control->help).'\')'; 291 } 292 $source[]='$js.="gControl.help=\'".'.$help.'."\';\n";'; 293 } 294 279 295 $source[]='$js.="gControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n";'; 280 296 $source[]='$js.="gControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n";'; trunk/lib/jelix/forms/jFormsCompiler.class.php
r518 r522 63 63 $srcjs=array(); 64 64 $srcjs[]='$js="gForm = new jFormsForm(\'".$this->_name."\');\n";'; 65 $srcjs[]='$js.="gForm.setDecorator(new ".$errorDecoratorName."());\n";'; 65 $srcjs[]='$js.="gForm.setErrorDecorator(new ".$errorDecoratorName."());\n";'; 66 $srcjs[]='$js.="gForm.setHelpDecorator(new ".$helpDecoratorName."());\n";'; 66 67 foreach($xml->children() as $controltype=>$control){ 67 68 $source[] = $this->generatePHPControl($controltype, $control); … … 77 78 $srcjs[]='$js.="jForms.declareForm(gForm);\n";'; 78 79 79 $srcHtmlBuilder[]=' public function getJavascriptCheck($errorDecoratorName ){';80 $srcHtmlBuilder[]=' public function getJavascriptCheck($errorDecoratorName, $helpDecoratorName){'; 80 81 $srcHtmlBuilder[]= implode("\n", $srcjs); 81 82 $srcHtmlBuilder[]=' return $js; }'; … … 109 110 110 111 $dt = (string)$control['type']; 111 if(!in_array(strtolower($dt), array('string','boolean','decimal','integer','hexadecimal','datetime','date','time','localedatetime','localedate','localetime', 'url','email','ipv4','ipv6'))){ 112 if(!in_array(strtolower($dt), array('string','boolean','decimal','integer','hexadecimal', 113 'datetime','date','time','localedatetime','localedate','localetime', 114 'url','email','ipv4','ipv6'))){ 112 115 throw new jException('jelix~formserr.datatype.unknow',array($dt,$controltype,$this->sourceFile)); 113 116 } … … 157 160 $source[]='$ctrl->label=\''.str_replace("'","\\'",$label).'\';'; 158 161 } 162 if(isset($control->help)){ 163 $source[]='$ctrl->hasHelp=true;'; 164 } 165 159 166 // support of static datas or daos 160 167 switch($controltype){ … … 277 284 } 278 285 286 if(isset($control->help)){ 287 if(isset($control->help['locale'])){ 288 $help='str_replace("\'","\\\'",jLocale::get(\''.(string)$control->help['locale'].'\'))'; 289 }else{ 290 $help='str_replace("\'","\\\'",\''.str_replace("'","\\'",(string)$control->help).'\')'; 291 } 292 $source[]='$js.="gControl.help=\'".'.$help.'."\';\n";'; 293 } 294 279 295 $source[]='$js.="gControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n";'; 280 296 $source[]='$js.="gControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n";'; trunk/lib/jelix/forms/jFormsControl.class.php
r518 r522 20 20 public $ref=''; 21 21 public $datatype='string'; 22 public $required =false;23 public $readonly =false;22 public $required = false; 23 public $readonly = false; 24 24 public $label=''; 25 25 public $value=''; 26 public $hasHelp = false; 26 27 27 28 function __construct($ref){ trunk/lib/jelix/forms/jFormsControl.class.php
r518 r522 20 20 public $ref=''; 21 21 public $datatype='string'; 22 public $required =false;23 public $readonly =false;22 public $required = false; 23 public $readonly = false; 24 24 public $label=''; 25 25 public $value=''; 26 public $hasHelp = false; 26 27 27 28 function __construct($ref){ trunk/lib/jelix/plugins/tpl/html/block.form.php
r506 r522 20 20 * 2=>array of parameters for submit action 21 21 * 3=>name of your javascript object for error listener 22 * 4=>name of your javascript object for help listener 22 23 * @return string the php code corresponding to the begin or end of the block 23 24 * @see jForms … … 40 41 } 41 42 42 if(isset($param[3]) )43 if(isset($param[3]) && $param[3] ! '') 43 44 $errdecorator = $param[3]; 44 45 else 45 46 $errdecorator = "'jFormsErrorDecoratorAlert'"; 46 47 48 if(isset($param[4]) && $param[4] ! '') 49 $helpdecorator = $param[4]; 50 else 51 $helpdecorator = "'jFormsErrorDecoratorAlert'"; 52 47 53 $content = ' $t->_privateVars[\'__form\'] = '.$param[0].'; 48 54 $t->_privateVars[\'__builder\'] = $t->_privateVars[\'__form\']->getBuilder(\'html\', '.$param[1].','.$param[2].'); 49 $t->_privateVars[\'__builder\']->outputHeader( '.$errdecorator.');55 $t->_privateVars[\'__builder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.')); 50 56 if($GLOBALS[\'gJCoord\']->response!= null){ 51 57 $GLOBALS[\'gJCoord\']->response->addJSLink($GLOBALS[\'gJConfig\']->urlengine[\'basePath\'].\'jelix/js/jforms.js\'); trunk/lib/jelix/plugins/tpl/html/block.form.php
r506 r522 20 20 * 2=>array of parameters for submit action 21 21 * 3=>name of your javascript object for error listener 22 * 4=>name of your javascript object for help listener 22 23 * @return string the php code corresponding to the begin or end of the block 23 24 * @see jForms … … 40 41 } 41 42 42 if(isset($param[3]) )43 if(isset($param[3]) && $param[3] ! '') 43 44 $errdecorator = $param[3]; 44 45 else 45 46 $errdecorator = "'jFormsErrorDecoratorAlert'"; 46 47 48 if(isset($param[4]) && $param[4] ! '') 49 $helpdecorator = $param[4]; 50 else 51 $helpdecorator = "'jFormsErrorDecoratorAlert'"; 52 47 53 $content = ' $t->_privateVars[\'__form\'] = '.$param[0].'; 48 54 $t->_privateVars[\'__builder\'] = $t->_privateVars[\'__form\']->getBuilder(\'html\', '.$param[1].','.$param[2].'); 49 $t->_privateVars[\'__builder\']->outputHeader( '.$errdecorator.');55 $t->_privateVars[\'__builder\']->outputHeader(array('.$errdecorator.','.$helpdecorator.')); 50 56 if($GLOBALS[\'gJCoord\']->response!= null){ 51 57 $GLOBALS[\'gJCoord\']->response->addJSLink($GLOBALS[\'gJConfig\']->urlengine[\'basePath\'].\'jelix/js/jforms.js\'); trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php
r518 r522 192 192 <selectedvalues> <value>bbb</value><value>aaa</value></selectedvalues> 193 193 </listbox>', 194 42=>'<input ref="nom" xmlns="http://jelix.org/ns/forms/1.0"> 195 <label>Votre nom</label> 196 <help>vous devez indiquer votre nom</help> 197 </input>', 194 198 ); 195 199 … … 446 450 $ctrl->multiple=true; 447 451 $this->addControl($ctrl);', 452 42=>'$ctrl= new jFormsControlinput(\'nom\'); 453 $ctrl->datatype= new jDatatypeString(); 454 $ctrl->label=\'Votre nom\'; 455 $ctrl->hasHelp=true; 456 $this->addControl($ctrl);', 448 457 ); 449 458 … … 662 671 $js.="gControl.multiple = true;\n"; 663 672 $js.="gForm.addControl( gControl);\n";', 673 42=>'$label = str_replace("\'","\\\'",\'Votre nom\'); 674 $js.="gControl = new jFormsControl(\'nom\', \'".$label."\', \'string\');\n"; 675 $js.="gControl.help=\'".str_replace("\'","\\\'",\'vous devez indiquer votre nom\')."\';\n"; 676 $js.="gControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 677 $js.="gControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 678 $js.="gForm.addControl( gControl);\n";', 679 664 680 ); 665 681 trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php
r518 r522 192 192 <selectedvalues> <value>bbb</value><value>aaa</value></selectedvalues> 193 193 </listbox>', 194 42=>'<input ref="nom" xmlns="http://jelix.org/ns/forms/1.0"> 195 <label>Votre nom</label> 196 <help>vous devez indiquer votre nom</help> 197 </input>', 194 198 ); 195 199 … … 446 450 $ctrl->multiple=true; 447 451 $this->addControl($ctrl);', 452 42=>'$ctrl= new jFormsControlinput(\'nom\'); 453 $ctrl->datatype= new jDatatypeString(); 454 $ctrl->label=\'Votre nom\'; 455 $ctrl->hasHelp=true; 456 $this->addControl($ctrl);', 448 457 ); 449 458 … … 662 671 $js.="gControl.multiple = true;\n"; 663 672 $js.="gForm.addControl( gControl);\n";', 673 42=>'$label = str_replace("\'","\\\'",\'Votre nom\'); 674 $js.="gControl = new jFormsControl(\'nom\', \'".$label."\', \'string\');\n"; 675 $js.="gControl.help=\'".str_replace("\'","\\\'",\'vous devez indiquer votre nom\')."\';\n"; 676 $js.="gControl.errRequired=\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.required\',$label))."\';\n"; 677 $js.="gControl.errInvalid =\'".str_replace("\'","\\\'",jLocale::get(\'jelix~formserr.js.err.invalid\', $label))."\';\n"; 678 $js.="gForm.addControl( gControl);\n";', 679 664 680 ); 665 681 trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php
r518 r522 26 26 27 27 class testJFormsHtmlBuilder extends jFormsHtmlBuilderBase { 28 public function getJavascriptCheck($ params){28 public function getJavascriptCheck($errDecorator,$helpDecorator){ 29 29 return ''; 30 30 } … … 46 46 $formname = $builder->getName(); 47 47 ob_start(); 48 $builder->outputHeader( '');48 $builder->outputHeader(array('','')); 49 49 $out = ob_get_clean(); 50 50 $result ='<form action="/index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="module" value="jelix_tests"/> … … 60 60 $formname = $builder->getName(); 61 61 ob_start(); 62 $builder->outputHeader( '');62 $builder->outputHeader(array('','')); 63 63 $out = ob_get_clean(); 64 64 $result ='<form action="/index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="foo" value="b>ar"/> … … 100 100 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 101 101 $this->assertEqualOrDiff('<input type="text" name="nominconnu" id="'.$this->formname.'_nominconnu" value="toto"/>', $out); 102 103 $ctrl->hasHelp=true; 104 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 105 $this->assertEqualOrDiff('<input type="text" name="nominconnu" id="'.$this->formname.'_nominconnu" value="toto"/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'nominconnu\')">?</a></span>', $out); 106 102 107 } 103 108 function testOutputCheckbox(){ trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php
r518 r522 26 26 27 27 class testJFormsHtmlBuilder extends jFormsHtmlBuilderBase { 28 public function getJavascriptCheck($ params){28 public function getJavascriptCheck($errDecorator,$helpDecorator){ 29 29 return ''; 30 30 } … … 46 46 $formname = $builder->getName(); 47 47 ob_start(); 48 $builder->outputHeader( '');48 $builder->outputHeader(array('','')); 49 49 $out = ob_get_clean(); 50 50 $result ='<form action="/index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="module" value="jelix_tests"/> … … 60 60 $formname = $builder->getName(); 61 61 ob_start(); 62 $builder->outputHeader( '');62 $builder->outputHeader(array('','')); 63 63 $out = ob_get_clean(); 64 64 $result ='<form action="/index.php" method="POST" name="'.$formname.'" onsubmit="return jForms.verifyForm(this)"><div><input type="hidden" name="foo" value="b>ar"/> … … 100 100 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 101 101 $this->assertEqualOrDiff('<input type="text" name="nominconnu" id="'.$this->formname.'_nominconnu" value="toto"/>', $out); 102 103 $ctrl->hasHelp=true; 104 ob_start();$this->builder->outputControl($ctrl);$out = ob_get_clean(); 105 $this->assertEqualOrDiff('<input type="text" name="nominconnu" id="'.$this->formname.'_nominconnu" value="toto"/><span class="jforms-help"><a href="javascript:jForms.showHelp(\''. $this->formname.'\',\'nominconnu\')">?</a></span>', $out); 106 102 107 } 103 108 function testOutputCheckbox(){
