diff options
| -rw-r--r-- | HISTORY | 1 | ||||
| -rw-r--r-- | demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page | 33 | ||||
| -rw-r--r-- | framework/Web/UI/TTemplateManager.php | 47 | 
3 files changed, 58 insertions, 23 deletions
@@ -1,5 +1,6 @@  Version 3.1.0 To be released
  ============================
 +ENH: Ticket#117 - added support to configure subproperties in a group. (Qiang)
  NEW: TOutputCache (Qiang)
  NEW: TQueue (Qiang)
  NEW: TSessionPageStatePersister (Qiang)
 diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page index 2ac672d8..17a0cd72 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.page @@ -10,24 +10,31 @@          BorderWidth="1px"
          BorderStyle="Solid"
          HeaderText="Please let us know your preference"
 -		SideBarStyle.Width="100px"
 -		SideBarStyle.Height="100px"
 -		SideBarStyle.BackColor="#507CD1"
 -		SideBarStyle.HorizontalAlign="Center"
  		StepStyle.HorizontalAlign="Center"
  		NavigationStyle.HorizontalAlign="Center"
 -		NavigationButtonStyle.BackColor="White"
 -		NavigationButtonStyle.BorderColor="#507CD1"
 -		NavigationButtonStyle.BorderStyle="Solid"
 -		NavigationButtonStyle.BorderWidth="1px"
 -		NavigationButtonStyle.ForeColor="#284E98"
  		SideBarButtonStyle.ForeColor="White"
 -        HeaderStyle.BackColor="#284E98"
 -		HeaderStyle.Font.Bold="True"
 -		HeaderStyle.ForeColor="White"
 -		HeaderStyle.HorizontalAlign="Center"
  		OnCompleteButtonClick="wizardCompleted" >
 +  <prop:SideBarStyle
 +		Width="100px"
 +		Height="100px"
 +		BackColor="#507CD1"
 +		HorizontalAlign="Center"
 +        />
 +  <prop:NavigationButtonStyle
 +		BackColor="White"
 +		BorderColor="#507CD1"
 +		BorderStyle="Solid"
 +		BorderWidth="1px"
 +		ForeColor="#284E98"
 +        />
 +  <prop:HeaderStyle
 +        BackColor="#284E98"
 +		Font.Bold="True"
 +		ForeColor="White"
 +		HorizontalAlign="Center"
 +        />
 +
    <com:TWizardStep Title="Step 1">
      <p>
      Your favorite color:
 diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 6e12726a..d2a92c04 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -127,14 +127,16 @@ class TTemplateManager extends TModule   * are treated as either property initial values, event handler attachment, or regular
   * tag attributes.
   * - property tags: property tags are used to set large block of attribute values.
 - * The property tag name is in the format of prop:AttributeName, where AttributeName
 + * The property tag name is in the format of <prop:AttributeName> where AttributeName
   * can be a property name, an event name or a regular tag attribute name.
 + * - group subproperty tags: subproperties of a common property can be configured using
 + * <prop:MainProperty SubProperty1="Value1" SubProperty2="Value2" .../>
   * - directive: directive specifies the property values for the template owner.
 - * It is in the format of <% property name-value pairs %>
 - * - expressions: They are in the formate of <= PHP expression > and <% PHP statements >
 + * It is in the format of <%@ property name-value pairs %>;
 + * - expressions: They are in the formate of <%= PHP expression %> and <%% PHP statements %>
   * - comments: There are two kinds of comments, regular HTML comments and special template comments.
 - * The former is in the format of <!-- comments -->, which will be treated as text strings.
 - * The latter is in the format of <%* comments %>, which will be stripped out.
 + * The former is in the format of <!-- comments -->, which will be treated as text strings.
 + * The latter is in the format of <!-- comments --!>, which will be stripped out.
   *
   * Tags other than the above are not required to be well-formed.
   *
 @@ -157,8 +159,9 @@ class TTemplate extends TApplicationComponent implements ITemplate  	 *	'<\/?prop:([\w\.]+)\s*>'  - property tags
  	 *	'<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>'  - directives
  	 *	'<%[%#~\\$=\\[](.*?)%>'  - expressions
 +	 *  '<prop:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/>' - group subproperty tags
  	 */
 -	const REGEX_RULES='/<!--.*?--!>|<!--.*?-->|<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>/msS';
 +	const REGEX_RULES='/<!--.*?--!>|<!--.*?-->|<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>|<prop:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/>/msS';
  	/**
  	 * Different configurations of component property/event/attribute
 @@ -625,14 +628,38 @@ class TTemplate extends TApplicationComponent implements ITemplate  				}
  				else if(strpos($str,'<prop:')===0)	// opening property
  				{
 -					$prop=strtolower($match[3][0]);
 -					array_push($stack,'@'.$prop);
 -					if(!$expectPropEnd)
 +					if(strrpos($str,'/>')===strlen($str)-2)  //subproperties
  					{
 +						if($expectPropEnd)
 +							continue;
  						if($matchStart>$textStart)
  							$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
  						$textStart=$matchEnd+1;
 -						$expectPropEnd=true;
 +						$prop=strtolower($match[6][0]);
 +						$attrs=$this->parseAttributes($match[7][0],$match[7][1]);
 +						$attributes=array();
 +						foreach($attrs as $name=>$value)
 +							$attributes[$prop.'.'.$name]=$value;
 +						$type=$tpl[$container][1];
 +						$this->validateAttributes($type,$attributes);
 +						foreach($attributes as $name=>$value)
 +						{
 +							if(isset($tpl[$container][2][$name]))
 +								throw new TConfigurationException('template_property_duplicated',$name);
 +							$tpl[$container][2][$name]=$value;
 +						}
 +					}
 +					else  // regular property
 +					{
 +						$prop=strtolower($match[3][0]);
 +						array_push($stack,'@'.$prop);
 +						if(!$expectPropEnd)
 +						{
 +							if($matchStart>$textStart)
 +								$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
 +							$textStart=$matchEnd+1;
 +							$expectPropEnd=true;
 +						}
  					}
  				}
  				else if(strpos($str,'</prop:')===0)	// closing property
  | 
