diff options
author | xue <> | 2007-10-03 21:21:40 +0000 |
---|---|---|
committer | xue <> | 2007-10-03 21:21:40 +0000 |
commit | 9b833015fcb1abffe80685a8ee5231ade9bd4923 (patch) | |
tree | 536de7a1646d1bc87ab645d8955e1befe2bc2f63 /framework/Web | |
parent | 7114280214ab22250c3ddd12509c2e388936a304 (diff) |
Fixed TConditional parent-child relationship.
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 28 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TConditional.php | 4 |
2 files changed, 16 insertions, 16 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 53058a9f..5a6faba6 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -302,14 +302,14 @@ class TTemplate extends TApplicationComponent implements ITemplate * Instantiates the template.
* 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.
+ * @param TControl the control who owns the template
+ * @param TControl the control who will become the root parent of the controls on the template. If null, it uses the template control.
*/
- public function instantiateIn($tplControl,$namingControl=null)
+ public function instantiateIn($tplControl,$parentControl=null)
{
$this->_tplControl=$tplControl;
- if($namingControl===null)
- $namingControl=$tplControl;
+ if($parentControl===null)
+ $parentControl=$tplControl;
if(($page=$tplControl->getPage())===null)
$page=$this->getService()->getRequestedPage();
$controls=array();
@@ -317,7 +317,7 @@ class TTemplate extends TApplicationComponent implements ITemplate foreach($this->_tpl as $key=>$object)
{
if($object[0]===-1)
- $parent=$tplControl;
+ $parent=$parentControl;
else if(isset($controls[$object[0]]))
$parent=$controls[$object[0]];
else
@@ -335,7 +335,7 @@ class TTemplate extends TApplicationComponent implements ITemplate {
if(is_array($properties['id']))
$properties['id']=$component->evaluateExpression($properties['id'][1]);
- $namingControl->registerObject($properties['id'],$component);
+ $tplControl->registerObject($properties['id'],$component);
}
if(isset($properties['skinid']))
{
@@ -354,7 +354,7 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->trackViewState(true);
- if($parent===$tplControl)
+ if($parent===$parentControl)
$directChildren[]=$component;
else
$component->createdOnTemplate($parent);
@@ -368,13 +368,13 @@ class TTemplate extends TApplicationComponent implements ITemplate {
if(is_array($properties['id']))
$properties['id']=$component->evaluateExpression($properties['id'][1]);
- $namingControl->registerObject($properties['id'],$component);
+ $tplControl->registerObject($properties['id'],$component);
if(!$component->hasProperty('id'))
unset($properties['id']);
}
foreach($properties as $name=>$value)
$this->configureComponent($component,$name,$value);
- if($parent===$tplControl)
+ if($parent===$parentControl)
$directChildren[]=$component;
else
$component->createdOnTemplate($parent);
@@ -387,14 +387,14 @@ class TTemplate extends TApplicationComponent implements ITemplate // need to clone a new object because the one in template is reused
$o=clone $object[1];
$o->setContainer($tplControl);
- if($parent===$tplControl)
+ if($parent===$parentControl)
$directChildren[]=$o;
else
$parent->addParsedObject($o);
}
else
{
- if($parent===$tplControl)
+ if($parent===$parentControl)
$directChildren[]=$object[1];
else
$parent->addParsedObject($object[1]);
@@ -407,9 +407,9 @@ class TTemplate extends TApplicationComponent implements ITemplate foreach($directChildren as $control)
{
if($control instanceof TComponent)
- $control->createdOnTemplate($tplControl);
+ $control->createdOnTemplate($parentControl);
else
- $tplControl->addParsedObject($control);
+ $parentControl->addParsedObject($control);
}
}
diff --git a/framework/Web/UI/WebControls/TConditional.php b/framework/Web/UI/WebControls/TConditional.php index d6cf2473..54ab6063 100644 --- a/framework/Web/UI/WebControls/TConditional.php +++ b/framework/Web/UI/WebControls/TConditional.php @@ -83,10 +83,10 @@ class TConditional extends TControl if($result)
{
if($this->_trueTemplate)
- $this->_trueTemplate->instantiateIn($this->getParent(),$this->getTemplateControl());
+ $this->_trueTemplate->instantiateIn($this->getTemplateControl(),$this->getParent());
}
else if($this->_falseTemplate)
- $this->_falseTemplate->instantiateIn($this->getParent(),$this->getTemplateControl());
+ $this->_falseTemplate->instantiateIn($this->getTemplateControl(),$this->getParent());
$this->_creatingChildren=false;
}
|