private void ResetCommentFields()
{
if (this.tbComment != null)
this.tbComment.Text = string.Empty;
if (this.tbEmail != null)
this.tbEmail.Text = SecurityHelper.IsAdmin ? Config.CurrentBlog.Email : string.Empty;
if (this.tbName != null)
this.tbName.Text = SecurityHelper.IsAdmin ? Config.CurrentBlog.UserName : string.Empty;
if(entry == null)
entry = Cacher.GetEntryFromRequest(CacheDuration.Short);
if (this.tbTitle != null)
this.tbTitle.Text = "re: " + HttpUtility.HtmlDecode(entry.Title);
if (this.tbUrl != null)
this.tbUrl.Text = SecurityHelper.IsAdmin ? Config.CurrentBlog.HomeFullyQualifiedUrl.ToString() : string.Empty;
HttpCookie user = Request.Cookies["CommentUser"];
if (user != null)
{
tbName.Text = user.Values["Name"];
tbUrl.Text = user.Values["Url"];
// Remember by default if no-checkbox.
if (this.chkRemember != null && this.chkRemember.Checked)
{
this.chkRemember.Checked = true;
}
//Check to see if email textbox is present
if (this.tbEmail != null && user.Values["Email"] != null)
{
this.tbEmail.Text = user.Values["Email"];
}
}
if (IsCommentsRendered)
{
if (entry.CommentingClosed)
{
this.Controls.Clear();
this.Controls.Add(new LiteralControl("<div class=\"commentsClosedMessage\"><span style=\"font-style: italic;\">Comments have been closed on this topic.</span></div>"));
}
else
{
tbTitle.Text = "re: " + HttpUtility.HtmlDecode(entry.Title);
}
}
else
{
this.Controls.Clear();
}
}