//------------------------------------------------------------------------------
//
// Copyright (c) Telligent Systems Corporation. All rights reserved.
//
//------------------------------------------------------------------------------
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
namespace CommunityServer.Blogs.Controls
{
///
/// Summary description for ViewBlogPost.
///
public class EntryPostCommentContainer : WeblogThemedControl
{
private EntryView entry = null;
private CommentForm form = null;
private EntryComments comments = null; // DBVT Added to display comments with commenf form
public EntryPostCommentContainer():base()
{
}
protected override void AttachChildControls()
{
entry = FindControl( "Entry" ) as EntryView;
form = FindControl( "form" ) as CommentForm;
comments = FindControl( "Comments" ) as EntryComments; // DBVT Added to display comments with commenf form
if(entry == null || form == null || comments == null)
return;
BindData();
}
void BindData()
{
CSContext csContext = CSContext.Current;
WeblogPost we = WeblogPosts.GetPost(csContext.PostID,Users.GetUser(true).UserID,false,true,true);
if(we != null && CurrentWeblog.SectionID == we.SectionID && CurrentWeblog.EnableNewComments(we,CurrentUser))
{
entry.DataSource = we;
entry.DataBind();
form.DataSource = we;
form.DataBind();
#region DBVT Added to display comments with new comment form
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;
comments.DataSource = WeblogPosts.GetPosts(query,true);
comments.DataBind();
#endregion
this.SetPageTitle(we.Subject);
}
else
{
csContext.Context.Response.Redirect(BlogUrls.Instance().Post(we,CurrentWeblog));
csContext.Context.Response.End();
}
}
}
}