From ccf0cd0f8d6480238db531f46ae1c70554d0e90d Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 8 Apr 2006 17:00:05 +0000 Subject: Added TOutputCache. --- framework/Web/UI/TPage.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'framework/Web/UI/TPage.php') diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index b68c4996..7f4c490c 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -141,6 +141,10 @@ class TPage extends TTemplateControl * @var mixed page state persister */ private $_statePersister=null; + /** + * @var TStack stack used to store currently active caching controls + */ + private $_cachingStack=null; /** * Constructor. @@ -599,9 +603,13 @@ class TPage extends TTemplateControl * if not checked, will not have a post value. * @param TControl control registered for loading post data */ - public function registerRequiresPostData(TControl $control) + public function registerRequiresPostData($control) { - $this->_controlsRegisteredForPostData[$control->getUniqueID()]=true; + $id=is_string($control)?$control:$control->getUniqueID(); + $this->_controlsRegisteredForPostData[$id]=true; + $params=func_get_args(); + foreach($this->getCachingStack() as $item) + $item->registerAction('registerRequiresPostData',$id); } /** @@ -747,8 +755,11 @@ class TPage extends TTemplateControl { if($this->_focus) { - if(($this->_focus instanceof TControl) && $this->_focus->getVisible(true) || is_string($this->_focus)) - $cs->registerFocusControl($this->_focus); + if(($this->_focus instanceof TControl) && $this->_focus->getVisible(true)) + $focus=$this->_focus->getClientID(); + else + $focus=$this->_focus; + $cs->registerFocusControl($focus); } else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) $cs->registerFocusControl($lastFocus); @@ -908,6 +919,13 @@ class TPage extends TTemplateControl { $this->_pagePath=$value; } + + public function getCachingStack() + { + if(!$this->_cachingStack) + $this->_cachingStack=new TStack; + return $this->_cachingStack; + } } /** -- cgit v1.2.3