Changeset 12431
- Timestamp:
- 10/30/08 11:16:51 (5 years ago)
- Files:
-
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/configuration.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/createAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/deleteAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/editAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/fieldsConfiguration.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/filterAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/filtersAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/filtersConfiguration.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/indexAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/newAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/paginationAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/paginationConfiguration.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/processFormAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/sortingAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/sortingConfiguration.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/parts/updateAction.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/actions (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/actions/actions.class.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/config (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/config/generator.yml (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/lib (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/lib/configuration.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/lib/helper.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/templates (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/skeleton/templates/.sf (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/actions (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/actions/actions.class.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/lib (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/lib/helper.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_assets.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_filters.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_filters_field.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_flashes.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_form.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_form_actions.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_form_field.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_form_fieldset.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_form_footer.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_form_header.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_actions.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_field_boolean.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_footer.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_header.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_td_actions.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_td_stacked.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_td_tabular.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_th_stacked.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_list_th_tabular.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/_pagination.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/editSuccess.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/indexSuccess.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/admin/template/templates/newSuccess.php (added)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/createAction.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/deleteAction.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/editAction.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/indexAction.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/newAction.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/showAction.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/updateAction.php (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/skeleton/config/generator.yml (modified) (1 diff)
- plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/template/templates/_form.php (modified) (4 diffs)
- plugins/sfPropelPlugin/branches/new_admin/lib/generator/sfPropelGenerator.class.php (added)
- plugins/sfPropelPlugin/branches/new_admin/lib/task/sfPropelGenerateAdminTask.class.php (added)
- plugins/sfPropelPlugin/branches/new_admin/lib/task/sfPropelGenerateModuleTask.class.php (modified) (5 diffs)
- plugins/sfPropelPlugin/branches/new_admin/web (added)
- plugins/sfPropelPlugin/branches/new_admin/web/css (added)
- plugins/sfPropelPlugin/branches/new_admin/web/css/default.css (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/asc.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/default.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/delete.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/desc.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/edit.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/error.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/first.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/last.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/list.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/new.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/next.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/previous.png (added)
- plugins/sfPropelPlugin/branches/new_admin/web/images/tick.png (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/createAction.php
r11475 r12431 6 6 7 7 <?php endif; ?> 8 $this->form = new <?php echo $this->get FormClassName()?>();8 $this->form = new <?php echo $this->getModelClass().'Form' ?>(); 9 9 10 10 $this->processForm($request, $this->form); plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/deleteAction.php
r11795 r12431 4 4 $this->getRoute()->getObject()->delete(); 5 5 <?php else: ?> 6 $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo $this->getPeerClassName() ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>), sprintf('Object <?php echo $this->getSingularName() ?> does not exist (%s).', <?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>));6 $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo constant($this->getModelClass().'::PEER') ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43) ?>), sprintf('Object <?php echo $this->getSingularName() ?> does not exist (%s).', <?php echo $this->getRetrieveByPkParamsForAction(43) ?>)); 7 7 $<?php echo $this->getSingularName() ?>->delete(); 8 8 <?php endif; ?> plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/editAction.php
r11795 r12431 2 2 { 3 3 <?php if (isset($this->params['with_propel_route']) && $this->params['with_propel_route']): ?> 4 $this->form = new <?php echo $this->get FormClassName()?>($this->getRoute()->getObject());4 $this->form = new <?php echo $this->getModelClass().'Form' ?>($this->getRoute()->getObject()); 5 5 <?php else: ?> 6 $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo $this->getPeerClassName() ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>), sprintf('Object <?php echo $this->getSingularName() ?> does not exist (%s).', <?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>));7 $this->form = new <?php echo $this->get FormClassName()?>($<?php echo $this->getSingularName() ?>);6 $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo constant($this->getModelClass().'::PEER') ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43) ?>), sprintf('Object <?php echo $this->getSingularName() ?> does not exist (%s).', <?php echo $this->getRetrieveByPkParamsForAction(43) ?>)); 7 $this->form = new <?php echo $this->getModelClass().'Form' ?>($<?php echo $this->getSingularName() ?>); 8 8 <?php endif; ?> 9 9 } plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/indexAction.php
r11795 r12431 4 4 $this-><?php echo $this->getPluralName() ?> = $this->getRoute()->getObjects(); 5 5 <?php else: ?> 6 $this-><?php echo $this->getPluralName() ?> = <?php echo $this->getPeerClassName() ?>::doSelect(new Criteria());6 $this-><?php echo $this->getPluralName() ?> = <?php echo constant($this->getModelClass().'::PEER') ?>::doSelect(new Criteria()); 7 7 <?php endif; ?> 8 8 } plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/newAction.php
r11475 r12431 1 1 public function executeNew($request) 2 2 { 3 $this->form = new <?php echo $this->get FormClassName()?>();3 $this->form = new <?php echo $this->getModelClass().'Form' ?>(); 4 4 } plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/showAction.php
r11795 r12431 4 4 $this-><?php echo $this->getSingularName() ?> = $this->getRoute()->getObject(); 5 5 <?php else: ?> 6 $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getPeerClassName() ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49, '$request->getParameter') ?>);6 $this-><?php echo $this->getSingularName() ?> = <?php echo constant($this->getModelClass().'::PEER') ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>); 7 7 $this->forward404Unless($this-><?php echo $this->getSingularName() ?>); 8 8 <?php endif; ?> plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/parts/updateAction.php
r11795 r12431 2 2 { 3 3 <?php if (isset($this->params['with_propel_route']) && $this->params['with_propel_route']): ?> 4 $this->form = new <?php echo $this->get FormClassName()?>($this->getRoute()->getObject());4 $this->form = new <?php echo $this->getModelClass().'Form' ?>($this->getRoute()->getObject()); 5 5 <?php else: ?> 6 6 $this->forward404Unless($request->isMethod('post') || $request->isMethod('put')); 7 $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo $this->getPeerClassName() ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>), sprintf('Object <?php echo $this->getSingularName() ?> does not exist (%s).', <?php echo $this->getRetrieveByPkParamsForAction(43, '$request->getParameter') ?>));8 $this->form = new <?php echo $this->get FormClassName()?>($<?php echo $this->getSingularName() ?>);7 $this->forward404Unless($<?php echo $this->getSingularName() ?> = <?php echo constant($this->getModelClass().'::PEER') ?>::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43) ?>), sprintf('Object <?php echo $this->getSingularName() ?> does not exist (%s).', <?php echo $this->getRetrieveByPkParamsForAction(43) ?>)); 8 $this->form = new <?php echo $this->getModelClass().'Form' ?>($<?php echo $this->getSingularName() ?>); 9 9 <?php endif; ?> 10 10 plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/skeleton/config/generator.yml
r6884 r12431 1 1 generator: 2 class: sfPropelCrudGenerator2 class: sfPropelGenerator 3 3 param: 4 model_class: ##MODEL_CLASS##5 theme: default6 7 4 ##CONFIG## plugins/sfPropelPlugin/branches/new_admin/data/generator/sfPropelCrud/default/template/templates/_form.php
r12240 r12431 1 [?php include_stylesheets_for_form($form) ?] 2 [?php include_javascripts_for_form($form) ?] 3 1 4 <?php $form = $this->getFormObject() ?> 2 5 <?php if (isset($this->params['route_prefix']) && $this->params['route_prefix']): ?> … … 12 15 <tr> 13 16 <td colspan="2"> 17 [?php echo $form->renderHiddenFields() ?] 14 18 <?php if (isset($this->params['route_prefix']) && $this->params['route_prefix']): ?> 15 19 <a href="[?php echo url_for('<?php echo $this->getUrlForAction('list') ?>') ?]">Cancel</a> … … 33 37 <?php else: ?> 34 38 [?php echo $form->renderGlobalErrors() ?] 35 <?php foreach ($form->getWidgetSchema()->getPositions() as $i => $name): ?> 36 <?php if ($form[$name]->isHidden()) continue ?> 39 <?php foreach ($form as $name => $field): if ($field->isHidden()) continue ?> 37 40 <tr> 38 41 <th>[?php echo $form['<?php echo $name ?>']->renderLabel() ?]</th> … … 40 43 [?php echo $form['<?php echo $name ?>']->renderError() ?] 41 44 [?php echo $form['<?php echo $name ?>'] ?] 42 <?php $i == $this->getLastNonHiddenField() and print $this->getHiddenFieldsAsString() ?>43 45 </td> 44 46 </tr> plugins/sfPropelPlugin/branches/new_admin/lib/task/sfPropelGenerateModuleTask.class.php
r12267 r12431 81 81 82 82 $this->constants = array( 83 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', 84 'APP_NAME' => $arguments['application'], 85 'MODULE_NAME' => $arguments['module'], 86 'MODEL_CLASS' => $arguments['model'], 87 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', 83 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', 84 'APP_NAME' => $arguments['application'], 85 'MODULE_NAME' => $arguments['module'], 86 'UC_MODULE_NAME' => ucfirst($arguments['module']), 87 'MODEL_CLASS' => $arguments['model'], 88 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', 88 89 ); 89 90 90 91 $method = $options['generate-in-cache'] ? 'executeInit' : 'executeGenerate'; 91 92 … … 98 99 $tmpDir = sfConfig::get('sf_cache_dir').DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.md5(uniqid(rand(), true)); 99 100 $generatorManager = new sfGeneratorManager($this->configuration, $tmpDir); 100 $generatorManager->generate('sfPropel CrudGenerator', array(101 $generatorManager->generate('sfPropelGenerator', array( 101 102 'model_class' => $arguments['model'], 102 103 'moduleName' => $arguments['module'], … … 145 146 $finder = sfFinder::type('any')->discard('.sf'); 146 147 $dirs = $this->configuration->getGeneratorSkeletonDirs('sfPropelCrud', $options['theme']); 148 147 149 foreach ($dirs as $dir) 148 150 { … … 154 156 } 155 157 158 // move configuration file 159 if (file_exists($config = $moduleDir.'/lib/configuration.php')) 160 { 161 if (file_exists($target = $moduleDir.'/lib/'.$arguments['module'].'GeneratorConfiguration.class.php')) 162 { 163 $this->getFilesystem()->remove($config); 164 } 165 else 166 { 167 $this->getFilesystem()->rename($config, $target); 168 } 169 } 170 171 // move helper file 172 if (file_exists($config = $moduleDir.'/lib/helper.php')) 173 { 174 if (file_exists($target = $moduleDir.'/lib/'.$arguments['module'].'GeneratorHelper.class.php')) 175 { 176 $this->getFilesystem()->remove($config); 177 } 178 else 179 { 180 $this->getFilesystem()->rename($config, $target); 181 } 182 } 183 156 184 // create basic test 157 185 $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').DIRECTORY_SEPARATOR.'task'.DIRECTORY_SEPARATOR.'generator'.DIRECTORY_SEPARATOR.'skeleton'.DIRECTORY_SEPARATOR.'module'.DIRECTORY_SEPARATOR.'test'.DIRECTORY_SEPARATOR.'actionsTest.php', sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'functional'.DIRECTORY_SEPARATOR.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php'); … … 162 190 // customize php and yml files 163 191 $finder = sfFinder::type('file')->name('*.php', '*.yml'); 164 $this->constants['CONFIG'] = sprintf(" non_verbose_templates: %s\n with_show: %s\n singular: %s\n plural: %s\n route_prefix: %s\n with_propel_route: %s", 192 $this->constants['CONFIG'] = sprintf(<<<EOF 193 model_class: %s 194 theme: %s 195 non_verbose_templates: %s 196 with_show: %s 197 singular: %s 198 plural: %s 199 route_prefix: %s 200 with_propel_route: %s 201 EOF 202 , 203 $arguments['model'], 204 $options['theme'], 165 205 $options['non-verbose-templates'] ? 'true' : 'false', 166 206 $options['with-show'] ? 'true' : 'false', 167 $options['singular'] ? $options['singular'] : ' null',168 $options['plural'] ? $options['plural'] : ' null',169 $options['route-prefix'] ? $options['route-prefix'] : ' null',207 $options['singular'] ? $options['singular'] : '~', 208 $options['plural'] ? $options['plural'] : '~', 209 $options['route-prefix'] ? $options['route-prefix'] : '~', 170 210 $options['with-propel-route'] ? $options['with-propel-route'] : 'false' 171 211 );