Changeset 702
- Timestamp:
- 12/15/07 15:28:20 (1 year ago)
- Files:
-
- trunk/build/manifests/jelix-lib.mn (modified) (1 diff)
- trunk/build/manifests/jelix-lib.mn (modified) (1 diff)
- trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.UTF-8.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.UTF-8.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.UTF-8.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.UTF-8.properties (modified) (2 diffs)
- trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties (modified) (1 diff)
- trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.UTF-8.properties (modified) (1 diff)
- trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.UTF-8.properties (modified) (1 diff)
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/lib/jelix/CREDITS (modified) (1 diff)
- trunk/lib/jelix/docs/ns/jforms.rng (modified) (2 diffs)
- trunk/lib/jelix/docs/ns/jforms.rng (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (13 diffs)
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (13 diffs)
- trunk/lib/jelix/forms/jFormsBuilderBase.class.php (modified) (6 diffs)
- trunk/lib/jelix/forms/jFormsBuilderBase.class.php (modified) (6 diffs)
- trunk/lib/jelix/forms/jFormsCompiler.class.php (modified) (12 diffs)
- trunk/lib/jelix/forms/jFormsCompiler.class.php (modified) (12 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (3 diffs)
- trunk/lib/jelix/forms/jFormsControl.class.php (modified) (3 diffs)
- trunk/lib/jelix/plugins/tpl/html/block.formcontrols.php (modified) (5 diffs)
- trunk/lib/jelix/plugins/tpl/html/block.formcontrols.php (modified) (5 diffs)
- trunk/lib/jelix/plugins/tpl/html/cfunction.formfull.php (modified) (4 diffs)
- trunk/lib/jelix/plugins/tpl/html/cfunction.formfull.php (modified) (4 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.ctrl_control.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.ctrl_control.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.ctrl_label.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.ctrl_label.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.ctrl_value.php (modified) (3 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.ctrl_value.php (modified) (3 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.formdatasfull.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.formdatasfull.php (modified) (2 diffs)
- trunk/lib/jelix/plugins/tpl/html/function.formreset.php (added)
- trunk/lib/jelix/plugins/tpl/html/function.formreset.php (added)
- trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php (modified) (7 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.compiler.html.php (modified) (7 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php (modified) (6 diffs)
- trunk/testapp/modules/jelix_tests/tests/jforms.htmlbuilder.html.php (modified) (6 diffs)
- trunk/testapp/modules/testapp/forms/sample.form.xml (modified) (1 diff)
- trunk/testapp/modules/testapp/forms/sample.form.xml (modified) (1 diff)
- trunk/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
- trunk/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/jelix-lib.mn
r696 r702 371 371 function.ctrl_value.php 372 372 function.formsubmit.php 373 function.formreset.php 373 374 function.pagelinks.php 374 375 trunk/build/manifests/jelix-lib.mn
r696 r702 371 371 function.ctrl_value.php 372 372 function.formsubmit.php 373 function.formreset.php 373 374 function.pagelinks.php 374 375 trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.ISO-8859-1.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.UTF-8.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/en_EN/formserr.UTF-8.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.ISO-8859-1.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.UTF-8.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/en_US/formserr.UTF-8.properties
r580 r702 1 1 tag.missing=(800) %1$s is missing (file %2$s) 2 unknow.tag=(801) unknow tag %1$s (file %2$s)2 unknow.tag=(801) unknown tag %1$s (file %2$s) 3 3 attribute.missing=(802) attribut %1$s is missing on %2$s (file %3$s) 4 4 attribute.not.allowed=(803) attribut %1$s not allowed on %2$s (file %3$s) 5 datatype.unknow=(804) unknow datatype %1$s on %2$s (file %3$s)5 datatype.unknow=(804) unknown datatype %1$s on %2$s (file %3$s) 6 6 invalid.xml.file=(805) invalid xml syntax in jforms file (file %s) 7 7 selected.attribute.not.allowed=(806)"selected" attribute on <item> is not allowed when using defaultvalue attribute or <defaultvalues> (file %s) … … 16 16 invalid.upload.control.name = (815) The given control name "%s" is invalid or the corresponding control is not an upload (form=%s) 17 17 content.missing=(816) content of %1$s tag is missing (file %2$s) 18 notunique.tag=(817) tag %1$s must be unique (file %2$s) 18 19 19 20 js.err.invalid= "%s" field is invalid trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties
r580 r702 16 16 invalid.upload.control.name = (815) Le nom de controle indiqu�%s" est invalide ou le control n'est pas un upload (form=%s) 17 17 content.missing=(816) le contenu de %1$s est manquant (fichier %2$s) 18 notunique.tag=(817) La balise %1$s doit �e unique (fichier %2$s) 18 19 19 20 js.err.invalid=La saisie de "%s" est invalide trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.ISO-8859-1.properties
r580 r702 16 16 invalid.upload.control.name = (815) Le nom de controle indiqu�%s" est invalide ou le control n'est pas un upload (form=%s) 17 17 content.missing=(816) le contenu de %1$s est manquant (fichier %2$s) 18 notunique.tag=(817) La balise %1$s doit �e unique (fichier %2$s) 18 19 19 20 js.err.invalid=La saisie de "%s" est invalide trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.UTF-8.properties
r580 r702 16 16 invalid.upload.control.name = (815) Le nom de controle indiqué "%s" est invalide ou le control n'est pas un upload (form=%s) 17 17 content.missing=(816) le contenu de %1$s est manquant (fichier %2$s) 18 notunique.tag=(817) La balise %1$s doit être unique (fichier %2$s) 18 19 19 20 js.err.invalid=La saisie de "%s" est invalide trunk/lib/jelix/core-modules/jelix/locales/fr_FR/formserr.UTF-8.properties
r580 r702 16 16 invalid.upload.control.name = (815) Le nom de controle indiqué "%s" est invalide ou le control n'est pas un upload (form=%s) 17 17 content.missing=(816) le contenu de %1$s est manquant (fichier %2$s) 18 notunique.tag=(817) La balise %1$s doit être unique (fichier %2$s) 18 19 19 20 js.err.invalid=La saisie de "%s" est invalide trunk/lib/jelix/CREDITS
r696 r702 90 90 - added support of 'else' keyword for block plugin in jtpl (#349) 91 91 - fixed bug in firebug support (#362) 92 - added support of <reset> in jforms (#258) 92 93 93 94 Thibault Piront (aka nuks) trunk/lib/jelix/CREDITS
r696 r702 90 90 - added support of 'else' keyword for block plugin in jtpl (#349) 91 91 - fixed bug in firebug support (#362) 92 - added support of <reset> in jforms (#258) 92 93 93 94 Thibault Piront (aka nuks) trunk/lib/jelix/docs/ns/jforms.rng
r700 r702 34 34 </choice> 35 35 </oneOrMore> 36 <optional> 37 <ref name="reset" /> 38 </optional> 36 39 </define> 37 40 … … 320 323 --> 321 324 325 <define name="reset"> 326 <element name="reset"> 327 <ref name="control.common" /> 328 </element> 329 </define> 322 330 323 331 <!-- trunk/lib/jelix/docs/ns/jforms.rng
r700 r702 34 34 </choice> 35 35 </oneOrMore> 36 <optional> 37 <ref name="reset" /> 38 </optional> 36 39 </define> 37 40 … … 320 323 --> 321 324 325 <define name="reset"> 326 <element name="reset"> 327 <ref name="control.common" /> 328 </element> 329 </define> 322 330 323 331 <!-- trunk/lib/jelix/forms/jFormsBase.class.php
r699 r702 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 * @contributor 7 * @copyright 2006-2007 Laurent Jouanneau 6 * @contributor Dominique Papin 7 * @copyright 2006-2007 Laurent Jouanneau, 2007 Dominique Papin 8 8 * @link http://www.jelix.org 9 9 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file … … 48 48 */ 49 49 protected $_submits = array(); 50 51 /** 52 * Reset button 53 * @var jFormsControl 54 * @see jFormsControl 55 * @since 1.0 56 */ 57 protected $_reset = null; 50 58 51 59 /** … … 116 124 } 117 125 }elseif($ctrl->type=='submit' && $value) { 118 // because IE send the <button> content as value instead of the content of the 126 // because IE send the <button> content as value instead of the content of the 119 127 // "value" attribute, we should verify it and get the real value 120 128 $datas = $ctrl->datasource->getDatas(); … … 189 197 }else { 190 198 $this->_container->datas[$name] = $ctrl->valueOnUncheck; 191 } 199 } 192 200 }else{ 193 201 $this->_container->datas[$name] = $daorec->$name; … … 239 247 // if no value and if the property is not required, we set null to it 240 248 $daorec->$name = null; 241 }else if($daorec->$name == '' && $prop[$name]['defaultValue'] !== null 249 }else if($daorec->$name == '' && $prop[$name]['defaultValue'] !== null 242 250 && in_array($prop[$name]['datatype'], 243 251 array('int','integer','double','float'))) { … … 272 280 /** 273 281 * set datas from a DAO, in a control 274 * 282 * 275 283 * The control must be a container like checkboxes or listbox with multiple attribute. 276 284 * The form should contain a formId 277 285 * 278 286 * The Dao should map to an "association table" : its primary key should be composed by 279 * the primary key stored in the formId (or the given primarykey) + the field which will contain one of 287 * the primary key stored in the formId (or the given primarykey) + the field which will contain one of 280 288 * the values of the control. If this order is not the same as defined into the dao, 281 289 * you should provide the list of property names which corresponds to the primary key 282 * in this order : properties for the formId, followed by the property which contains 290 * in this order : properties for the formId, followed by the property which contains 283 291 * the value. 284 292 * @param string $controlName the name of the control … … 332 340 * The control must be a container like checkboxes or listbox with multiple attribute. 333 341 * If the form contain a new record (no formId), you should call saveToDao before 334 * in order to get a new id (the primary key of the new record), or you should get a new id 342 * in order to get a new id (the primary key of the new record), or you should get a new id 335 343 * by an other way. then you must pass this primary key in the third argument. 336 344 * If the form have already a formId, then it will be used as a primary key, unless … … 338 346 * 339 347 * The Dao should map to an "association table" : its primary key should be 340 * the primary key stored in the formId + the field which will contain one of 348 * the primary key stored in the formId + the field which will contain one of 341 349 * the values of the control. If this order is not the same as defined into the dao, 342 350 * you should provide the list of property names which corresponds to the primary key 343 * in this order : properties for the formId, followed by the property which contains 351 * in this order : properties for the formId, followed by the property which contains 344 352 * the value. 345 353 * All existing records which have the formid in their keys are deleted … … 411 419 * set an error message on a specific field 412 420 * @param string $field the field name 413 * @param string $mesg the error message string 421 * @param string $mesg the error message string 414 422 */ 415 423 public function setErrorOn($field, $mesg){ … … 460 468 /** 461 469 * @param string $name the control name you want to get 462 * @return jFormsControl 470 * @return jFormsControl 463 471 * @since jelix 1.0 464 472 */ … … 469 477 */ 470 478 public function getSubmits(){ return $this->_submits; } 479 480 /** 481 * @return array of jFormsControl objects 482 */ 483 public function getReset(){ return $this->_reset; } 471 484 472 485 /** … … 498 511 499 512 /** 500 * save an uploaded file in the given directory. the given control must be 513 * save an uploaded file in the given directory. the given control must be 501 514 * an upload control of course. 502 515 * @param string $controlName the name of the upload control … … 568 581 if($control->type =='submit') 569 582 $this->_submits [$control->ref] = $control; 570 if($control->type =='upload'){ 583 else if($control->type =='reset') 584 $this->_reset = $control; 585 else if($control->type =='upload') 571 586 $this->_uploads [$control->ref] = $control; 572 } 587 573 588 if(!isset($this->_container->datas[$control->ref])){ 574 589 if ( $control->datatype instanceof jDatatypeDateTime && $control->defaultValue == 'now') { trunk/lib/jelix/forms/jFormsBase.class.php
r699 r702 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 * @contributor 7 * @copyright 2006-2007 Laurent Jouanneau 6 * @contributor Dominique Papin 7 * @copyright 2006-2007 Laurent Jouanneau, 2007 Dominique Papin 8 8 * @link http://www.jelix.org 9 9 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file … … 48 48 */ 49 49 protected $_submits = array(); 50 51 /** 52 * Reset button 53 * @var jFormsControl 54 * @see jFormsControl 55 * @since 1.0 56 */ 57 protected $_reset = null; 50 58 51 59 /** … … 116 124 } 117 125 }elseif($ctrl->type=='submit' && $value) { 118 // because IE send the <button> content as value instead of the content of the 126 // because IE send the <button> content as value instead of the content of the 119 127 // "value" attribute, we should verify it and get the real value 120 128 $datas = $ctrl->datasource->getDatas(); … … 189 197 }else { 190 198 $this->_container->datas[$name] = $ctrl->valueOnUncheck; 191 } 199 } 192 200 }else{ 193 201 $this->_container->datas[$name] = $daorec->$name; … … 239 247 // if no value and if the property is not required, we set null to it 240 248 $daorec->$name = null; 241 }else if($daorec->$name == '' && $prop[$name]['defaultValue'] !== null 249 }else if($daorec->$name == '' && $prop[$name]['defaultValue'] !== null 242 250 && in_array($prop[$name]['datatype'], 243 251 array('int','integer','double','float'))) { … … 272 280 /** 273 281 * set datas from a DAO, in a control 274 * 282 * 275 283 * The control must be a container like checkboxes or listbox with multiple attribute. 276 284 * The form should contain a formId 277 285 * 278 286 * The Dao should map to an "association table" : its primary key should be composed by 279 * the primary key stored in the formId (or the given primarykey) + the field which will contain one of 287 * the primary key stored in the formId (or the given primarykey) + the field which will contain one of 280 288 * the values of the control. If this order is not the same as defined into the dao, 281 289 * you should provide the list of property names which corresponds to the primary key 282 * in this order : properties for the formId, followed by the property which contains 290 * in this order : properties for the formId, followed by the property which contains 283 291 * the value. 284 292 * @param string $controlName the name of the control … … 332 340 * The control must be a container like checkboxes or listbox with multiple attribute. 333 341 * If the form contain a new record (no formId), you should call saveToDao before 334 * in order to get a new id (the primary key of the new record), or you should get a new id 342 * in order to get a new id (the primary key of the new record), or you should get a new id 335 343 * by an other way. then you must pass this primary key in the third argument. 336 344 * If the form have already a formId, then it will be used as a primary key, unless … … 338 346 * 339 347 * The Dao should map to an "association table" : its primary key should be 340 * the primary key stored in the formId + the field which will contain one of 348 * the primary key stored in the formId + the field which will contain one of 341 349 * the values of the control. If this order is not the same as defined into the dao, 342 350 * you should provide the list of property names which corresponds to the primary key 343 * in this order : properties for the formId, followed by the property which contains 351 * in this order : properties for the formId, followed by the property which contains 344 352 * the value. 345 353 * All existing records which have the formid in their keys are deleted … … 411 419 * set an error message on a specific field 412 420 * @param string $field the field name 413 * @param string $mesg the error message string 421 * @param string $mesg the error message string 414 422 */ 415 423 public function setErrorOn($field, $mesg){ … … 460 468 /** 461 469 * @param string $name the control name you want to get 462 * @return jFormsControl 470 * @return jFormsControl 463 471 * @since jelix 1.0 464 472 */ … … 469 477 */ 470 478 public function getSubmits(){ return $this->_submits; } 479 480 /** 481 * @return array of jFormsControl objects 482 */ 483 public function getReset(){ return $this->_reset; } 471 484 472 485 /** … … 498 511 499 512 /** 500 * save an uploaded file in the given directory. the given control must be 513 * save an uploaded file in the given directory. the given control must be 501 514 * an upload control of course. 502 515 * @param string $controlName the name of the upload control … … 568 581 if($control->type =='submit') 569 582 $this->_submits [$control->ref] = $control; 570 if($control->type =='upload'){ 583 else if($control->type =='reset') 584 $this->_reset = $control; 585 else if($control->type =='upload') 571 586 $this->_uploads [$control->ref] = $control; 572 } 587 573 588 if(!isset($this->_container->datas[$control->ref])){ 574 589 if ( $control->datatype instanceof jDatatypeDateTime && $control->defaultValue == 'now') { trunk/lib/jelix/forms/jFormsBuilderBase.class.php
r669 r702 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 * @contributor Loic Mathaud 7 * @copyright 2006-2007 Laurent Jouanneau 6 * @contributor Loic Mathaud, Dominique Papin 7 * @copyright 2006-2007 Laurent Jouanneau, 2007 Dominique Papin 8 8 * @copyright 2007 Loic Mathaud 9 9 * @link http://www.jelix.org … … 123 123 echo '</div>'; 124 124 } 125 echo '<script type="text/javascript"> 125 echo '<script type="text/javascript"> 126 126 //<![CDATA[ 127 127 ', $this->getJavascriptCheck($params[0],$params[1]),' … … 165 165 if($ctrl->type == 'output' || $ctrl->type == 'checkboxes' || $ctrl->type == 'radiobuttons'){ 166 166 echo '<span class="jforms-label',$required,$inError,'"',$hint,'>',htmlspecialchars($ctrl->label),'</span>'; 167 }else if($ctrl->type != 'submit' ){167 }else if($ctrl->type != 'submit' && $ctrl->type != 'reset'){ 168 168 $id = $this->_name.'_'.$ctrl->ref; 169 169 echo '<label class="jforms-label',$required,$inError,'" for="'.$id.'"',$hint,'>'.htmlspecialchars($ctrl->label).'</label>'; … … 204 204 foreach($ctrl->datasource->getDatas() as $v=>$label){ 205 205 echo '<input type="checkbox"',$attrs,$i,'" value="',htmlspecialchars($v),'"'; 206 if(in_array($v,$value)) 206 if(in_array($v,$value)) 207 207 echo ' checked="checked"'; 208 208 echo $readonly,$class,$this->_endt,'<label for="',$id,$i,'">',htmlspecialchars($label),'</label>'; … … 212 212 foreach($ctrl->datasource->getDatas() as $v=>$label){ 213 213 echo '<input type="checkbox"',$attrs,$i,'" value="',htmlspecialchars($v),'"'; 214 if($v == $value) 214 if($v == $value) 215 215 echo ' checked="checked"'; 216 216 echo $readonly,$class,$this->_endt,'<label for="',$id,$i,'">',htmlspecialchars($label),'</label>'; … … 318 318 } 319 319 break; 320 case 'reset': 321 echo '<button type="reset"',$id,$hint,'>',htmlspecialchars($ctrl->label),'</button>'; 322 break; 320 323 } 321 324 trunk/lib/jelix/forms/jFormsBuilderBase.class.php
r669 r702 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 * @contributor Loic Mathaud 7 * @copyright 2006-2007 Laurent Jouanneau 6 * @contributor Loic Mathaud, Dominique Papin 7 * @copyright 2006-2007 Laurent Jouanneau, 2007 Dominique Papin 8 8 * @copyright 2007 Loic Mathaud 9 9 * @link http://www.jelix.org … … 123 123 echo '</div>'; 124 124 } 125 echo '<script type="text/javascript"> 125 echo '<script type="text/javascript"> 126 126 //<![CDATA[ 127 127 ', $this->getJavascriptCheck($params[0],$params[1]),' … … 165 165 if($ctrl->type == 'output' || $ctrl->type == 'checkboxes' || $ctrl->type == 'radiobuttons'){ 166 166 echo '<span class="jforms-label',$required,$inError,'"',$hint,'>',htmlspecialchars($ctrl->label),'</span>'; 167 }else if($ctrl->type != 'submit' ){167 }else if($ctrl->type != 'submit' && $ctrl->type != 'reset'){ 168 168 $id = $this->_name.'_'.$ctrl->ref; 169 169 echo '<label class="jforms-label',$required,$inError,'" for="'.$id.'"',$hint,'>'.htmlspecialchars($ctrl->label).'</label>'; … … 204 204 foreach($ctrl->datasource->getDatas() as $v=>$label){ 205 205 echo '<input type="checkbox"',$attrs,$i,'" value="',htmlspecialchars($v),'"'; 206 if(in_array($v,$value)) 206 if(in_array($v,$value)) 207 207 echo ' checked="checked"'; 208 208 echo $readonly,$class,$this->_endt,'<label for="',$id,$i,'">',htmlspecialchars($label),'</label>'; … … 212 212 foreach($ctrl->datasource->getDatas() as $v=>$label){ 213 213 echo '<input type="checkbox"',$attrs,$i,'" value="',htmlspecialchars($v),'"'; 214 if($v == $value) 214 if($v == $value) 215 215 echo ' checked="checked"'; 216 216 echo $readonly,$class,$this->_endt,'<label for="',$id,$i,'">',htmlspecialchars($label),'</label>'; … … 318 318 } 319 319 break; 320 case 'reset': 321 echo '<button type="reset"',$id,$hint,'>',htmlspecialchars($ctrl->label),'</button>'; 322 break; 320 323 } 321 324 trunk/lib/jelix/forms/jFormsCompiler.class.php
r699 r702 4 4 * @subpackage forms 5 5 * @author Laurent Jouanneau 6 * @contributor Loic Mathaud 6 * @contributor Loic Mathaud, Dominique Papin 7 7 * @contributor Uriel Corfa Emotic SARL 8 8 * @copyright 2006-2007 Laurent Jouanneau 9 * @copyright 2007 Loic Mathaud 9 * @copyright 2007 Loic Mathaud, 2007 Dominique Papin 10 10 * @copyright 2007 Emotic SARL 11 11 * @link http://www.jelix.org … … 37 37 throw new jException('jelix~formserr.invalid.xml.file',array($this->sourceFile)); 38 38 } 39 40 if($doc->documentElement->namespaceURI != JELIX_NAMESPACE_BASE.'forms/1.0'){41 throw new jException('jelix~formserr.namespace.wrong',array($this->sourceFile));42 }43 44 $xml = simplexml_import_dom($doc);45 39 46 40 $source=array(); … … 64 58 $srcjs[]='$js.="jForms.tForm.setHelpDecorator(new ".$helpDecoratorName."());\n";'; 65 59 66 foreach($xml->children() as $controltype=>$control){ 67 $source[] = $this->generatePHPControl($controltype, $control); 68 $srcjs[] = $this->generateJsControl($controltype, $control); 69 } 60 $this->generatePHPContent($doc, $source, $srcjs); 61 70 62 $source[]=" }\n} ?>"; 71 63 … … 82 74 } 83 75 76 protected function generatePHPContent($doc, &$source, &$srcjs){ 77 78 if($doc->documentElement->namespaceURI != JELIX_NAMESPACE_BASE.'forms/1.0'){ 79 throw new jException('jelix~formserr.namespace.wrong',array($this->sourceFile)); 80 } 81 82 $xml = simplexml_import_dom($doc); 83 84 if (count($xml->reset) > 1 ) 85 throw new jException('jelix~formserr.notunique.tag',array('reset',$this->sourceFile)); 86 87 88 foreach($xml->children() as $controltype=>$control){ 89 $source[] = $this->generatePHPControl($controltype, $control); 90 $srcjs[] = $this->generateJsControl($controltype, $control); 91 } 92 } 84 93 85 94 protected function generatePHPControl($controltype, $control){ … … 106 115 $dt = (string)$control['type']; 107 116 if(!in_array(strtolower($dt), array('string','boolean','decimal','integer','hexadecimal', 108 'datetime','date','time','localedatetime','localedate','localetime', 117 'datetime','date','time','localedatetime','localedate','localetime', 109 118 'url','email','ipv4','ipv6'))){ 110 119 throw new jException('jelix~formserr.datatype.unknow',array($dt,$controltype,$this->sourceFile)); … … 118 127 // readonly support 119 128 if(isset($control['readonly'])){ 120 if($controltype == 'output' || $controltype == 'submit' ){129 if($controltype == 'output' || $controltype == 'submit' || $controltype == 'reset'){ 121 130 throw new jException('jelix~formserr.attribute.not.allowed',array('readonly',$controltype,$this->sourceFile)); 122 131 } … … 126 135 // required support 127 136 if(isset($control['required'])){ 128 if($controltype == 'checkbox' || $controltype == 'output' || $controltype == 'submit' ){137 if($controltype == 'checkbox' || $controltype == 'output' || $controltype == 'submit' || $controltype == 'reset'){ 129 138 throw new jException('jelix~formserr.attribute.not.allowed',array('required',$controltype,$this->sourceFile)); 130 139 } …
