From 15da6f4ef7a1bdfe03a59d9f17cda7d241fdb0b6 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 13 Jun 2006 12:01:19 +0000 Subject: Added TPageService.BasePageClass property --- HISTORY | 1 + framework/Web/Services/TPageService.php | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 7fff00fb..ce142543 100644 --- a/HISTORY +++ b/HISTORY @@ -6,6 +6,7 @@ BUG: Ticket#213 - PRADO Requirements Checker charset error (Qiang) CHG: ensureChildControls() is now invoked in TControl::initRecursive (Qiang) CHG: Postback enabled control will always disable default client-side browser action. (Qiang) ENH: TRepeater, TDataList and TDataGrid will store data indices in DataKeys if DataKeyField is not set. (Qiang) +ENH: Added TPageService.BasePageClass property (Qiang) Version 3.0.1 June 4, 2006 ========================== diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index 1df4ffde..5172f59c 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -95,6 +95,10 @@ class TPageService extends TService * @var string root path of pages */ private $_basePath=null; + /** + * @var string base path class in namespace format + */ + private $_basePageClass='TPage'; /** * @var string default page */ @@ -397,6 +401,25 @@ class TPageService extends TService $this->_basePath=realpath($path); } + /** + * Sets the base page class name (in namespace format). + * If a page only has a template file without page class file, + * this base page class will be instantiated. + * @param string class name + */ + public function setBasePageClass($value) + { + $this->_basePageClass=$value; + } + + /** + * @return string base page class name in namespace format. Defaults to 'TPage'. + */ + public function getBasePageClass() + { + return $this->_basePageClass; + } + /** * Runs the service. * This will create the requested page, initializes it with the property values @@ -417,9 +440,9 @@ class TPageService extends TService throw new TConfigurationException('pageservice_pageclass_unknown',$className); } else - $className='TPage'; + $className=$this->getBasePageClass(); - $this->_page=new $className(); + $this->_page=Prado::createComponent($className); $this->_page->setPagePath($this->getRequestedPagePath()); // initialize page properties with those set in configurations -- cgit v1.2.3