From 9b334afcd805d57834ca6504873f5efbb02d47fd Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 1 Dec 2005 16:33:16 +0000 Subject: --- demos/controls/protected/pages/LoginPage.tpl | 8 +++-- framework/TApplication.php | 52 ++++++++++++++++++---------- framework/Web/Services/TPageService.php | 27 ++++++++++----- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/demos/controls/protected/pages/LoginPage.tpl b/demos/controls/protected/pages/LoginPage.tpl index 5f2c9b2b..04edae1c 100644 --- a/demos/controls/protected/pages/LoginPage.tpl +++ b/demos/controls/protected/pages/LoginPage.tpl @@ -1,7 +1,9 @@ - -Username:
-Password:
+ + +
+ +
diff --git a/framework/TApplication.php b/framework/TApplication.php index f4d8c124..bd8e8e39 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -220,7 +220,6 @@ class TApplication extends TComponent $this->_cacheFile=$cacheFile; // generates unique ID by hashing the configuration file path $this->_uniqueID=md5($this->_configFile); - $this->_errorHandler=new TErrorHandler; } /** @@ -363,6 +362,11 @@ class TApplication extends TComponent */ public function getRequest() { + if(!$this->_request) + { + $this->_request=new THttpRequest; + $this->_request->init($this,null); + } return $this->_request; } @@ -379,6 +383,11 @@ class TApplication extends TComponent */ public function getResponse() { + if(!$this->_response) + { + $this->_response=new THttpResponse; + $this->_response->init($this,null); + } return $this->_response; } @@ -391,35 +400,45 @@ class TApplication extends TComponent } /** - * @return TErrorHandler the error hanlder module + * @return THttpSession the session module, null if session module is not installed */ - public function getErrorHandler() + public function getSession() { - return $this->_errorHandler; + if(!$this->_session) + { + $this->_session=new THttpSession; + $this->_session->init($this,null); + } + return $this->_session; } /** - * @param TErrorHandler the error hanlder module + * @param THttpSession the session module */ - public function setErrorHandler(TErrorHandler $handler) + public function setSession(THttpSession $session) { - $this->_errorHandler=$handler; + $this->_session=$session; } /** - * @return THttpSession the session module, null if session module is not installed + * @return TErrorHandler the error hanlder module */ - public function getSession() + public function getErrorHandler() { - return $this->_session; + if(!$this->_errorHandler) + { + $this->_errorHandler=new TErrorHandler; + $this->_errorHandler->init($this,null); + } + return $this->_errorHandler; } /** - * @param THttpSession the session module + * @param TErrorHandler the error hanlder module */ - public function setSession(THttpSession $session) + public function setErrorHandler(TErrorHandler $handler) { - $this->_session=$session; + $this->_errorHandler=$handler; } /** @@ -559,7 +578,7 @@ class TApplication extends TComponent if($this->hasEventHandler('Error')) $this->raiseEvent('Error',$this,$param); else - $this->_errorHandler->handleError($this,$param); + $this->getErrorHandler()->handleError($this,$param); } /** @@ -724,10 +743,7 @@ class TApplicationConfiguration extends TComponent /** * @var array list of module configurations */ - private $_modules=array( - 'request'=>array('THttpRequest',array(),null), - 'response'=>array('THttpResponse',array(),null) - ); + private $_modules=array(); /** * @var array list of service configurations */ diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index 520c4187..6ef07d03 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -116,15 +116,15 @@ class TPageService extends TComponent implements IService /** * @var TAssetManager asset manager */ - private $_assetManager; + private $_assetManager=null; /** * @var TThemeManager theme manager */ - private $_themeManager; + private $_themeManager=null; /** * @var TTemplateManager template manager */ - private $_templateManager; + private $_templateManager=null; /** * Initializes the service. @@ -253,6 +253,11 @@ class TPageService extends TComponent implements IService */ public function getTemplateManager() { + if(!$this->_templateManager) + { + $this->_templateManager=new TTemplateManager; + $this->_templateManager->init($this->_application,null); + } return $this->_templateManager; } @@ -269,6 +274,11 @@ class TPageService extends TComponent implements IService */ public function getAssetManager() { + if(!$this->_assetManager) + { + $this->_assetManager=new TAssetManager; + $this->_assetManager->init($this->_application,null); + } return $this->_assetManager; } @@ -285,6 +295,11 @@ class TPageService extends TComponent implements IService */ public function getThemeManager() { + if(!$this->_themeManager) + { + $this->_themeManager=new TThemeManager; + $this->_themeManager->init($this->_application,null); + } return $this->_themeManager; } @@ -430,11 +445,7 @@ class TPageConfiguration extends TComponent /** * @var array list of module configurations */ - private $_modules=array( - 'template'=>array('TTemplateManager',array(),null), - 'asset'=>array('TAssetManager',array(),null), - 'theme'=>array('TThemeManager',array(),null) - ); + private $_modules=array(); /** * @var array list of parameters */ -- cgit v1.2.3