diff options
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/WebControls/TFlushOutput.php | 2 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TOutputCache.php | 34 |
2 files changed, 31 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TFlushOutput.php b/framework/Web/UI/WebControls/TFlushOutput.php index ab79fe0b..cc55646d 100644 --- a/framework/Web/UI/WebControls/TFlushOutput.php +++ b/framework/Web/UI/WebControls/TFlushOutput.php @@ -72,7 +72,7 @@ class TFlushOutput extends TControl */
public function render($writer)
{
-$writer->write('<!-- flush -->');
+//$writer->write('<!-- flush -->');
// ajax responses can't be parsed by the client side before loaded and returned completely,
// so don't bother with flushing output somewhere mid-page if refreshing in a callback
if (!$this->Page->IsCallback)
diff --git a/framework/Web/UI/WebControls/TOutputCache.php b/framework/Web/UI/WebControls/TOutputCache.php index c9764454..37a1fd70 100644 --- a/framework/Web/UI/WebControls/TOutputCache.php +++ b/framework/Web/UI/WebControls/TOutputCache.php @@ -262,7 +262,7 @@ class TOutputCache extends TControl implements INamingContainer $this->_actions[]=array($context,$funcName,$funcParams);
}
- private function getCacheKey()
+ public function getCacheKey()
{
if($this->_cacheKey===null)
$this->_cacheKey=$this->calculateCacheKey();
@@ -478,17 +478,18 @@ class TOutputCache extends TControl implements INamingContainer $writer->write($this->_contents);
else if($this->_cacheAvailable)
{
- $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
+ $textwriter = new TTextWriter();
+ $multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(),$textwriter));
+ $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter);
$stack=$this->getPage()->getCachingStack();
$stack->push($this);
parent::render($htmlWriter);
$stack->pop();
- $content=$htmlWriter->flush();
+ $content=$textwriter->flush();
$data=array($content,$this->_state,$this->_actions,time());
$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
- $writer->write($content);
}
else
parent::render($writer);
@@ -582,3 +583,28 @@ class TOutputCacheCalculateKeyEventParameter extends TEventParameter }
}
+
+class TOutputCacheTextWriterMulti extends TTextWriter
+{
+ protected $_writers;
+
+ public function __construct(Array $writers)
+ {
+ //parent::__construct();
+ $this->_writers = $writers;
+ }
+
+ public function write($s)
+ {
+ foreach($this->_writers as $writer)
+ $writer->write($s);
+ }
+
+ public function flush()
+ {
+ foreach($this->_writers as $writer)
+ $s = $writer->flush();
+ return $s;
+ }
+}
+
|