Development

Changeset 8304

You must first sign up to be able to contribute.

Changeset 8304

Show
Ignore:
Timestamp:
04/04/08 20:27:40 (6 months ago)
Author:
naholyr
Message:

0.1.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfAdvancedAdminGeneratorPlugin/trunk/README

    r8303 r8304  
    33The `sfAdvancedAdminGenerator` provide advanced functionalities for admin generator. 
    44 
    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 
    610 
    711== Installation == 
     
    1014   
    1115    {{{ 
    12       symfony plugin-install http://plugins.symfony-project.com/sfAdvancedLoggerPlugin 
     16      symfony plugin-install http://plugins.symfony-project.com/sfAdvancedAdminGeneratorPlugin 
    1317    }}} 
    1418 
     
    2327     
    2428    list: 
     29      click_action: show ## Change the default hyperlink 
    2530      object_actions: 
    2631        _edit: 
     32        _show: ## Show the object (no edit) 
    2733 
    2834    edit: 
     
    5359== Compatibility with default symfony generator == 
    5460 
    55 If no 'create' section is present in your configuration, the generator act exactly like the default generator (create action use edit configuration)  
     61If no 'create' section is present in your configuration, the generator act exactly like the default generator (create action use edit configuration) 
     62 
     63If no 'click_action' option is present in 'list' section, the hyperlink link to edit action  
    5664 
    5765== Configuration == 
    5866 
    59 The configuration is the same that the symfony default admin generation
     67The configuration for the 'create' and 'show' sections are the same that the symfony default admin generator
    6068 
    6169[http://www.symfony-project.com/book/1_0/14-Generators Click for more information]  
     
    6674 
    6775 * 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  
    88 
    99 * @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 $ 
    1111 */ 
    1212class <?php echo $this->getGeneratedModuleName() ?>Actions extends sfActions 
     
    4343  } 
    4444 
     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 
    4554  public function executeCreate() 
    4655  { 
     
    97106    switch ($this->getActionName()) { 
    98107<?php foreach (array('create', 'edit') as $action): ?> 
    99       case '<?=$action?>': 
     108      case '<?php echo $action; ?>': 
    100109<?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> 
    101110<?php foreach ($this->getColumns($action.'.display', $category) as $name => $column): ?> 
     
    158167    switch ($this->getActionName()) { 
    159168<?php foreach (array('create', 'edit') as $action): ?> 
    160       case '<?=$action?>': 
     169      case '<?php echo $action ?>': 
    161170<?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> 
    162171<?php foreach ($this->getColumns($action.'.display', $category) as $name => $column): $type = $column->getCreoleType(); ?> 
     
    230239    switch ($this->getActionName()) { 
    231240<?php foreach (array('create', 'edit') as $action): ?> 
    232       case '<?=$action?>': 
     241      case '<?php echo $action; ?>': 
    233242<?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> 
    234243<?php foreach ($this->getColumns($action.'.display', $category) as $name => $column): $type = $column->getCreoleType(); ?> 
     
    463472  { 
    464473    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; ?>': 
    467476        return array( 
    468477<?php foreach ($this->getColumnCategories($action.'.display') as $category): ?> 
  • plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php

    r8303 r8304  
    5858  [?php endif; ?] 
    5959 
    60   [?php $value = <?php echo $this->getColumnEditTag($column); ?>; echo $value ? $value : '&nbsp;' ?] 
     60  [?php $value = <?php echo $this->getColumnCreateTag($column); ?>; echo $value ? $value : '&nbsp;' ?] 
    6161  <?php echo $this->getHelp($column, 'create') ?> 
    6262  </div> 
  • plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php

    r8303 r8304  
    77<?php else: ?> 
    88  <?php echo $this->getButtonToAction('_create', array(), false) ?> 
    9 <?php endif; ?> 
     9  <?php endif; ?> 
    1010</ul> 
  • plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_td_stacked.php

    r8303 r8304  
    77<?php if (in_array($column->getName(), $hides)) continue ?> 
    88  <?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() ?>) ?] 
    1010  <?php else: ?> 
    1111  [?php echo <?php echo $this->getColumnListTag($column) ?> ?] 
  • plugins/sfAdvancedAdminGeneratorPlugin/trunk/data/generator/sfAdvancedAdmin/default/template/templates/_list_td_tabular.php

    r8303 r8304  
    77<?php endif; ?> 
    88  <?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> 
    1010<?php else: ?> 
    1111  <td>[?php echo <?php echo $this->getColumnListTag($column) ?> ?]</td> 
  • plugins/sfAdvancedAdminGeneratorPlugin/trunk/lib/sfAdvancedAdminGenerator.class.php

    r8303 r8304  
    3333    $this->setGeneratorClass('sfAdvancedAdmin'); 
    3434  } 
     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  } 
    3597} 
  • plugins/sfAdvancedAdminGeneratorPlugin/trunk/package.xml

    r8303 r8304  
    1111  <active>yes</active> 
    1212 </lead> 
    13  <date>2007-10-16</date> 
    14  <time>16:25:54</time> 
     13 <date>2007-10-23</date> 
     14 <time>18:23:41</time> 
    1515 <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> 
    1818 </version> 
    1919 <stability> 
     
    2525 <contents> 
    2626  <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" /> 
    2828   <file md5sum="99bf4065cd55a4f6cddadce48c284a88" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_actions.php" role="data" /> 
    2929   <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" /> 
    3131   <file md5sum="e40ef5265dd4213fdcbfeb0735e1b8b0" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_header.php" role="data" /> 
    3232   <file md5sum="f94fa0edce99730123d17db97902e1c2" name="data/generator/sfAdvancedAdmin/default/template/templates/_create_messages.php" role="data" /> 
     
    3737   <file md5sum="f94fa0edce99730123d17db97902e1c2" name="data/generator/sfAdvancedAdmin/default/template/templates/_edit_messages.php" role="data" /> 
    3838   <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" /> 
    4040   <file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_footer.php" role="data" /> 
    4141   <file md5sum="d41d8cd98f00b204e9800998ecf8427e" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_header.php" role="data" /> 
    4242   <file md5sum="ba045ac332bd8aa31e47496e9cd51a76" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_messages.php" role="data" /> 
    4343   <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" /> 
    4646   <file md5sum="a56f41c8133291c743ea56b5d83146c2" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_th_stacked.php" role="data" /> 
    4747   <file md5sum="cf07bc656e18ae390e4b7f7706ee4490" name="data/generator/sfAdvancedAdmin/default/template/templates/_list_th_tabular.php" role="data" /> 
    4848   <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" /> 
    4953   <file md5sum="5b06c2d05f5e2f7db2edbde0d19ab631" name="data/generator/sfAdvancedAdmin/default/template/templates/createSuccess.php" role="data" /> 
    5054   <file md5sum="815ea1e613f2d8ef462de8eeee34d173" name="data/generator/sfAdvancedAdmin/default/template/templates/editSuccess.php" role="data" /> 
    5155   <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" /> 
    5458   <file md5sum="f8f064191ae90258ba4b3005852a2bbd" name="LICENSE" role="data" /> 
    5559  </dir>