Development

Changeset 8797

You must first sign up to be able to contribute.

Changeset 8797

Show
Ignore:
Timestamp:
05/05/08 17:00:49 (7 months ago)
Author:
Leon.van.der.Ree
Message:

Implemented event-listeners,
make more use of sfExtjs2Plugin

Files:

Legend:

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

    r8772 r8797  
    33 
    44$controller = sfContext::getInstance()->getController(); 
    5 // TODO: next 2 lines can probably be removed (after small adjustments) 
    6 //$edit_name = str_replace(".", '_', $edit_key); 
     5$sfExtjs2Plugin = new sfExtjs2Plugin(); 
     6 
    77$edit_ns = ucfirst(sfInflector::camelize($this->getModuleName()))."Edit"; 
    88$moduleName = sfInflector::camelize($this->getModuleName()); 
     
    2525$sfExtjs2_<?php echo $moduleName ?>_doSubmit = " 
    2626  if (!this.getForm().isValid()) { 
    27     Ext.Msg.show({ 
    28       title:'Problem', 
    29       msg:'Not all fields (in every tab-page) contain valid data,<br>Please check all fields first', 
    30       modal:true, 
    31       icon:Ext.Msg.INFO
    32       buttons:Ext.Msg.OK 
    33     });     
     27    Ext.Msg.show(<?php echo $sfExtjs2Plugin->asAnonymousClass(array( 
     28      'title'   =>  'Problem', 
     29      'msg'     =>  'Not all fields (in every tab-page) contain valid data,<br>Please check all fields first', 
     30      'modal'   =>  true, 
     31      'icon'    =>  $sfExtjs2Plugin->asVar('Ext.Msg.INFO')
     32      'buttons' =>  $sfExtjs2Plugin->asVar('Ext.Msg.OK') 
     33    )) ?>); 
    3434  } else { 
    3535    var url_key = ''; 
     
    3939      url_key = '?<?php echo sfInflector::underscore($groupedColumns['pk']->getPhpName()) ?>='+this.ownerCt.key; 
    4040    } 
    41     this.getForm().submit({ 
    42       url: this.url + url_key
    43       scope:this
    44       success:this.onSubmitSuccess
    45       failure:this.onSubmitFailure
    46       params:{cmd:'save'}
    47       waitMsg:'Saving...' 
    48     }); 
     41    this.getForm().submit(<?php echo $sfExtjs2Plugin->asAnonymousClass(array( 
     42      'url'     => $sfExtjs2Plugin->asVar('this.url + url_key')
     43      'scope'   => $sfExtjs2Plugin->asVar('this')
     44      'success' => $sfExtjs2Plugin->asVar('this.onSubmitSuccess')
     45      'failure' => $sfExtjs2Plugin->asVar('this.onSubmitFailure')
     46      'params'  => $sfExtjs2Plugin->asAnonymousClass(array('cmd' => 'save'))
     47      'waitMsg' => 'Saving...' 
     48    )) ?>); 
    4949  } 
    5050"; 
     
    7878$sfExtjs2_<?php echo $moduleName ?>_showError = " 
    7979  title = title || 'Error'; 
    80   Ext.Msg.show({ 
    81     title:title
    82     msg:msg
    83     modal:true, 
    84     icon:Ext.Msg.ERROR
    85     buttons:Ext.Msg.OK 
    86   }); 
     80  Ext.Msg.show(<?php echo $sfExtjs2Plugin->asAnonymousClass(array( 
     81    'title'   => $sfExtjs2Plugin->asVar('title')
     82    'msg'     => $sfExtjs2Plugin->asVar('msg')
     83    'modal'   => true, 
     84    'icon'    => $sfExtjs2Plugin->asVar('Ext.Msg.ERROR')
     85    'buttons' => $sfExtjs2Plugin->asVar('Ext.Msg.OK') 
     86  ))?>); 
    8787"; 
    8888 
     
    9393  'width'               => 400, 
    9494//  'autoHeight'          => true, 
    95 //  'height'          => 200, 
     95//  'height'              => 200, 
    9696 
    9797  'autoScroll'          => true, 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_list_ajax_addTab.php

    r8772 r8797  
    11<?php 
    22  $controller = sfContext::getInstance()->getController(); 
     3  $sfExtjs2Plugin = new sfExtjs2Plugin(); 
     4   
    35  $moduleName = sfInflector::camelize($this->getModuleName()); 
     6  $list_ns = ucfirst(sfInflector::camelize($this->getModuleName()))."List"; 
     7   
    48?> 
    59  if(typeof(closeable)=='undefined') var closeable = true; 
     
    1014  if (!(tab = tabPanel.items.find(function(i){return i.key === tabId;}))) { 
    1115    using('url(<?php echo $controller->genUrl('js/'.$this->getModuleName()) ?>/editAjaxJs.pjs)', function() { 
    12       var tab = new Ext.app.sx.Edit<?php echo $moduleName ?>Panel({ 
    13 //        autoLoad : {url: tabUrl, params: params, method: 'POST'}, 
    14 //        id : tabId, 
    15 //        height: 400, //deze aan 
    16         title : tabTitle, 
    17         iconCls : icon, 
    18         closable : closeable, 
    19         hideBorders: true, 
    20         key: tabId 
    21       }); 
     16      var tab = new Ext.app.sx.Edit<?php echo $moduleName ?>Panel(<?php echo $sfExtjs2Plugin->asAnonymousClass(array( 
     17        'height'      => 400, //deze aan 
     18//        'autoHeight'  => true, 
     19        'title'       => $sfExtjs2Plugin->asVar('tabTitle'), 
     20        'iconCls'     => $sfExtjs2Plugin->asVar('icon'), 
     21        'closable'    => $sfExtjs2Plugin->asVar('closeable'), 
     22        'hideBorders' => true, 
     23        'key'         => $sfExtjs2Plugin->asVar('tabId') 
     24      ))?>); 
     25       
     26      tab.on('saved',         function(ep, old_key) { <?php echo $list_ns ?>.getDataStore().reload(); } ); 
     27      tab.on('deleted',       function(ep)          { <?php echo $list_ns ?>.getDataStore().reload(); tabPanel.remove(ep); } ); 
     28      tab.on('close_request', function(ep)          { tabPanel.remove(ep); } ); 
     29       
    2230      tabPanel.add(tab); 
    2331      if(active) { 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/editAjaxSuccess.php

    r8793 r8797  
    11<?php 
     2  $sfExtjs2Plugin = new sfExtjs2Plugin(); 
     3 
    24  $moduleName = sfInflector::camelize($this->getModuleName()); 
    35 
     
    5254    editPanel.on('close_request', function(ep) {alert('Close Request: ' + ep.key + ', message from event-handler')} ); 
    5355     
    54     var viewport = new Ext.Viewport({ 
    55       layout: 'fit', 
    56       items: [ 
    57         editPanel 
    58       ] 
    59     }) 
     56    var viewport = <?php echo $sfExtjs2Plugin->Viewport(array(  
     57      'layout'  => 'fit', 
     58      'items'   => array($sfExtjs2Plugin->asVar('editPanel')) 
     59    )); ?> 
    6060    viewport.doLayout(); 
    6161  });