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 | |
parent | b87fd00a62994d24a3708cec5f5613ed2e9a67ed (diff) |
Merge from 3.0 branch till 1115.
Diffstat (limited to 'demos/blog/protected')
-rw-r--r-- | demos/blog/protected/Common/BlogDataModule.php | 5 | ||||
-rw-r--r-- | demos/blog/protected/Layouts/MainLayout.tpl | 2 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Admin/PostMan.page | 7 | ||||
-rw-r--r-- | demos/blog/protected/Pages/Admin/PostMan.php | 2 | ||||
-rw-r--r-- | demos/blog/protected/Pages/ErrorReport.page | 2 | ||||
-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 | ||||
-rw-r--r-- | demos/blog/protected/Pages/SearchPost.page | 2 |
11 files changed, 22 insertions, 11 deletions
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">
|