Development

Changeset 10234

You must first sign up to be able to contribute.

Changeset 10234

Show
Ignore:
Timestamp:
07/12/08 02:47:20 (4 months ago)
Author:
dwhittle
Message:

dwhittle: merged changes to branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dwhittle/1.1/lib/helper/PartialHelper.php

    r9133 r10234  
    142142  $actionName = '_'.$componentName; 
    143143 
     144  $viewClass = sfConfig::get('mod_'.$moduleName.'_partial_view_class', 'sf').'PartialView'; 
     145  $view = new $viewClass($context, $moduleName, $actionName, ''); 
     146  $view->setPartialVars($vars); 
     147 
     148  if ($retval = $view->getCache()) 
     149  { 
     150    return $retval; 
     151  } 
     152 
    144153  $allVars = _call_component($moduleName, $componentName, $vars); 
    145154 
    146155  if (!is_null($allVars)) 
    147156  { 
    148     $viewClass = sfConfig::get('mod_'.$moduleName.'_partial_view_class', 'sf').'PartialView'; 
    149  
    150     // render 
    151     $view = new $viewClass($context, $moduleName, $actionName, ''); 
    152     $view->setPartialVars($vars); 
    153157    $view->getAttributeHolder()->add($allVars); 
    154158 
  • branches/dwhittle/1.1/lib/view/sfPartialView.class.php

    r9515 r10234  
    6767    } 
    6868 
    69     if (sfConfig::get('sf_cache')) 
     69    if ($retval = $this->getCache()) 
    7070    { 
    71       $viewCache = $this->context->getViewCacheManager(); 
    72       $viewCache->registerConfiguration($this->moduleName); 
    73  
    74       $cacheKey = $viewCache->computeCacheKey($this->partialVars); 
    75       if ($retval = $viewCache->getPartialCache($this->moduleName, $this->actionName, $cacheKey)) 
    76       { 
    77         return $retval; 
    78       } 
    79       else 
    80       { 
    81         $mainResponse = $this->context->getResponse(); 
    82         $responseClass = get_class($mainResponse); 
    83         $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 
    84       } 
     71      return $retval; 
     72    } 
     73    else if (sfConfig::get('sf_cache')) 
     74    { 
     75      $mainResponse = $this->context->getResponse(); 
     76      $responseClass = get_class($mainResponse); 
     77      $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 
    8578    } 
    8679 
     
    9588    if (sfConfig::get('sf_cache')) 
    9689    { 
    97       $retval = $viewCache->setPartialCache($this->moduleName, $this->actionName, $cacheKey, $retval); 
     90      $retval = $this->viewCache->setPartialCache($this->moduleName, $this->actionName, $this->cacheKey, $retval); 
    9891      $this->context->setResponse($mainResponse); 
    9992      $mainResponse->merge($response); 
     
    107100    return $retval; 
    108101  } 
     102 
     103  public function getCache() 
     104  { 
     105    if (!sfConfig::get('sf_cache')) 
     106    { 
     107      return null; 
     108    } 
     109 
     110    $this->viewCache = $this->context->getViewCacheManager(); 
     111    $this->viewCache->registerConfiguration($this->moduleName); 
     112 
     113    $this->cacheKey = $this->viewCache->computeCacheKey($this->partialVars); 
     114    if ($retval = $this->viewCache->getPartialCache($this->moduleName, $this->actionName, $this->cacheKey)) 
     115    { 
     116      return $retval; 
     117    } 
     118  } 
    109119} 
  • branches/dwhittle/1.2/lib/helper/PartialHelper.php

    r9128 r10234  
    137137  $actionName = '_'.$componentName; 
    138138 
     139  $view = new sfPartialView($context, $moduleName, $actionName, ''); 
     140  $view->setPartialVars($vars); 
     141 
     142  if ($retval = $view->getCache()) 
     143  { 
     144    return $retval; 
     145  } 
     146 
    139147  $allVars = _call_component($moduleName, $componentName, $vars); 
    140148 
     
    142150  { 
    143151    // render 
    144     $view = new sfPartialView($context, $moduleName, $actionName, ''); 
    145     $view->setPartialVars($vars); 
    146152    $view->getAttributeHolder()->add($allVars); 
    147153 
  • branches/dwhittle/1.2/lib/view/sfPartialView.class.php

    r9496 r10234  
    6767    } 
    6868 
    69     if (sfConfig::get('sf_cache')) 
     69    if ($retval = $this->getCache()) 
    7070    { 
    71       $viewCache = $this->context->getViewCacheManager(); 
    72       $viewCache->registerConfiguration($this->moduleName); 
    73  
    74       $cacheKey = $viewCache->computeCacheKey($this->partialVars); 
    75       if ($retval = $viewCache->getPartialCache($this->moduleName, $this->actionName, $cacheKey)) 
    76       { 
    77         return $retval; 
    78       } 
    79       else 
    80       { 
    81         $mainResponse = $this->context->getResponse(); 
    82         $responseClass = get_class($mainResponse); 
    83         $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 
    84       } 
     71      return $retval; 
     72    } 
     73    else if (sfConfig::get('sf_cache')) 
     74    { 
     75      $mainResponse = $this->context->getResponse(); 
     76      $responseClass = get_class($mainResponse); 
     77      $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 
    8578    } 
    8679 
     
    9588    if (sfConfig::get('sf_cache')) 
    9689    { 
    97       $retval = $viewCache->setPartialCache($this->moduleName, $this->actionName, $cacheKey, $retval); 
     90      $retval = $this->viewCache->setPartialCache($this->moduleName, $this->actionName, $this->cacheKey, $retval); 
    9891      $this->context->setResponse($mainResponse); 
    9992      $mainResponse->merge($response); 
     
    107100    return $retval; 
    108101  } 
     102 
     103  public function getCache() 
     104  { 
     105    if (!sfConfig::get('sf_cache')) 
     106    { 
     107      return null; 
     108    } 
     109 
     110    $this->viewCache = $this->context->getViewCacheManager(); 
     111    $this->viewCache->registerConfiguration($this->moduleName); 
     112 
     113    $this->cacheKey = $this->viewCache->computeCacheKey($this->partialVars); 
     114    if ($retval = $this->viewCache->getPartialCache($this->moduleName, $this->actionName, $this->cacheKey)) 
     115    { 
     116      return $retval; 
     117    } 
     118  } 
    109119}