diff options
author | xue <> | 2007-10-03 21:12:33 +0000 |
---|---|---|
committer | xue <> | 2007-10-03 21:12:33 +0000 |
commit | 7114280214ab22250c3ddd12509c2e388936a304 (patch) | |
tree | 9b3cfba339f94e2c59312c4a602a26c00cfeb749 /framework | |
parent | c81e28244ac07075473a1ce1bb8fec4719a9a3ba (diff) |
Changed TConditional so that the controls in its template behave like they are in its parent
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 9 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TConditional.php | 16 |
2 files changed, 8 insertions, 17 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 34d66b47..53058a9f 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -303,10 +303,13 @@ class TTemplate extends TApplicationComponent implements ITemplate * Content in the template will be instantiated as components and text strings
* and passed to the specified parent control.
* @param TControl the parent control
+ * @param TControl the control with which explicitly named controls are registered. If null, it uses the parent control.
*/
- public function instantiateIn($tplControl)
+ public function instantiateIn($tplControl,$namingControl=null)
{
$this->_tplControl=$tplControl;
+ if($namingControl===null)
+ $namingControl=$tplControl;
if(($page=$tplControl->getPage())===null)
$page=$this->getService()->getRequestedPage();
$controls=array();
@@ -332,7 +335,7 @@ class TTemplate extends TApplicationComponent implements ITemplate {
if(is_array($properties['id']))
$properties['id']=$component->evaluateExpression($properties['id'][1]);
- $tplControl->registerObject($properties['id'],$component);
+ $namingControl->registerObject($properties['id'],$component);
}
if(isset($properties['skinid']))
{
@@ -365,7 +368,7 @@ class TTemplate extends TApplicationComponent implements ITemplate {
if(is_array($properties['id']))
$properties['id']=$component->evaluateExpression($properties['id'][1]);
- $tplControl->registerObject($properties['id'],$component);
+ $namingControl->registerObject($properties['id'],$component);
if(!$component->hasProperty('id'))
unset($properties['id']);
}
diff --git a/framework/Web/UI/WebControls/TConditional.php b/framework/Web/UI/WebControls/TConditional.php index fa17eede..d6cf2473 100644 --- a/framework/Web/UI/WebControls/TConditional.php +++ b/framework/Web/UI/WebControls/TConditional.php @@ -64,18 +64,6 @@ class TConditional extends TControl }
/**
- * Registers an object defined in the template.
- * This method is overriden so that the objects are actually
- * registered to the template containing the TConditional control.
- * @param string name of the object
- * @param mixed the object to be registered
- */
- public function registerObject($name,$object)
- {
- $this->getTemplateControl()->registerObject($name,$object);
- }
-
- /**
* Creates child controls.
* This method overrides the parent implementation. It evaluates {@link getCondition Condition}
* and instantiate the corresponding template.
@@ -95,10 +83,10 @@ class TConditional extends TControl if($result)
{
if($this->_trueTemplate)
- $this->_trueTemplate->instantiateIn($this);
+ $this->_trueTemplate->instantiateIn($this->getParent(),$this->getTemplateControl());
}
else if($this->_falseTemplate)
- $this->_falseTemplate->instantiateIn($this);
+ $this->_falseTemplate->instantiateIn($this->getParent(),$this->getTemplateControl());
$this->_creatingChildren=false;
}
|