summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-05-31 03:12:35 +0000
committerxue <>2006-05-31 03:12:35 +0000
commit067ab51fbd9b2f18f63fc80895476e5b0e2f9bfb (patch)
tree4025d5e8379bef9de6bb4d251c2796c00e8503a2
parentb87fd00a62994d24a3708cec5f5613ed2e9a67ed (diff)
Merge from 3.0 branch till 1115.
-rw-r--r--HISTORY1
-rw-r--r--demos/blog/protected/Common/BlogDataModule.php5
-rw-r--r--demos/blog/protected/Layouts/MainLayout.tpl2
-rw-r--r--demos/blog/protected/Pages/Admin/PostMan.page7
-rw-r--r--demos/blog/protected/Pages/Admin/PostMan.php2
-rw-r--r--demos/blog/protected/Pages/ErrorReport.page2
-rw-r--r--demos/blog/protected/Pages/Posts/EditPost.page1
-rw-r--r--demos/blog/protected/Pages/Posts/EditPost.php2
-rw-r--r--demos/blog/protected/Pages/Posts/ListPost.php5
-rw-r--r--demos/blog/protected/Pages/Posts/NewPost.php1
-rw-r--r--demos/blog/protected/Pages/Posts/ViewPost.php4
-rw-r--r--demos/blog/protected/Pages/SearchPost.page2
-rw-r--r--framework/Web/UI/TControl.php11
-rw-r--r--tests/FunctionalTests/validators/tests/RequiredListTestCase.php26
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 @@
<com:TForm>
<div id="header">
-<h1 id="header-title"><a href="?"><%$ SiteTitle %></a></h1>
+<h1 id="header-title"><a href="<%=$this->Request->ApplicationUrl %>"><%$ SiteTitle %></a></h1>
<h2 id="header-subtitle"><%$ SiteSubtitle %></h2>
</div><!-- end of header -->
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'))
%>
</prop:ItemTemplate>
<prop:EditItemTemplate>
@@ -51,13 +53,14 @@
<com:TListItem Value="0" Text="Published" />
<com:TListItem Value="1" Text="Draft" />
<com:TListItem Value="2" Text="Pending" />
+ <com:TListItem Value="3" Text="Sticky" />
</com:TDropDownList>
</prop:EditItemTemplate>
</com:TTemplateColumn>
<com:TBoundColumn
HeaderText="Time"
ReadOnly="true"
- DataField="CreateTime"
+ DataField="ModifyTime"
DataFormatString="#date('M j, Y',{0})"
ItemStyle.Wrap="false"
ItemStyle.Width="90px"
diff --git a/demos/blog/protected/Pages/Admin/PostMan.php b/demos/blog/protected/Pages/Admin/PostMan.php
index 349278fc..09c1809c 100644
--- a/demos/blog/protected/Pages/Admin/PostMan.php
+++ b/demos/blog/protected/Pages/Admin/PostMan.php
@@ -23,7 +23,7 @@ class PostMan extends BlogPage
{
$offset=$this->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" %>
+
<com:TContent ID="Main">
<h2>Error</h2>
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"
<br/>
<com:TCheckBox ID="DraftMode" Text="in draft mode (the post will not be published)" />
+
<br/>
<br/>
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" %>
+
<com:TContent ID="Main">
<div class="search-title">
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 @@
<?php
-class RequiredListTestCase extends SeleniumTestCase
+class RequiredListTestCase extends SeleniumTestCase
{
-
+
function test()
{
$base = "ctl0_Content_";
@@ -12,28 +12,28 @@ class RequiredListTestCase extends SeleniumTestCase
$this->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");
}
}