summaryrefslogtreecommitdiff
path: root/framework/Web/Services/TPageService.php
diff options
context:
space:
mode:
authorxue <>2005-11-12 18:17:58 +0000
committerxue <>2005-11-12 18:17:58 +0000
commit8a4e5a9b04c479fa027acfba52f4d68cf3bd6679 (patch)
tree461c326e7a2a82a998e329e29b1b28c65d1be7db /framework/Web/Services/TPageService.php
parent63386d118321bbff8af2d8c480b89fe226400d53 (diff)
Added asset manager.
Diffstat (limited to 'framework/Web/Services/TPageService.php')
-rw-r--r--framework/Web/Services/TPageService.php80
1 files changed, 16 insertions, 64 deletions
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index e4791543..f6609725 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -38,7 +38,7 @@ class TPageService extends TComponent implements IService
/**
* @var string root path of pages
*/
- private $_pageRootPath;
+ private $_pageBasePath;
/**
* @var string default page
*/
@@ -52,14 +52,6 @@ class TPageService extends TComponent implements IService
*/
private $_pageType;
/**
- * @var string the base URL for accessing published assets
- */
- private $_assetBaseUrl;
- /**
- * @var string the root path for storing published asset files
- */
- private $_assetRootPath;
- /**
* @var array list of initial page property values
*/
private $_properties;
@@ -86,8 +78,8 @@ class TPageService extends TComponent implements IService
{
$this->_application=$application;
- if(($pageRootPath=Prado::getPathOfNamespace($this->_pageRootPath))===null || !is_dir($pageRootPath))
- throw new TConfigurationException('pageservice_pagerootpath_invalid',$this->_pageRootPath);
+ if(($pageBasePath=Prado::getPathOfNamespace($this->_pageBasePath))===null || !is_dir($pageBasePath))
+ throw new TConfigurationException('pageservice_pagebasepath_invalid',$this->_pageBasePath);
$this->_pagePath=$application->getRequest()->getServiceParameter();
if(empty($this->_pagePath))
@@ -99,7 +91,7 @@ class TPageService extends TComponent implements IService
{
$pageConfig=new TPageConfiguration;
$pageConfig->loadXmlElement($config,dirname($application->getConfigurationFile()),null);
- $pageConfig->loadConfigurationFiles($this->_pagePath,$pageRootPath);
+ $pageConfig->loadConfigurationFiles($this->_pagePath,$pageBasePath);
}
else
{
@@ -113,7 +105,7 @@ class TPageService extends TComponent implements IService
// check to see if cache is the latest
$paths=explode('.',$this->_pagePath);
array_pop($paths);
- $configPath=$pageRootPath;
+ $configPath=$pageBasePath;
foreach($paths as $path)
{
if(@filemtime($configPath.'/'.self::CONFIG_FILE)>$timestamp)
@@ -133,7 +125,7 @@ class TPageService extends TComponent implements IService
{
$pageConfig=new TPageConfiguration;
$pageConfig->loadXmlElement($config,dirname($application->getConfigurationFile()),null);
- $pageConfig->loadConfigurationFiles($this->_pagePath,$pageRootPath);
+ $pageConfig->loadConfigurationFiles($this->_pagePath,$pageBasePath);
$cache->set(self::CONFIG_CACHE_PREFIX.$this->_pagePath,array($pageConfig,time()),$this->_cacheExpire<0?0:$this->_cacheExpire);
}
}
@@ -163,7 +155,7 @@ class TPageService extends TComponent implements IService
}
}
- // load modules specified in app config
+ // load modules specified in page directory config
foreach($pageConfig->getModules() as $id=>$moduleConfig)
{
$module=Prado::createComponent($moduleConfig[0]);
@@ -274,61 +266,21 @@ class TPageService extends TComponent implements IService
/**
* @return string root directory (in namespace form) storing pages
*/
- public function getPageRootPath()
+ public function getPageBasePath()
{
- return $this->_pageRootPath;
+ return $this->_pageBasePath;
}
/**
* @param string root directory (in namespace form) storing pages
* @throws TInvalidOperationException if the service is initialized already
*/
- public function setPageRootPath($value)
- {
- if($this->_initialized)
- throw new TInvalidOperationException('pageservice_pagerootpath_unchangeable');
- else
- $this->_pageRootPath=$value;
- }
-
- /**
- * @return string the root directory storing published asset files
- */
- public function getAssetRootPath()
- {
- return $this->_assetRootPath;
- }
-
- /**
- * @param string the root directory storing published asset files
- * @throws TInvalidOperationException if the service is initialized already
- */
- public function setAssetRootPath($value)
- {
- if($this->_initialized)
- throw new TInvalidOperationException('pageservice_assetrootpath_unchangeable');
- else
- $this->_assetRootPath=$value;
- }
-
- /**
- * @return string the base url that the published asset files can be accessed
- */
- public function getAssetBaseUrl()
- {
- return $this->_assetBaseUrl;
- }
-
- /**
- * @param string the base url that the published asset files can be accessed
- * @throws TInvalidOperationException if the service is initialized already
- */
- public function setAssetBaseUrl($value)
+ public function setPageBasePath($value)
{
if($this->_initialized)
- throw new TInvalidOperationException('pageservice_assetbaseurl_unchangeable');
+ throw new TInvalidOperationException('pageservice_pagebasepath_unchangeable');
else
- $this->_assetBaseUrl=$value;
+ $this->_pageBasePath=$value;
}
/**
@@ -347,7 +299,7 @@ class TPageService extends TComponent implements IService
$p=explode('.',$this->_pagePath);
array_pop($p);
array_push($p,$className);
- $path=Prado::getPathOfNamespace($this->_pageRootPath).'/'.implode('/',$p).Prado::CLASS_FILE_EXT;
+ $path=Prado::getPathOfNamespace($this->_pageBasePath).'/'.implode('/',$p).Prado::CLASS_FILE_EXT;
require_once($path);
}
}
@@ -419,7 +371,7 @@ class TPageConfiguration extends TComponent
*/
private $_modules=array(
'template'=>array('System.Web.UI.TTemplateManager',array(),null),
- //'asset'=>array('System.Web.TAssetManager',array(),null)
+ 'asset'=>array('System.Web.TAssetManager',array(),null)
);
/**
* @var array list of parameters
@@ -525,11 +477,11 @@ class TPageConfiguration extends TComponent
* @param string path to the page (dot-connected format)
* @param string root path for pages
*/
- public function loadConfigurationFiles($pagePath,$pageRootPath)
+ public function loadConfigurationFiles($pagePath,$pageBasePath)
{
$paths=explode('.',$pagePath);
$page=array_pop($paths);
- $path=$pageRootPath;
+ $path=$pageBasePath;
foreach($paths as $p)
{
$this->loadFromFile($path.'/'.TPageService::CONFIG_FILE,null);