📄 entrypostcommentcontainer.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
namespace CommunityServer.Blogs.Controls
{
/// <summary>
/// Summary description for ViewBlogPost.
/// </summary>
public class EntryPostCommentContainer : WeblogThemedControl
{
private EntryView entry = null;
private CommentForm form = null;
private EntryComments comments = null;
public EntryPostCommentContainer():base()
{
}
protected override void AttachChildControls()
{
entry = FindControl( "Entry" ) as EntryView;
form = FindControl( "form" ) as CommentForm;
comments = FindControl( "Comments" ) as EntryComments;
if(entry == null || form == null || comments == null)
return;
BindData();
}
void BindData()
{
CSContext csContext = CSContext.Current;
WeblogPost we = WeblogPosts.GetPost(csContext.PostID,false,true,true);
if(we != null && CurrentWeblog.SectionID == we.SectionID && CurrentWeblog.EnableNewComments(we,CurrentUser))
{
entry.DataSource = we;
entry.DataBind();
form.DataSource = we;
form.DataBind();
// Retrieve comments to populate EntryComments control
BlogPostQuery query = new BlogPostQuery();
query.PostID = csContext.PostID;
string name = Context.Request.QueryString["PostName"];
if(!Globals.IsNullorEmpty(name))
query.Name = name;
query.IncludeCategories = false;
query.ReturnFullThread = true;
query.BlogID = CurrentWeblog.SectionID;
PostSet ps = WeblogPosts.GetPosts(query,true);
if(ps != null)
{
comments.DataSource = ps;
comments.DataBind();
}
this.SetPageTitle(we.Subject);
}
else
{
csContext.Context.Response.Redirect(BlogUrls.Instance().Post(we,CurrentWeblog));
csContext.Context.Response.End();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -