summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Exceptions/messages.txt2
-rw-r--r--framework/Web/UI/TTemplateManager.php23
3 files changed, 18 insertions, 8 deletions
diff --git a/HISTORY b/HISTORY
index 537f5012..e96675d7 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3,6 +3,7 @@ Version 3.0.1 June 1, 2006
ENH: Ticket#150 - TDataGrid and TDataList now render table section tags (Qiang)
ENH: Ticket#152 - constituent parts of TWizard are exposed (Qiang)
ENH: added sanity check to calling event handlers (Qiang)
+ENH: added support to property tags for template owner control (Qiang)
CHG: Ticket#151 - URL format is modified to handle empty GET values (Qiang)
CHG: Ticket#153 - TAssetManager now ignores .svn directories (Qiang)
NEW: TTableHeaderRow, TTableFooterRow and table section support (Qiang)
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt
index 3df84dde..3506d1a4 100644
--- a/framework/Exceptions/messages.txt
+++ b/framework/Exceptions/messages.txt
@@ -103,7 +103,7 @@ pageserviceconf_page_invalid = <page> element must have an "id" attribute in p
template_closingtag_unexpected = Unexpected closing tag '{0}' is found.
template_closingtag_expected = Closing tag '{0}' is expected.
-template_directive_nonunique = Directive '<%@ ... %>' must appear at most once in a template.
+template_directive_nonunique = Directive '<%@ ... %>' must appear at the beginning of the template and can appear at most once.
template_comments_forbidden = Template comments are not allowed within property tags.
template_matching_unexpected = Unexpected matching.
template_property_unknown = {0} has no property called '{1}'.
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 0ea80b7e..379eec2f 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -519,6 +519,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
$container=-1;
$matchEnd=0;
$c=0;
+ $this->_directive=null;
try
{
for($i=0;$i<$n;++$i)
@@ -571,7 +572,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]);
}
@@ -624,18 +625,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;
@@ -679,6 +685,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;