summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/controls/protected/pages/LoginPage.tpl8
-rw-r--r--framework/TApplication.php52
-rw-r--r--framework/Web/Services/TPageService.php27
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 @@
<com:TForm>
-<com:TPanel GroupingText="Login" Width="300px">
-Username: <com:TTextBox ID="username" /><br/>
-Password: <com:TTextBox ID="password" TextMode="Password" /><br/>
+<com:TPanel GroupingText="Login" Width="270px" HorizontalAlign="center">
+<com:TLabel Text="Username" AssociatedControlID="username"/>
+<com:TTextBox ID="username" /><br/>
+<com:TLabel Text="Password" AssociatedControlID="password"/>
+<com:TTextBox ID="password" TextMode="Password" /><br/>
<com:TButton Text="Login" Click="login" />
<com:TLabel ID="error" />
</com:TPanel>
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
*/