diff options
author | xue <> | 2006-04-18 02:22:05 +0000 |
---|---|---|
committer | xue <> | 2006-04-18 02:22:05 +0000 |
commit | 1a8b8dae95cf11d2c4eec62334f8f21d2fdd617f (patch) | |
tree | 37ba8ff994c5a892ae8f9b30d1c06150ec057249 /framework/Web/UI/TTemplateManager.php | |
parent | d813a484809142c5cce2e50bff0f805630cea7d9 (diff) |
Fixed an issue about using expression with non-control component.
Diffstat (limited to 'framework/Web/UI/TTemplateManager.php')
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 25a43670..d92d4a36 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -193,6 +193,7 @@ class TTemplate extends TApplicationComponent implements ITemplate * @var boolean whether this template is a source template
*/
private $_sourceTemplate=true;
+ private $_tplControl=null;
/**
@@ -257,6 +258,7 @@ class TTemplate extends TApplicationComponent implements ITemplate */
public function instantiateIn($tplControl)
{
+ $this->_tplControl=$tplControl;
if(($page=$tplControl->getPage())===null)
$page=$this->getService()->getRequestedPage();
$controls=array();
@@ -383,7 +385,13 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->bindProperty($name,$value[1]);
break;
case self::CONFIG_EXPRESSION:
- $component->autoBindProperty($name,$value[1]);
+ if($component instanceof TControl)
+ $component->autoBindProperty($name,$value[1]);
+ else
+ {
+ $setter='set'.$name;
+ $component->$setter($this->_tplControl->evaluateExpression($value[1]));
+ }
break;
case self::CONFIG_TEMPLATE:
$setter='set'.$name;
@@ -429,7 +437,10 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->bindProperty($name,$value[1]);
break;
case self::CONFIG_EXPRESSION: // expression
- $component->autoBindProperty($name,$value[1]);
+ if($component instanceof TControl)
+ $component->autoBindProperty($name,$value[1]);
+ else
+ $component->setSubProperty($name,$this->_tplControl->evaluateExpression($value[1]));
break;
case self::CONFIG_TEMPLATE:
$component->setSubProperty($name,$value[1]);
@@ -801,7 +812,7 @@ class TTemplate extends TApplicationComponent implements ITemplate {
foreach($attributes as $name=>$att)
{
- if(is_array($att) && ($att[0]===self::CONFIG_DATABIND || $att[0]===self::CONFIG_EXPRESSION))
+ if(is_array($att) && ($att[0]===self::CONFIG_DATABIND))
throw new TConfigurationException('template_databind_forbidden',$type,$name);
if(($pos=strpos($name,'.'))!==false)
{
|