Changeset 926
- Timestamp:
- 05/05/08 08:46:36 (3 months ago)
- Files:
-
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php (modified) (5 diffs)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php (modified) (5 diffs)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php (modified) (5 diffs)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php (modified) (5 diffs)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (4 diffs)
- branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (4 diffs)
- branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (4 diffs)
- branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php (modified) (4 diffs)
- branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php (modified) (2 diffs)
- branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php (modified) (2 diffs)
- branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php (modified) (2 diffs)
- branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php (modified) (2 diffs)
- branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/forms/sample.form.xml (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/forms/sample.form.xml (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/forms/sample.form.xml (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/forms/sample.form.xml (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
- branches/experimental/jforms-groups/testapp/modules/testapp/templates/sampleform.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php
r920 r926 48 48 * @see jFormsControl 49 49 */ 50 protected $ topControls = array();50 protected $rootControls = array(); 51 51 52 52 /** … … 134 134 $req = $GLOBALS['gJCoord']->request; 135 135 $this->modifiedControls=array(); 136 foreach($this-> topControls as $name=>$ctrl){136 foreach($this->rootControls as $name=>$ctrl){ 137 137 if(!$this->container->isActivated($name) || $this->container->isReadOnly($name)) 138 138 continue; … … 492 492 public function getContainer(){ return $this->container; } 493 493 494 495 /** 496 * @return array of jFormsControl objects 497 */ 498 public function getRootControls(){ return $this->rootControls; } 499 494 500 /** 495 501 * @return array of jFormsControl objects … … 627 633 */ 628 634 public function addControl($control){ 629 $this-> topControls [$control->ref] = $control;635 $this->rootControls [$control->ref] = $control; 630 636 $this->addChildControl($control); 631 637 … … 638 644 639 645 function removeControl($name) { 640 if(!isset($this-> topControls [$name]))646 if(!isset($this->rootControls [$name])) 641 647 return; 642 unset($this-> topControls [$name]);648 unset($this->rootControls [$name]); 643 649 unset($this->controls [$name]); 644 650 unset($this->submits [$name]); branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php
r920 r926 48 48 * @see jFormsControl 49 49 */ 50 protected $ topControls = array();50 protected $rootControls = array(); 51 51 52 52 /** … … 134 134 $req = $GLOBALS['gJCoord']->request; 135 135 $this->modifiedControls=array(); 136 foreach($this-> topControls as $name=>$ctrl){136 foreach($this->rootControls as $name=>$ctrl){ 137 137 if(!$this->container->isActivated($name) || $this->container->isReadOnly($name)) 138 138 continue; … … 492 492 public function getContainer(){ return $this->container; } 493 493 494 495 /** 496 * @return array of jFormsControl objects 497 */ 498 public function getRootControls(){ return $this->rootControls; } 499 494 500 /** 495 501 * @return array of jFormsControl objects … … 627 633 */ 628 634 public function addControl($control){ 629 $this-> topControls [$control->ref] = $control;635 $this->rootControls [$control->ref] = $control; 630 636 $this->addChildControl($control); 631 637 … … 638 644 639 645 function removeControl($name) { 640 if(!isset($this-> topControls [$name]))646 if(!isset($this->rootControls [$name])) 641 647 return; 642 unset($this-> topControls [$name]);648 unset($this->rootControls [$name]); 643 649 unset($this->controls [$name]); 644 650 unset($this->submits [$name]); branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php
r920 r926 48 48 * @see jFormsControl 49 49 */ 50 protected $ topControls = array();50 protected $rootControls = array(); 51 51 52 52 /** … … 134 134 $req = $GLOBALS['gJCoord']->request; 135 135 $this->modifiedControls=array(); 136 foreach($this-> topControls as $name=>$ctrl){136 foreach($this->rootControls as $name=>$ctrl){ 137 137 if(!$this->container->isActivated($name) || $this->container->isReadOnly($name)) 138 138 continue; … … 492 492 public function getContainer(){ return $this->container; } 493 493 494 495 /** 496 * @return array of jFormsControl objects 497 */ 498 public function getRootControls(){ return $this->rootControls; } 499 494 500 /** 495 501 * @return array of jFormsControl objects … … 627 633 */ 628 634 public function addControl($control){ 629 $this-> topControls [$control->ref] = $control;635 $this->rootControls [$control->ref] = $control; 630 636 $this->addChildControl($control); 631 637 … … 638 644 639 645 function removeControl($name) { 640 if(!isset($this-> topControls [$name]))646 if(!isset($this->rootControls [$name])) 641 647 return; 642 unset($this-> topControls [$name]);648 unset($this->rootControls [$name]); 643 649 unset($this->controls [$name]); 644 650 unset($this->submits [$name]); branches/experimental/jforms-groups/lib/jelix/forms/jFormsBase.class.php
r920 r926 48 48 * @see jFormsControl 49 49 */ 50 protected $ topControls = array();50 protected $rootControls = array(); 51 51 52 52 /** … … 134 134 $req = $GLOBALS['gJCoord']->request; 135 135 $this->modifiedControls=array(); 136 foreach($this-> topControls as $name=>$ctrl){136 foreach($this->rootControls as $name=>$ctrl){ 137 137 if(!$this->container->isActivated($name) || $this->container->isReadOnly($name)) 138 138 continue; … … 492 492 public function getContainer(){ return $this->container; } 493 493 494 495 /** 496 * @return array of jFormsControl objects 497 */ 498 public function getRootControls(){ return $this->rootControls; } 499 494 500 /** 495 501 * @return array of jFormsControl objects … … 627 633 */ 628 634 public function addControl($control){ 629 $this-> topControls [$control->ref] = $control;635 $this->rootControls [$control->ref] = $control; 630 636 $this->addChildControl($control); 631 637 … … 638 644 639 645 function removeControl($name) { 640 if(!isset($this-> topControls [$name]))646 if(!isset($this->rootControls [$name])) 641 647 return; 642 unset($this-> topControls [$name]);648 unset($this->rootControls [$name]); 643 649 unset($this->controls [$name]); 644 650 unset($this->submits [$name]); branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r920 r926 534 534 $ctrl->check($this); 535 535 } 536 return $ r;536 return $v; 537 537 } 538 538 branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r920 r926 534 534 $ctrl->check($this); 535 535 } 536 return $ r;536 return $v; 537 537 } 538 538 branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r920 r926 534 534 $ctrl->check($this); 535 535 } 536 return $ r;536 return $v; 537 537 } 538 538 branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r920 r926 534 534 $ctrl->check($this); 535 535 } 536 return $ r;536 return $v; 537 537 } 538 538 branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r914 r926 21 21 22 22 echo '<table class="jforms-table" border="0">'; 23 foreach( $this->_form->get Controls() as $ctrlref=>$ctrl){23 foreach( $this->_form->getRootControls() as $ctrlref=>$ctrl){ 24 24 if($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden') continue; 25 25 if(!$this->_form->isActivated($ctrlref)) continue; 26 echo '<tr><th scope="row">'; 27 $this->outputControlLabel($ctrl); 28 echo '</th><td>'; 29 $this->outputControl($ctrl); 30 echo '</td></tr>'; 26 if($ctrl->type == 'group') { 27 echo '<tr><td colspan="2">'; 28 $this->outputControl($ctrl); 29 echo '</td></tr>'; 30 }else{ 31 echo '<tr><th scope="row">'; 32 $this->outputControlLabel($ctrl); 33 echo '</th><td>'; 34 $this->outputControl($ctrl); 35 echo '</td></tr>'; 36 } 31 37 } 32 38 echo '</table> <div class="jforms-submit-buttons">'; … … 137 143 138 144 public function outputControlLabel($ctrl){ 139 if($ctrl->type == 'hidden' ) return;145 if($ctrl->type == 'hidden' || $ctrl->type == 'group') return; 140 146 $required = ($ctrl->required == ''|| $ctrl->isReadOnly()?'':' jforms-required'); 141 147 $inError = (isset($this->_form->getContainer()->errors[$ctrl->ref]) ?' jforms-error':''); … … 145 151 }else if($ctrl->type != 'submit' && $ctrl->type != 'reset'){ 146 152 $id = $this->_name.'_'.$ctrl->ref; 147 echo '<label class="jforms-label',$required,$inError,'" for="' .$id.'"',$hint,'>'.htmlspecialchars($ctrl->label).'</label>';153 echo '<label class="jforms-label',$required,$inError,'" for="',$id,'"',$hint,'>',htmlspecialchars($ctrl->label),'</label>'; 148 154 } 149 155 } … … 352 358 } 353 359 360 protected function outputGroup($ctrl, $id, $class, $readonly, $hint) { 361 echo '<fieldset><legend>',htmlspecialchars($ctrl->label),'</legend>',"\n"; 362 echo '<table class="jforms-table-group" border="0">'; 363 foreach( $ctrl->getChildControls() as $ctrlref=>$c){ 364 if($c->type == 'submit' || $c->type == 'reset' || $c->type == 'hidden') continue; 365 if(!$this->_form->isActivated($ctrlref)) continue; 366 echo '<tr><th scope="row">'; 367 $this->outputControlLabel($c); 368 echo '</th><td>'; 369 $this->outputControl($c); 370 echo '</td></tr>'; 371 } 372 echo '</table></fieldset>'; 373 } 374 354 375 protected function outputHelp($ctrl) { 355 376 if ($ctrl->hasHelp) { branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r914 r926 21 21 22 22 echo '<table class="jforms-table" border="0">'; 23 foreach( $this->_form->get Controls() as $ctrlref=>$ctrl){23 foreach( $this->_form->getRootControls() as $ctrlref=>$ctrl){ 24 24 if($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden') continue; 25 25 if(!$this->_form->isActivated($ctrlref)) continue; 26 echo '<tr><th scope="row">'; 27 $this->outputControlLabel($ctrl); 28 echo '</th><td>'; 29 $this->outputControl($ctrl); 30 echo '</td></tr>'; 26 if($ctrl->type == 'group') { 27 echo '<tr><td colspan="2">'; 28 $this->outputControl($ctrl); 29 echo '</td></tr>'; 30 }else{ 31 echo '<tr><th scope="row">'; 32 $this->outputControlLabel($ctrl); 33 echo '</th><td>'; 34 $this->outputControl($ctrl); 35 echo '</td></tr>'; 36 } 31 37 } 32 38 echo '</table> <div class="jforms-submit-buttons">'; … … 137 143 138 144 public function outputControlLabel($ctrl){ 139 if($ctrl->type == 'hidden' ) return;145 if($ctrl->type == 'hidden' || $ctrl->type == 'group') return; 140 146 $required = ($ctrl->required == ''|| $ctrl->isReadOnly()?'':' jforms-required'); 141 147 $inError = (isset($this->_form->getContainer()->errors[$ctrl->ref]) ?' jforms-error':''); … … 145 151 }else if($ctrl->type != 'submit' && $ctrl->type != 'reset'){ 146 152 $id = $this->_name.'_'.$ctrl->ref; 147 echo '<label class="jforms-label',$required,$inError,'" for="' .$id.'"',$hint,'>'.htmlspecialchars($ctrl->label).'</label>';153 echo '<label class="jforms-label',$required,$inError,'" for="',$id,'"',$hint,'>',htmlspecialchars($ctrl->label),'</label>'; 148 154 } 149 155 } … … 352 358 } 353 359 360 protected function outputGroup($ctrl, $id, $class, $readonly, $hint) { 361 echo '<fieldset><legend>',htmlspecialchars($ctrl->label),'</legend>',"\n"; 362 echo '<table class="jforms-table-group" border="0">'; 363 foreach( $ctrl->getChildControls() as $ctrlref=>$c){ 364 if($c->type == 'submit' || $c->type == 'reset' || $c->type == 'hidden') continue; 365 if(!$this->_form->isActivated($ctrlref)) continue; 366 echo '<tr><th scope="row">'; 367 $this->outputControlLabel($c); 368 echo '</th><td>'; 369 $this->outputControl($c); 370 echo '</td></tr>'; 371 } 372 echo '</table></fieldset>'; 373 } 374 354 375 protected function outputHelp($ctrl) { 355 376 if ($ctrl->hasHelp) { branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r914 r926 21 21 22 22 echo '<table class="jforms-table" border="0">'; 23 foreach( $this->_form->get Controls() as $ctrlref=>$ctrl){23 foreach( $this->_form->getRootControls() as $ctrlref=>$ctrl){ 24 24 if($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden') continue; 25 25 if(!$this->_form->isActivated($ctrlref)) continue; 26 echo '<tr><th scope="row">'; 27 $this->outputControlLabel($ctrl); 28 echo '</th><td>'; 29 $this->outputControl($ctrl); 30 echo '</td></tr>'; 26 if($ctrl->type == 'group') { 27 echo '<tr><td colspan="2">'; 28 $this->outputControl($ctrl); 29 echo '</td></tr>'; 30 }else{ 31 echo '<tr><th scope="row">'; 32 $this->outputControlLabel($ctrl); 33 echo '</th><td>'; 34 $this->outputControl($ctrl); 35 echo '</td></tr>'; 36 } 31 37 } 32 38 echo '</table> <div class="jforms-submit-buttons">'; … … 137 143 138 144 public function outputControlLabel($ctrl){ 139 if($ctrl->type == 'hidden' ) return;145 if($ctrl->type == 'hidden' || $ctrl->type == 'group') return; 140 146 $required = ($ctrl->required == ''|| $ctrl->isReadOnly()?'':' jforms-required'); 141 147 $inError = (isset($this->_form->getContainer()->errors[$ctrl->ref]) ?' jforms-error':''); … … 145 151 }else if($ctrl->type != 'submit' && $ctrl->type != 'reset'){ 146 152 $id = $this->_name.'_'.$ctrl->ref; 147 echo '<label class="jforms-label',$required,$inError,'" for="' .$id.'"',$hint,'>'.htmlspecialchars($ctrl->label).'</label>';153 echo '<label class="jforms-label',$required,$inError,'" for="',$id,'"',$hint,'>',htmlspecialchars($ctrl->label),'</label>'; 148 154 } 149 155 } … … 352 358 } 353 359 360 protected function outputGroup($ctrl, $id, $class, $readonly, $hint) { 361 echo '<fieldset><legend>',htmlspecialchars($ctrl->label),'</legend>',"\n"; 362 echo '<table class="jforms-table-group" border="0">'; 363 foreach( $ctrl->getChildControls() as $ctrlref=>$c){ 364 if($c->type == 'submit' || $c->type == 'reset' || $c->type == 'hidden') continue; 365 if(!$this->_form->isActivated($ctrlref)) continue; 366 echo '<tr><th scope="row">'; 367 $this->outputControlLabel($c); 368 echo '</th><td>'; 369 $this->outputControl($c); 370 echo '</td></tr>'; 371 } 372 echo '</table></fieldset>'; 373 } 374 354 375 protected function outputHelp($ctrl) { 355 376 if ($ctrl->hasHelp) { branches/experimental/jforms-groups/lib/jelix/plugins/jforms/html/html.jformsbuilder.php
r914 r926 21 21 22 22 echo '<table class="jforms-table" border="0">'; 23 foreach( $this->_form->get Controls() as $ctrlref=>$ctrl){23 foreach( $this->_form->getRootControls() as $ctrlref=>$ctrl){ 24 24 if($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden') continue; 25 25 if(!$this->_form->isActivated($ctrlref)) continue; 26 echo '<tr><th scope="row">'; 27 $this->outputControlLabel($ctrl); 28 echo '</th><td>'; 29 $this->outputControl($ctrl); 30 echo '</td></tr>'; 26 if($ctrl->type == 'group') { 27 echo '<tr><td colspan="2">'; 28 $this->outputControl($ctrl); 29 echo '</td></tr>'; 30 }else{ 31 echo '<tr><th scope="row">'; 32 $this->outputControlLabel($ctrl); 33 echo '</th><td>'; 34 $this->outputControl($ctrl); 35 echo '</td></tr>'; 36 } 31 37 } 32 38 echo '</table> <div class="jforms-submit-buttons">'; … … 137 143 138 144 public function outputControlLabel($ctrl){ 139 if($ctrl->type == 'hidden' ) return;145 if($ctrl->type == 'hidden' || $ctrl->type == 'group') return; 140 146 $required = ($ctrl->required == ''|| $ctrl->isReadOnly()?'':' jforms-required'); 141 147 $inError = (isset($this->_form->getContainer()->errors[$ctrl->ref]) ?' jforms-error':''); … … 145 151 }else if($ctrl->type != 'submit' && $ctrl->type != 'reset'){ 146 152 $id = $this->_name.'_'.$ctrl->ref; 147 echo '<label class="jforms-label',$required,$inError,'" for="' .$id.'"',$hint,'>'.htmlspecialchars($ctrl->label).'</label>';153 echo '<label class="jforms-label',$required,$inError,'" for="',$id,'"',$hint,'>',htmlspecialchars($ctrl->label),'</label>'; 148 154 } 149 155 } … … 352 358 } 353 359 360 protected function outputGroup($ctrl, $id, $class, $readonly, $hint) { 361 echo '<fieldset><legend>',htmlspecialchars($ctrl->label),'</legend>',"\n"; 362 echo '<table class="jforms-table-group" border="0">'; 363 foreach( $ctrl->getChildControls() as $ctrlref=>$c){ 364 if($c->type == 'submit' || $c->type == 'reset' || $c->type == 'hidden') continue; 365 if(!$this->_form->isActivated($ctrlref)) continue; 366 echo '<tr><th scope="row">'; 367 $this->outputControlLabel($c); 368 echo '</th><td>'; 369 $this->outputControl($c); 370 echo '</td></tr>'; 371 } 372 echo '</table></fieldset>'; 373 } 374 354 375 protected function outputHelp($ctrl) { 355 376 if ($ctrl->hasHelp) { branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php
r877 r926 70 70 $content .= '$ctrls_notto_display=null;'; 71 71 } 72 72 $_frmctrlInsideForm = $compiler->isInsideBlock('form'); 73 73 $content .= ' 74 74 if (!isset($t->_privateVars[\'__displayed_ctrl\'])) { … … 76 76 } 77 77 $t->_privateVars[\'__ctrlref\']=\'\'; 78 $_frmctrlInsideForm = isset($t->_privateVars[\'__formbuilder\']); 79 foreach($t->_privateVars[\'__form\']->getControls() as $ctrlref=>$ctrl){ 78 '; 79 if($_frmctrlInsideForm){ 80 $list = 'getRootControls()'; 81 }else{ 82 $list = 'getControls()'; 83 } 84 $content.=' 85 foreach($t->_privateVars[\'__form\']->'.$list.' as $ctrlref=>$ctrl){ 80 86 if(!$t->_privateVars[\'__form\']->isActivated($ctrlref)) continue; 81 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue; 82 if($ctrl->type == \'submit\' && ($_frmctrlInsideForm || $ctrl->standalone)) continue; 83 if(!$_frmctrlInsideForm && ($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') ) continue; 84 if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 87 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue;'."\n"; 88 if(!$_frmctrlInsideForm) 89 $content.='if($ctrl->type == \'submit\' && $ctrl->standalone) continue; 90 if($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') continue;'."\n"; 91 else 92 $content.='if($ctrl->type == \'submit\') continue;'; 93 94 $content.='if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 85 95 && ( ($ctrls_to_display===null && $ctrls_notto_display === null) 86 96 || ($ctrls_to_display===null && !in_array($ctrlref, $ctrls_notto_display)) branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php
r877 r926 70 70 $content .= '$ctrls_notto_display=null;'; 71 71 } 72 72 $_frmctrlInsideForm = $compiler->isInsideBlock('form'); 73 73 $content .= ' 74 74 if (!isset($t->_privateVars[\'__displayed_ctrl\'])) { … … 76 76 } 77 77 $t->_privateVars[\'__ctrlref\']=\'\'; 78 $_frmctrlInsideForm = isset($t->_privateVars[\'__formbuilder\']); 79 foreach($t->_privateVars[\'__form\']->getControls() as $ctrlref=>$ctrl){ 78 '; 79 if($_frmctrlInsideForm){ 80 $list = 'getRootControls()'; 81 }else{ 82 $list = 'getControls()'; 83 } 84 $content.=' 85 foreach($t->_privateVars[\'__form\']->'.$list.' as $ctrlref=>$ctrl){ 80 86 if(!$t->_privateVars[\'__form\']->isActivated($ctrlref)) continue; 81 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue; 82 if($ctrl->type == \'submit\' && ($_frmctrlInsideForm || $ctrl->standalone)) continue; 83 if(!$_frmctrlInsideForm && ($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') ) continue; 84 if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 87 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue;'."\n"; 88 if(!$_frmctrlInsideForm) 89 $content.='if($ctrl->type == \'submit\' && $ctrl->standalone) continue; 90 if($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') continue;'."\n"; 91 else 92 $content.='if($ctrl->type == \'submit\') continue;'; 93 94 $content.='if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 85 95 && ( ($ctrls_to_display===null && $ctrls_notto_display === null) 86 96 || ($ctrls_to_display===null && !in_array($ctrlref, $ctrls_notto_display)) branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php
r877 r926 70 70 $content .= '$ctrls_notto_display=null;'; 71 71 } 72 72 $_frmctrlInsideForm = $compiler->isInsideBlock('form'); 73 73 $content .= ' 74 74 if (!isset($t->_privateVars[\'__displayed_ctrl\'])) { … … 76 76 } 77 77 $t->_privateVars[\'__ctrlref\']=\'\'; 78 $_frmctrlInsideForm = isset($t->_privateVars[\'__formbuilder\']); 79 foreach($t->_privateVars[\'__form\']->getControls() as $ctrlref=>$ctrl){ 78 '; 79 if($_frmctrlInsideForm){ 80 $list = 'getRootControls()'; 81 }else{ 82 $list = 'getControls()'; 83 } 84 $content.=' 85 foreach($t->_privateVars[\'__form\']->'.$list.' as $ctrlref=>$ctrl){ 80 86 if(!$t->_privateVars[\'__form\']->isActivated($ctrlref)) continue; 81 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue; 82 if($ctrl->type == \'submit\' && ($_frmctrlInsideForm || $ctrl->standalone)) continue; 83 if(!$_frmctrlInsideForm && ($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') ) continue; 84 if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 87 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue;'."\n"; 88 if(!$_frmctrlInsideForm) 89 $content.='if($ctrl->type == \'submit\' && $ctrl->standalone) continue; 90 if($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') continue;'."\n"; 91 else 92 $content.='if($ctrl->type == \'submit\') continue;'; 93 94 $content.='if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 85 95 && ( ($ctrls_to_display===null && $ctrls_notto_display === null) 86 96 || ($ctrls_to_display===null && !in_array($ctrlref, $ctrls_notto_display)) branches/experimental/jforms-groups/lib/jelix/plugins/tpl/html/block.formcontrols.php
r877 r926 70 70 $content .= '$ctrls_notto_display=null;'; 71 71 } 72 72 $_frmctrlInsideForm = $compiler->isInsideBlock('form'); 73 73 $content .= ' 74 74 if (!isset($t->_privateVars[\'__displayed_ctrl\'])) { … … 76 76 } 77 77 $t->_privateVars[\'__ctrlref\']=\'\'; 78 $_frmctrlInsideForm = isset($t->_privateVars[\'__formbuilder\']); 79 foreach($t->_privateVars[\'__form\']->getControls() as $ctrlref=>$ctrl){ 78 '; 79 if($_frmctrlInsideForm){ 80 $list = 'getRootControls()'; 81 }else{ 82 $list = 'getControls()'; 83 } 84 $content.=' 85 foreach($t->_privateVars[\'__form\']->'.$list.' as $ctrlref=>$ctrl){ 80 86 if(!$t->_privateVars[\'__form\']->isActivated($ctrlref)) continue; 81 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue; 82 if($ctrl->type == \'submit\' && ($_frmctrlInsideForm || $ctrl->standalone)) continue; 83 if(!$_frmctrlInsideForm && ($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') ) continue; 84 if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 87 if($ctrl->type == \'reset\' || $ctrl->type == \'hidden\') continue;'."\n"; 88 if(!$_frmctrlInsideForm) 89 $content.='if($ctrl->type == \'submit\' && $ctrl->standalone) continue; 90 if($ctrl->type == \'captcha\' || $ctrl->type == \'secretconfirm\') continue;'."\n"; 91 else 92 $content.='if($ctrl->type == \'submit\') continue;'; 93 94 $content.='if(!isset($t->_privateVars[\'__displayed_ctrl\'][$ctrlref]) 85 95 && ( ($ctrls_to_display===null && $ctrls_notto_display === null) 86 96 || ($ctrls_to_display===null && !in_array($ctrlref, $ctrls_notto_display)) branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php
r892 r926 393 393 } 394 394 return $res; 395 } 396 397 /** 398 * for plugins, it says if the plugin is inside the given block 399 * @param string $blockName the block to search 400 * @param boolean $onlyUpper check only the upper block 401 * @return boolean true if it is inside the block 402 */ 403 public function isInsideBlock($blockName, $onlyUpper=false) { 404 if($onlyUpper) 405 return (end($this->_blockStack) == $blockName); 406 for($i=count($this->_blockStack) -1; $i>=0; $i--) { 407 if($this->_blockStack[$i] == $blockName) 408 return true; 409 } 410 return false; 395 411 } 396 412 branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php
r892 r926 393 393 } 394 394 return $res; 395 } 396 397 /** 398 * for plugins, it says if the plugin is inside the given block 399 * @param string $blockName the block to search 400 * @param boolean $onlyUpper check only the upper block 401 * @return boolean true if it is inside the block 402 */ 403 public function isInsideBlock($blockName, $onlyUpper=false) { 404 if($onlyUpper) 405 return (end($this->_blockStack) == $blockName); 406 for($i=count($this->_blockStack) -1; $i>=0; $i--) { 407 if($this->_blockStack[$i] == $blockName) 408 return true; 409 } 410 return false; 395 411 } 396 412 branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php
r892 r926 393 393 } 394 394 return $res; 395 } 396 397 /** 398 * for plugins, it says if the plugin is inside the given block 399 * @param string $blockName the block to search 400 * @param boolean $onlyUpper check only the upper block 401 * @return boolean true if it is inside the block 402 */ 403 public function isInsideBlock($blockName, $onlyUpper=false) { 404 if($onlyUpper) 405 return (end($this->_blockStack) == $blockName); 406 for($i=count($this->_blockStack) -1; $i>=0; $i--) { 407 if($this->_blockStack[$i] == $blockName) 408 return true; 409 } 410 return false; 395 411 } 396 412 branches/experimental/jforms-groups/lib/jelix/tpl/jTplCompiler.class.php
r892 r926 393 393 } 394 394 return $res; 395 } 396 397 /** 398 * for plugins, it says if the plugin is inside the given block 399 * @param string $blockName the block to search 400 * @param boolean $onlyUpper check only the upper block 401 * @return boolean true if it is inside the block 402 */ 403 public function isInsideBlock($blockName, $onlyUpper=false) { 404 if($onlyUpper) 405 return (end($this->_blockStack) == $blockName); 406 for($i=count($this->_blockStack) -1; $i>=0; $i--) { 407 if($this->_blockStack[$i] == $blockName) 408 return true; 409 } 410 return false; 395 411 } 396 412 branches/experimental/jforms-groups/testapp/modules/testapp/forms/sample.form.xml
r907 r926 3 3 4 4 <hidden ref="hiddenvalue" defaultvalue="my hidden value"/> 5 <group ref="identity"> 6 <label>Your identity</label> 5 7 6 <input ref="nom" required="true">7 <label>Votre nom</label>8 </input>8 <input ref="nom" required="true"> 9 <label>Your name</label> 10 </input> 9 11 10 <input ref="prenom" defaultvalue="robert">11 <label>Votre prénom</label>12 </input>12 <input ref="prenom" defaultvalue="robert"> 13 <label>Your firstname</label> 14 </input> 13 15 14 <input ref="mail" type="email"> 15 <label>Votre mail</label> 16 </input> 16 <radiobuttons ref="sexe" required="true"> 17 <label>Vous êtes </label> 18 <item value="h">un homme</item> 19 <item value="f">une femme</item> 20 <item value="no">je ne sais pas</item> 21 <alert type="required">Vous devez indiquer le sexe, même si vous ne savez pas :-)</alert> 22 </radiobuttons> 23 <input ref="mail" type="email"> 24 <label>Votre mail</label> 25 </input> 17 26 18 <checkbox ref="geek"> 19 <label>Êtes vous un geek ?</label> 20 <help>Un geek est un passionné d'informatique</help> 21 <hint>Cochez la case si vous êtes un geek</hint> 22 </checkbox> 23 24 <radiobuttons ref="sexe" required="true"> 25 <label>Vous êtes </label> 26 <item value="h">un homme</item> 27 <item value="f">une femme</item> 28 <item value="no">je ne sais pas</item> 29 <alert type="required">Vous devez indiquer le sexe, même si vous ne savez pas :-)</alert> 30 </radiobuttons> 27 <checkbox ref="geek"> 28 <label>Êtes vous un geek ?</label> 29
