Changeset 1638
- Timestamp:
- 02/04/07 17:23:30 (2 years ago)
- Location:
- branches/0.11
- Files:
-
- 4 modified
-
samples/app/modules/Default/actions/MenuAction.class.php (modified) (1 diff)
-
src/action/AgaviAction.class.php (modified) (1 diff)
-
src/controller/AgaviExecutionContainer.class.php (modified) (3 diffs)
-
src/filter/AgaviExecutionFilter.class.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/samples/app/modules/Default/actions/MenuAction.class.php
r1635 r1638 71 71 return 'Success'; 72 72 } 73 74 public function isSimple() 75 { 76 return true; 77 } 73 78 } 74 79 -
branches/0.11/src/action/AgaviAction.class.php
r1607 r1638 130 130 131 131 /** 132 * Whether or not this action is "simple", i.e. doesn't use validation etc. 133 * 134 * @return bool true, if this action should act in simple mode, or false. 135 * 136 * @author David Zuelke <dz@bitxtender.com> 137 * @since 0.11.0 138 */ 139 public function isSimple() 140 { 141 return false; 142 } 143 144 /** 132 145 * Manually register validators for this action. 133 146 * -
branches/0.11/src/controller/AgaviExecutionContainer.class.php
r1635 r1638 187 187 $request = $this->context->getRequest(); 188 188 189 $this->requestData = clone $request->getRequestData();190 191 if($this->arguments !== null) {192 $this->requestData->merge($this->arguments);193 }194 195 189 $controller->countExecution(); 196 190 … … 280 274 $this->actionInstance->initialize($this); 281 275 282 // create a new filter chain 283 $fcfi = $this->context->getFactoryInfo('filter_chain'); 284 $filterChain = new $fcfi['class'](); 285 $filterChain->initialize($this->context, $fcfi['parameters']); 286 287 if(AgaviConfig::get('core.available', false)) { 288 // the application is available so we'll register 289 // global and module filters, otherwise skip them 290 291 // does this action require security? 292 if(AgaviConfig::get('core.use_security', false) && $this->actionInstance->isSecure()) { 293 // register security filter 294 $filterChain->register($controller->getFilter('security')); 276 if($this->actionInstance->isSimple()) { 277 if($this->arguments !== null) { 278 $this->requestData = $this->arguments; 279 } else { 280 $this->requestData = new AgaviRequestDataHolder(); 295 281 } 296 297 // load filters 298 $controller->loadFilters($filterChain, 'action'); 299 $controller->loadFilters($filterChain, 'action', $moduleName); 282 var_dump('foo'); 283 // run the execution filter, without a proper chain 284 $controller->getFilter('execution')->execute(new AgaviFilterChain(), $this); 285 } else { 286 $this->requestData = clone $request->getRequestData(); 287 288 if($this->arguments !== null) { 289 $this->requestData->merge($this->arguments); 290 } 291 292 // create a new filter chain 293 $fcfi = $this->context->getFactoryInfo('filter_chain'); 294 $filterChain = new $fcfi['class'](); 295 $filterChain->initialize($this->context, $fcfi['parameters']); 296 297 if(AgaviConfig::get('core.available', false)) { 298 // the application is available so we'll register 299 // global and module filters, otherwise skip them 300 301 // does this action require security? 302 if(AgaviConfig::get('core.use_security', false) && $this->actionInstance->isSecure()) { 303 // register security filter 304 $filterChain->register($controller->getFilter('security')); 305 } 306 307 // load filters 308 $controller->loadFilters($filterChain, 'action'); 309 $controller->loadFilters($filterChain, 'action', $moduleName); 310 } 311 312 // register the execution filter 313 $filterChain->register($controller->getFilter('execution')); 314 315 // process the filter chain 316 $filterChain->execute($this); 300 317 } 301 302 // register the execution filter303 $filterChain->register($controller->getFilter('execution'));304 305 // process the filter chain306 $filterChain->execute($this);307 318 308 319 // restore autoloads … … 327 338 } 328 339 329 // TODO. this will be pretty difficult, I guess...330 340 $this->setNext($controller->createExecutionContainer($moduleName, $actionName)); 331 341 } -
branches/0.11/src/filter/AgaviExecutionFilter.class.php
r1635 r1638 206 206 public function execute(AgaviFilterChain $filterChain, AgaviExecutionContainer $container) 207 207 { 208 $lm = $this->context->getLoggerManager(); 208 // $lm = $this->context->getLoggerManager(); 209 209 210 // get the context, controller and validator manager 210 211 $controller = $this->context->getController(); … … 472 473 // get the (already formatted) request method 473 474 $method = $request->getMethod(); 475 476 $requestData = $container->getRequestData(); 474 477 475 478 $useGenericMethods = false; … … 480 483 } 481 484 482 if($ useGenericMethods && !method_exists($actionInstance, $executeMethod)) {485 if($actionInstance->isSimple() || ($useGenericMethods && !method_exists($actionInstance, $executeMethod))) { 483 486 // this action will skip validation/execution for this method 484 487 // get the default view … … 487 490 // set default validated status 488 491 $validated = true; 489 492 490 493 // get the current action validation configuration 491 494 $validationConfig = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/validate/' . $actionName . '.xml'; … … 505 508 506 509 // process validators 507 $validated = $validationManager->execute($ container->getRequestData());508 510 $validated = $validationManager->execute($requestData); 511 509 512 $validateMethod = 'validate' . $method; 510 513 if(!method_exists($actionInstance, $validateMethod)) { 511 514 $validateMethod = 'validate'; 512 515 } 513 516 514 517 // prevent access to Request::getParameters() 515 518 // process manual validation 516 if($actionInstance->$validateMethod($ container->getRequestData()) && $validated) {519 if($actionInstance->$validateMethod($requestData) && $validated) { 517 520 // execute the action 518 521 $key = $request->toggleLock(); 519 $viewName = $actionInstance->$executeMethod($ container->getRequestData());522 $viewName = $actionInstance->$executeMethod($requestData); 520 523 $request->toggleLock($key); 521 524 } else { … … 526 529 } 527 530 $key = $request->toggleLock(); 528 $viewName = $actionInstance->$handleErrorMethod($ container->getRequestData());531 $viewName = $actionInstance->$handleErrorMethod($requestData); 529 532 $request->toggleLock($key); 530 533 }

