Changeset 12508 for plugins/sfExtjsThemePlugin
- Timestamp:
- 10/31/08 21:09:52 (5 years ago)
- Files:
-
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/actions/actions.class.php (modified) (1 diff)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_columnmodel_js.php (modified) (3 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_columnmodel_method_constructor_js.php (modified) (1 diff)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_columnmodel_variable_cmConfig_js.php (deleted)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_filterpanel_js.php (modified) (2 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_gridpanel_js.php (modified) (6 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_renderer_js.php (modified) (1 diff)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_rowactions_js.php (modified) (2 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_store_js.php (modified) (2 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_tabpanel_js.php (modified) (2 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_toolbar_paging_js.php (modified) (3 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_toolbar_top_js.php (modified) (3 diffs)
- plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/lib/Extjs2DbFinderAdminGenerator.class.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/actions/actions.class.php
r12497 r12508 438 438 { 439 439 <?php 440 foreach ($this->DbFinderAdminGenerator->getUnique DisplayColumns() as $column):440 foreach ($this->DbFinderAdminGenerator->getUniqueListDisplayColumns() as $column): 441 441 $type = $this->DbFinderAdminGenerator->getFieldType($column); 442 442 $name = str_replace('::','.',sfInflector::camelize($column->getName())); plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_columnmodel_js.php
r12379 r12508 1 1 <?php 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 $cmName = "List".$moduleName.'ColumnModel'; 4 $rendererName = "List".$moduleName.'Renderers'; 3 $cmConfig = $this->DbFinderAdminGenerator->getColumnModelConfig(); 4 $cmName = "List".$moduleName."ColumnModel"; 5 $cm_xtype = strtolower($cmName); 5 6 ?> 6 7 [?php … … 9 10 $columnmodel->attributes = array(); 10 11 11 // cmConfig Var 12 include_partial('list_columnmodel_variable_cmConfig_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'columnmodel' => $columnmodel)); 12 $columnmodel->config_array = <?php echo preg_replace("/'(get_partial\([^\)]*\))',/", '\1,', var_export($cmConfig['col_items'], true)) ?>; 13 14 $columnmodel->plugins = <?php var_export($cmConfig['plugins']) ?>; 15 16 /* handle user credentials */ 17 <?php echo implode("\n", $cmConfig['cred_arr']) ?> 18 19 <?php 20 $user_params = $this->getParameterValue('columnmodel.params', array()); 21 if (is_array($user_params)): 22 ?> 23 $columnmodel->config_array = array_merge($columnmodel->config_array, <?php var_export($user_params) ?>); 24 <?php endif; ?> 13 25 14 26 // constructor … … 17 29 // initComponent 18 30 include_partial('list_columnmodel_method_initComponent_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'columnmodel' => $columnmodel)); 19 20 <?php 21 $methods = $this->getParameterValue('columnmodel.method'); 22 if(isset($methods['partials'])): 23 if (!is_array($methods['partials'])) 24 { 25 $methods['partials'] = array($methods['partials']); 26 } 27 ?> 28 // generator method partials 29 <?php 30 foreach($methods['partials'] as $method): 31 ?> 32 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'columnmodel' => $columnmodel)); 33 <?php 34 $this->DbFinderAdminGenerator->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $columnmodel provided ?>'); 35 endforeach; 36 endif; 37 38 $variables = $this->getParameterValue('columnmodel.variable'); 39 if (isset($variables['partials'])): 40 if (!is_array($variables['partials'])) 41 { 42 $variables['partials'] = array($variables['partials']); 43 } 44 ?> 45 // generator variable partials 46 <?php 47 foreach($variables['partials'] as $variable): 48 ?> 49 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'columnmodel' => $columnmodel)); 50 <?php 51 $this->DbFinderAdminGenerator->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $columnmodel provided ?>'); 52 endforeach; 53 endif; 54 ?> 55 31 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('columnmodel','method'); ?> 32 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('columnmodel','variable'); ?> 56 33 $sfExtjs2Plugin->beginClass( 57 34 'Ext.app.sx', 58 35 '<?php echo $cmName ?>', 59 'Ext.app.sx.<?php echo $rendererName?>',36 'Ext.app.sx.<?php echo "List".$moduleName."Renderers" ?>', 60 37 $columnmodel->attributes 61 38 ); 39 62 40 $sfExtjs2Plugin->endClass(); 63 64 41 ?] 42 // register xtype 43 Ext.reg('<?php echo $cm_xtype ?>', Ext.app.sx.<?php echo $cmName ?>); plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_columnmodel_method_constructor_js.php
r12379 r12508 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 3 $cmName = "List".$moduleName."ColumnModel"; 4 5 4 ?> 6 5 plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_filterpanel_js.php
r12392 r12508 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 3 $panelName = "List".$moduleName."FilterPanel"; 4 $panelName_xtype = "list".$this->getModuleName()."filterpanel";4 $panelName_xtype = strtolower($panelName); 5 5 $limit = $this->getParameterValue('list.max_per_page', sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_max_per_page', 20)); 6 6 … … 108 108 // initEvents 109 109 include_partial('list_filterpanel_method_initEvents_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'filterpanel' => $filterpanel)); 110 111 112 <?php 113 $methods = $this->getParameterValue('filterpanel.method'); 114 if(isset($methods['partials'])): 115 if (!is_array($methods['partials'])) 116 { 117 $methods['partials'] = array($methods['partials']); 118 } 119 ?> 120 // generator method partials 121 <?php 122 foreach($methods['partials'] as $method): 123 ?> 124 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'filterpanel' => $filterpanel)); 125 <?php 126 $this->DbFinderAdminGenerator->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $filterpanel provided ?>'); 127 endforeach; 128 endif; 129 130 $variables = $this->getParameterValue('filterpanel.variable'); 131 if (isset($variables['partials'])): 132 if (!is_array($variables['partials'])) 133 { 134 $variables['partials'] = array($variables['partials']); 135 } 136 ?> 137 // generator variable partials 138 <?php 139 foreach($variables['partials'] as $variable): 140 ?> 141 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'filterpanel' => $filterpanel)); 142 <?php 143 $this->DbFinderAdminGenerator->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $filterpanel provided ?>'); 144 endforeach; 145 endif; 146 ?> 147 110 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('filterpanel','method'); ?> 111 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('filterpanel','variable'); ?> 148 112 // create the Ext.app.sx.<?php echo $panelName ?> class 149 113 $sfExtjs2Plugin->beginClass( plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_gridpanel_js.php
r12392 r12508 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 3 $panelName = "List".$moduleName."GridPanel"; 4 $panelName_xtype = "list".$this->getModuleName()."gridpanel"; 5 6 $group_field = $this->getParameterValue('list.grouping.field', null); 7 8 if($this->getParameterValue('list.grouping.text_tpl',false)) $grid_view['groupTextTpl'] = $this->getParameterValue('list.grouping.text_tpl'); 9 10 $listDisplay = $this->getParameterValue('list.display', null); 11 12 $expander = $this->getParameterValue('list.expand_columns'); 13 4 $panelName_xtype = strtolower($panelName); 5 $group_field = $this->getParameterValue('list.grouping.field', false); 6 $objectName = $this->getParameterValue('object_name', $this->getModuleName()); 14 7 $limit = $this->getParameterValue('list.max_per_page', sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_max_per_page', 20)); 15 $pluginArr = false; 16 17 if($this->getParameterValue('list.plugins')) 18 { 19 $pluginArr = (!is_array($this->getParameterValue('list.plugins'))) ? array($this->getParameterValue('list.plugins')) : $this->getParameterValue('list.plugins'); 20 } 21 22 if (isset($expander['renderer_partial'])) 23 { 24 $pluginArr[] = 'this.rowExpander'; 25 } 26 27 if (isset($listDisplay)) 28 { 29 foreach($this->getParameterValue('list.display') as $col) 30 { 31 if($this->getParameterValue('list.fields.'.$col.'.plugin')) $pluginArr[] = 'this.cm.'.$col.'_'.$this->getParameterValue('list.fields.'.$col.'.plugin'); 32 if($col == '^rowactions') $pluginArr[] = 'this.cm.'.strtolower($moduleName).'_rowactions'; 33 } 34 } 35 8 $gridConfig = $this->DbFinderAdminGenerator->getGridPanelConfig(); 36 9 ?> 37 10 [?php … … 41 14 /* gridPanel Configuration */ 42 15 43 <?php $objectName = $this->getParameterValue('object_name', $this->getModuleName()) ?>44 45 16 $sfExtjs2_gridpanel_view = 'new Ext.grid.<?php echo (($group_field)?'Grouping':'Grid') ?>View()'; 46 17 47 <?php if ( isset($expander['renderer_partial'])): ?>18 <?php if (!empty($gridConfig['expander_partial'])): ?> 48 19 // initialise the row expander plugin 49 20 $gridpanel->rowExpander = 'this.getRowExpander();'; 21 50 22 <?php endif; ?> 51 23 $gridpanel->column_model = 'new Ext.app.sx.<?php echo 'List'.$moduleName.'ColumnModel' ?>()'; … … 59 31 'autoScroll' => true, //needed to set a height on the toolbar so the scroll doesnt mess up when adding buttons to an empty bar 60 32 'autoLoadStore' => true, 61 'selModel' => $sfExtjs2Plugin->RowSelectionModel(array( 62 'singleSelect' => <?php echo $this->getParameterValue('list.single_select', true) ? 'true' : 'false' ?> // this should probably also be defined application wide 63 )), 64 'clicksToEdit' => <?php var_export(sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_clicksToEdit', 1)) ?>, 65 'trackMouseOver' => <?php var_export(sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_trackMouseOver', false)) ?>, //this will cause the firefox permission denied errors if true 66 'loadMask' => <?php var_export(sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_loadMask', false)) ?>, 67 'stripeRows' => <?php var_export(sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_stripeRows', true)) ?>, 33 'clicksToEdit' => 1, 34 'trackMouseOver' => false, //this will cause the firefox permission denied errors if true 35 'loadMask' => false, 36 'stripeRows' => true, 68 37 'viewConfig' => $sfExtjs2Plugin->asAnonymousClass(array('forceFit'=>true)), 69 38 ); … … 71 40 <?php if (sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_tabbed')): ?> 72 41 $gridpanel->config_array['header'] = false; 42 73 43 <?php endif; ?> 44 // get plugins from generator 45 <?php if(is_array($gridConfig['plugin_arr'])): ?> 46 $gridpanel->config_array['plugins'] = <?php echo var_export($gridConfig['plugin_arr']); ?>; 74 47 75 // get plugins from generator76 <?php if(is_array($pluginArr)): ?>77 $gridpanel->config_array['plugins'] = <?php echo var_export($pluginArr); ?>;78 48 <?php endif; ?> 49 <?php if (is_array($gridConfig['user_params'])):?> 79 50 80 <?php 81 $user_params = $this->getParameterValue('gridpanel.params', array()); 82 83 if (isset($user_params['bbar'])) unset($user_params['bbar']); 84 if (isset($user_params['tbar'])) unset($user_params['tbar']); 85 86 if (is_array($user_params)): 87 ?> 88 $gridpanel->config_array = array_merge($gridpanel->config_array, <?php var_export($user_params) ?>); 51 $gridpanel->config_array = array_merge($gridpanel->config_array, <?php var_export($gridConfig['user_params']) ?>); 89 52 <?php endif; ?> 90 91 53 /* gridPanel methods and variables */ 92 54 … … 108 70 // updateDB 109 71 include_partial('list_gridpanel_method_updateDB_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'gridpanel' => $gridpanel)); 72 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('gridpanel','method'); ?> 73 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('gridpanel','variable'); ?> 74 <?php echo $gridConfig['expander_partial'] ?> 110 75 111 76 // setFilter … … 139 104 } 140 105 141 <?php142 $methods = $this->getParameterValue('gridpanel.method');143 if (isset($methods['partials'])):144 if (!is_array($methods['partials']))145 {146 $methods['partials'] = array($methods['partials']);147 }148 ?>149 // generator method partials150 <?php151 foreach($methods['partials'] as $method):152 ?>153 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'gridpanel' => $gridpanel));154 <?php155 $this->DbFinderAdminGenerator->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $gridpanel provided ?>');156 endforeach;157 endif;158 159 if (isset($expander['renderer_partial'])):160 if (!is_array($expander['renderer_partial']))161 {162 $expander['renderer_partial'] = array($expander['renderer_partial']);163 }164 if (isset($expander['fields']))165 {166 if (!is_array($expander['fields']))167 {168 $expander['fields'] = array($expander['fields']);169 }170 $template = '';171 foreach($expander['fields'] as $field)172 {173 $template .= "<tr><td><p>{".str_replace('/','-',$field)."}</p></td></tr>";174 }175 }176 ?>177 // generator expand columns renderer partial178 <?php179 foreach($expander['renderer_partial'] as $expanderRenderer):180 $this->DbFinderAdminGenerator->createPartialFile($expanderRenderer,'<?php // @object $sfExtjs2Plugin and @object $gridpanel provided181 $configArr["source"] = "182 if(typeof this.rowExpander ==\'undefined\')183 {184 this.rowExpander = Ext.ComponentMgr.create({185 xtype: \'rowexpander\',186 tpl : new Ext.Template(187 \'<table width=\"100%\">'.$template.'</table>\'188 )189 });190 }191 return this.rowExpander";192 $gridpanel->attributes["getRowExpander"] = $sfExtjs2Plugin->asMethod($configArr);193 ?>');194 ?>195 include_partial('<?php echo substr($expanderRenderer,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'gridpanel' => $gridpanel));196 <?php197 198 endforeach;199 endif;200 201 $variables = $this->getParameterValue('gridpanel.variable');202 if (isset($variables['partials'])):203 if (!is_array($variables['partials']))204 {205 $variables['partials'] = array($variables['partials']);206 }207 ?>208 // generator variable partials209 <?php210 foreach($variables['partials'] as $variable):211 ?>212 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'gridpanel' => $gridpanel));213 <?php214 $this->DbFinderAdminGenerator->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $gridpanel provided ?>');215 endforeach;216 endif;217 ?>218 219 106 // create the Ext.app.sx.<?php echo $panelName ?> class 220 107 $sfExtjs2Plugin->beginClass( plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_renderer_js.php
r12421 r12508 14 14 $renderer->attributes = array(); 15 15 16 // initComponent17 $renderer->attributes['initComponent'] = $sfExtjs2Plugin->asMethod("18 //call parent19 Ext.app.sx.<?php echo $rendererName ?>.superclass.initComponent.apply(this, arguments);20 ");16 // initComponent 17 $renderer->attributes['initComponent'] = $sfExtjs2Plugin->asMethod(" 18 //call parent 19 Ext.app.sx.<?php echo $rendererName ?>.superclass.initComponent.apply(this, arguments); 20 "); 21 21 22 // renderLink23 $renderer->attributes['renderLink'] = $sfExtjs2Plugin->asMethod(array(24 'parameters' => 'value, params, record, rowIndex, colIndex, store',25 'source' => "26 if (record) return String.format('<u><b><a class=\'gridlink\' sf_ns:modulename=\'<?php echo $this->DbFinderAdminGenerator->getPrimaryKeyAdminColumn()->getTableName() ?>\' sf_ns:key=\'{1}\' href=\'<?php echo $this->controller->genUrl($this->getModuleName().'/edit?'.$pkn.'=') ?>/{1}\'>{0}</a></b></u>',27 value,28 record.data['<?php echo $pkn ?>']29 );30 "31 ));22 // renderLink 23 $renderer->attributes['renderLink'] = $sfExtjs2Plugin->asMethod(array( 24 'parameters' => 'value, params, record, rowIndex, colIndex, store', 25 'source' => " 26 if (record) return String.format('<u><b><a class=\'gridlink\' sf_ns:modulename=\'<?php echo $this->DbFinderAdminGenerator->getPrimaryKeyAdminColumn()->getTableName() ?>\' sf_ns:key=\'{1}\' href=\'<?php echo $this->controller->genUrl($this->getModuleName().'/edit?'.$pkn.'=') ?>/{1}\'>{0}</a></b></u>', 27 value, 28 record.data['<?php echo $pkn ?>'] 29 ); 30 " 31 )); 32 32 33 // a column with a weight34 $renderer->attributes['renderWeight'] = $sfExtjs2Plugin->asMethod(array(35 'parameters' => 'v',36 'source' => "37 if (!v) return '';33 // a column with a weight 34 $renderer->attributes['renderWeight'] = $sfExtjs2Plugin->asMethod(array( 35 'parameters' => 'v', 36 'source' => " 37 if (!v) return ''; 38 38 39 v = String(v); var ps = v.split('.');40 var whole = ps[0];41 var r = /(\d+)(\d{3})/;42 while (r.test(whole)) {43 whole = whole.replace(r, '$1' +',' + '$2');44 }45 v = whole;39 v = String(v); var ps = v.split('.'); 40 var whole = ps[0]; 41 var r = /(\d+)(\d{3})/; 42 while (r.test(whole)) { 43 whole = whole.replace(r, '$1' +',' + '$2'); 44 } 45 v = whole; 46 46 47 return String.format('{0} kg', v);48 "49 ));47 return String.format('{0} kg', v); 48 " 49 )); 50 50 51 // formatDate52 $renderer->attributes['formatDate'] = $sfExtjs2Plugin->asMethod(array(53 'parameters' => 'v',54 'source' => "return Ext.util.Format.date(v, '<?php echo sfConfig::get('app_extjs2_dbfgen_theme_plugin_format_date', 'm/d/Y') ?>')"55 ));51 // formatDate 52 $renderer->attributes['formatDate'] = $sfExtjs2Plugin->asMethod(array( 53 'parameters' => 'v', 54 'source' => "return Ext.util.Format.date(v, '<?php echo sfConfig::get('app_extjs2_dbfgen_theme_plugin_format_date', 'm/d/Y') ?>')" 55 )); 56 56 57 $renderer->attributes['formatLongstring'] = $sfExtjs2Plugin->asMethod(array(58 'parameters' => 'v, metaData',59 'source' => "60 metaData.css = 'x-grid3-cell-wrap';61 v = Ext.util.Format.stripTags(v);62 return Ext.util.Format.ellipsis(v, 255);63 "64 ));57 $renderer->attributes['formatLongstring'] = $sfExtjs2Plugin->asMethod(array( 58 'parameters' => 'v, metaData', 59 'source' => " 60 metaData.css = 'x-grid3-cell-wrap'; 61 v = Ext.util.Format.stripTags(v); 62 return Ext.util.Format.ellipsis(v, 255); 63 " 64 )); 65 65 66 $renderer->attributes['formatNumber'] = $sfExtjs2Plugin->asMethod(array(67 'parameters' => 'v',68 'source' => "69 var vString = v.toString();70 if (vString.indexOf('.') != -1)71 {72 v.toFixed(2);73 }74 return v;75 "76 ));66 $renderer->attributes['formatNumber'] = $sfExtjs2Plugin->asMethod(array( 67 'parameters' => 'v', 68 'source' => " 69 var vString = v.toString(); 70 if (vString.indexOf('.') != -1) 71 { 72 v.toFixed(2); 73 } 74 return v; 75 " 76 )); 77 77 78 $renderer->attributes['formatBoolean'] = $sfExtjs2Plugin->asMethod(array(79 'parameters' => 'v',80 'source' => "return v ? 'Yes' : 'No';"81 ));78 $renderer->attributes['formatBoolean'] = $sfExtjs2Plugin->asMethod(array( 79 'parameters' => 'v', 80 'source' => "return v ? 'Yes' : 'No';" 81 )); 82 82 83 $renderer->attributes['formatReadonly'] = $sfExtjs2Plugin->asMethod(array( 84 'parameters' => 'v', 85 'source' => "return String.format('<i>{0}</i>', v);" 86 )); 83 $renderer->attributes['formatReadonly'] = $sfExtjs2Plugin->asMethod(array( 84 'parameters' => 'v', 85 'source' => "return String.format('<i>{0}</i>', v);" 86 )); 87 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('renderer','method'); ?> 88 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('renderer','variable'); ?> 89 // app.sx from Symfony eXtended (instead of ux: user eXtention) 90 $sfExtjs2Plugin->beginClass( 91 'Ext.app.sx', 92 '<?php echo $rendererName ?>', 93 'Ext.grid.ColumnModel', 94 $renderer->attributes 95 ); 87 96 88 89 <?php 90 $methods = $this->getParameterValue('renderers.method'); 91 if (isset($methods['partials'])): 92 if (!is_array($methods['partials'])) 93 { 94 $methods['partials'] = array($methods['partials']); 95 } 96 ?> 97 // generator method partials 98 <?php 99 foreach($methods['partials'] as $method): 100 ?> 101 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'renderer' => $renderer)); 102 <?php 103 $this->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $renderer provided 104 $configArr["parameters"] = "value, metadata, record, rowIndex, colIndex, store"; 105 $configArr["source"] = "Ext.Msg.alert(\'Error\',\'New renderer partial defined in generator.yml!<br><br>Copy the template file from cache \"_'.$method.'.php\" to your application/modules/'.strtolower($this->getModuleName()).'/templates folder and alter it\');"; 106 $renderer->attributes["'.$method.'"] = $sfExtjs2Plugin->asMethod($configArr); 107 ?>'); 108 endforeach; 109 endif; 110 111 $variables = $this->getParameterValue('renderers.variable'); 112 if (isset($variables['partials'])): 113 if (!is_array($variables['partials'])) 114 { 115 $variables['partials'] = array($variables['partials']); 116 } 117 ?> 118 // generator variable partials 119 <?php 120 foreach($variables['partials'] as $variable): 121 ?> 122 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'renderer' => $renderer)); 123 <?php 124 $this->DbFinderAdminGenerator->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $renderer provided ?>'); 125 endforeach; 126 endif; 127 ?> 128 129 130 // app.sx from Symfony eXtended (instead of ux: user eXtention) 131 $sfExtjs2Plugin->beginClass( 132 'Ext.app.sx', 133 '<?php echo $rendererName ?>', 134 'Ext.grid.ColumnModel', 135 $renderer->attributes 136 ); 137 138 $sfExtjs2Plugin->endClass(); 97 $sfExtjs2Plugin->endClass(); 139 98 ?] plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_rowactions_js.php
r12417 r12508 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 3 $rowactionsName = "List".$moduleName."RowActions"; 4 $rowactionsName_xtype = "list".$this->getModuleName()."rowactions";4 $rowactionsName_xtype = strtolower($rowactionsName); 5 5 ?> 6 6 [?php … … 16 16 // initComponent 17 17 include_partial('list_rowactions_method_initComponent_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'rowactions' => $rowactions)); 18 18 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('rowactions','method'); ?> 19 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('rowactions','variable'); ?> 19 20 <?php 20 $methods = $this->getParameterValue('rowactions.method');21 if(isset($methods['partials'])):22 if (!is_array($methods['partials']))23 {24 $methods['partials'] = array($methods['partials']);25 }26 ?>27 // generator method partials28 <?php29 foreach($methods['partials'] as $method):30 ?>31 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'rowactions' => $rowactions));32 <?php33 $this->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $rowactions provided ?>');34 endforeach;35 endif;36 37 $variables = $this->getParameterValue('rowactions.variable');38 if (isset($variables['partials'])):39 if (!is_array($variables['partials']))40 {41 $variables['partials'] = array($variables['partials']);42 }43 ?>44 // generator variable partials45 <?php46 foreach($variables['partials'] as $variable):47 ?>48 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'rowactions' => $rowactions));49 <?php50 $this->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $rowactions provided ?>');51 endforeach;52 endif;53 54 21 $listActions = $this->getParameterValue('list.rowactions'); 55 22 ?> plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_store_js.php
r12502 r12508 10 10 11 11 $panelName = "List".$moduleName.$store; 12 $panelName_xtype = "list".$this->getModuleName().$store;12 $panelName_xtype = strtolower($panelName); 13 13 14 14 $storeConfig = $this->DbFinderAdminGenerator->getDataStoreConfig(); … … 50 50 // initEvents 51 51 include_partial('list_store_method_initEvents_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'store' => $store, 'panelName' => $panelName)); 52 53 <?php 54 $methods = $this->getParameterValue('datastore.method'); 55 if(isset($methods['partials'])): 56 if (!is_array($methods['partials'])) 57 { 58 $methods['partials'] = array($methods['partials']); 59 } 60 ?> 61 // generator method partials 62 <?php 63 foreach($methods['partials'] as $method): 64 ?> 65 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'store' => $store)); 66 <?php 67 $this->DbFinderAdminGenerator->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $store provided ?>'); 68 endforeach; 69 endif; 70 71 $variables = $this->getParameterValue('datastore.variable'); 72 if (isset($variables['partials'])): 73 if (!is_array($variables['partials'])) 74 { 75 $variables['partials'] = array($variables['partials']); 76 } 77 ?> 78 // generator variable partials 79 <?php 80 foreach($variables['partials'] as $variable): 81 ?> 82 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'store' => $store)); 83 <?php 84 $this->DbFinderAdminGenerator->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $store provided ?>'); 85 endforeach; 86 endif; 87 ?> 88 52 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('store','method'); ?> 53 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('store','variable'); ?> 89 54 // create the Ext.app.sx.<?php echo $panelName ?> class 90 55 $sfExtjs2Plugin->beginClass( plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_tabpanel_js.php
r12379 r12508 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 3 $panelName = "List".$moduleName."TabPanel"; 4 $panelName_xtype = "list".$this->getModuleName()."tabpanel";4 $panelName_xtype = strtolower($panelName); 5 5 ?> 6 6 [?php … … 40 40 // initEvents 41 41 include_partial('list_tabpanel_method_initEvents_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'tabpanel' => $tabpanel)); 42 43 <?php 44 $methods = $this->getParameterValue('tabpanel.method'); 45 if(isset($methods['partials'])): 46 if (!is_array($methods['partials'])) 47 { 48 $methods['partials'] = array($methods['partials']); 49 } 50 ?> 51 // generator method partials 52 <?php 53 foreach($methods['partials'] as $method): 54 ?> 55 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'tabpanel' => $tabpanel)); 56 <?php 57 $this->DbFinderAdminGenerator->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $tabpanel provided ?>'); 58 endforeach; 59 endif; 60 61 $variables = $this->getParameterValue('tabpanel.variable'); 62 if (isset($variables['partials'])): 63 if (!is_array($variables['partials'])) 64 { 65 $variables['partials'] = array($variables['partials']); 66 } 67 ?> 68 // generator variable partials 69 <?php 70 foreach($variables['partials'] as $variable): 71 ?> 72 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'tabpanel' => $tabpanel)); 73 <?php 74 $this->DbFinderAdminGenerator->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $tabpanel provided ?>'); 75 endforeach; 76 endif; 77 ?> 78 42 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('tabpanel','method'); ?> 43 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('tabpanel','variable'); ?> 79 44 // create the Ext.app.sx.<?php echo $panelName ?> class 80 45 $sfExtjs2Plugin->beginClass( plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_toolbar_paging_js.php
r12392 r12508 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 3 $toolbarName = "List".$moduleName."ToolbarPaging"; 4 $toolbarName_xtype = "list".$this->getModuleName()."pagingtoolbar";4 $toolbarName_xtype = strtolower($toolbarName); 5 5 $limit = $this->getParameterValue('list.max_per_page', sfConfig::get('app_extjs2_dbfgen_theme_plugin_list_max_per_page', 20)); 6 6 ?> … … 29 29 // initComponent 30 30 include_partial('list_toolbar_paging_method_initComponent_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'toolbar_paging' => $toolbar_paging)); 31 32 <?php 33 $methods = $this->getParameterValue('toolbar_paging.method'); 34 if(isset($methods['partials'])): 35 if (!is_array($methods['partials'])) 36 { 37 $methods['partials'] = array($methods['partials']); 38 } 39 ?> 40 // generator method partials 41 <?php 42 foreach($methods['partials'] as $method): 43 ?> 44 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'toolbar_paging' => $toolbar_paging)); 45 <?php 46 $this->DbFinderAdminGenerator->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $toolbar_paging provided ?>'); 47 endforeach; 48 endif; 49 50 $variables = $this->getParameterValue('toolbar_paging.variable'); 51 if (isset($variables['partials'])): 52 if (!is_array($variables['partials'])) 53 { 54 $variables['partials'] = array($variables['partials']); 55 } 56 ?> 57 // generator variable partials 58 <?php 59 foreach($variables['partials'] as $variable): 60 ?> 61 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'toolbar_paging' => $toolbar_paging)); 62 <?php 63 $this->DbFinderAdminGenerator->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $toolbar_paging provided ?>'); 64 endforeach; 65 endif;?> 66 31 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('toolbar_paging','method'); ?> 32 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('toolbar_paging','variable'); ?> 67 33 // app.sx from Symfony eXtended (instead of ux: user eXtention) 68 34 $sfExtjs2Plugin->beginClass( … … 72 38 $toolbar_paging->attributes 73 39 ); 40 74 41 $sfExtjs2Plugin->endClass(); 75 42 ?] plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/data/generator/DbFinderAdmin/extjs2/template/templates/_list_toolbar_top_js.php
r12386 r12508 2 2 $moduleName = ucfirst(sfInflector::camelize($this->getModuleName())); 3 3 $toolbarName = "List".$moduleName."ToolbarTop"; 4 $toolbarName_xtype = "list".$this->getModuleName()."toptoolbar";4 $toolbarName_xtype = strtolower($toolbarName); 5 5 ?> 6 6 [?php … … 22 22 // initComponent 23 23 include_partial('list_toolbar_top_method_initComponent_js', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'toolbar_top' => $toolbar_top)); 24 24 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('toolbar_top','method'); ?> 25 <?php echo $this->DbFinderAdminGenerator->getCustomPartials('toolbar_top','variable'); ?> 25 26 <?php 26 $methods = $this->getParameterValue('toolbar_top.method');27 if(isset($methods['partials'])):28 if (!is_array($methods['partials']))29 {30 $methods['partials'] = array($methods['partials']);31 }32 ?>33 // generator method partials34 <?php35 foreach($methods['partials'] as $method):36 ?>37 include_partial('<?php echo substr($method,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'toolbar_top' => $toolbar_top));38 <?php39 $this->createPartialFile($method,'<?php // @object $sfExtjs2Plugin and @object $toolbar_top provided ?>');40 endforeach;41 endif;42 43 $variables = $this->getParameterValue('toolbar_top.variable');44 if (isset($variables['partials'])):45 if (!is_array($variables['partials']))46 {47 $variables['partials'] = array($variables['partials']);48 }49 ?>50 // generator variable partials51 <?php52 foreach($variables['partials'] as $variable):53 ?>54 include_partial('<?php echo substr($variable,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'toolbar_top' => $toolbar_top));55 <?php56 $this->createPartialFile($variable,'<?php // @object $sfExtjs2Plugin and @object $toolbar_top provided ?>');57 endforeach;58 endif;59 60 27 $listActions = $this->getParameterValue('list.actions'); 61 28 ?> … … 80 47 $toolbar_top->attributes 81 48 ); 49 82 50 $sfExtjs2Plugin->endClass(); 83 51 ?] plugins/sfExtjsThemePlugin/branches/Extjs2DBFGeneratorThemePlugin/lib/Extjs2DbFinderAdminGenerator.class.php
r12502 r12508 5 5 $listDisplayColumns = null, 6 6 $uniqueListDisplayColumns = null, 7 $displayColumnsConfig = null; 7 $listDisplayColumnsConfig = null, 8 $editDisplayColumns = null, 9 $uniqueEditDisplayColumns = null, 10 $editDisplayColumnsConfig = null; 8 11 9 12 /** … … 53 56 $this->generator->DbFinderAdminGenerator = $this; 54 57 return $this->generator->generate($params); 58 } 59 60 public function getCustomPartials($objName,$type='method') 61 { 62 $partialStr =''; 63 $customs = $this->getParameterValue("$objName.$type"); 64 if(isset($customs['partials'])) 65 { 66 if (!is_array($customs['partials'])) 67 { 68 $customs['partials'] = array($customs['partials']); 69 } 70 71 $partialStr .= "\n// generator $type partials\n"; 72 73 foreach($customs['partials'] as $custom) 74 { 75 $partialStr .= "include_partial('".substr($custom,1)."', array('sfExtjs2Plugin' => \$sfExtjs2Plugin, '$objName' => \$$objName));\n"; 76 $this->createPartialFile($custom,'<?php // @object $sfExtjs2Plugin and @object $'.$objName.' provided ?>'); 77 } 78 } 79 return $partialStr; 55 80 } 56 81 … … 108 133 $group_field = $this->getParameterValue('list.grouping.field', null); 109 134 110 $displayColumnsConfig = $this->get DisplayColumnsConfig();135 $displayColumnsConfig = $this->getListDisplayColumnsConfig(); 111 136 $groupedColumns = $this->getListDisplayColumns(); 112 137 … … 150 175 } 151 176 177 public function getColumnModelConfig() 178 { 179 $plugins = false; 180 $cmItems = array(); 181 $credArr = array(); 182 $i=0; 183 foreach ($this->sortColumns($this->getListColumns($this->getListDisplayColumns())) as $column) 184 { 185 //don't create column config for invisible columns 186 if (($column->isInvisible())) 187 { 188 continue; 189 } 190 191 //captures the ^expander in the list.display and sets the rowexpander at that position 192 //new syntax is ^expander, need to obsolete plain * 193 if ($column->key == '*'||$column->key == '^expander') 194 { 195 $cmItems[] = "{xtype: 'rowexpander'}"; 196 $i++; 197 continue; 198 } 199 200 //handle credentials for displaying the column 201 $listcreds = $this->getParameterValue('list.fields.'.$column->key.'.credentials'); 202 if ($listcreds) 203 { 204 $listcreds = str_replace("\n", ' ', var_export($listcreds, true)); 205 //if the user doesn't have the right permissions remove the columnconfig 206 $credArr[] = 'if(!$sf_user->hasCredential('.$listcreds.')) unset($columnmodel->config_array['.$i.']);'; 207 } 208 209 $columnDefinition = $this->getColumnAjaxListDefinition($column, $this->getListDisplayColumns()); 210 211 //captures the ^rowactions in the list.display and sets the rowexpander at that position 212 if ($column->key == '^rowactions') 213 { 214 //handle credentials for displaying the rowaction column 215 $listRowactions = $this->getParameterValue('list.rowactions'); 216 foreach ((array) $listRowactions as $actionName => $params) 217 { 218 $actioncreds = (isset($params['credentials']))?$params['credentials']:false; 219 if ($actioncreds) 220 { 221 $actioncreds = str_replace("\n", ' ', var_export($actioncreds, true)); 222 //if the user doesn't have the right permissions remove the button config 223 $credArr[] = 'if(!$sf_user->hasCredential('.$actioncreds.')) unset($columnmodel->config_array['.$i.']);'; 224 } 225 } 226 227 $pluginArrName = strtolower($this->getModuleName()).'_rowactions'; 228 //here are the defaults if nothing is set in the fields config 229 $plugins[$pluginArrName] = array('xtype' => 'list'.strtolower($this->getModuleName()).'rowactions', 'header' => ' '); 230 //merge in the fields config if it's there 231 if($this->getParameterValue('fields.'.$column->key,false)||$this->getParameterValue('list.fields.'.$column->key,false)){ 232 $plugins[$pluginArrName] = array_merge($plugins[$pluginArrName], $columnDefinition); 233 } 234 //set the column item to our generated plugin 235 $cmItems[] = 'this.'.$pluginArrName; 236 $i++; 237 continue; 238 } 239 240 //handle edit credentials for plugin columns 241 if($this->getParameterValue('list.fields.'.$column->key.'.plugin')) 242 { 243 $pluginArrName = $column->key.'_'.$this->getParameterValue('list.fields.'.$column->key.'.plugin'); 244 //setup the data for generating the new plugin instance 245 $plugins[$pluginArrName] = $columnDefinition; 246 if ($editcreds = $this->getParameterValue('edit.fields.'.$column->key.'.credentials')) 247 { 248 $editcreds = str_replace("\n", ' ', var_export($editcreds, true)); 249 //pass our credentials down to the generated partial 250 $credArr[] = "if(!\$sf_user->hasCredential($editcreds)&& is_array(\$columnmodel->plugins['$pluginArrName'])) \$columnmodel->plugins['$pluginArrName']['editable'] = false;"; 251 } 252 //set the column item to our generated plugin 253 $cmItems[] = 'this.'.$pluginArrName; 254 $i++; 255 continue; 256 } 257 258 //handle edit credentials for non-plugin columns 259 if ($editcreds = $this->getParameterValue('edit.fields.'.$column->key.'.credentials')) 260 { 261 $editcreds = str_replace("\n", ' ', var_export($editcreds, true)); 262 //unset the editor if the user doesn't have the right credentials 263 $credArr[] = "if(!\$sf_user->hasCredential($editcreds)&& is_array(\$columnmodel->config_array['$i'])&& isset(\$columnmodel->config_array['$i']['editor'])) unset(\$columnmodel->config_array['$i']['editor']);"; 264 } 265 266 $cmItems[] = $columnDefinition; 267 268 $i++; 269 } 270 return array('plugins'=>$plugins, 'cred_arr' =>$credArr, 'col_items'=>$cmItems); 271 } 272 273 public function getToolbarTopConfig() 274 { 275 276 } 277 278 public function getFilterPanelConfig() 279 { 280 281 } 282 283 public function getGridPanelConfig() 284 { 285 if($this->getParameterValue('list.grouping.text_tpl',false)) 286 { 287 $grid_view['groupTextTpl'] = $this->getParameterValue('list.grouping.text_tpl'); 288 } 289 290 $pluginArr = false; 291 $listPlugins = $this->getParameterValue('list.plugins',false); 292 if($listPlugins) 293 { 294 $pluginArr = (!is_array($listPlugins)) ? array($listPlugins) : $listPlugins; 295 } 296 297 $listDisplay = $this->getParameterValue('list.display', false); 298 if ($listDisplay) 299 { 300 foreach($listDisplay as $col) 301 { 302 if($this->getParameterValue('list.fields.'.$col.'.plugin')) 303 { 304 $pluginArr[] = 'this.cm.'.$col.'_'.$this->getParameterValue('list.fields.'.$col.'.plugin'); 305 } 306 if($col == '^rowactions') 307 { 308 $pluginArr[] = 'this.cm.'.strtolower($this->getModuleName()).'_rowactions'; 309 } 310 } 311 } 312 313 $expander = $this->getParameterValue('list.expand_columns'); 314 $expanderPartial = ''; 315 if (isset($expander['renderer_partial'])) 316 { 317 $pluginArr[] = 'this.rowExpander'; 318 319 if (!is_array($expander['renderer_partial'])) 320 { 321 $expander['renderer_partial'] = array($expander['renderer_partial']); 322 } 323 324 if (isset($expander['fields'])) 325 { 326 if (!is_array($expander['fields'])) 327 { 328 $expander['fields'] = array($expander['fields']); 329 } 330 $template = ''; 331 foreach($expander['fields'] as $field) 332 { 333 $template .= "<tr><td><p>{".str_replace('/','-',$field)."}</p></td></tr>"; 334 } 335 } 336 337 $expanderPartial .= "\n// generator expand columns renderer partial\n"; 338 foreach($expander['renderer_partial'] as $expanderRenderer) 339 { 340 $this->createPartialFile($expanderRenderer,'<?php // @object $sfExtjs2Plugin and @object $gridpanel provided 341 $configArr["source"] = " 342 if(typeof this.rowExpander ==\'undefined\') 343 { 344 this.rowExpander = Ext.ComponentMgr.create({ 345 xtype: \'rowexpander\', 346 tpl : new Ext.Template( 347 \'<table width=\"100%\">'.$template.'</table>\' 348 ) 349 }); 350 } 351 return this.rowExpander"; 352 $gridpanel->attributes["getRowExpander"] = $sfExtjs2Plugin->asMethod($configArr); 353 ?>'); 354 355 $expanderPartial .= "include_partial('<?php echo substr($expanderRenderer,1) ?>', array('sfExtjs2Plugin' => $sfExtjs2Plugin, 'gridpanel' => $gridpanel));\n"; 356 } 357 } 358 359 $user_params = $this->getParameterValue('gridpanel.params', array()); 360 if (isset($user_params['bbar'])) unset($user_params['bbar']); 361 if (isset($user_params['tbar'])) unset($user_params['tbar']); 362 363 return array('expander_partial'=>$expanderPartial,'user_params'=>$user_params,'plugin_arr'=>$pluginArr); 364 } 365 366 public function getRowActionsConfig() 367 { 368 369 } 370 152 371 public function getListDisplayColumns() 153 372 { 154 if(!$this-> displayListColumns)155 { 156 $this-> displayColumns = $this->getColumnsGrouped('list.display');157 } 158 return $this-> displayColumns;373 if(!$this->listDisplayColumns) 374 { 375 $this->listDisplayColumns = $this->getColumnsGrouped('list.display'); 376 } 377 return $this->listDisplayColumns; 159 378 } 160 379 … … 166 385 } 167 386 return $this->uniqueListDisplayColumns; 387 } 388 389 public function getEditDisplayColumns() 390 { 391 if(!$this->editDisplayColumns) 392 { 393 $this->editDisplayColumns = $this->getColumnsGrouped('list.display'); 394 } 395 return $this->editDisplayColumns; 396 } 397 398 public function getUniqueEditDisplayColumns() 399 { 400 if(!$this->uniqueEditDisplayColumns) 401 { 402 $this->uniqueEditDisplayColumns = $this->getListUniqueColumns($this->getEditDisplayColumns(), true); 403 } 404 return $this->uniqueEditDisplayColumns; 168 405 } 169 406 170 407 /** 171 408 * Configures the display columns config used in several modules 172 * @param409 * 173 410 * @return array($listDisplay, $credArr) 174 411 * 175 412 */ 176 public function get DisplayColumnsConfig()177 { 178 if(!$this-> displayColumnsConfig)413 public function getListDisplayColumnsConfig() 414 { 415 if(!$this->listDisplayColumnsConfig) 179 416 { 180 417 $i=0; 181 $this-> displayColumnsConfig['credArr'] = array();182 $this-> displayColumnsConfig['listDisplay'] = array();183 foreach ($this->getUnique DisplayColumns() as $column)418 $this->listDisplayColumnsConfig['credArr'] = array(); 419 $this->listDisplayColumnsConfig['listDisplay'] = array(); 420 foreach ($this->getUniqueListDisplayColumns() as $column) 184 421 { 185 422 if ($column->isPlugin()) continue; //plugin placeholder columns not in json-data … … 192 429 if ($credentials){ 193 430 $credentials = str_replace("\n", ' ', var_export($credentials, true)); 194 $this-> displayColumnsConfig['credArr'][] = 'if(!$sf_user->hasCredential('.$credentials.')) unset($reader["fields"]['.$i.']);';195 } 196 197 $this-> displayColumnsConfig['listDisplay'][] = array(431 $this->listDisplayColumnsConfig['credArr'][] = 'if(!$sf_user->hasCredential('.$credentials.')) unset($reader["fields"]['.$i.']);'; 432 } 433 434 $this->listDisplayColumnsConfig['listDisplay'][] = array( 198 435 'name' => $fieldName, 199 436 'type' => $this->getFieldTypeForReader($column) … … 202 439 } 203 440 } 204 return $this-> displayColumnsConfig;441 return $this->listDisplayColumnsConfig; 205 442 } 206 443 … … 250 487 251 488 } 489 252 490 /** 253 491 * Returns javascript code for an action button in the toolbar new (config)style (with sfExtjs2Plugin usage). … … 675 913 } 676 914 677 // add grouping.field if set 678 // if ($groupColumnName = $this->getParameterValue('list.grouping.field', null)) 679 // { 680 // $columnNames[] = $groupColumnName; 681 // } 682 683 // you don't have to add 'list.grouping.display' to the arguments of this method, it is taken into account automatically if you provide 'list.display' 684 // if (!in_array('list.grouping.display', $for)) 685 // { 686 // 687 // if ($groupColumnDisplay = $this->getParameterValue('list.grouping.display', null)) 688 // { 689 // $for[] = 'list.grouping.display'; 690 // } 691 // } 915 if ($this->hasGroupFieldNotInDisplay()) 916 { 917 $for[] = 'list.grouping.field'; 918 } 919 692 920 } 693 921 // check if you want to display edit, add pages automatically … … 960 1188 } 961 1189 } 962 // else 963 // { 964 // $group_field = sfInflector::underscore($this->getClassName()).$this->generator->tableDelimiter.$group_field; 965 // } 966 } 967 1190 } 968 1191 return $group_field; 969 }970 971 //obsolete972 public function hasGroupField()973 {974 $group_field = $this->getParameterValue('list.grouping.field', null);975 976 return $group_field ? true : false;977 1192 } 978 1193 … … 1680 1895 } 1681 1896 1682 1683 1897 /** This method overwrites the original method so it can handle foreign-field by providing a peerName 1684 1898 */