From 067ab51fbd9b2f18f63fc80895476e5b0e2f9bfb Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 31 May 2006 03:12:35 +0000 Subject: Merge from 3.0 branch till 1115. --- HISTORY | 1 + demos/blog/protected/Common/BlogDataModule.php | 5 +++-- demos/blog/protected/Layouts/MainLayout.tpl | 2 +- demos/blog/protected/Pages/Admin/PostMan.page | 7 ++++-- demos/blog/protected/Pages/Admin/PostMan.php | 2 +- demos/blog/protected/Pages/ErrorReport.page | 2 ++ demos/blog/protected/Pages/Posts/EditPost.page | 1 + demos/blog/protected/Pages/Posts/EditPost.php | 2 +- demos/blog/protected/Pages/Posts/ListPost.php | 5 +++-- demos/blog/protected/Pages/Posts/NewPost.php | 1 + demos/blog/protected/Pages/Posts/ViewPost.php | 4 ++-- demos/blog/protected/Pages/SearchPost.page | 2 ++ framework/Web/UI/TControl.php | 11 +-------- .../validators/tests/RequiredListTestCase.php | 26 +++++++++++----------- 14 files changed, 37 insertions(+), 34 deletions(-) diff --git a/HISTORY b/HISTORY index 5f4fc7d0..73068587 100644 --- a/HISTORY +++ b/HISTORY @@ -18,6 +18,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/Common/BlogDataModule.php b/demos/blog/protected/Common/BlogDataModule.php index 3dc71989..b8f2b7d9 100644 --- a/demos/blog/protected/Common/BlogDataModule.php +++ b/demos/blog/protected/Common/BlogDataModule.php @@ -282,8 +282,8 @@ class BlogDataModule extends TModule $title=sqlite_escape_string($post->Title); $content=sqlite_escape_string($post->Content); $sql="INSERT INTO tblPosts - (author_id,create_time,title,content,status) - VALUES ({$post->AuthorID},{$post->CreateTime},'$title','$content',{$post->Status})"; + (author_id,create_time,modify_time,title,content,status) + VALUES ({$post->AuthorID},{$post->CreateTime},{$post->ModifyTime},'$title','$content',{$post->Status})"; $this->query($sql); $post->ID=sqlite_last_insert_rowid($this->_db); foreach($catIDs as $catID) @@ -537,6 +537,7 @@ class PostRecord const STATUS_PUBLISHED=0; const STATUS_DRAFT=1; const STATUS_PENDING=2; + const STATUS_STICKY=3; public $ID; public $AuthorID; public $AuthorName; diff --git a/demos/blog/protected/Layouts/MainLayout.tpl b/demos/blog/protected/Layouts/MainLayout.tpl index f3a77adc..8e2b1792 100644 --- a/demos/blog/protected/Layouts/MainLayout.tpl +++ b/demos/blog/protected/Layouts/MainLayout.tpl @@ -14,7 +14,7 @@ diff --git a/demos/blog/protected/Pages/Admin/PostMan.page b/demos/blog/protected/Pages/Admin/PostMan.page index 8ba8ef29..68ac44f8 100644 --- a/demos/blog/protected/Pages/Admin/PostMan.page +++ b/demos/blog/protected/Pages/Admin/PostMan.page @@ -43,7 +43,9 @@ <%# $this->Parent->DataItem->Status===0 ? 'Published' : - ($this->Parent->DataItem->Status===1 ? 'Draft' : 'Pending') + ($this->Parent->DataItem->Status===1 ? + 'Draft' : + ($this->Parent->DataItem->Status===2 ? 'Pending' : 'Sticky')) %> @@ -51,13 +53,14 @@ + PostGrid->CurrentPageIndex*$this->PostGrid->PageSize; $limit=$this->PostGrid->PageSize; - $this->PostGrid->DataSource=$this->DataAccess->queryPosts('','','ORDER BY a.status DESC, create_time DESC',"LIMIT $offset,$limit"); + $this->PostGrid->DataSource=$this->DataAccess->queryPosts('','','ORDER BY a.status DESC, modify_time DESC',"LIMIT $offset,$limit"); $this->PostGrid->VirtualItemCount=$this->DataAccess->queryPostCount('',''); $this->PostGrid->dataBind(); } 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/EditPost.page b/demos/blog/protected/Pages/Posts/EditPost.page index 97702848..eb55102a 100644 --- a/demos/blog/protected/Pages/Posts/EditPost.page +++ b/demos/blog/protected/Pages/Posts/EditPost.page @@ -34,6 +34,7 @@ Display="Dynamic"
+

diff --git a/demos/blog/protected/Pages/Posts/EditPost.php b/demos/blog/protected/Pages/Posts/EditPost.php index 24b58529..2638293d 100644 --- a/demos/blog/protected/Pages/Posts/EditPost.php +++ b/demos/blog/protected/Pages/Posts/EditPost.php @@ -41,7 +41,7 @@ class EditPost extends BlogPage $postRecord=$this->_postRecord; $this->Title->Text=$postRecord->Title; $this->Content->Text=$postRecord->Content; - $this->DraftMode->Checked=$postRecord->Status!==PostRecord::STATUS_PUBLISHED; + $this->DraftMode->Checked=$postRecord->Status===PostRecord::STATUS_DRAFT; $this->Categories->DataSource=$this->DataAccess->queryCategories(); $this->Categories->dataBind(); $cats=$this->DataAccess->queryCategoriesByPostID($postRecord->ID); diff --git a/demos/blog/protected/Pages/Posts/ListPost.php b/demos/blog/protected/Pages/Posts/ListPost.php index bed18222..c3b2bcc9 100644 --- a/demos/blog/protected/Pages/Posts/ListPost.php +++ b/demos/blog/protected/Pages/Posts/ListPost.php @@ -28,7 +28,7 @@ class ListPost extends BlogPage $this->_posts=$this->DataAccess->queryPosts( $this->getPostFilter(), $this->getCategoryFilter(), - 'ORDER BY create_time DESC', + 'ORDER BY a.status DESC, create_time DESC', 'LIMIT '.$this->getPageOffset().','.$this->getPageSize()); if($this->Request['cat']!==null) { @@ -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() @@ -73,7 +74,7 @@ class ListPost extends BlogPage private function getPostFilter() { - $filter='a.status=0'; + $filter='(a.status=0 OR a.status=3)'; if(($timeFilter=$this->getTimeFilter())!=='') return "$filter AND $timeFilter"; else diff --git a/demos/blog/protected/Pages/Posts/NewPost.php b/demos/blog/protected/Pages/Posts/NewPost.php index 7d02557d..bba09975 100644 --- a/demos/blog/protected/Pages/Posts/NewPost.php +++ b/demos/blog/protected/Pages/Posts/NewPost.php @@ -43,6 +43,7 @@ class NewPost extends BlogPage else $postRecord->Status=PostRecord::STATUS_PUBLISHED; $postRecord->CreateTime=time(); + $postRecord->ModifyTime=$postRecord->CreateTime; $postRecord->AuthorID=$this->User->ID; $cats=array(); foreach($this->Categories->SelectedValues as $value) diff --git a/demos/blog/protected/Pages/Posts/ViewPost.php b/demos/blog/protected/Pages/Posts/ViewPost.php index 8d0a7124..e45fd505 100644 --- a/demos/blog/protected/Pages/Posts/ViewPost.php +++ b/demos/blog/protected/Pages/Posts/ViewPost.php @@ -29,7 +29,7 @@ class ViewPost extends BlogPage if($this->_post===null) throw new BlogException(500,'post_id_invalid',$id); // if post is not published, only the author and admin can view it - if($this->_post->Status!==PostRecord::STATUS_PUBLISHED && !$this->User->IsAdmin && $this->User->ID!==$this->_post->AuthorID) + if($this->_post->Status!==PostRecord::STATUS_PUBLISHED && $this->_post->Status!==PostRecord::STATUS_STICKY && !$this->User->IsAdmin && $this->User->ID!==$this->_post->AuthorID) throw new BlogException(500,'post_view_disallowed',$id); $this->Title=htmlentities($this->_post->Title,ENT_QUOTES,'UTF-8'); } @@ -48,7 +48,7 @@ class ViewPost extends BlogPage public function onLoad($param) { parent::onLoad($param); - $this->Status->Visible=$this->_post->Status!==PostRecord::STATUS_PUBLISHED; + $this->Status->Visible=$this->_post->Status!==PostRecord::STATUS_PUBLISHED && $this->_post->Status!==PostRecord::STATUS_STICKY; $this->CategoryList->DataSource=$this->DataAccess->queryCategoriesByPostID($this->_post->ID); $this->CategoryList->dataBind(); $this->CommentList->DataSource=$this->DataAccess->queryCommentsByPostID($this->_post->ID); 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 1aabb2a5..10541a37 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -1544,11 +1544,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); - } } } } @@ -1581,11 +1576,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