Development

Changeset 29921

You must first sign up to be able to contribute.

Changeset 29921

Show
Ignore:
Timestamp:
06/21/10 19:45:54 (3 years ago)
Author:
KRavEN
Message:

fixed partials config. renamed extjs components attributes to variables. added methods array to all extjs components. improved generated partials with examples.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/ExtjsGeneratorPlugin/trunk/TODO.txt

    r29879 r29921  
    2828### generic 
    2929add time display for datetime fields to list, filter, and edit 
    30 use heredoc in ExtjsGenerator for getStandardPartials, createStandardConstructorPartial, createStandardInitComponentPartial, createStandardInitEventsPartial methods 
    31 expand generated partials with examples 
    3230add support for objects with multiple fields as primary key 
    3331 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_bottomToolbar.js.php

    r29426 r29921  
    77$className = '<?php echo $className ?>'; 
    88$bottomToolbar = new stdClass(); 
    9 $bottomToolbar->attributes = array(); 
     9$bottomToolbar->methods = array(); 
     10$bottomToolbar->variables = array(); 
    1011 
    1112/* bottomToolbar configuration */ 
     
    2728  '<?php echo $className ?>', 
    2829  'Ext.PagingToolbar', 
    29   $bottomToolbar->attributes 
     30  array_merge( 
     31    $bottomToolbar->methods, 
     32    $bottomToolbar->variables 
     33  ) 
    3034); 
    3135 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_columnModel.js.php

    r29610 r29921  
    77$className = '<?php echo $className ?>'; 
    88$columnModel = new stdClass(); 
    9 $columnModel->attributes = array(); 
     9$columnModel->methods = array(); 
     10$columnModel->variables = array(); 
    1011 
    1112$columnModel->config_array = array( 
     
    3536  '<?php echo $className ?>', 
    3637  'Ext.app.sf.<?php echo $moduleName."ColumnRenderers" ?>', 
    37   $columnModel->attributes 
     38  array_merge( 
     39    $columnModel->methods, 
     40    $columnModel->variables 
     41  ) 
    3842); 
    3943 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_columnRenderers.js.php

    r29727 r29921  
    77$className = '<?php echo $className ?>'; 
    88$columnRenderers = new stdClass(); 
    9 $columnRenderers->attributes = array(); 
     9$columnRenderers->methods = array(); 
     10$columnRenderers->variables = array(); 
    1011 
    1112// renderLink 
    12 $columnRenderers->attributes['renderLink'] = $sfExtjs3Plugin->asMethod(array( 
     13$columnRenderers->methods['renderLink'] = $sfExtjs3Plugin->asMethod(array( 
    1314  'parameters' => 'value, params, record, rowIndex, colIndex, store', 
    1415  'source' => " 
     
    2223)); 
    2324 
    24 $columnRenderers->attributes['formatLongstring'] = $sfExtjs3Plugin->asMethod(array( 
     25$columnRenderers->methods['formatLongstring'] = $sfExtjs3Plugin->asMethod(array( 
    2526  'parameters' => 'value, params, record, rowIndex, colIndex, store', 
    2627  'source' => " 
     
    3132)); 
    3233 
    33 $columnRenderers->attributes['formatBoolean'] = $sfExtjs3Plugin->asMethod(array( 
     34$columnRenderers->methods['formatBoolean'] = $sfExtjs3Plugin->asMethod(array( 
    3435  'parameters' => 'value, params, record, rowIndex, colIndex, store', 
    3536  'source' => "return value ? 'Yes' : 'No';" 
     
    3738 
    3839// formatDate 
    39 $renderers->attributes['formatDate'] = $sfExtjs3Plugin->asMethod(array( 
     40$columnRenderers->methods['formatDate'] = $sfExtjs3Plugin->asMethod(array( 
    4041  'parameters' => 'v', 
    4142  'source' => "return Ext.util.Format.date(v, 'm/d/Y')" 
     
    5051  '<?php echo $className ?>', 
    5152  'Ext.grid.ColumnModel', 
    52   $columnRenderers->attributes 
     53  array_merge( 
     54    $columnRenderers->methods, 
     55    $columnRenderers->variables 
     56  ) 
    5357); 
    5458 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_datastore.js.php

    r29426 r29921  
    88$className = '<?php echo $className ?>'; 
    99$datastore = new stdClass(); 
    10 $datastore->attributes = array(); 
     10$datastore->methods = array(); 
     11$datastore->variables = array(); 
    1112 
    1213/* store configuration */ 
     
    4950  '<?php echo $className ?>', 
    5051  'Ext.data.<?php echo $store ?>', 
    51   $datastore->attributes 
     52  array_merge( 
     53    $datastore->methods, 
     54    $datastore->variables 
     55  ) 
    5256); 
    5357 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_editaction__cancel.js.php

    r29426 r29921  
    1 [?php // @object $sfExtjs3Plugin and @object $formpanel provided 
    2   $formpanel->attributes["_cancel"] = $sfExtjs3Plugin->asMethod(" 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
     2  $formpanel->methods["_cancel"] = $sfExtjs3Plugin->asMethod(" 
    33  this.fireEvent('close', this); 
    44  "); 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_editaction__delete.js.php

    r29426 r29921  
    1 [?php // @object $sfExtjs3Plugin and @object $formpanel provided 
    2   $formpanel->attributes["_delete"] = $sfExtjs3Plugin->asMethod("this.doDelete();"); 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
     2  $formpanel->methods["_delete"] = $sfExtjs3Plugin->asMethod("this.doDelete();"); 
    33?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_editaction__reload.js.php

    r29426 r29921  
    1 [?php // @object $sfExtjs3Plugin and @object $formpanel provided 
    2   $formpanel->attributes["_reload"] = $sfExtjs3Plugin->asMethod(" 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
     2  $formpanel->methods["_reload"] = $sfExtjs3Plugin->asMethod(" 
    33  if (!this.getForm().isDirty()) { 
    44    this.doLoad(); 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_editaction__save.js.php

    r29426 r29921  
    1 [?php // @object $sfExtjs3Plugin and @object $formpanel provided 
    2   $formpanel->attributes["_save"] = $sfExtjs3Plugin->asMethod("this.doSubmit();"); 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
     2  $formpanel->methods["_save"] = $sfExtjs3Plugin->asMethod("this.doSubmit();"); 
    33?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_editaction__savenew.js.php

    r29426 r29921  
    1 [?php // @object $sfExtjs3Plugin and @object $formpanel provided 
    2   $formpanel->attributes["_savenew"] = $sfExtjs3Plugin->asMethod("this.doSubmit(true);"); 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
     2  $formpanel->methods["_savenew"] = $sfExtjs3Plugin->asMethod("this.doSubmit(true);"); 
    33?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_filterpanel.js.php

    r29879 r29921  
    77$className = '<?php echo $className ?>'; 
    88$filterpanel = new stdClass(); 
    9 $filterpanel->attributes = array(); 
     9$filterpanel->methods = array(); 
     10$filterpanel->variables = array(); 
    1011 
    1112/* Filterpanel Configuration */ 
     
    7778  '<?php echo $className ?>', 
    7879  'Ext.FormPanel', 
    79   $filterpanel->attributes 
     80  array_merge( 
     81    $filterpanel->methods, 
     82    $filterpanel->variables 
     83  ) 
    8084); 
    8185 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_filterpanel_method_initEvents.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $filterpanel provided 
    22// constructor 
    33$configArr = array( 
     
    3333); 
    3434 
    35 $filterpanel->attributes['initEvents'] = $sfExtjs3Plugin->asMethod($configArr); 
     35$filterpanel->methods['initEvents'] = $sfExtjs3Plugin->asMethod($configArr); 
    3636?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel.js.php

    r29879 r29921  
    77$className = '<?php echo $className ?>'; 
    88$formpanel = new stdClass(); 
    9 $formpanel->attributes = array(); 
     9$formpanel->methods = array(); 
     10$formpanel->variables = array(); 
    1011 
    1112/* formpanel configuration */ 
     
    2627<?php foreach ($editActions as $name => $params): ?> 
    2728<?php if(! isset($params['handler_function']) && $name[0] != '_'): 
    28 $this->createPartialFile('_editaction_'.$name,'<?php 
    29   // @object $sfExtjs3Plugin and @object $formpanel provided 
    30   $configArr["source"] = "Ext.Msg.alert(\'Error\',\'handler_function is not defined!<br><br>Copy the template \"_editaction_'.$actionName.'.js.php\" from cache to your application/modules/'.strtolower($this->getModuleName()).'/templates folder and alter it or define the \"handler_function\" in your generator.yml file\');"; 
    31   $formpanel->attributes["'.$name.'"] = $sfExtjs3Plugin->asMethod($configArr); 
    32 ?>'); 
     29$this->createPartialFile('_editaction_'.$name, <<<EOT 
     30<?php 
     31/* @object \$sfExtjs3Plugin string \$className and @object \$formpanel provided 
     32*** Method example with no parameters 
     33\$formpanel->methods['$name'] = \$sfExtjs3Plugin->asMethod(" 
     34  //method code 
     35"); 
     36 
     37*** Method example with parameters 
     38\$configArr->['parameters'] = 'grid, record, action, row, col'; 
     39\$configArr->['source'] = " 
     40  //method code 
     41"); 
     42\$formpanel->methods['$name'] = \$sfExtjs3Plugin->asMethod(\$configArr); 
     43*/ 
     44\$configArr["source"] = " 
     45  Ext.Msg.alert(\'Error\',\'handler_function is not defined!<br><br>Copy the template \"_editaction_$actionName.js.php\" from cache to your application/modules/'.strtolower(\$this->getModuleName()).'/templates folder and alter it or define the \"handler_function\" in your generator.yml file\'); 
     46"; 
     47\$formpanel->methods['$name'] = \$sfExtjs3Plugin->asMethod(\$configArr); 
     48?> 
     49EOT 
     50 
     51); 
    3352?> 
    3453<?php endif; ?> 
     
    142161  array_merge( 
    143162    $formpanel->methods, 
    144     $formpanel->attributes 
     163    $formpanel->variables 
    145164  ) 
    146165); 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_close.js.php

    r29507 r29921  
    1 [?php  
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22$formpanel->methods['close'] = $sfExtjs3Plugin->asMethod(" 
    33  this.gridPanel.getStore().reload(); 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_doDelete.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22$form = new BaseForm(); 
    33$csrf = '';  
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_doLoad.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin @object $form string $className and @object $formpanel provided 
    22// doLoad 
    33$formpanel->methods['doLoad'] = $sfExtjs3Plugin->asMethod(" 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_doSubmit.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin @object $form string $className and @object $formpanel provided 
    22// doSubmit 
    33$formpanel->methods['doSubmit'] = $sfExtjs3Plugin->asMethod(array( 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_initComponent.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// constructor 
    33$configArr = array( 
     
    5757); 
    5858 
    59 $formpanel->attributes['initComponent'] = $sfExtjs3Plugin->asMethod($configArr); 
     59$formpanel->methods['initComponent'] = $sfExtjs3Plugin->asMethod($configArr); 
    6060?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_initEvents.js.php

    r29426 r29921  
    1 [?php  
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22$formpanel->methods['initEvents'] = $sfExtjs3Plugin->asMethod(" 
    33  Ext.app.sf.$className.superclass.initEvents.apply(this); 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_isNew.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// isNew 
    33$formpanel->methods['isNew'] = $sfExtjs3Plugin->asMethod(" 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_onLoadFailure.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// onLoadFailure 
    33$formpanel->methods['onLoadFailure'] = $sfExtjs3Plugin->asMethod(array( 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_onLoadSuccess.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// onLoadSuccess 
    33$formpanel->methods['onLoadSuccess'] = $sfExtjs3Plugin->asMethod(array( 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_onSubmitFailure.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// onSubmitFailure 
    33$formpanel->methods['onSubmitFailure'] = $sfExtjs3Plugin->asMethod(array( 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_onSubmitSuccess.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// onSubmitSuccess 
    33$formpanel->methods['onSubmitSuccess'] = $sfExtjs3Plugin->asMethod(array( 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_setKey.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// setKey 
    33$formpanel->methods['setKey'] = $sfExtjs3Plugin->asMethod(array( 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_formpanel_method_updateButtonsVisibility.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $formpanel provided 
    22// updateButtonsVisibility 
    33$formpanel->methods['updateButtonsVisibility'] = $sfExtjs3Plugin->asMethod(" 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_gridpanel.js.php

    r29426 r29921  
    77$className = '<?php echo $className ?>'; 
    88$gridpanel = new stdClass(); 
    9 $gridpanel->attributes = array(); 
     9$gridpanel->methods = array(); 
     10$gridpanel->variables = array(); 
    1011$gridpanelPlugins = array(); 
    1112 
    12 $gridpanel->attributes['cm'] = $sfExtjs3Plugin->asVar("Ext.ComponentMgr.create({xtype:'<?php echo $this->getModuleName() ?>columnmodel'})"); 
     13$gridpanel->variables['cm'] = $sfExtjs3Plugin->asVar("Ext.ComponentMgr.create({xtype:'<?php echo $this->getModuleName() ?>columnmodel'})"); 
    1314 
    1415/* gridpanel Configuration */ 
     
    8889  '<?php echo $className ?>', 
    8990  'Ext.grid.EditorGridPanel', 
    90   $gridpanel->attributes 
     91  array_merge( 
     92    $gridpanel->methods, 
     93    $gridpanel->variables 
     94  ) 
    9195); 
    9296$sfExtjs3Plugin->endClass(); 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_gridpanel_method_initComponent.js.php

    r29426 r29921  
    1414   */ 
    1515?> 
    16 [?php 
     16[?php // @object $sfExtjs3Plugin string $className and @object $gridpanel provided 
    1717// constructor 
    1818$configArr = array( 
     
    5555); 
    5656 
    57 $gridpanel->attributes['initComponent'] = $sfExtjs3Plugin->asMethod($configArr); 
     57$gridpanel->methods['initComponent'] = $sfExtjs3Plugin->asMethod($configArr); 
    5858?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_gridpanel_method_initEvents.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $gridpanel provided 
    22// constructor 
    33$configArr = array( 
     
    2424"); 
    2525 
    26 $gridpanel->attributes['initEvents'] = $sfExtjs3Plugin->asMethod($configArr); 
     26$gridpanel->methods['initEvents'] = $sfExtjs3Plugin->asMethod($configArr); 
    2727?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_gridpanel_method_onEditLinkClick.js.php

    r29507 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $gridpanel provided 
    22// onLinkClick 
    33$configArr = Array( 
     
    2020); 
    2121 
    22 $gridpanel->attributes['onEditLinkClick'] = $sfExtjs3Plugin->asMethod($configArr); 
     22$gridpanel->methods['onEditLinkClick'] = $sfExtjs3Plugin->asMethod($configArr); 
    2323?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_gridpanel_method_resetFilter.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $gridpanel provided 
    22// resetFilter 
    3 $gridpanel->attributes['resetFilter'] = $sfExtjs3Plugin->asMethod(" 
     3$gridpanel->methods['resetFilter'] = $sfExtjs3Plugin->asMethod(" 
    44  this.getStore().proxy.setMethod('POST'); 
    55  this.getStore().proxy.setUrl('".url_for('<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter')).".json'); 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_gridpanel_method_setFilter.js.php

    r29426 r29921  
    1 [?php 
     1[?php // @object $sfExtjs3Plugin string $className and @object $gridpanel provided 
    22// setFilter 
    3 $gridpanel->attributes['setFilter'] = $sfExtjs3Plugin->asMethod(array( 
     3$gridpanel->methods['setFilter'] = $sfExtjs3Plugin->asMethod(array( 
    44  'parameters' => 'params', 
    55  'source' => " 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_listaction__new.js.php

    r29552 r29921  
    1 [?php // @object $sfExtjs3Plugin and @object $topToolbar provided 
     1[?php // @object $sfExtjs3Plugin string $className and @object $topToolbar provided 
    22  $configArr["parameters"] = "button, event"; 
    33  $configArr["source"] =   $configArr["source"] = " 
     
    1010  <?php echo sfConfig::get('app_extjs_gen_plugin_module_tab_panel_name', 'Ext.app.sf.TabPanel') ?>.add(formpanel).show(); 
    1111"; 
    12   $topToolbar->attributes["_new"] = $sfExtjs3Plugin->asMethod($configArr); 
     12  $topToolbar->methods["_new"] = $sfExtjs3Plugin->asMethod($configArr); 
    1313?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_objectAction__delete.js.php

    r29426 r29921  
    77  } 
    88   
    9   $configArr["parameters"] = "grid, record, action, row, col"
    10   $configArr["source"] =   $configArr["source"] = " 
     9  $configArr['parameters'] = 'grid, record, action, row, col'
     10  $configArr['source'] = " 
    1111  Ext.Msg.confirm('Confirm','Are you sure you want to delete this <?php echo $this->configuration->getObjectName() ?>?',function(btn,text){ 
    1212    if(btn == 'yes') 
     
    3737  }); 
    3838  "; 
    39   $objectActions->attributes["_delete"] = $sfExtjs3Plugin->asMethod($configArr); 
     39  $objectActions->methods['_delete'] = $sfExtjs3Plugin->asMethod($configArr); 
    4040?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_objectAction__edit.js.php

    r29836 r29921  
    1515    } 
    1616"; 
    17   $objectActions->attributes["_edit"] = $sfExtjs3Plugin->asMethod($configArr); 
     17  $objectActions->methods["_edit"] = $sfExtjs3Plugin->asMethod($configArr); 
    1818?] 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_objectActions.js.php

    r29426 r29921  
    77$className = '<?php echo $className ?>'; 
    88$objectActions = new stdClass(); 
    9 $objectActions->attributes = array(); 
     9$objectActions->methods = array(); 
     10$objectActions->variables = array(); 
    1011 
    1112/* objectActions configuration */ 
     
    2021<?php foreach ($actions as $name => $params): ?> 
    2122<?php if(! isset($params['handler_function']) && $name[0] != '_'): 
    22 $this->createPartialFile('_list_rowaction_'.$name,'<?php // @object $sfExtjs3Plugin and @object $objectActions provided 
    23   $configArr["parameters"] = "grid, record, action, row, col"; 
    24   $configArr["source"] = "Ext.Msg.alert(\'Error\',\'callback is not defined!<br><br>Copy the template file from cache \"_list_action_'.$actionName.'.php\" to your application/modules/'.strtolower($this->getModuleName()).'/templates folder and alter it or define the \"callback\" in your generator.yml file\');"; 
    25   $objectActions->attributes["'.$name.'"] = $sfExtjs3Plugin->asMethod($configArr); 
    26 ?>'); 
     23$this->createPartialFile('_objectAction_'.$name, <<<EOT 
     24<?php 
     25/* @object \$sfExtjs3Plugin string \$className and @object \$objectActions provided 
     26*** Method example with no parameters 
     27\$objectActions->methods['$name'] = \$sfExtjs3Plugin->asMethod(" 
     28  //method code 
     29"); 
     30 
     31*** Method example with parameters 
     32\$configArr->['parameters'] = 'grid, record, action, row, col'; 
     33\$configArr->['source'] = " 
     34  //method code 
     35"); 
     36\$objectActions->methods['$name'] = \$sfExtjs3Plugin->asMethod(\$configArr); 
     37*/ 
     38\$configArr["source"] = " 
     39  Ext.Msg.alert(\'Error\',\'handler_function is not defined!<br><br>Copy the template \"_objectAction_$actionName.js.php\" from cache to your application/modules/'.strtolower(\$this->getModuleName()).'/templates folder and alter it or define the \"handler_function\" in your generator.yml file\'); 
     40"; 
     41\$objectActions->methods['$name'] = \$sfExtjs3Plugin->asMethod(\$configArr); 
     42?> 
     43EOT 
     44 
     45); 
    2746?> 
    2847<?php endif; ?> 
     
    4261  '<?php echo $className ?>', 
    4362  'Ext.ux.grid.RowActions', 
    44   $objectActions->attributes 
     63  array_merge( 
     64    $objectActions->methods, 
     65    $objectActions->variables 
     66  ) 
    4567); 
    4668 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_tabpanel.js.php

    r29426 r29921  
    77$className = '<?php echo $className ?>'; 
    88$tabpanel = new stdClass(); 
    9 $tabpanel->attributes = array(); 
     9$tabpanel->methods = array(); 
     10$tabpanel->variables = array(); 
    1011 
    1112/* tabpanel configuration */ 
     
    2425  '<?php echo $className ?>', 
    2526  'Ext.TabPanel', 
    26   $tabpanel->attributes 
     27  array_merge( 
     28    $tabpanel->methods, 
     29    $tabpanel->variables 
     30  ) 
    2731); 
    2832 
  • plugins/ExtjsGeneratorPlugin/trunk/data/generator/ExtjsModule/admin/template/templates/_topToolbar.js.php

    r29426 r29921  
    77$className = '<?php echo $className ?>'; 
    88$topToolbar = new stdClass(); 
    9 $topToolbar->attributes = array(); 
     9$topToolbar->methods = array(); 
     10$topToolbar->variables = array(); 
    1011 
    1112/* topToolbar configuration */ 
     
    117118<?php foreach ($listActions as $name => $params): ?> 
    118119<?php if(! isset($params['handler_function']) && $name[0] != '_'): 
    119 $this->createPartialFile('_listaction_'.$name,'<?php 
    120   // @object $sfExtjs3Plugin and @object $topToolbar provided 
    121   $configArr["source"] = "Ext.Msg.alert(\'Error\',\'handler_function is not defined!<br><br>Copy the template \"_listaction_'.$actionName.'.js.php\" from cache to your application/modules/'.strtolower($this->getModuleName()).'/templates folder and alter it or define the \"handler_function\" in your generator.yml file\');"; 
    122   $topToolbar->attributes["'.$name.'"] = $sfExtjs3Plugin->asMethod($configArr); 
    123 ?>'); 
     120$this->createPartialFile('_listaction_'.$name, <<<EOT 
     121<?php 
     122/* @object \$sfExtjs3Plugin string \$className and @object \$topToolbar provided 
     123*** Method example with no parameters 
     124\$topToolbar->methods['$name'] = \$sfExtjs3Plugin->asMethod(" 
     125  //method code 
     126"); 
     127 
     128*** Method example with parameters 
     129\$configArr->['parameters'] = 'grid, record, action, row, col'; 
     130\$configArr->['source'] = " 
     131  //method code 
     132"); 
     133\$topToolbar->methods['$name'] = \$sfExtjs3Plugin->asMethod(\$configArr); 
     134*/ 
     135\$configArr["source"] = " 
     136  Ext.Msg.alert(\'Error\',\'handler_function is not defined!<br><br>Copy the template \"_listaction_$actionName.js.php\" from cache to your application/modules/'.strtolower(\$this->getModuleName()).'/templates folder and alter it or define the \"handler_function\" in your generator.yml file\'); 
     137"; 
     138\$topToolbar->methods['$name'] = \$sfExtjs3Plugin->asMethod(\$configArr); 
     139?> 
     140EOT 
     141 
     142); 
    124143?> 
    125144<?php endif; ?> 
     
    139158  '<?php echo $className ?>', 
    140159  'Ext.Toolbar', 
    141   $topToolbar->attributes 
     160  array_merge( 
     161    $topToolbar->methods, 
     162    $topToolbar->variables 
     163  ) 
    142164); 
    143165 
  • plugins/ExtjsGeneratorPlugin/trunk/lib/generator/ExtjsGenerator.class.php

    r29879 r29921  
    133133    else 
    134134    { 
    135       $params = ExtjsGeneratorUtil::getColumnParams($column, $modelClass); 
     135      $params = ExtjsGeneratorUtil::getColumnParams($column, sfInflector::camelize($modelClass)); 
    136136      $getter = $params['getter']; 
    137137    } 
     
    562562      foreach($partials as $partial) 
    563563      { 
     564        if($partial[0] == '_') $partial = substr($partial, 1); 
    564565        $partialStr .= "include_partial('" . $partial . "', array('sfExtjs3Plugin' => \$sfExtjs3Plugin, '$objName' => \$$objName, 'className' => \$className));\n"; 
    565         $this->createPartialFile('_' . $partial, '<?php // @object $sfExtjs3Plugin, $className and @object $' . $objName . ' provided ?>'); 
     566         
     567        $partialContent = <<<EOF 
     568<?php  
     569// @object \$sfExtjs3Plugin string \$className and @object $$objName provided 
     570/* 
     571*** Method example with no parameters 
     572\${$objName}->methods['MethodName'] = \$sfExtjs3Plugin->asMethod(" 
     573  //method code 
     574"); 
     575 
     576*** Method example with parameters 
     577\$configArr->['parameters'] = 'grid, record, action, row, col'; 
     578\$configArr->['source'] = " 
     579  //method code 
     580"); 
     581\${$objName}->methods['MethodName'] = \$sfExtjs3Plugin->asMethod(\$configArr); 
     582 
     583*** Variable example 
     584\${$objName}->variables['VariableName'] = \$sfExtjs3Plugin->asVar(" 
     585  //variable creation or string 
     586"); 
     587*/ 
     588?>         
     589EOF; 
     590         
     591        $this->createPartialFile('_' . $partial, $partialContent); 
    566592      } 
    567593    } 
     
    610636  protected function createStandardConstructorPartial($objName) 
    611637  { 
    612     return sprintf('<?php 
     638    return sprintf('<?php // @object \$sfExtjs3Plugin string \$className and @object %1$s provided 
    613639// constructor 
    614640$configArr["parameters"] = "c"; 
     
    619645// combine %1$s config with arguments 
    620646Ext.app.sf.$className.superclass.constructor.call(this, Ext.apply(this.%1$s_config, c));"; 
    621 $%1$s->attributes["constructor"] = $sfExtjs3Plugin->asMethod($configArr);', $objName); 
     647$%1$s->methods["constructor"] = $sfExtjs3Plugin->asMethod($configArr);', $objName); 
    622648  } 
    623649 
    624650  protected function createStandardInitComponentPartial($objName) 
    625651  { 
    626     return sprintf('<?php 
     652    return sprintf('<?php // @object \$sfExtjs3Plugin string \$className and @object %1$s provided 
    627653// initComponent 
    628654$configArr["source"] = "Ext.app.sf.$className.superclass.initComponent.apply(this, arguments);"; 
    629 $%1$s->attributes["initComponent"] = $sfExtjs3Plugin->asMethod($configArr);', $objName); 
     655$%1$s->methods["initComponent"] = $sfExtjs3Plugin->asMethod($configArr);', $objName); 
    630656  } 
    631657 
    632658  protected function createStandardInitEventsPartial($objName) 
    633659  { 
    634     return sprintf('<?php 
     660    return sprintf('<?php // @object \$sfExtjs3Plugin string \$className and @object %1$s provided 
    635661// initEvents 
    636662$configArr["source"] = "Ext.app.sf.$className.superclass.initEvents.apply(this);"; 
    637 $%1$s->attributes["initEvents"] = $sfExtjs3Plugin->asMethod($configArr);', $objName); 
     663$%1$s->methods["initEvents"] = $sfExtjs3Plugin->asMethod($configArr);', $objName); 
    638664  } 
    639665 
  • plugins/ExtjsGeneratorPlugin/trunk/lib/generator/ExtjsModelGeneratorConfiguration.class.php

    r29743 r29921  
    1616  { 
    1717    $config = $this->getConfig(); 
    18  
     18     
    1919    // inheritance rules: 
    2020    // new|edit < form < default 
     
    2222    // filter < default 
    2323    $this->configuration = array( 
    24       'list'   => array( 
    25         'fields'         => array(), 
    26         'layout'         => $this->getListLayout(), 
    27         'title'          => $this->getListTitle(), 
    28         'actions'        => $this->getListActions(), 
    29         'object_actions' => $this->getListObjectActions(), 
    30         'params'         => $this->getListParams(), 
    31       ), 
     24      'list' => array( 
     25        'fields' => array(),  
     26        'layout' => $this->getListLayout(),  
     27        'title' => $this->getListTitle(),  
     28        'actions' => $this->getListActions(),  
     29        'object_actions' => $this->getListObjectActions(),  
     30        'params' => $this->getListParams() 
     31      ),  
    3232      'filter' => array( 
    33         'fields' => array(), 
    34       ), 
    35       'form'   => array( 
    36         'fields' => array(), 
    37       ), 
    38       'new'    => array( 
    39         'fields' => array(), 
    40         'title'   => $this->getNewTitle(), 
    41         'actions' => $this->getNewActions() ? $this->getNewActions() : $this->getFormActions(), 
    42       ), 
    43       'edit'   => array( 
    44         'fields' => array(), 
    45         'title'   => $this->getEditTitle(), 
    46         'actions' => $this->getEditActions() ? $this->getEditActions() : $this->getFormActions(), 
    47       ), 
    48       'top_toolbar'   => array( 
    49         'config' => $this->getTopToolbarConfig(), 
    50         'plugins' => $this->getTopToolbarPlugins(), 
    51         'method'  => $this->getTopToolbarPartials(), 
    52       ), 
    53       'bottom_toolbar'   => array( 
    54         'config' => $this->getBottomToolbarConfig(), 
    55         'plugins' => $this->getBottomToolbarPlugins(), 
    56         'method'  => $this->getBottomToolbarPartials(), 
    57       ), 
    58       'datastore'   => array( 
    59         'config'    => $this->getDatastoreConfig(), 
    60         'method'    => $this->getDatastorePartials(), 
    61         'grouping' => $this->getDatastoreGroupingConfig(), 
    62       ), 
    63       'column_renderers'   => array( 
    64         'method'  => $this->getColumnRenderersPartials(), 
    65       ), 
    66       'column_model'   => array( 
    67         'config' => $this->getColumnModelConfig(), 
    68         'method'  => $this->getColumnModelPartials(), 
    69       ), 
    70       'tabpanel'   => array( 
    71         'config' => $this->getTabpanelConfig(), 
    72         'plugins' => $this->getTabpanelPlugins(), 
    73         'method'  => $this->getTabpanelPartials(), 
    74         'active_tab' => $this->getTabpanelActiveTab(), 
    75       ), 
    76       'filterpanel'   => array( 
    77         'config' => $this->getFilterpanelConfig(), 
    78         'plugins' => $this->getFilterpanelPlugins(), 
    79         'method'  => $this->getFilterpanelPartials(), 
    80       ), 
    81       'gridpanel'   => array( 
    82         'config' => $this->getGridpanelConfig(), 
    83         'plugins' => $this->getGridpanelPlugins(), 
    84         'method'  => $this->getGridpanelPartials(), 
    85       ), 
    86       'formpanel'   => array( 
    87         'config' => $this->getFormpanelConfig(), 
    88         'plugins' => $this->getFormpanelPlugins(), 
    89         'method'  => $this->getFormpanelPartials(), 
    90       ), 
    91       'object_actions'   => array( 
    92         'method' => $this->getObjectActionsPartials(), 
     33        'fields' => array() 
     34      ),  
     35      'form' => array( 
     36        'fields' => array() 
     37      ),  
     38      'new' => array( 
     39        'fields' => array(),  
     40        'title' => $this->getNewTitle(),  
     41        'actions' => $this->getNewActions() ? $this->getNewActions() : $this->getFormActions() 
     42      ),  
     43      'edit' => array( 
     44        'fields' => array(),  
     45        'title' => $this->getEditTitle(),  
     46        'actions' => $this->getEditActions() ? $this->getEditActions() : $this->getFormActions() 
     47      ),  
     48      'top_toolbar' => array( 
     49        'config' => $this->getTopToolbarConfig(),  
     50        'plugins' => $this->getTopToolbarPlugins(),  
     51        'partials' => $this->getTopToolbarPartials() 
     52      ),  
     53      'bottom_toolbar' => array( 
     54        'config' => $this->getBottomToolbarConfig(),  
     55        'plugins' => $this->getBottomToolbarPlugins(),  
     56        'partials' => $this->getBottomToolbarPartials() 
     57      ),  
     58      'datastore' => array( 
     59        'config' => $this->getDatastoreConfig(),  
     60        'partials' => $this->getDatastorePartials(),  
     61        'grouping' => $this->getDatastoreGroupingConfig() 
     62      ),  
     63      'column_renderers' => array( 
     64        'partials' => $this->getColumnRenderersPartials() 
     65      ),  
     66      'column_model' => array( 
     67        'config' => $this->getColumnModelConfig(),  
     68        'partials' => $this->getColumnModelPartials() 
     69      ),  
     70      'tabpanel' => array( 
     71        'config' => $this->getTabpanelConfig(),  
     72        'plugins' => $this->getTabpanelPlugins(),  
     73        'partials' => $this->getTabpanelPartials(),  
     74        'active_tab' => $this->getTabpanelActiveTab() 
     75      ),  
     76      'filterpanel' => array( 
     77        'config' => $this->getFilterpanelConfig(),  
     78        'plugins' => $this->getFilterpanelPlugins(),  
     79        'partials' => $this->getFilterpanelPartials() 
     80      ),  
     81      'gridpanel' => array( 
     82        'config' => $this->getGridpanelConfig(),  
     83        'plugins' => $this->getGridpanelPlugins(),  
     84        'partials' => $this->getGridpanelPartials() 
     85      ),  
     86      'formpanel' => array( 
     87        'config' => $this->getFormpanelConfig(),  
     88        'plugins' => $this->getFormpanelPlugins(),  
     89        'partials' => $this->getFormpanelPartials() 
     90      ),  
     91      'object_actions' => array( 
     92        'method' => $this->getObjectActionsPartials() 
    9393      ), 
    9494    );