summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-09-11 13:01:29 +0000
committerxue <>2007-09-11 13:01:29 +0000
commit7d6036d9736558e4f9241be87447e1c2321834b1 (patch)
treea90a7a12772ef66b5b09ccb8fd80b7352c5addc1
parent269c9a0010c2495db961c185e83fd52b33b04d73 (diff)
further enhancements to page matching.
-rw-r--r--demos/quickstart/protected/pages/Configurations/PageConfig.page2
-rw-r--r--framework/Web/Services/TPageService.php14
2 files changed, 13 insertions, 3 deletions
diff --git a/demos/quickstart/protected/pages/Configurations/PageConfig.page b/demos/quickstart/protected/pages/Configurations/PageConfig.page
index c52164b6..d4ffb4b3 100644
--- a/demos/quickstart/protected/pages/Configurations/PageConfig.page
+++ b/demos/quickstart/protected/pages/Configurations/PageConfig.page
@@ -41,7 +41,7 @@ Complete specification of page configurations can be found in the <a href="<%~..
<com:SinceVersion Version="3.1.1" />
<p class="block-content">
-Since version 3.1.1, the <tt>id</tt> attribute in the &lt;page&gt; element can be a relative page path pointing to a page in the subdirectory of the directory containing the page configuration. For example, <tt>id="admin.Home"</tt> refers to the <tt>Home</tt> page under the <tt>admin</tt> directory. This enhancement allows developers to centralize their page configurations (e.g. put all page initializations in the aplication configuration or the root page configuration.)
+Since version 3.1.1, the <tt>id</tt> attribute in the &lt;page&gt; element can be a relative page path pointing to a page in the subdirectory of the directory containing the page configuration. For example, <tt>id="admin.Home"</tt> refers to the <tt>Home</tt> page under the <tt>admin</tt> directory. The <tt>id</tt> attribute can also contain wildcard '*' to match all pages under the specified directory. For example, <tt>id="admin.*"</tt> refers to all pages under the <tt>admin</tt> directory and its subdirectories. This enhancement allows developers to centralize their page configurations (e.g. put all page initializations in the aplication configuration or the root page configuration.)
</p>
<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index 8b7fb52d..fcbb961f 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -695,9 +695,19 @@ class TPageConfiguration extends TComponent
foreach($pagesNode->getElementsByTagName('page') as $node)
{
$properties=$node->getAttributes();
- if(($id=$properties->remove('id'))===null)
+ $id=$properties->remove('id');
+ if(empty($id))
throw new TConfigurationException('pageserviceconf_page_invalid',$configPath);
- if(($configPagePath==='' && strcasecmp($id,$this->_pagePath)===0) || ($configPath!=='' && strcasecmp($configPagePath.'.'.$id,$this->_pagePath)===0))
+ $matching=false;
+ $id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
+ if(strcasecmp($id,$this->_pagePath)===0)
+ $matching=true;
+ else if($id[strlen($id)-1]==='*') // try wildcard matching
+ {
+ $id=strtolower(substr($id,0,strlen($id)-1));
+ $matching=(strpos(strtolower($this->_pagePath),$pattern)===0);
+ }
+ if($matching)
$this->_properties=array_merge($this->_properties,$properties->toArray());
}
}