summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-05-31 00:33:26 +0000
committerxue <>2006-05-31 00:33:26 +0000
commite3b10414305b181aa4e39e211cf6b0e9bf992518 (patch)
tree780cf0f0eab6ca0a216a3cdbc960ac4585eaf922
parentac746689f6ba6efc4e8fac69d19e4daa7393d7fb (diff)
Added sticky feature for published posts.
-rw-r--r--demos/blog/protected/Common/BlogDataModule.php1
-rw-r--r--demos/blog/protected/Pages/Admin/PostMan.page5
-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.php4
5 files changed, 9 insertions, 4 deletions
diff --git a/demos/blog/protected/Common/BlogDataModule.php b/demos/blog/protected/Common/BlogDataModule.php
index 3dc71989..9c074260 100644
--- a/demos/blog/protected/Common/BlogDataModule.php
+++ b/demos/blog/protected/Common/BlogDataModule.php
@@ -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/Pages/Admin/PostMan.page b/demos/blog/protected/Pages/Admin/PostMan.page
index 8ba8ef29..8c78574c 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,6 +53,7 @@
<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>
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..8c51546f 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)
{
@@ -73,7 +73,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