From ae57f5fb591ecc01c9cb007c4517efa5c4ff9e72 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 27 Jun 2006 14:21:23 +0000 Subject: Fixed #239. --- .gitattributes | 3 ++ HISTORY | 1 + framework/Web/UI/WebControls/TMultiView.php | 5 +- .../tickets/protected/pages/Ticket239.page | 19 ++++++++ .../tickets/protected/pages/Ticket239.php | 16 +++++++ .../tickets/tests/Ticket239TestCase.php | 55 ++++++++++++++++++++++ 6 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket239.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket239.php create mode 100644 tests/FunctionalTests/tickets/tests/Ticket239TestCase.php diff --git a/.gitattributes b/.gitattributes index a60f67b8..1577fc6a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1667,6 +1667,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket191.page -text tests/FunctionalTests/tickets/protected/pages/Ticket191.php -text tests/FunctionalTests/tickets/protected/pages/Ticket21.page -text tests/FunctionalTests/tickets/protected/pages/Ticket21.php -text +tests/FunctionalTests/tickets/protected/pages/Ticket239.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket239.php -text tests/FunctionalTests/tickets/protected/pages/Ticket27.page -text tests/FunctionalTests/tickets/protected/pages/Ticket28.page -text tests/FunctionalTests/tickets/protected/pages/Ticket28.php -text @@ -1685,6 +1687,7 @@ tests/FunctionalTests/tickets/tests/Ticket163TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket169TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket191TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket21TestCase.php -text +tests/FunctionalTests/tickets/tests/Ticket239TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket27TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket28TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket54TestCase.php -text diff --git a/HISTORY b/HISTORY index 6650d07f..39b1e90d 100644 --- a/HISTORY +++ b/HISTORY @@ -4,6 +4,7 @@ BUG: Ticket#182 - List and validator controls cause problem in child classes (Qi BUG: Ticket#191 - Duplicated postbacks occur when using TButton with validators (Qiang) BUG: Ticket#213 - PRADO Requirements Checker charset error (Qiang) BUG: Ticket#234 - Postback target could be out of date (Qiang) +BUG: Ticket#239 - Ondeactivate handler for the first View of MultiView is always fired (Qiang) BUG: Ticket#244 - redirect() needs absolute URL (Qiang) BUG: Ticket#245 - getIsSecureConnection() is not working correctly (Qiang) CHG: ensureChildControls() is now invoked in TControl::initRecursive (Qiang) diff --git a/framework/Web/UI/WebControls/TMultiView.php b/framework/Web/UI/WebControls/TMultiView.php index b6001f90..00c0ce93 100644 --- a/framework/Web/UI/WebControls/TMultiView.php +++ b/framework/Web/UI/WebControls/TMultiView.php @@ -144,7 +144,7 @@ class TMultiView extends TControl { if($view->getActive()) return; - $triggerEvent=($this->getControlStage()>=TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack())); + $triggerEvent=$triggerViewChangedEvent && ($this->getControlStage()>=TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack())); foreach($this->getViews() as $v) { if($v===$view) @@ -153,8 +153,7 @@ class TMultiView extends TControl if($triggerEvent) { $view->onActivate(null); - if($triggerViewChangedEvent) - $this->onActiveViewChanged(null); + $this->onActiveViewChanged(null); } } else if($v->getActive()) diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket239.page b/tests/FunctionalTests/tickets/protected/pages/Ticket239.page new file mode 100644 index 00000000..a67c38a8 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket239.page @@ -0,0 +1,19 @@ + + + + + view1 + + + + view2 + + + + + view3 + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket239.php b/tests/FunctionalTests/tickets/protected/pages/Ticket239.php new file mode 100644 index 00000000..a40c94b5 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket239.php @@ -0,0 +1,16 @@ +Result->Text.=$sender->ID." is activated. "; + } + + public function deactivateView($sender,$param) + { + $this->Result->Text.=$sender->ID." is deactivated. "; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/tickets/tests/Ticket239TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket239TestCase.php new file mode 100644 index 00000000..9d895cb4 --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket239TestCase.php @@ -0,0 +1,55 @@ +open('tickets/index.php?page=Ticket239'); + + // view1 + $this->verifyTextPresent('view1 is activated',''); + $this->verifyTextNotPresent('view1 is deactivated',''); + $this->verifyTextNotPresent('view2 is activated',''); + $this->verifyTextNotPresent('view2 is deactivated',''); + $this->verifyTextNotPresent('view3 is activated',''); + $this->verifyTextNotPresent('view3 is deactivated',''); + + // goto view2 + $this->clickAndWait('name=ctl0$Content$ctl1'); + $this->verifyTextNotPresent('view1 is activated',''); + $this->verifyTextPresent('view1 is deactivated',''); + $this->verifyTextPresent('view2 is activated',''); + $this->verifyTextNotPresent('view2 is deactivated',''); + $this->verifyTextNotPresent('view3 is activated',''); + $this->verifyTextNotPresent('view3 is deactivated',''); + + // goto view3 + $this->clickAndWait('name=ctl0$Content$ctl3'); + $this->verifyTextNotPresent('view1 is activated',''); + $this->verifyTextNotPresent('view1 is deactivated',''); + $this->verifyTextNotPresent('view2 is activated',''); + $this->verifyTextPresent('view2 is deactivated',''); + $this->verifyTextPresent('view3 is activated',''); + $this->verifyTextNotPresent('view3 is deactivated',''); + + // goto view2 + $this->clickAndWait('name=ctl0$Content$ctl4'); + $this->verifyTextNotPresent('view1 is activated',''); + $this->verifyTextNotPresent('view1 is deactivated',''); + $this->verifyTextPresent('view2 is activated',''); + $this->verifyTextNotPresent('view2 is deactivated',''); + $this->verifyTextNotPresent('view3 is activated',''); + $this->verifyTextPresent('view3 is deactivated',''); + + // goto view1 + $this->clickAndWait('name=ctl0$Content$ctl2'); + $this->verifyTextPresent('view1 is activated',''); + $this->verifyTextNotPresent('view1 is deactivated',''); + $this->verifyTextNotPresent('view2 is activated',''); + $this->verifyTextPresent('view2 is deactivated',''); + $this->verifyTextNotPresent('view3 is activated',''); + $this->verifyTextNotPresent('view3 is deactivated',''); + } +} + +?> \ No newline at end of file -- cgit v1.2.3