Changeset 2214

Show
Ignore:
Timestamp:
09/11/2007 08:01:29 AM (15 months ago)
Author:
xue
Message:

further enhancements to page matching.

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/demos/quickstart/protected/pages/Configurations/PageConfig.page

    r2213 r2214  
    4242<com:SinceVersion Version="3.1.1" /> 
    4343<p class="block-content"> 
    44 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.) 
     44Since 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.) 
    4545</p> 
    4646 
  • trunk/framework/Web/Services/TPageService.php

    r2213 r2214  
    696696                        { 
    697697                                $properties=$node->getAttributes(); 
    698                                 if(($id=$properties->remove('id'))===null) 
     698                                $id=$properties->remove('id'); 
     699                                if(empty($id)) 
    699700                                        throw new TConfigurationException('pageserviceconf_page_invalid',$configPath); 
    700                                 if(($configPagePath==='' && strcasecmp($id,$this->_pagePath)===0) || ($configPath!=='' && strcasecmp($configPagePath.'.'.$id,$this->_pagePath)===0)) 
     701                                $matching=false; 
     702                                $id=($configPagePath==='')?$id:$configPagePath.'.'.$id; 
     703                                if(strcasecmp($id,$this->_pagePath)===0) 
     704                                        $matching=true; 
     705                                else if($id[strlen($id)-1]==='*') // try wildcard matching 
     706                                { 
     707                                        $id=strtolower(substr($id,0,strlen($id)-1)); 
     708                                        $matching=(strpos(strtolower($this->_pagePath),$pattern)===0); 
     709                                } 
     710                                if($matching) 
    701711                                        $this->_properties=array_merge($this->_properties,$properties->toArray()); 
    702712                        }