diff options
Diffstat (limited to 'framework/Web/UI')
| -rw-r--r-- | framework/Web/UI/TTemplateManager.php | 23 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/TButton.php | 2 | 
2 files changed, 17 insertions, 8 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index d2a92c04..60ce11ca 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -546,6 +546,7 @@ class TTemplate extends TApplicationComponent implements ITemplate  		$container=-1;
  		$matchEnd=0;
  		$c=0;
 +		$this->_directive=null;
  		try
  		{
  			for($i=0;$i<$n;++$i)
 @@ -598,7 +599,7 @@ class TTemplate extends TApplicationComponent implements ITemplate  					if($matchStart>$textStart)
  						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
  					$textStart=$matchEnd+1;
 -					if(isset($tpl[0]))
 +					if(isset($tpl[0]) || $this->_directive!==null)
  						throw new TConfigurationException('template_directive_nonunique');
  					$this->_directive=$this->parseAttributes($match[4][0],$match[4][1]);
  				}
 @@ -675,18 +676,23 @@ class TTemplate extends TApplicationComponent implements ITemplate  					}
  					if(($last=count($stack))<1 || $stack[$last-1][0]!=='@')
  					{
 -						if($matchStart>$textStart && $container>=0)
 +						if($matchStart>$textStart)
  						{
  							$value=substr($input,$textStart,$matchStart-$textStart);
  							if(strrpos($prop,'template')===strlen($prop)-8)
  								$value=$this->parseTemplateProperty($value,$textStart);
  							else
  								$value=$this->parseAttribute($value);
 -							$type=$tpl[$container][1];
 -							$this->validateAttributes($type,array($prop=>$value));
 -							if(isset($tpl[$container][2][$prop]))
 -								throw new TConfigurationException('template_property_duplicated',$prop);
 -							$tpl[$container][2][$prop]=$value;
 +							if($container>=0)
 +							{
 +								$type=$tpl[$container][1];
 +								$this->validateAttributes($type,array($prop=>$value));
 +								if(isset($tpl[$container][2][$prop]))
 +									throw new TConfigurationException('template_property_duplicated',$prop);
 +								$tpl[$container][2][$prop]=$value;
 +							}
 +							else	// a property for the template control
 +								$this->_directive[$prop]=$value;
  							$textStart=$matchEnd+1;
  						}
  						$expectPropEnd=false;
 @@ -730,6 +736,9 @@ class TTemplate extends TApplicationComponent implements ITemplate  				throw new TConfigurationException('template_format_invalid',$this->_tplFile,$line,$e->getMessage());
  		}
 +		if($this->_directive===null)
 +			$this->_directive=array();
 +
  		// optimization by merging consecutive strings, expressions, statements and bindings
  		$objects=array();
  		$parent=null;
 diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index ba523168..75d60695 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -19,7 +19,7 @@   * A <b>command</b> button has a command name (specified by
   * the {@link setCommandName CommandName} property) and and a command parameter
   * (specified by {@link setCommandParameter CommandParameter} property)
 - * associated with the button. This allows you to create multiple TLinkButton
 + * associated with the button. This allows you to create multiple TButton
   * components on a Web page and programmatically determine which one is clicked
   * with what parameter. You can provide an event handler for
   * {@link onCommand OnCommand} event to programmatically control the actions performed
  | 
