Changeset 2786
- Timestamp:
- 09/04/08 15:54:39 (4 months ago)
- Location:
- branches/1.0
- Files:
-
- 5 modified
-
CHANGELOG (modified) (1 diff)
-
RELEASE_NOTES (modified) (1 diff)
-
src/controller/AgaviController.class.php (modified) (2 diffs)
-
src/filter/AgaviExecutionFilter.class.php (modified) (3 diffs)
-
src/view/AgaviFileTemplateLayer.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/CHANGELOG
r2782 r2786 5 5 -------------------------------- 6 6 7 ADD: Allow customization of the way Actions, Views etc. are laid out in the filesystem (#668) (David) 7 8 ADD: AgaviXmlConfigDomElement::hasAgaviParameters() (#841) (David) 8 9 -
branches/1.0/RELEASE_NOTES
r2784 r2786 33 33 %core.app_dir%/modules/Default/actions/Foo_BarAction.class.php is class Default_Foo_BarAction 34 34 The legacy naming schemes (leaving out module name for Actions, Views and non-global Models; leaving out sub-notation paths except the last one) are not supported anymore. 35 36 Finally, you can now define the filesystem structure of the following elements on a per-module basis: 37 - Actions 38 - Caching XML configs 39 - Validation XML configs 40 - Views 41 You can also customize these aspects: 42 - Default template "directory" part 43 - View shortname resolution ("Success" => "Default_Sub_MarineSuccess") 44 This allows you to put all the files for a feature into a single subdirectory, instead of having the separate files cluttered over action/, template/, view/ etc. subfolders inside the module directory. 45 Ticket #668 has more details an an example. 35 46 36 47 Project development environment -
branches/1.0/src/controller/AgaviController.class.php
r2782 r2786 288 288 */ 289 289 public function checkActionFile($moduleName, $actionName) 290 { 290 { 291 $this->initializeModule($moduleName); 291 292 $actionName = AgaviToolkit::canonicalName($actionName); 292 $file = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/actions/' . $actionName . 'Action.class.php'; 293 $file = AgaviToolkit::expandVariables( 294 AgaviToolkit::expandDirectives( 295 AgaviConfig::get( 296 sprintf('modules.%s.agavi.action.path', strtolower($moduleName)), 297 '%core.module_dir%/${moduleName}/actions/${actionName}Action.class.php' 298 ) 299 ), 300 array( 301 'moduleName' => $moduleName, 302 'actionName' => $actionName, 303 ) 304 ); 293 305 if(is_readable($file) && substr($actionName, 0, 1) !== '/') { 294 306 return $file; … … 368 380 */ 369 381 public function checkViewFile($moduleName, $viewName) 370 { 382 { 383 $this->initializeModule($moduleName); 371 384 $viewName = AgaviToolkit::canonicalName($viewName); 372 $file = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/views/' . $viewName . 'View.class.php'; 385 $file = AgaviToolkit::expandVariables( 386 AgaviToolkit::expandDirectives( 387 AgaviConfig::get( 388 sprintf('modules.%s.agavi.view.path', strtolower($moduleName)), 389 '%core.module_dir%/${moduleName}/views/${viewName}View.class.php' 390 ) 391 ), 392 array( 393 'moduleName' => $moduleName, 394 'viewName' => $viewName, 395 ) 396 ); 373 397 if(is_readable($file) && substr($viewName, 0, 1) !== '/') { 374 398 return $file; -
branches/1.0/src/filter/AgaviExecutionFilter.class.php
r2612 r2786 269 269 270 270 $isCacheable = false; 271 if($this->getParameter('enable_caching', true) && is_readable($cachingDotXml = AgaviConfig::get('core.module_dir') . '/' . $moduleName . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $actionName . '.xml')) { 271 $cachingDotXml = AgaviToolkit::expandVariables( 272 AgaviToolkit::expandDirectives( 273 AgaviConfig::get( 274 sprintf('modules.%s.agavi.cache.path', strtolower($moduleName)), 275 '%core.module_dir%/${moduleName}/cache/${actionName}.xml' 276 ) 277 ), 278 array( 279 'moduleName' => $moduleName, 280 'actionName' => $actionName, 281 ) 282 ); 283 if($this->getParameter('enable_caching', true) && is_readable($cachingDotXml)) { 272 284 // $lm->log('Caching enabled, configuration file found, loading...'); 273 285 // no _once please! … … 639 651 640 652 // get the current action validation configuration 641 $validationConfig = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/validate/' . $actionName . '.xml'; 642 653 $validationConfig = AgaviToolkit::expandVariables( 654 AgaviToolkit::expandDirectives( 655 AgaviConfig::get( 656 sprintf('modules.%s.agavi.validate.path', strtolower($moduleName)), 657 '%core.module_dir%/${moduleName}/validate/${actionName}.xml' 658 ) 659 ), 660 array( 661 'moduleName' => $moduleName, 662 'actionName' => $actionName, 663 ) 664 ); 643 665 if(is_readable($validationConfig)) { 644 666 // load validation configuration … … 699 721 } elseif($viewName !== AgaviView::NONE) { 700 722 // use a view related to this action 701 $viewName = $actionName . $viewName; 723 $viewName = AgaviToolkit::expandVariables( 724 AgaviToolkit::expandDirectives( 725 AgaviConfig::get( 726 sprintf('modules.%s.agavi.view.name', strtolower($moduleName)), 727 '${actionName}${viewName}' 728 ) 729 ), 730 array( 731 'actionName' => $actionName, 732 'viewName' => $viewName, 733 ) 734 ); 702 735 $viewModule = $moduleName; 703 736 } else { -
branches/1.0/src/view/AgaviFileTemplateLayer.class.php
r2259 r2786 56 56 57 57 /** 58 * Initialize the layer. 59 * 60 * Will try and figure out an alternative default for "directory". 61 * 62 * @param AgaviContext The current Context instance. 63 * @param array An array of initialization parameters. 64 * 65 * @author David Zülke <david.zuelke@bitextender.com> 66 * @since 1.0.0 67 */ 68 public function initialize(AgaviContext $context, array $parameters = array()) 69 { 70 $this->setParameter( 71 'directory', 72 AgaviToolkit::expandDirectives( 73 AgaviConfig::get( 74 sprintf('modules.%s.agavi.template.directory', isset($parameters['module']) ? strtolower($parameters['module']) : ''), 75 '%core.module_dir%/${module}/templates' 76 ) 77 ) 78 ); 79 80 parent::initialize($context, $parameters); 81 } 82 83 /** 58 84 * Get the full, resolved stream location name to the template resource. 59 85 *

