- Timestamp:
- 10/06/08 17:23:40 (3 months ago)
- Location:
- trunk/extra/moddev
- Files:
-
- 3 modified
-
configure.ac (modified) (1 diff)
-
src/ebox-moddev-model.in (modified) (5 diffs)
-
stubs/src/Model/FormModel.pm.mas (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/extra/moddev/configure.ac
r11472 r11478 1 AC_INIT([emoddev], [0.1 ])1 AC_INIT([emoddev], [0.1.1]) 2 2 3 3 AC_CONFIG_AUX_DIR([config]) -
trunk/extra/moddev/src/ebox-moddev-model.in
r11476 r11478 19 19 sub types 20 20 { 21 return qw/Text Int Boolean Port HostIP IPAddress /;21 return qw/Text Int Boolean Port HostIP IPAddress Select/; 22 22 } 23 23 … … 166 166 modelDomain => $options->{mainClass}, 167 167 fields => $options->{parsedFields}, 168 modelType => $options->{model} 168 169 )); 169 170 write_file("$dir/$mainClass", ${$output}); … … 182 183 for my $model (@{_models($dir)}) { 183 184 $code .= ' ' x 8; 185 $model =~ s/\.pm//; 184 186 $code .= "'EBox::${mainClass}::Model::$model',\n"; 185 187 } … … 209 211 } 210 212 213 sub _runAutogen 214 { 215 if (-e 'autogen.sh') { 216 system('./autogen.sh'); 217 } else { 218 print STDERR " You will have to manually run autogen.sh within your module directory"; 219 } 220 } 221 211 222 sub _createModel 212 223 { … … 223 234 _makefile($interp, \$output, $options); 224 235 _addModelsToMainClass($interp, \$output, $options); 225 236 _runAutogen(); 226 237 } 227 238 -
trunk/extra/moddev/stubs/src/Model/FormModel.pm.mas
r11476 r11478 54 54 } 55 55 56 % for my $field (@fields) { 57 % if ($field->{type} eq 'Select') { 58 # Method: populate_<% $field->{name} %> 59 # 60 # Callback function to fill out the values that can 61 # be picked from the <EBox::Types::Select> field <% $field->{name} %> 62 # 63 # Returns: 64 # 65 # Array ref of hash refs containing: 66 # 67 # 68 sub populate_<% $field->{name} %> 69 { 70 return [ { value => 'value1', printableValue => 'value2'}]; 71 } 72 % } 73 % } 74 56 75 sub _table 57 76 { … … 60 79 ( 61 80 % for my $field (@fields) { 81 % if ($field->{type} eq 'Select') { 82 new EBox::Types::<% $field->{type} %>( 83 'fieldName' => '<% $field->{name} %>', 84 'printableName' => __('<% $field->{name} %>'), 85 'populate' => \&populate_<% $field->{name} %>, 86 'unique' => 1, 87 'editable' => 1 88 ), 89 % } else { 62 90 new EBox::Types::<% $field->{type} %>( 63 91 'fieldName' => '<% $field->{name} %>', … … 67 95 'editable' => 1 68 96 ), 97 % } 69 98 % } 70 99 );
