From c53ef254ccc2959f5f6d9bf6fff26071fc57368e Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Mon, 5 Dec 2011 16:30:49 +0000 Subject: reverted r2801, r2803, r2829's madness. --- framework/Web/Services/TPageService.php | 185 +------------------------------- 1 file changed, 5 insertions(+), 180 deletions(-) (limited to 'framework/Web/Services') diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index a9b74724..d9467864 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -68,18 +68,13 @@ Prado::using('System.Web.UI.TThemeManager'); * The first matching rule will be used. The last rule always allows all users * accessing to any resources. * - * The TPageService replicates the {@link TPage} events through {@link IPageEvents}. - * When the TPage is run, the TPageService events attach to all the corresponding TPage - * events. This allows modules to handle page events. - * * @author Qiang Xue * @author Carl G. Mathisen - * @author Brad Anderson * @version $Id$ * @package System.Web.Services * @since 3.0 */ -class TPageService extends TService implements IPageEvents +class TPageService extends TService { /** * Configuration file name @@ -146,11 +141,7 @@ class TPageService extends TService implements IPageEvents * @var TTemplateManager template manager */ private $_templateManager=null; - /** - * @var boolean if the onPageNotFound event is specifically blocked - */ - private $_blockOnPageNotFound = false; - + /** * Initializes the service. * This method is required by IService interface and is invoked by application. @@ -397,29 +388,6 @@ class TPageService extends TService implements IPageEvents { return $this->constructUrl($this->getDefaultPage()); } - - /** - * This event is triggered when a 404 in the normal page tree hierarchy is generated - * @param mixed $sender - * @param mixed $param - */ - public function onPageNotFound($sender, $param) { - } - - /** - * @return boolean whether the onPageNotFound event is blocked - */ - public function getBlockOnPageNotFoundEvent() { return $this->_blockOnPageNotFound; } - - /** - * For security reasons, you may want to turn off the onPageNotFound event. For instance, - * if your website has a "maintenence mode" where the website is offline and want to ensure - * that modules cannot use this event and provide content when they shouldn't be. - * @param boolean whether the onPageNotFound event is blocked - */ - public function setBlockOnPageNotFoundEvent($v) { - $this->_blockOnPageNotFound = TPropertyValue::ensureBoolean($v); - } /** * @return string the root directory for storing pages. Defaults to the 'pages' directory under the application base path. @@ -505,25 +473,18 @@ class TPageService extends TService implements IPageEvents /** * Creates a page instance based on requested page path. * @param string requested page path - * @param (boolean|null) can specify if this is allowed to call onPageNotFound if no page is found; defaults to true. * @return TPage the requested page instance * @throws THttpException if requested page path is invalid * @throws TConfigurationException if the page class cannot be found */ - protected function createPage($pagePath, $doOnPageNotFound = true) + protected function createPage($pagePath) { $path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.',DIRECTORY_SEPARATOR); $hasTemplateFile=is_file($path.self::PAGE_FILE_EXT); $hasClassFile=is_file($path.Prado::CLASS_FILE_EXT); - if(!$hasTemplateFile && !$hasClassFile) { - $param = new TPageNotFoundEventParameter($pagePath); - if(!$this->BlockOnPageNotFoundEvent && $doOnPageNotFound) - $this->raiseEvent('onPageNotFound', $this, $param); - if(!$param->FoundPage) - throw new THttpException(404,'pageservice_page_unknown',$pagePath); - return $param->FoundPage; - } + if(!$hasTemplateFile && !$hasClassFile) + throw new THttpException(404,'pageservice_page_unknown',$pagePath); if($hasClassFile) { @@ -560,19 +521,6 @@ class TPageService extends TService implements IPageEvents { foreach($properties as $name=>$value) $page->setSubProperty($name,$value); - - $page->OnDataBinding[] = array($this, 'OnDataBinding'); - $page->OnPreInit[] = array($this, 'OnPreInit'); - $page->OnInit[] = array($this, 'OnInit'); - $page->OnInitComplete[] = array($this, 'OnInitComplete'); - $page->OnPreLoad[] = array($this, 'OnPreLoad'); - $page->OnLoad[] = array($this, 'OnLoad'); - $page->OnLoadComplete[] = array($this, 'OnLoadComplete'); - $page->OnPreRender[] = array($this, 'OnPreRender'); - $page->OnPreRenderComplete[] = array($this, 'OnPreRenderComplete'); - $page->OnSaveStateComplete[] = array($this, 'OnSaveStateComplete'); - $page->OnUnload[] = array($this, 'OnUnload'); - $page->run($this->getResponse()->createHtmlWriter()); } @@ -588,129 +536,6 @@ class TPageService extends TService implements IPageEvents { return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems); } - - - /** - * Raises 'OnDataBinding' event. (inherited from TControl) - */ - public function onDataBinding($param) { - Prado::trace("onDataBinding",'System.Web.Services.TPageService'); - $this->raiseEvent('OnDataBinding',$this,$param); - } - /** - * This method is invoked when the control enters 'OnInit' stage. (inherited from TControl) - */ - public function onInit($param) { - Prado::trace("onInit",'System.Web.Services.TPageService'); - $this->raiseEvent('OnInit',$this,$param); - } - /** - * Raises OnInitComplete event. - */ - public function onInitComplete($param) { - Prado::trace("onInitComplete",'System.Web.Services.TPageService'); - $this->raiseEvent('OnInitComplete',$this,$param); - } - /** - * This method is invoked when the control enters 'OnLoad' stage. (inherited from TControl) - */ - public function onLoad($param) { - Prado::trace("OnLoad",'System.Web.Services.TPageService'); - $this->raiseEvent('OnLoad',$this,$param); - } - /** - * Raises OnLoadComplete event. - */ - public function onLoadComplete($param) { - Prado::trace("OnLoadComplete",'System.Web.Services.TPageService'); - $this->raiseEvent('OnLoadComplete',$this,$param); - } - /** - * Raises OnPreInit event. - */ - public function onPreInit($param) { - Prado::trace("OnPreInit",'System.Web.Services.TPageService'); - $this->raiseEvent('OnPreInit',$this,$param); - } - /** - * Raises OnPreLoad event. - */ - public function onPreLoad($param) { - Prado::trace("OnPreLoad",'System.Web.Services.TPageService'); - $this->raiseEvent('OnPreLoad',$this,$param); - } - /** - * This method is invoked when the control enters 'OnPreRender' stage. (inherited from TControl) - */ - public function onPreRender($param) { - Prado::trace("OnPreRender",'System.Web.Services.TPageService'); - $this->raiseEvent('OnPreRender',$this,$param); - } - /** - * Raises OnPreRenderComplete event. - */ - public function onPreRenderComplete($param) { - Prado::trace("OnPreRenderComplete",'System.Web.Services.TPageService'); - $this->raiseEvent('OnPreRenderComplete',$this,$param); - } - /** - * Raises OnSaveStateComplete event. - */ - public function onSaveStateComplete($param) { - Prado::trace("OnSaveStateComplete",'System.Web.Services.TPageService'); - $this->raiseEvent('OnSaveStateComplete',$this,$param); - } - /** - * This method is invoked when the control enters 'OnUnload' stage. (inherited from TControl) - */ - public function onUnload($param) { - Prado::trace("OnUnload",'System.Web.Services.TPageService'); - $this->raiseEvent('OnUnload',$this,$param); - } -} - - - -/** - * TPageNotFoundEventParameter class. - * TPageNotFoundEventParameter is the parameter sent when no page is found and the code is allowed to call the onPageNotFound. - * - * @author Brad Anderson - * @version $Id$ - * @package System.Web.Services - * @since 3.2a - */ -class TPageNotFoundEventParameter extends TEventParameter { - - private $_foundpage; - private $_path; - - /** - * Holds the parameters for the Class Behavior Events - * @param string $class this is the class to get the behavior - * @param string $name the name of the behavior - * @param object $behavior this is the behavior to implement the class behavior - */ - public function __construct($path) { - $this->_path = $path; - } - - /** - * This is the path of the page to be found - * @return string the page path to find - */ - public function getPath() { return $this->_path; } - - /** - * the found TPage, if found - * @return string the name to get the behavior - */ - public function getFoundPage() { return $this->_foundpage; } - - /** - * This sets the found page - */ - public function setFoundPage($value) { $this->_foundpage = $value; } } -- cgit v1.2.3