Changeset 984
- Timestamp:
- 06/11/08 08:57:03 (6 months ago)
- Files:
-
- branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng (modified) (3 diffs)
- branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng (modified) (3 diffs)
- branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng (modified) (3 diffs)
- branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng (modified) (3 diffs)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.class.php (modified) (1 diff)
- branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.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/forms/jFormsControl.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng
r907 r984 17 17 <oneOrMore> 18 18 <choice> 19 <ref name="input" /> 20 <ref name="textarea" /> 21 <ref name="htmleditor" /> 22 <ref name="secret" /> 23 <ref name="output" /> 24 <ref name="upload" /> 19 <ref name="primary_controls" /> 20 <ref name="group" /> 25 21 <ref name="submit" /> 26 <ref name="checkbox" /> 27 <ref name="checkboxes" /> 28 <ref name="listbox" /> 29 <ref name="radiobuttons"/> 30 <ref name="menulist" /> 31 <ref name="hidden" /> 22 <ref name="choice" /> 32 23 <ref name="captcha" /> 33 24 <!-- … … 39 30 <ref name="reset" /> 40 31 </optional> 32 </define> 33 34 <define name="primary_controls"> 35 <ref name="input" /> 36 <ref name="textarea" /> 37 <ref name="htmleditor" /> 38 <ref name="secret" /> 39 <ref name="output" /> 40 <ref name="upload" /> 41 <ref name="checkbox" /> 42 <ref name="checkboxes" /> 43 <ref name="listbox" /> 44 <ref name="radiobuttons"/> 45 <ref name="menulist" /> 46 <ref name="hidden" /> 41 47 </define> 42 48 … … 219 225 </define> 220 226 227 <define name="group"> 228 <element name="group"> 229 <attribute name="ref" /> 230 <ref name="label" /> 231 <ref name="UI.attr.readonly" /> 232 <oneOrMore> 233 <choice> 234 <ref name="primary_controls" /> 235 </choice> 236 </oneOrMore> 237 </element> 238 </define> 239 240 <define name="choice"> 241 <element name="choice"> 242 <ref name="control.common" /> 243 <ref name="UI.attr.readonly" /> 244 <oneOrMore> 245 <element name="item"> 246 <attribute name="value" /> 247 <optional> 248 <attribute name="selected"> 249 <choice><value>true</value><value>false</value></choice> 250 </attribute> 251 </optional> 252 <ref name="label" /> 253 <zeroOrMore> 254 <choice> 255 <ref name="primary_controls" /> 256 </choice> 257 </zeroOrMore> 258 </element> 259 </oneOrMore> 260 </element> 261 </define> 262 221 263 <define name="control.common"> 222 264 <attribute name="ref" /> branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng
r907 r984 17 17 <oneOrMore> 18 18 <choice> 19 <ref name="input" /> 20 <ref name="textarea" /> 21 <ref name="htmleditor" /> 22 <ref name="secret" /> 23 <ref name="output" /> 24 <ref name="upload" /> 19 <ref name="primary_controls" /> 20 <ref name="group" /> 25 21 <ref name="submit" /> 26 <ref name="checkbox" /> 27 <ref name="checkboxes" /> 28 <ref name="listbox" /> 29 <ref name="radiobuttons"/> 30 <ref name="menulist" /> 31 <ref name="hidden" /> 22 <ref name="choice" /> 32 23 <ref name="captcha" /> 33 24 <!-- … … 39 30 <ref name="reset" /> 40 31 </optional> 32 </define> 33 34 <define name="primary_controls"> 35 <ref name="input" /> 36 <ref name="textarea" /> 37 <ref name="htmleditor" /> 38 <ref name="secret" /> 39 <ref name="output" /> 40 <ref name="upload" /> 41 <ref name="checkbox" /> 42 <ref name="checkboxes" /> 43 <ref name="listbox" /> 44 <ref name="radiobuttons"/> 45 <ref name="menulist" /> 46 <ref name="hidden" /> 41 47 </define> 42 48 … … 219 225 </define> 220 226 227 <define name="group"> 228 <element name="group"> 229 <attribute name="ref" /> 230 <ref name="label" /> 231 <ref name="UI.attr.readonly" /> 232 <oneOrMore> 233 <choice> 234 <ref name="primary_controls" /> 235 </choice> 236 </oneOrMore> 237 </element> 238 </define> 239 240 <define name="choice"> 241 <element name="choice"> 242 <ref name="control.common" /> 243 <ref name="UI.attr.readonly" /> 244 <oneOrMore> 245 <element name="item"> 246 <attribute name="value" /> 247 <optional> 248 <attribute name="selected"> 249 <choice><value>true</value><value>false</value></choice> 250 </attribute> 251 </optional> 252 <ref name="label" /> 253 <zeroOrMore> 254 <choice> 255 <ref name="primary_controls" /> 256 </choice> 257 </zeroOrMore> 258 </element> 259 </oneOrMore> 260 </element> 261 </define> 262 221 263 <define name="control.common"> 222 264 <attribute name="ref" /> branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng
r907 r984 17 17 <oneOrMore> 18 18 <choice> 19 <ref name="input" /> 20 <ref name="textarea" /> 21 <ref name="htmleditor" /> 22 <ref name="secret" /> 23 <ref name="output" /> 24 <ref name="upload" /> 19 <ref name="primary_controls" /> 20 <ref name="group" /> 25 21 <ref name="submit" /> 26 <ref name="checkbox" /> 27 <ref name="checkboxes" /> 28 <ref name="listbox" /> 29 <ref name="radiobuttons"/> 30 <ref name="menulist" /> 31 <ref name="hidden" /> 22 <ref name="choice" /> 32 23 <ref name="captcha" /> 33 24 <!-- … … 39 30 <ref name="reset" /> 40 31 </optional> 32 </define> 33 34 <define name="primary_controls"> 35 <ref name="input" /> 36 <ref name="textarea" /> 37 <ref name="htmleditor" /> 38 <ref name="secret" /> 39 <ref name="output" /> 40 <ref name="upload" /> 41 <ref name="checkbox" /> 42 <ref name="checkboxes" /> 43 <ref name="listbox" /> 44 <ref name="radiobuttons"/> 45 <ref name="menulist" /> 46 <ref name="hidden" /> 41 47 </define> 42 48 … … 219 225 </define> 220 226 227 <define name="group"> 228 <element name="group"> 229 <attribute name="ref" /> 230 <ref name="label" /> 231 <ref name="UI.attr.readonly" /> 232 <oneOrMore> 233 <choice> 234 <ref name="primary_controls" /> 235 </choice> 236 </oneOrMore> 237 </element> 238 </define> 239 240 <define name="choice"> 241 <element name="choice"> 242 <ref name="control.common" /> 243 <ref name="UI.attr.readonly" /> 244 <oneOrMore> 245 <element name="item"> 246 <attribute name="value" /> 247 <optional> 248 <attribute name="selected"> 249 <choice><value>true</value><value>false</value></choice> 250 </attribute> 251 </optional> 252 <ref name="label" /> 253 <zeroOrMore> 254 <choice> 255 <ref name="primary_controls" /> 256 </choice> 257 </zeroOrMore> 258 </element> 259 </oneOrMore> 260 </element> 261 </define> 262 221 263 <define name="control.common"> 222 264 <attribute name="ref" /> branches/experimental/jforms-groups/lib/jelix/docs/ns/jforms_1.1.rng
r907 r984 17 17 <oneOrMore> 18 18 <choice> 19 <ref name="input" /> 20 <ref name="textarea" /> 21 <ref name="htmleditor" /> 22 <ref name="secret" /> 23 <ref name="output" /> 24 <ref name="upload" /> 19 <ref name="primary_controls" /> 20 <ref name="group" /> 25 21 <ref name="submit" /> 26 <ref name="checkbox" /> 27 <ref name="checkboxes" /> 28 <ref name="listbox" /> 29 <ref name="radiobuttons"/> 30 <ref name="menulist" /> 31 <ref name="hidden" /> 22 <ref name="choice" /> 32 23 <ref name="captcha" /> 33 24 <!-- … … 39 30 <ref name="reset" /> 40 31 </optional> 32 </define> 33 34 <define name="primary_controls"> 35 <ref name="input" /> 36 <ref name="textarea" /> 37 <ref name="htmleditor" /> 38 <ref name="secret" /> 39 <ref name="output" /> 40 <ref name="upload" /> 41 <ref name="checkbox" /> 42 <ref name="checkboxes" /> 43 <ref name="listbox" /> 44 <ref name="radiobuttons"/> 45 <ref name="menulist" /> 46 <ref name="hidden" /> 41 47 </define> 42 48 … … 219 225 </define> 220 226 227 <define name="group"> 228 <element name="group"> 229 <attribute name="ref" /> 230 <ref name="label" /> 231 <ref name="UI.attr.readonly" /> 232 <oneOrMore> 233 <choice> 234 <ref name="primary_controls" /> 235 </choice> 236 </oneOrMore> 237 </element> 238 </define> 239 240 <define name="choice"> 241 <element name="choice"> 242 <ref name="control.common" /> 243 <ref name="UI.attr.readonly" /> 244 <oneOrMore> 245 <element name="item"> 246 <attribute name="value" /> 247 <optional> 248 <attribute name="selected"> 249 <choice><value>true</value><value>false</value></choice> 250 </attribute> 251 </optional> 252 <ref name="label" /> 253 <zeroOrMore> 254 <choice> 255 <ref name="primary_controls" /> 256 </choice> 257 </zeroOrMore> 258 </element> 259 </oneOrMore> 260 </element> 261 </define> 262 221 263 <define name="control.common"> 222 264 <attribute name="ref" /> branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.class.php
r966 r984 105 105 } 106 106 107 protected function generateChoice(&$source, $control, &$attributes) { 108 $this->readLabel($source, $control, 'choice'); 109 $this->attrReadOnly(&$source, &$attributes); 110 $this->readHelpHintAlert($source, $control); 111 $source[]='$topctrl = $ctrl;'; 112 $hasSelected = false; 113 $selectedvalue = null; 114 $itemCount = 0; 115 foreach($control->item as $item){ 116 if(!isset($item['value'])){ 117 throw new jException('jelix~formserr.attribute.missing',array('value','item of choice',$this->sourceFile)); 118 } 119 $value = (string)$item['value']; 120 121 if(isset($item['selected'])){ 122 if($hasSelected){ 123 throw new jException('jelix~formserr.selected.attribute.not.allowed',$this->sourceFile); 124 } 125 if((string)$item['selected']== 'true'){ 126 $hasSelected = true; 127 $selectedvalue=$value; 128 } 129 } 130 if(!isset($item->label)){ 131 throw new jException('jelix~formserr.tag.missing',array('label','item of choice',$this->sourceFile)); 132 } 133 134 if(isset($item->label['locale'])){ 135 $label=''; 136 $labellocale=(string)$item->label['locale']; 137 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', jLocale::get(\''.$labellocale.'\'));'; 138 }else{ 139 $label=(string)$item->label; 140 $labellocale=''; 141 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', \''.str_replace("'","\\'",$label).'\');'; 142 } 143 144 $ctrlcount = $this->readChildControls($source, 'choice', $item, array(), str_replace("'","\\'",$value)); 145 $itemCount ++; 146 } 147 148 if ($itemCount == 0) { 149 throw new jException('jelix~formserr.no.child.control',array('choice',$this->sourceFile)); 150 } 151 152 $source[]='$topctrl->defaultValue=\''.str_replace('\'','\\\'',$selectedvalue).'\';'; 153 $source[]='$ctrl = $topctrl;'; 154 return false; 155 } 156 107 157 108 158 protected function readChildControls(&$source, $controltype, $xml, $ignore, $itemname='') { branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.class.php
r966 r984 105 105 } 106 106 107 protected function generateChoice(&$source, $control, &$attributes) { 108 $this->readLabel($source, $control, 'choice'); 109 $this->attrReadOnly(&$source, &$attributes); 110 $this->readHelpHintAlert($source, $control); 111 $source[]='$topctrl = $ctrl;'; 112 $hasSelected = false; 113 $selectedvalue = null; 114 $itemCount = 0; 115 foreach($control->item as $item){ 116 if(!isset($item['value'])){ 117 throw new jException('jelix~formserr.attribute.missing',array('value','item of choice',$this->sourceFile)); 118 } 119 $value = (string)$item['value']; 120 121 if(isset($item['selected'])){ 122 if($hasSelected){ 123 throw new jException('jelix~formserr.selected.attribute.not.allowed',$this->sourceFile); 124 } 125 if((string)$item['selected']== 'true'){ 126 $hasSelected = true; 127 $selectedvalue=$value; 128 } 129 } 130 if(!isset($item->label)){ 131 throw new jException('jelix~formserr.tag.missing',array('label','item of choice',$this->sourceFile)); 132 } 133 134 if(isset($item->label['locale'])){ 135 $label=''; 136 $labellocale=(string)$item->label['locale']; 137 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', jLocale::get(\''.$labellocale.'\'));'; 138 }else{ 139 $label=(string)$item->label; 140 $labellocale=''; 141 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', \''.str_replace("'","\\'",$label).'\');'; 142 } 143 144 $ctrlcount = $this->readChildControls($source, 'choice', $item, array(), str_replace("'","\\'",$value)); 145 $itemCount ++; 146 } 147 148 if ($itemCount == 0) { 149 throw new jException('jelix~formserr.no.child.control',array('choice',$this->sourceFile)); 150 } 151 152 $source[]='$topctrl->defaultValue=\''.str_replace('\'','\\\'',$selectedvalue).'\';'; 153 $source[]='$ctrl = $topctrl;'; 154 return false; 155 } 156 107 157 108 158 protected function readChildControls(&$source, $controltype, $xml, $ignore, $itemname='') { branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.class.php
r966 r984 105 105 } 106 106 107 protected function generateChoice(&$source, $control, &$attributes) { 108 $this->readLabel($source, $control, 'choice'); 109 $this->attrReadOnly(&$source, &$attributes); 110 $this->readHelpHintAlert($source, $control); 111 $source[]='$topctrl = $ctrl;'; 112 $hasSelected = false; 113 $selectedvalue = null; 114 $itemCount = 0; 115 foreach($control->item as $item){ 116 if(!isset($item['value'])){ 117 throw new jException('jelix~formserr.attribute.missing',array('value','item of choice',$this->sourceFile)); 118 } 119 $value = (string)$item['value']; 120 121 if(isset($item['selected'])){ 122 if($hasSelected){ 123 throw new jException('jelix~formserr.selected.attribute.not.allowed',$this->sourceFile); 124 } 125 if((string)$item['selected']== 'true'){ 126 $hasSelected = true; 127 $selectedvalue=$value; 128 } 129 } 130 if(!isset($item->label)){ 131 throw new jException('jelix~formserr.tag.missing',array('label','item of choice',$this->sourceFile)); 132 } 133 134 if(isset($item->label['locale'])){ 135 $label=''; 136 $labellocale=(string)$item->label['locale']; 137 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', jLocale::get(\''.$labellocale.'\'));'; 138 }else{ 139 $label=(string)$item->label; 140 $labellocale=''; 141 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', \''.str_replace("'","\\'",$label).'\');'; 142 } 143 144 $ctrlcount = $this->readChildControls($source, 'choice', $item, array(), str_replace("'","\\'",$value)); 145 $itemCount ++; 146 } 147 148 if ($itemCount == 0) { 149 throw new jException('jelix~formserr.no.child.control',array('choice',$this->sourceFile)); 150 } 151 152 $source[]='$topctrl->defaultValue=\''.str_replace('\'','\\\'',$selectedvalue).'\';'; 153 $source[]='$ctrl = $topctrl;'; 154 return false; 155 } 156 107 157 108 158 protected function readChildControls(&$source, $controltype, $xml, $ignore, $itemname='') { branches/experimental/jforms-groups/lib/jelix/forms/jFormsCompiler_jf_1_1.class.php
r966 r984 105 105 } 106 106 107 protected function generateChoice(&$source, $control, &$attributes) { 108 $this->readLabel($source, $control, 'choice'); 109 $this->attrReadOnly(&$source, &$attributes); 110 $this->readHelpHintAlert($source, $control); 111 $source[]='$topctrl = $ctrl;'; 112 $hasSelected = false; 113 $selectedvalue = null; 114 $itemCount = 0; 115 foreach($control->item as $item){ 116 if(!isset($item['value'])){ 117 throw new jException('jelix~formserr.attribute.missing',array('value','item of choice',$this->sourceFile)); 118 } 119 $value = (string)$item['value']; 120 121 if(isset($item['selected'])){ 122 if($hasSelected){ 123 throw new jException('jelix~formserr.selected.attribute.not.allowed',$this->sourceFile); 124 } 125 if((string)$item['selected']== 'true'){ 126 $hasSelected = true; 127 $selectedvalue=$value; 128 } 129 } 130 if(!isset($item->label)){ 131 throw new jException('jelix~formserr.tag.missing',array('label','item of choice',$this->sourceFile)); 132 } 133 134 if(isset($item->label['locale'])){ 135 $label=''; 136 $labellocale=(string)$item->label['locale']; 137 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', jLocale::get(\''.$labellocale.'\'));'; 138 }else{ 139 $label=(string)$item->label; 140 $labellocale=''; 141 $source[]='$topctrl->createItem(\''.str_replace("'","\\'",$value).'\', \''.str_replace("'","\\'",$label).'\');'; 142 } 143 144 $ctrlcount = $this->readChildControls($source, 'choice', $item, array(), str_replace("'","\\'",$value)); 145 $itemCount ++; 146 } 147 148 if ($itemCount == 0) { 149 throw new jException('jelix~formserr.no.child.control',array('choice',$this->sourceFile)); 150 } 151 152 $source[]='$topctrl->defaultValue=\''.str_replace('\'','\\\'',$selectedvalue).'\';'; 153 $source[]='$ctrl = $topctrl;'; 154 return false; 155 } 156 107 157 108 158 protected function readChildControls(&$source, $controltype, $xml, $ignore, $itemname='') { branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r970 r984 653 653 * @package jelix 654 654 * @subpackage forms 655 * @experimental 655 656 */ 656 657 class jFormsControlSwitch extends jFormsControlChoice { branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r970 r984 653 653 * @package jelix 654 654 * @subpackage forms 655 * @experimental 655 656 */ 656 657 class jFormsControlSwitch extends jFormsControlChoice { branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r970 r984 653 653 * @package jelix 654 654 * @subpackage forms 655 * @experimental 655 656 */ 656 657 class jFormsControlSwitch extends jFormsControlChoice { branches/experimental/jforms-groups/lib/jelix/forms/jFormsControl.class.php
r970 r984 653 653 * @package jelix 654 654 * @subpackage forms 655 * @experimental 655 656 */ 656 657 class jFormsControlSwitch extends jFormsControlChoice {
