Development

Changeset 10288

You must first sign up to be able to contribute.

Changeset 10288

Show
Ignore:
Timestamp:
07/15/08 00:48:31 (4 months ago)
Author:
Leon.van.der.Ree
Message:

implemented edit.params generator.yml config option (to set width and other options for the form)
start of implementation for formpanel.method.partials (it is working, but can use some further cleanup)

Files:

Legend:

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

    r10256 r10288  
    11<?php 
    2 // TAKES $form_config and sets $form_config['items'] and $form_config['buttons'] recursively (per (tab)page) 
     2// TAKES $formpanel->config_array and sets $formpanel->config_array['items'] and $formpanel->config_array['buttons'] recursively (per (tab)page) 
    33// REQUIRES $edit_key (for current edit.display (or edit.page.pagename.display, etc) 
    44 
     
    4949[?php if ($sf_user->hasCredential(<?php echo str_replace("\n", ' ', var_export($credentials, true)) ?>)): ?] 
    5050<?php endif; ?> 
    51 $form_config['items'][] = <?php var_export($this->getColumnAjaxEditDefinition($column, $groupedColumns, $edit_key)) ?>; 
     51$formpanel->config_array['items'][] = <?php var_export($this->getColumnAjaxEditDefinition($column, $groupedColumns, $edit_key)) ?>; 
    5252<?php if ($credentials): ?> 
    5353[?php endif; ?] 
     
    9090<?php endif; ?> 
    9191<?php endforeach; ?> 
    92 $form_config['items'][] = $fieldset; 
     92$formpanel->config_array['items'][] = $fieldset; 
    9393<?php endforeach; ?> 
    9494<?php if (count($pages) > 0): ?> 
    95   $form_config_org[] = $form_config
     95  $form_config_org[] = $formpanel->config_array
    9696  $tabpages_config_items = array(); 
    9797<?php foreach($pages as $pageName => $page): ?> 
     
    125125?> 
    126126 
    127     $form_config = array(); 
     127    $formpanel->config_array = array(); 
    128128    // TODO: this brakes recursion of tab-pages in tab-pages at the moment (it includes itself over and over again... 
    129129    include('_tabpage_<?php echo $edit_key_name ?>.php'); 
     
    137137//      'height'              => 323, 
    138138 
    139       'items'               => $form_config['items'] 
     139      'items'               => $formpanel->config_array['items'] 
    140140    ); 
    141141 
    142     if (isset($form_config['buttons']) && ($form_config['buttons']!=array())) 
     142    if (isset($formpanel->config_array['buttons']) && ($formpanel->config_array['buttons']!=array())) 
    143143    { 
    144       $tab_page_form['buttons'] = $form_config['buttons']; 
     144      $tab_page_form['buttons'] = $formpanel->config_array['buttons']; 
    145145    } 
    146146 
     
    148148<?php endforeach ?> 
    149149    //restore $form_connfig after iterations 
    150     $form_config = array_pop($form_config_org); 
     150    $formpanel->config_array = array_pop($form_config_org); 
    151151 
    152152    $tabpages_config = $sfExtjs2Plugin->asAnonymousClass(array( 
     
    168168 
    169169    // add tab-pages to formpanel 
    170     $form_config['items'][] = $tabpages_config; 
     170    $formpanel->config_array['items'][] = $tabpages_config; 
    171171 
    172172<?php endif ?> 
     
    187187 
    188188if (count($editActions) > 0): ?> 
    189   $form_config['buttons'] = array(); 
     189  $formpanel->config_array['buttons'] = array(); 
    190190<?php foreach ($editActions as $actionName => $params): ?> 
    191191    //TODO: add credential check 
    192     $form_config['buttons'][] = <?php var_export($this->getEditAjaxActionToButton($actionName, $params, $edit_ns, true)) ?>; 
     192    $formpanel->config_array['buttons'][] = <?php var_export($this->getEditAjaxActionToButton($actionName, $params, $edit_ns, true)) ?>; 
    193193<?php endforeach ?> 
    194194<?php endif ?> 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_edit_ajax_form.php

    r10256 r10288  
    1515sfLoader::loadHelpers('Extjs'); 
    1616 
     17$formpanel = new stdClass(); 
     18$formpanel->attributes = array(); 
     19 
     20//TODO: rewrite with include partial, without ob_start 
    1721ob_start(); 
    1822  require('_edit_ajax_reader.php'); 
    19 $sfExtjs2_<?php echo $formName ?>_reader = trim(ob_get_clean()); 
     23$formpanel->reader = trim(ob_get_clean()); 
    2024 
    2125 
    2226<?php $objectName = $this->getParameterValue('object_name', $this->getModuleName()) ?> 
    2327 
    24 $form_config = array( 
     28$formpanel->config_array = array( 
    2529  'xtype'               => 'form', 
    2630//  'baseCls              => 'x-plain', 
     
    4751  'defaultType'         => 'textfield', 
    4852 
    49   'reader'              => $sfExtjs2_<?php echo $formName ?>_reader, 
     53  'reader'              => $formpanel->reader, 
    5054 
    5155  'baseParams'          => array( 
     
    5559  'method'              => 'post', 
    5660 
    57 <?php if (($width = $this->getParameterValue('edit.width', 400)) != 'fill'): ?> 
     61<?php if (($width = $this->getParameterValue('edit.params.width', 400)) != 'fill'): ?> 
    5862  'width'               => <?php echo $width  ?>, 
    5963<?php endif; ?> 
    6064 
    6165); 
    62  
     66<?php 
     67  $user_params = $this->getParameterValue('edit.params', array()); 
     68  if (is_array($user_params)): 
     69?> 
     70$formpanel->config_array = array_merge($formpanel->config_array, <?php var_export($user_params) ?>); 
     71<?php endif; ?> 
     72<?php 
     73 
     74 
     75$methods =  $this->getParameterValue('formpanel.method'); 
     76if (isset($methods['partials'])): 
     77if (!is_array($methods['partials'])) 
     78
     79  $methods['partials'] = array($methods['partials']); 
     80
     81?> 
     82// generator method partials 
     83<?php 
     84  foreach($methods['partials'] as $method): 
     85?> 
     86include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'formpanel' => $formpanel)); 
     87<?php 
     88    $this->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $formpanel provided ?>'); 
     89  endforeach; 
     90endif; 
     91 
     92 
     93?> 
    6394<?php 
    6495  // add fields, fieldsets, tab-pages and buttons 
     
    72103      'source'     => " 
    73104        // combine <?php echo $formName ?>Config with arguments 
    74         Ext.app.sx.<?php echo $formName ?>.superclass.constructor.call(this, Ext.apply(".$sfExtjs2Plugin->asAnonymousClass($form_config).", c)); 
     105        Ext.app.sx.<?php echo $formName ?>.superclass.constructor.call(this, Ext.apply(".$sfExtjs2Plugin->asAnonymousClass($formpanel->config_array).", c)); 
    75106 
    76107        this.modulename = '<?php echo $this->getModuleName() ?>'; 
     
    316347  '<?php echo $formName ?>', 
    317348  'Ext.FormPanel', 
    318   array ( 
    319     'constructor'   => $sfExtjs2_<?php echo $formName ?>_constructor, 
    320     'initComponent'   => $sfExtjs2_<?php echo $formName ?>_initComponent, 
    321  
    322     'getModulename' => $sfExtjs2_<?php echo $formName ?>_getModulename, 
    323     'getPanelType'  => $sfExtjs2_<?php echo $formName ?>_getPanelType, 
    324  
    325     'getKey'  => $sfExtjs2_<?php echo $formName ?>_getKey, 
    326     'setKey' => $sfExtjs2_<?php echo $formName ?>_setKey, 
    327  
    328     'isNew'  => $sfExtjs2_<?php echo $formName ?>_isNew, 
    329     'updateButtonsVisibility' => $sfExtjs2_<?php echo $formName ?>_updateButtonsVisibility, 
    330  
    331     'loadItem' => $sfExtjs2_<?php echo $formName ?>_loadItem, 
    332     'onLoadSuccess' => $sfExtjs2_<?php echo $formName ?>_onLoadSuccess, 
    333  
    334     'doSubmit' => $sfExtjs2_<?php echo $formName ?>_doSubmit, 
    335     'onSubmitSuccess' => $sfExtjs2_<?php echo $formName ?>_onSubmitSuccess, 
    336     'onSubmitFailure' => $sfExtjs2_<?php echo $formName ?>_onSubmitFailure, 
    337  
    338     'deleteItem' => $sfExtjs2_<?php echo $formName ?>_deleteItem, 
    339  
    340     'showError' => $sfExtjs2_<?php echo $formName ?>_showError, 
     349  array_merge( 
     350    array ( 
     351      'constructor'   => $sfExtjs2_<?php echo $formName ?>_constructor, 
     352      'initComponent'   => $sfExtjs2_<?php echo $formName ?>_initComponent, 
     353 
     354      'getModulename' => $sfExtjs2_<?php echo $formName ?>_getModulename, 
     355      'getPanelType'  => $sfExtjs2_<?php echo $formName ?>_getPanelType, 
     356 
     357      'getKey'  => $sfExtjs2_<?php echo $formName ?>_getKey, 
     358      'setKey' => $sfExtjs2_<?php echo $formName ?>_setKey, 
     359 
     360      'isNew'  => $sfExtjs2_<?php echo $formName ?>_isNew, 
     361      'updateButtonsVisibility' => $sfExtjs2_<?php echo $formName ?>_updateButtonsVisibility, 
     362 
     363      'loadItem' => $sfExtjs2_<?php echo $formName ?>_loadItem, 
     364      'onLoadSuccess' => $sfExtjs2_<?php echo $formName ?>_onLoadSuccess, 
     365 
     366      'doSubmit' => $sfExtjs2_<?php echo $formName ?>_doSubmit, 
     367      'onSubmitSuccess' => $sfExtjs2_<?php echo $formName ?>_onSubmitSuccess, 
     368      'onSubmitFailure' => $sfExtjs2_<?php echo $formName ?>_onSubmitFailure, 
     369 
     370      'deleteItem' => $sfExtjs2_<?php echo $formName ?>_deleteItem, 
     371 
     372      'showError' => $sfExtjs2_<?php echo $formName ?>_showError, 
     373    ), 
     374    $formpanel->attributes // TODO: all methods above should be placed in $formpanel as done with the gridpanel 
    341375  ) 
    342376); 
  • plugins/sfExtjsThemePlugin/data/generator/sfPropelAdmin/extjs/template/templates/_list_ajax_gridpanel_js.php

    r10129 r10288  
    4646$gridpanel->config_array['autoExpandColumn'] = '<?php echo $this->getParameterValue('list.auto_expand_column') ?>'; 
    4747<?php endif; ?> 
    48 <? 
     48<?php 
    4949  $user_params = $this->getParameterValue('list.params', array()); 
    5050