📄 blogposttoolbar.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.Controls;
namespace CommunityServer.Blogs.Controls
{
/// <summary>
/// Summary description for BlogPostToolBar.
/// </summary>
public class BlogPostToolBar : WeblogThemedControl
{
public BlogPostToolBar()
{
}
private PostReplyButton replyButton;
private BlogRatePost rateButton;
private BlogThreadSubscribeLinkButton threadSubButton;
private HyperLink EditLink = null;
protected override void AttachChildControls()
{
(FindControl("Message") as HtmlGenericControl).Visible = (Context.Request.QueryString["CommentPosted"] != null);
replyButton = FindControl("ReplyButton") as PostReplyButton;
rateButton = FindControl("RatePost") as BlogRatePost;
threadSubButton = FindControl("BlogThreadButton") as BlogThreadSubscribeLinkButton;
EditLink = FindControl("EditLink") as HyperLink;
rateButton.RatingsChanged +=new System.EventHandler(rateButton_RatingsChanged);
//rateButton.Post
}
public override void DataBind()
{
base.DataBind ();
if(CurrentPost != null)
{
bool enableComments = CurrentWeblog.EnableNewComments(CurrentPost,CurrentUser);
replyButton.Visible = enableComments;
threadSubButton.Visible = enableComments && !CurrentUser.IsAnonymous;
rateButton.Visible = !CurrentUser.IsAnonymous && CurrentPost.EnableRatings;
if(enableComments)
{
threadSubButton.Post = CurrentPost;
replyButton.Post = CurrentPost;
}
rateButton.Post = CurrentPost;
if(Permissions.ValidatePermissions(this.CurrentWeblog,Permission.Post,this.CurrentUser))
{
EditLink.NavigateUrl = BlogUrls.Instance().PostEditor(this.CurrentWeblog.ApplicationKey,CurrentPost.PostID);
EditLink.Text = ResourceManager.GetString("Edit");
EditLink.ToolTip = ResourceManager.GetString("Weblog_EntryList_Edit");
EditLink.Visible = true;
}
else
{
EditLink.Visible = false;
((Literal)FindControl("Sep3")).Visible = false;
}
}
else
{
this.Controls.Clear();
this.Visible = false;
}
}
protected override void OnPreRender(System.EventArgs e)
{
if(replyButton.Visible == false)
((Literal)FindControl("Sep1")).Visible = false;
if(threadSubButton.Visible == false)
((Literal)FindControl("Sep3")).Visible = false;
if(rateButton.Visible == false)
((Literal)FindControl("Sep2")).Visible = false;
base.OnPreRender (e);
}
private WeblogPost _currentPost;
/// <summary>
/// Property CurrentPost (WeblogPost)
/// </summary>
public WeblogPost CurrentPost
{
get { return this._currentPost; }
set { this._currentPost = value; }
}
private void rateButton_RatingsChanged(object sender, System.EventArgs e)
{
(FindControl("Message") as HtmlGenericControl).Visible = true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -