summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes3
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/WebControls/TMultiView.php5
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket239.page19
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket239.php16
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket239TestCase.php55
6 files changed, 96 insertions, 3 deletions
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 @@
+<com:TContent ID="Content">
+
+<com:TMultiView ActiveViewIndex="0">
+ <com:TView ID="view1" OnActivate="activateView" OnDeactivate="deactivateView">
+ view1
+ <com:TButton Text="Next view" CommandName="NextView" />
+ </com:TView>
+ <com:TView ID="view2" OnActivate="activateView" OnDeactivate="deactivateView">
+ view2
+ <com:TButton Text="Prev view" CommandName="PreviousView" />
+ <com:TButton Text="Next view" CommandName="NextView" />
+ </com:TView>
+ <com:TView ID="view3" OnActivate="activateView" OnDeactivate="deactivateView">
+ view3
+ <com:TButton Text="Prev view" CommandName="PreviousView" />
+ </com:TView>
+</com:TMultiView>
+<com:TLabel ID="Result" EnableViewState="false" />
+</com:TContent> \ 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 @@
+<?php
+
+class Ticket239 extends TPage
+{
+ public function activateView($sender,$param)
+ {
+ $this->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 @@
+<?php
+
+class Ticket239TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->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