From 652bffab24bab354d9e3022b22866640f4fd4a0e Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 31 May 2006 01:47:08 +0000 Subject: Fixed a bug that newly created controls during postbacks may get their initial states reset during loadStateRecursive. --- HISTORY | 1 + demos/blog/protected/Pages/ErrorReport.page | 2 ++ demos/blog/protected/Pages/Posts/ListPost.php | 1 + demos/blog/protected/Pages/SearchPost.page | 2 ++ framework/Web/UI/TControl.php | 11 +-------- .../validators/tests/RequiredListTestCase.php | 26 +++++++++++----------- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/HISTORY b/HISTORY index 1eec7319..97bc0800 100644 --- a/HISTORY +++ b/HISTORY @@ -9,6 +9,7 @@ BUG: Ticket#169 - Validation of subclass of THtmlArea/TDatePicker fails (Wei) BUG: Ticket#179 - CGI incompatibility causing clientscripts.php failure (Qiang) BUG: Ticket#181 - Unable to change Content-Type in response header if charset is not set (Qiang) BUG: Ticket#200 - onClick javascript event triggered twice on CheckBox label (Qiang) +BUG: newly created controls during postbacks might get their initial states reset during loadStateRecursive. (Qiang) ENH: Ticket#150 - TDataGrid and TDataList now render table section tags (Qiang) ENH: Ticket#152 - constituent parts of TWizard are exposed (Qiang) ENH: Ticket#184 - added TUserManager.Users and Roles properties (Qiang) diff --git a/demos/blog/protected/Pages/ErrorReport.page b/demos/blog/protected/Pages/ErrorReport.page index 3a068e3c..90c659e8 100644 --- a/demos/blog/protected/Pages/ErrorReport.page +++ b/demos/blog/protected/Pages/ErrorReport.page @@ -1,3 +1,5 @@ +<%@ Title="Error" %> +

Error

diff --git a/demos/blog/protected/Pages/Posts/ListPost.php b/demos/blog/protected/Pages/Posts/ListPost.php index 8c51546f..c3b2bcc9 100644 --- a/demos/blog/protected/Pages/Posts/ListPost.php +++ b/demos/blog/protected/Pages/Posts/ListPost.php @@ -36,6 +36,7 @@ class ListPost extends BlogPage $this->_category=$this->DataAccess->queryCategoryByID($catID); $this->CategoryPanel->Visible=true; } + $this->Title=$this->Application->Parameters['SiteTitle']; } private function getPageOffset() diff --git a/demos/blog/protected/Pages/SearchPost.page b/demos/blog/protected/Pages/SearchPost.page index e3a71d44..6a4b2e04 100644 --- a/demos/blog/protected/Pages/SearchPost.page +++ b/demos/blog/protected/Pages/SearchPost.page @@ -1,3 +1,5 @@ +<%@ Title="Search Results" %> +
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 66ac8fd5..36cc34dd 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -1522,11 +1522,6 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable $control->loadStateRecursive($state[$control->_id],$needViewState); unset($state[$control->_id]); } - else - { - $s=array(); - $control->loadStateRecursive($s,$needViewState); - } } } } @@ -1560,11 +1555,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable foreach($this->_rf[self::RF_CONTROLS] as $control) { if($control instanceof TControl) - { - $cs=&$control->saveStateRecursive($needViewState); - if(!empty($cs)) - $state[$control->_id]=&$cs; - } + $state[$control->_id]=&$control->saveStateRecursive($needViewState); } } if($needViewState && !empty($this->_viewState)) diff --git a/tests/FunctionalTests/validators/tests/RequiredListTestCase.php b/tests/FunctionalTests/validators/tests/RequiredListTestCase.php index ad299dc5..cb10f201 100644 --- a/tests/FunctionalTests/validators/tests/RequiredListTestCase.php +++ b/tests/FunctionalTests/validators/tests/RequiredListTestCase.php @@ -1,8 +1,8 @@ assertVisible("{$base}validator1"); $this->assertVisible("{$base}validator2"); $this->assertVisible("{$base}validator3"); - $this->click("{$base}list1_0"); + $this->click("{$base}list1_c0"); $this->select("{$base}list2", "label=One"); $this->select("{$base}list2", "label=Two"); - $this->click("{$base}list3_3"); + $this->click("{$base}list3_c3"); $this->clickAndWait("{$base}submit1"); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); - $this->click("{$base}list1_1"); - $this->click("{$base}list1_2"); - $this->click("{$base}list1_3"); + $this->click("{$base}list1_c1"); + $this->click("{$base}list1_c2"); + $this->click("{$base}list1_c3"); $this->select("{$base}list2", "label=Two"); - $this->click("{$base}list1_3"); - $this->click("{$base}submit1"); + $this->click("{$base}list1_c3"); + $this->click("{$base}submit1"); $this->assertNotVisible("{$base}validator1"); - $this->assertNotVisible("{$base}validator2"); + $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); - $this->click("{$base}list3_3"); - $this->click("{$base}submit1"); + $this->click("{$base}list3_c3"); + $this->click("{$base}submit1"); $this->pause(200); $this->assertNotVisible("{$base}validator1"); - $this->assertNotVisible("{$base}validator2"); + $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); } } -- cgit v1.2.3