Changeset 5025
- Timestamp:
- 09/09/07 22:29:32 (6 years ago)
- Files:
-
- trunk/lib/action/sfAction.class.php (modified) (4 diffs)
- trunk/lib/config/sfViewConfigHandler.class.php (modified) (1 diff)
- trunk/lib/view/sfPHPView.class.php (modified) (4 diffs)
- trunk/lib/view/sfView.class.php (modified) (1 diff)
- trunk/lib/view/sfViewCacheManager.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/action/sfAction.class.php
r4957 r5025 406 406 } 407 407 408 $this->getResponse()->setParameter($this->getModuleName().'_'.$this->getActionName().'_template', $name, 'symfony/action/view');408 sfConfig::set($this->getModuleName().'_'.$this->getActionName().'_template', $name); 409 409 } 410 410 … … 421 421 public function getTemplate() 422 422 { 423 return $this->getResponse()->getParameter($this->getModuleName().'_'.$this->getActionName().'_template', null, 'symfony/action/view');423 return sfConfig::get($this->getModuleName().'_'.$this->getActionName().'_template'); 424 424 } 425 425 … … 440 440 } 441 441 442 $this->getResponse()->setParameter($this->getModuleName().'_'.$this->getActionName().'_layout', $name, 'symfony/action/view');442 sfConfig::set($this->getModuleName().'_'.$this->getActionName().'_layout', $name); 443 443 } 444 444 … … 453 453 public function getLayout() 454 454 { 455 return $this->getResponse()->getParameter($this->getModuleName().'_'.$this->getActionName().'_layout', null, 'symfony/action/view');455 return sfConfig::get($this->getModuleName().'_'.$this->getActionName().'_layout'); 456 456 } 457 457 trunk/lib/config/sfViewConfigHandler.class.php
r4951 r5025 175 175 $defaultTemplateName = $templateName ? "'$templateName'" : '$this->actionName'; 176 176 177 $data .= " \$templateName = \$response->getParameter(\$this->moduleName.'_'.\$this->actionName.'_template', $defaultTemplateName, 'symfony/action/view');\n";177 $data .= " \$templateName = sfConfig::get(\$this->moduleName.'_'.\$this->actionName.'_template', $defaultTemplateName);\n"; 178 178 $data .= " \$this->setTemplate(\$templateName.\$this->viewName.\$this->getExtension());\n"; 179 179 trunk/lib/view/sfPHPView.class.php
r4951 r5025 100 100 101 101 // decorator configuration 102 $this-> updateDecoratorConfiguration();102 $this->setDecoratorTemplate(sfConfig::get($this->moduleName.'_'.$this->actionName.'_layout')); 103 103 104 104 // set template directory … … 144 144 $uri = $this->context->getRouting()->getCurrentInternalUri(); 145 145 146 list($content, $attributeHolder ) = $viewCache->getActionCache($uri);146 list($content, $attributeHolder, $decoratorTemplate) = $viewCache->getActionCache($uri); 147 147 if (!is_null($content)) 148 148 { 149 149 $this->attributeHolder = $attributeHolder; 150 $this->setDecoratorTemplate($decoratorTemplate); 150 151 } 151 152 // FIXME: needed because the response in cache can change the layout153 $this->updateDecoratorConfiguration();154 152 } 155 153 … … 165 163 if (sfConfig::get('sf_cache')) 166 164 { 167 $content = $viewCache->setActionCache($uri, $content, $this->attributeHolder );165 $content = $viewCache->setActionCache($uri, $content, $this->attributeHolder, $this->isDecorator() ? $this->getDecoratorDirectory().'/'.$this->getDecoratorTemplate() : false); 168 166 } 169 167 } … … 177 175 return $content; 178 176 } 179 180 protected function updateDecoratorConfiguration()181 {182 // decorator configuration183 $layout = $this->context->getResponse()->getParameter($this->moduleName.'_'.$this->actionName.'_layout', null, 'symfony/action/view');184 if (false === $layout)185 {186 $this->setDecorator(false);187 }188 else if (!is_null($layout))189 {190 $this->setDecoratorTemplate($layout.$this->getExtension());191 }192 }193 177 } trunk/lib/view/sfView.class.php
r5018 r5025 360 360 public function setDecoratorTemplate($template) 361 361 { 362 if (false === $template) 363 { 364 $this->decorator = false; 365 366 return; 367 } 368 else if (is_null($template)) 369 { 370 return; 371 } 372 362 373 if (sfToolkit::isPathAbsolute($template)) 363 374 { trunk/lib/view/sfViewCacheManager.class.php
r5016 r5025 563 563 } 564 564 565 return array($content, $cache['attributeHolder'] );565 return array($content, $cache['attributeHolder'], $cache['decoratorTemplate']); 566 566 } 567 567 … … 575 575 * @return string The cached content 576 576 */ 577 public function setActionCache($uri, $content, $attributeHolder )577 public function setActionCache($uri, $content, $attributeHolder, $decoratorTemplate) 578 578 { 579 579 if (!$this->isCacheable($uri) || $this->withLayout($uri)) … … 582 582 } 583 583 584 $saved = $this->set(serialize(array('content' => $content, 'attributeHolder' => $attributeHolder, ' response' => $this->context->getResponse())), $uri);584 $saved = $this->set(serialize(array('content' => $content, 'attributeHolder' => $attributeHolder, 'decoratorTemplate' => $decoratorTemplate, 'response' => $this->context->getResponse())), $uri); 585 585 586 586 if ($saved && sfConfig::get('sf_web_debug'))