diff options
author | xue <> | 2006-05-31 03:12:35 +0000 |
---|---|---|
committer | xue <> | 2006-05-31 03:12:35 +0000 |
commit | 067ab51fbd9b2f18f63fc80895476e5b0e2f9bfb (patch) | |
tree | 4025d5e8379bef9de6bb4d251c2796c00e8503a2 /demos/blog/protected/Pages/Posts | |
parent | b87fd00a62994d24a3708cec5f5613ed2e9a67ed (diff) |
Merge from 3.0 branch till 1115.
Diffstat (limited to 'demos/blog/protected/Pages/Posts')
-rw-r--r-- | demos/blog/protected/Pages/Posts/EditPost.page | 1 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Posts/EditPost.php | 2 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Posts/ListPost.php | 5 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Posts/NewPost.php | 1 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Posts/ViewPost.php | 4 |
5 files changed, 8 insertions, 5 deletions
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);
|