Changeset 8304
- Timestamp:
- 04/04/08 20:27:40 (6 months ago)
- Files:
-
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/README (modified) (5 diffs)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php (modified) (6 diffs)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_td_stacked.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_td_tabular.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_show.php (added)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_show_actions.php (added)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_show_footer.php (added)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_show_header.php (added)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/lib/sfAdvancedAdminGenerator.class.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/trunk/package.xml (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfAdvancedAdminGeneratorPlugin/trunk/README
r8303 r8304 3 3 The `sfAdvancedAdminGenerator` provide advanced functionalities for admin generator. 4 4 5 Currently, only one is the distinct configurations between create and edit action 5 - Distinct configurations between create and edit action 6 7 - Add a 'show' action that provide a view for the object (no edit) 8 9 - Change the action for the hyperlink on the list 6 10 7 11 == Installation == … … 10 14 11 15 {{{ 12 symfony plugin-install http://plugins.symfony-project.com/sfAdvanced LoggerPlugin16 symfony plugin-install http://plugins.symfony-project.com/sfAdvancedAdminGeneratorPlugin 13 17 }}} 14 18 … … 23 27 24 28 list: 29 click_action: show ## Change the default hyperlink 25 30 object_actions: 26 31 _edit: 32 _show: ## Show the object (no edit) 27 33 28 34 edit: … … 53 59 == Compatibility with default symfony generator == 54 60 55 If no 'create' section is present in your configuration, the generator act exactly like the default generator (create action use edit configuration) 61 If no 'create' section is present in your configuration, the generator act exactly like the default generator (create action use edit configuration) 62 63 If no 'click_action' option is present in 'list' section, the hyperlink link to edit action 56 64 57 65 == Configuration == 58 66 59 The configuration is the same that the symfony default admin generation.67 The configuration for the 'create' and 'show' sections are the same that the symfony default admin generator. 60 68 61 69 [http://www.symfony-project.com/book/1_0/14-Generators Click for more information] … … 66 74 67 75 * romain: plug-in added to symfony 76 77 === 2007-10-23 | 0.1.1 === 78 79 * romain: add 'show' action 80 * romain: add 'click_action' in the 'list' section plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php
r8303 r8304 8 8 9 9 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 10 * @version SVN: $Id: actions.class.php 275 2007-10-16 13:49:13Z romain $10 * @version SVN: $Id: actions.class.php 300 2007-10-23 15:18:49Z romain $ 11 11 */ 12 12 class <?php echo $this->getGeneratedModuleName() ?>Actions extends sfActions … … 43 43 } 44 44 45 public function executeShow() 46 { 47 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 48 if ($this-><?php echo $this->getSingularName() ?>->isNew()) { 49 return $this->forward('<?php echo $this->getModuleName() ?>', 'create'); 50 } 51 $this->labels = $this->getLabels(); 52 } 53 45 54 public function executeCreate() 46 55 { … … 97 106 switch ($this->getActionName()) { 98 107 <?php foreach (array('create', 'edit') as $action): ?> 99 case '<? =$action?>':108 case '<?php echo $action; ?>': 100 109 <?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> 101 110 <?php foreach ($this->getColumns($action.'.display', $category) as $name => $column): ?> … … 158 167 switch ($this->getActionName()) { 159 168 <?php foreach (array('create', 'edit') as $action): ?> 160 case '<? =$action?>':169 case '<?php echo $action ?>': 161 170 <?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> 162 171 <?php foreach ($this->getColumns($action.'.display', $category) as $name => $column): $type = $column->getCreoleType(); ?> … … 230 239 switch ($this->getActionName()) { 231 240 <?php foreach (array('create', 'edit') as $action): ?> 232 case '<? =$action?>':241 case '<?php echo $action; ?>': 233 242 <?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> 234 243 <?php foreach ($this->getColumns($action.'.display', $category) as $name => $column): $type = $column->getCreoleType(); ?> … … 463 472 { 464 473 switch ($this->getActionName()) { 465 <?php foreach (array('create', 'edit' ) as $action): ?>466 case '<? =$action?>':474 <?php foreach (array('create', 'edit', 'show') as $action): ?> 475 case '<?php echo $action; ?>': 467 476 return array( 468 477 <?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php
r8303 r8304 58 58 [?php endif; ?] 59 59 60 [?php $value = <?php echo $this->getColumn EditTag($column); ?>; echo $value ? $value : ' ' ?]60 [?php $value = <?php echo $this->getColumnCreateTag($column); ?>; echo $value ? $value : ' ' ?] 61 61 <?php echo $this->getHelp($column, 'create') ?> 62 62 </div> plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php
r8303 r8304 7 7 <?php else: ?> 8 8 <?php echo $this->getButtonToAction('_create', array(), false) ?> 9 <?php endif; ?>9 <?php endif; ?> 10 10 </ul> plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_td_stacked.php
r8303 r8304 7 7 <?php if (in_array($column->getName(), $hides)) continue ?> 8 8 <?php if ($column->isLink()): ?> 9 [?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/ edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]9 [?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/<? echo $this->getParameterValue('list.click_action', 'edit') ?>?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?] 10 10 <?php else: ?> 11 11 [?php echo <?php echo $this->getColumnListTag($column) ?> ?] plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_td_tabular.php
r8303 r8304 7 7 <?php endif; ?> 8 8 <?php if ($column->isLink()): ?> 9 <td>[?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/ edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]</td>9 <td>[?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/<? echo $this->getParameterValue('list.click_action', 'edit') ?>?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]</td> 10 10 <?php else: ?> 11 11 <td>[?php echo <?php echo $this->getColumnListTag($column) ?> ?]</td> plugins/sfAdvancedAdminGeneratorPlugin/trunk/lib/sfAdvancedAdminGenerator.class.php
r8303 r8304 33 33 $this->setGeneratorClass('sfAdvancedAdmin'); 34 34 } 35 36 public function getColumnCreateTag($column, $params = array()) 37 { 38 // user defined parameters 39 $user_params = $this->getParameterValue('create.fields.'.$column->getName().'.params'); 40 $user_params = is_array($user_params) ? $user_params : sfToolkit::stringToArray($user_params); 41 $params = $user_params ? array_merge($params, $user_params) : $params; 42 43 if ($column->isComponent()) 44 { 45 return "get_component('".$this->getModuleName()."', '".$column->getName()."', array('type' => 'create', '{$this->getSingularName()}' => \${$this->getSingularName()}))"; 46 } 47 else if ($column->isPartial()) 48 { 49 return "get_partial('".$column->getName()."', array('type' => 'create', '{$this->getSingularName()}' => \${$this->getSingularName()}))"; 50 } 51 52 // default control name 53 $params = array_merge(array('control_name' => $this->getSingularName().'['.$column->getName().']'), $params); 54 55 // default parameter values 56 $type = $column->getCreoleType(); 57 if ($type == CreoleTypes::DATE) 58 { 59 $params = array_merge(array('rich' => true, 'calendar_button_img' => sfConfig::get('sf_admin_web_dir').'/images/date.png'), $params); 60 } 61 else if ($type == CreoleTypes::TIMESTAMP) 62 { 63 $params = array_merge(array('rich' => true, 'withtime' => true, 'calendar_button_img' => sfConfig::get('sf_admin_web_dir').'/images/date.png'), $params); 64 } 65 66 // user sets a specific tag to use 67 if ($inputType = $this->getParameterValue('create.fields.'.$column->getName().'.type')) 68 { 69 if ($inputType == 'plain') 70 { 71 return $this->getColumnListTag($column, $params); 72 } 73 else 74 { 75 return $this->getPHPObjectHelper($inputType, $column, $params); 76 } 77 } 78 79 // guess the best tag to use with column type 80 return parent::getCrudColumnEditTag($column, $params); 81 } 82 83 public function getColumnShowTag($column, $params = array()) 84 { 85 return $this->getColumnListTag($column, $params); 86 } 87 88 public function getLinkToAction($actionName, $params, $pk_link = false) { 89 $ret = parent::getLinkToAction($actionName, $params, $pk_link); 90 if ($actionName === '_show') { 91 return preg_replace('/\/show_icon.png/', '/filter.png', $ret); 92 } 93 else { 94 return $ret; 95 } 96 } 35 97 } plugins/sfAdvancedAdminGeneratorPlugin/trunk/package.xml
r8303 r8304 11 11 <active>yes</active> 12 12 </lead> 13 <date>2007-10- 16</date>14 <time>1 6:25:54</time>13 <date>2007-10-23</date> 14 <time>18:23:41</time> 15 15 <version> 16 <release>0.1. 0</release>17 <api>0.1. 0</api>16 <release>0.1.1</release> 17 <api>0.1.1</api> 18 18 </version> 19 19 <stability> … … 25 25 <contents> 26 26 <dir name="/"> 27 <file md5sum=" 86e31c9189ba620ae4d839e2d9fc0a02" name="data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php" role="data" />27 <file md5sum="fc020347da3cffe38fdbeda3751a87b0" name="data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php" role="data" /> 28 28 <file md5sum="99bf4065cd55a4f6cddadce48c284a88" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_actions.php" role="data" /> 29 29 <file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_footer.php" role="data" /> 30 <file md5sum=" e431558cc4b01f41b9825a751782134d" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php" role="data" />30 <file md5sum="4f227c73dbeb84db2aa52696e8ead246" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php" role="data" /> 31 31 <file md5sum="e40ef5265dd4213fdcbfeb0735e1b8b0" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_header.php" role="data" /> 32 32 <file md5sum="f94fa0edce99730123d17db97902e1c2" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_messages.php" role="data" /> … … 37 37 <file md5sum="f94fa0edce99730123d17db97902e1c2" name="data/generator/sfAdvancedAdmin/default/template/templates/_edit_messages.php" role="data" /> 38 38 <file md5sum="cbc41f754c7d8d689241c167a4ad818e" name="data/generator/sfAdvancedAdmin/default/template/templates/_filters.php" role="data" /> 39 <file md5sum=" c2de281f9be6e014bb382b2aa4161632" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php" role="data" />39 <file md5sum="5ef5a93b694a73470dded8a483601acd" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php" role="data" /> 40 40 <file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_footer.php" role="data" /> 41 41 <file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_header.php" role="data" /> 42 42 <file md5sum="ba045ac332bd8aa31e47496e9cd51a76" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_messages.php" role="data" /> 43 43 <file md5sum="37f96b05d70df8f26b250b995c6a001f" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_td_actions.php" role="data" /> 44 <file md5sum=" a586a14e0e6cb81086d79b4cc563f1ff" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_td_stacked.php" role="data" />45 <file md5sum=" ebbfcb717d26f4841c26c57770275059" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_td_tabular.php" role="data" />44 <file md5sum="45d33bbbd746d4ce436c0c33c3908da5" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_td_stacked.php" role="data" /> 45 <file md5sum="0abaf4ab624d80937fc5953ac227f9c1" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_td_tabular.php" role="data" /> 46 46 <file md5sum="a56f41c8133291c743ea56b5d83146c2" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_th_stacked.php" role="data" /> 47 47 <file md5sum="cf07bc656e18ae390e4b7f7706ee4490" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_th_tabular.php" role="data" /> 48 48 <file md5sum="5fe99a831753020603c3ea924c2b246c" name="data/generator/sfAdvancedAdmin/default/template/templates/_list.php" role="data" /> 49 <file md5sum="ea8bb65246dd3be78024d80f2d07c897" name="data/generator/sfAdvancedAdmin/default/template/templates/_show_actions.php" role="data" /> 50 <file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="data/generator/sfAdvancedAdmin/default/template/templates/_show_footer.php" role="data" /> 51 <file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="data/generator/sfAdvancedAdmin/default/template/templates/_show_header.php" role="data" /> 52 <file md5sum="1d757049672fd1b896b486fbd725a2d4" name="data/generator/sfAdvancedAdmin/default/template/templates/_show.php" role="data" /> 49 53 <file md5sum="5b06c2d05f5e2f7db2edbde0d19ab631" name="data/generator/sfAdvancedAdmin/default/template/templates/createSuccess.php" role="data" /> 50 54 <file md5sum="815ea1e613f2d8ef462de8eeee34d173" name="data/generator/sfAdvancedAdmin/default/template/templates/editSuccess.php" role="data" /> 51 55 <file md5sum="b980e7a592fe5a096c2e1770c8c04f1e" name="data/generator/sfAdvancedAdmin/default/template/templates/listSuccess.php" role="data" /> 52 <file md5sum=" 0ec6622b94a737d308b3732db9b8b75e" name="lib/sfAdvancedAdminGenerator.class.php" role="data" />53 <file md5sum=" 3507a2dd251ab4452b2e509e6c594587" name="README" role="data" />56 <file md5sum="ea9bc1fa3b4205dbe291edca922dbb0e" name="lib/sfAdvancedAdminGenerator.class.php" role="data" /> 57 <file md5sum="d26db58bbe7a214e1a993e905827b435" name="README" role="data" /> 54 58 <file md5sum="f8f064191ae90258ba4b3005852a2bbd" name="LICENSE" role="data" /> 55 59 </dir>