summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TMultiView.php
diff options
context:
space:
mode:
authorxue <>2006-03-23 21:10:05 +0000
committerxue <>2006-03-23 21:10:05 +0000
commit5042df3f7a3f4ea7932a4329559dd93477290322 (patch)
tree09c4a04a121735f8cbbdedf4f6726d934f0bf7ca /framework/Web/UI/WebControls/TMultiView.php
parent29d40192ed3dc0085b5e513ec071c81e03e95d3b (diff)
Fixed a bug in triggering onActiveStepChanged event.
Diffstat (limited to 'framework/Web/UI/WebControls/TMultiView.php')
-rw-r--r--framework/Web/UI/WebControls/TMultiView.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TMultiView.php b/framework/Web/UI/WebControls/TMultiView.php
index 42e76349..5e9398f3 100644
--- a/framework/Web/UI/WebControls/TMultiView.php
+++ b/framework/Web/UI/WebControls/TMultiView.php
@@ -95,7 +95,7 @@ class TMultiView extends TControl
$this->setControlState('ActiveViewIndex',$index,-1);
$this->_cachedActiveViewIndex=-1;
if($index>=0)
- $this->activateView($views->itemAt($index));
+ $this->activateView($views->itemAt($index),true);
}
else
throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
@@ -115,7 +115,7 @@ class TMultiView extends TControl
return null;
$view=$views->itemAt($index);
if(!$view->getActive())
- $this->activateView($view);
+ $this->activateView($view,false);
return $view;
}
@@ -135,20 +135,24 @@ class TMultiView extends TControl
* Activates the specified view.
* If there is any view currently active, it will be deactivated.
* @param TView the view to be activated
+ * @param boolean whether to trigger OnActiveViewChanged event.
*/
- protected function activateView($view)
+ protected function activateView($view,$triggerViewChangedEvent=true)
{
if($view->getActive())
return;
- $triggerEvent=$this->getControlStage()>=TControl::CS_STATE_LOADED || !$this->getPage() || !$this->getPage()->getIsPostBack();
+ $triggerEvent=($this->getControlStage()>=TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack()));
foreach($this->getViews() as $v)
{
if($v===$view)
{
$view->setActive(true);
if($triggerEvent)
+ {
$view->onActivate(null);
- $this->onActiveViewChanged(null);
+ if($triggerViewChangedEvent)
+ $this->onActiveViewChanged(null);
+ }
}
else if($v->getActive())
{