Development

Changeset 8909

You must first sign up to be able to contribute.

Changeset 8909

Show
Ignore:
Timestamp:
05/11/08 17:06:38 (2 months ago)
Author:
Leon.van.der.Ree
Message:

improved implementation of extended objects, by constructor calls, adding default option to load grid-datastore

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/__list_ajax_action.php

    r8380 r8909  
    77 
    88?> 
    9 <?php echo $this->addCredentialCondition($this->getAjaxButtonToToolbarAction($actionName, $params, false), $params) ?> 
     9<?php echo $this->addCredentialCondition($this->getAjaxButtonToToolbarActionOBSOLETE($actionName, $params, false), $params) ?> 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_list_ajax_columnmodel_js.php

    r8834 r8909  
    105105// constructor 
    106106$sfExtjs2_<?php echo $cmName ?>_constructor = " 
    107   //todo combine <?php echo $cmName ?>Config with arguments 
    108   Ext.app.sx.<?php echo $cmName ?>.superclass.constructor.apply(this, [<?php echo $cmName ?>Config]); 
     107  // combine <?php echo $cmName ?>Config with arguments 
     108  Ext.app.sx.<?php echo $cmName ?>.superclass.constructor.call(this, Ext.apply(<?php echo $cmName ?>Config, c)); 
    109109"; 
    110110 
     
    123123  'Ext.grid.ColumnModel', 
    124124  array ( 
    125     'constructor'   => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $cmName ?>_constructor), 
     125    'constructor'   => $sfExtjs2Plugin->asMethod(array( 
     126      'parameters' => 'c', 
     127      'source'     => $sfExtjs2_<?php echo $cmName ?>_constructor 
     128    )), 
    126129    'initComponent' => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $cmName ?>_initComponent), 
    127130  ) 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_list_ajax_datastore_js.php

    r8849 r8909  
    8181 
    8282?> 
    83  
    8483var <?php echo $storeName ?>Config = <?php echo $config ?>; 
     84  
    8585 
    8686[?php 
     
    8888// constructor 
    8989$sfExtjs2_<?php echo $storeName ?>_constructor = " 
    90   Ext.app.sx.<?php echo $storeName ?>.superclass.constructor.apply(this, arguments); 
     90  // combine <?php echo $storeName ?>Config with arguments 
     91  Ext.app.sx.<?php echo $storeName ?>.superclass.constructor.call(this, Ext.apply(<?php echo $storeName ?>Config, c)); 
    9192"; 
    9293 
    9394// initComponent 
    9495$sfExtjs2_<?php echo $storeName ?>_initComponent = " 
    95   //apply extra config 
    96   Ext.apply(this, this.initialConfig, <?php echo $storeName ?>Config); 
    9796  //call parent 
    9897  Ext.app.sx.<?php echo $storeName ?>.superclass.initComponent.apply(this, arguments); 
     
    106105  'Ext.data.<?php echo $store ?>', 
    107106  array ( 
    108     'constructor'   => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $storeName ?>_constructor), 
     107    'constructor'   => $sfExtjs2Plugin->asMethod(array( 
     108      'parameters' => 'c', 
     109      'source'     => $sfExtjs2_<?php echo $storeName ?>_constructor 
     110    )), 
    109111    'initComponent' => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $storeName ?>_initComponent), 
    110112  ) 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_list_ajax_toolbar_paging_js.php

    r8866 r8909  
    3535  // constructor 
    3636  $sfExtjs2_<?php echo $toolbarName ?>_constructor = " 
    37     Ext.app.sx.<?php echo $toolbarName ?>.superclass.constructor.apply(this, arguments); 
     37    // combine <?php echo $toolbarName ?>Config with arguments 
     38    Ext.app.sx.<?php echo $toolbarName ?>.superclass.constructor.call(this, Ext.apply(<?php echo $toolbarName ?>Config, c)); 
    3839  "; 
    3940   
    4041  // initComponent 
    4142  $sfExtjs2_<?php echo $toolbarName ?>_initComponent = " 
    42     //apply extra config 
    43     Ext.apply(this, this.initialConfig, <?php echo $toolbarName ?>Config); 
    4443    //call parent 
    4544    Ext.app.sx.<?php echo $toolbarName ?>.superclass.initComponent.apply(this, arguments); 
     
    5453    'Ext.PagingToolbar', 
    5554    array ( 
    56       'constructor'   => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $toolbarName ?>_constructor), 
     55      'constructor'   => $sfExtjs2Plugin->asMethod(array( 
     56        'parameters' => 'c', 
     57        'source'     => $sfExtjs2_<?php echo $toolbarName ?>_constructor 
     58      )), 
    5759      'initComponent' => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $toolbarName ?>_initComponent), 
    5860    ) 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_list_ajax_toolbar_top_js.php

    r8898 r8909  
    3535 
    3636<?php foreach ((array) $listActions as $actionName => $params): ?> 
    37   <?php echo $this->addCredentialCondition("\$config['attributes']['items'][] = \$sfExtjs2Plugin->asAnonymousClass(array(".$this->getAjaxButtonToToolbarAction2($actionName, $params, false)."));\n\n", $params) ?> 
     37  <?php echo $this->addCredentialCondition("\$config['attributes']['items'][] = \$sfExtjs2Plugin->asAnonymousClass(array(".$this->getAjaxButtonToToolbarAction($actionName, $params, false)."));\n\n", $params) ?> 
    3838<?php endforeach ?>  
    3939   
     
    4242  // constructor 
    4343  $sfExtjs2_<?php echo $toolbarName ?>_constructor = " 
    44     Ext.app.sx.<?php echo $toolbarName ?>.superclass.constructor.apply(this, arguments); 
     44    // combine <?php echo $toolbarName ?>Config with arguments 
     45    Ext.app.sx.<?php echo $toolbarName ?>.superclass.constructor.call(this, Ext.apply(<?php echo $toolbarName ?>Config, c)); 
    4546  "; 
    4647   
    4748  // initComponent 
    4849  $sfExtjs2_<?php echo $toolbarName ?>_initComponent = " 
    49     //apply extra config 
    50     Ext.apply(this, this.initialConfig, <?php echo $toolbarName ?>Config); 
    5150    //call parent 
    5251    Ext.app.sx.<?php echo $toolbarName ?>.superclass.initComponent.apply(this, arguments); 
     
    6160    'Ext.Toolbar', 
    6261    array ( 
    63       'constructor'   => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $toolbarName ?>_constructor), 
     62      'constructor'   => $sfExtjs2Plugin->asMethod(array( 
     63        'parameters' => 'c', 
     64        'source'     => $sfExtjs2_<?php echo $toolbarName ?>_constructor 
     65      )), 
    6466      'initComponent' => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $toolbarName ?>_initComponent), 
    6567    ) 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_related_ajax_renderer.php

    r8407 r8909  
    5050    [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?] 
    5151<?php endif; ?> 
    52  
    53       function render<?php echo $camelizedKey ?>Field(value, params, record, attr) { 
     52      function render<?php echo $camelizedKey ?>Field(value, params, record, rowIndex, i, ds) { 
    5453        if (value) { 
    5554<?php 
     
    6564            result = <?php echo $storeName ?>.getById(value).get('<?php echo $displayField ?>'); 
    6665          // if not in foreign datastore, test if it is preloaded (this can be out-dated therefor do it after checking datastore) 
    67           } else if ((index = ds_list.find('<?php echo str_replace('/', $tableDelimiter, $relatedTableFKs) ?>', value)) != -1)  { 
     66          } else if ((index = ds.find('<?php echo str_replace('/', $tableDelimiter, $relatedTableFKs) ?>', value)) != -1)  { 
    6867            // foreign-ID not known in foreign-store yet, add preloaded data from the main-store 
    69             <?php echo $camelizedKey?>AddPreloadedFromIndex(index, value); 
     68            <?php echo $camelizedKey?>AddPreloadedFromIndex(index, value, ds); 
    7069 
    71             result = ds_list.getAt(index).get('<?php echo str_replace('/', $tableDelimiter, $column->key) ?>'); 
     70            result = ds.getAt(index).get('<?php echo str_replace('/', $tableDelimiter, $column->key) ?>'); 
    7271          } else { 
    7372            //TODO if value still not found the foreign-data-store should get it from the server! (but I don't think this will be necesarry occur) 
     
    8685       
    8786      // Define related renderer-helpers to show preloaded data; prevent loading all related data stores 
    88       function <?php echo $camelizedKey ?>AddPreloadedFromIndex(index, value) { 
     87      function <?php echo $camelizedKey ?>AddPreloadedFromIndex(index, value, ds) { 
    8988<?php 
    9089    $hs2 = array(); 
     
    137136      [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?] 
    138137<?php endif; ?> 
    139         record_data['<?php echo $this->getRelatedFieldName($column2); ?>'] = ds_list.getAt(index).get('<?php echo str_replace('/', $tableDelimiter, $relatedTableFKs).$tableDelimiter.$column2->getName() ?>'); 
     138        record_data['<?php echo $this->getRelatedFieldName($column2); ?>'] = ds.getAt(index).get('<?php echo str_replace('/', $tableDelimiter, $relatedTableFKs).$tableDelimiter.$column2->getName() ?>'); 
    140139<?php if ($credentials): ?> 
    141140      [?php endif; ?] 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/listAjaxGridPanelJsSuccess.pjs

    r8864 r8909  
    2424?] 
    2525 
     26//TODO: check related-stores and renderers for improvements... imported directly from old-style (hence missing the _js suffix) 
     27[?php include_partial('related_ajax_stores') ?] 
     28 
    2629[?php include_partial('list_ajax_renderer') ?] 
    2730[?php include_partial('related_ajax_renderer') ?] 
     
    4851      'autoHeight'          => true, 
    4952      'autoScroll'          => true,  //TODO: need some work 
     53       
     54      'autoLoadStore'       => true, 
    5055     
    5156      'selModel'            => $sfExtjs2Plugin->RowSelectionModel(array( 
     
    7681// constructor 
    7782$sfExtjs2_<?php echo $panelName ?>_constructor = " 
    78   Ext.app.sx.<?php echo $panelName ?>.superclass.constructor.apply(this, arguments); 
     83  // combine <?php echo $panelName ?>Config with arguments 
     84  Ext.app.sx.<?php echo $panelName ?>.superclass.constructor.call(this, Ext.apply(<?php echo $panelName ?>Config, c)); 
    7985"; 
    8086 
    8187// initComponent 
    8288$sfExtjs2_<?php echo $panelName ?>_initComponent = " 
    83   //apply extra config 
    84   Ext.apply(this, this.initialConfig, <?php echo $panelName ?>Config); 
    8589  //call parent 
    8690  Ext.app.sx.<?php echo $panelName ?>.superclass.initComponent.apply(this, arguments); 
     
    8892//  this.addEvents( //TODO 
    8993//  ); 
     94 
     95  if (this.autoLoadStore){ 
     96    this.store.load.defer(10, this.store, [ 
     97      typeof this.autoLoadStore == 'object' ? this.autoLoadStore : undefined 
     98    ]); 
     99  }; 
    90100 
    91101"; 
     
    105115  'Ext.grid.EditorGridPanel', 
    106116  array ( 
    107     'constructor'   => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $panelName ?>_constructor), 
     117    'constructor'   => $sfExtjs2Plugin->asMethod(array( 
     118      'parameters' => 'c', 
     119      'source'     => $sfExtjs2_<?php echo $panelName ?>_constructor 
     120    )), 
    108121    'initComponent' => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $panelName ?>_initComponent), 
    109122    'initEvents'    => $sfExtjs2Plugin->asMethod($sfExtjs2_<?php echo $panelName ?>_initEvents), 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/listJsSuccess.pjs

    r7873 r8909  
    11[?php /* * Created on 2-sep-2007 * * by Leon van der Ree */ ?] 
    22<?php 
     3  //this file is OBSOLETE 
    34  $included=true; 
    45  include('_list_ajax_layout.php'); 
  • plugins/sfExtjsThemePlugin/lib/sfExtjsPropelAdminGenerator.php

    r8898 r8909  
    1818   * @return string javascript code 
    1919   */ 
    20   function getAjaxButtonToToolbarAction($actionName, $params, $pk_link = false) 
     20  function getAjaxButtonToToolbarActionOBSOLETE($actionName, $params, $pk_link = false) 
    2121  { 
    2222    // get the controller, used for URL creation 
     
    207207   * @return string javascript code 
    208208   */ 
    209   function getAjaxButtonToToolbarAction2($actionName, $params, $pk_link = false) 
     209  function getAjaxButtonToToolbarAction($actionName, $params, $pk_link = false) 
    210210  { 
    211211    // get the controller, used for URL creation