📄 interestingposts.aspx.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.Blogs.Components;
using CommunityServer.ControlPanel.Components;
using CommunityServer.ControlPanel.Controls;
using CommunityServer.ControlPanel.UI;
using ResourceManager = CommunityServer.ControlPanel.Components.ResourceManager;
namespace CommunityServer.ControlPanel.BlogAdmin
{
/// <summary>
/// Summary description for GeneralOptionsPage.
/// </summary>
public class InterestingPostsOptionsPage : BaseBlogAdminPage
{
#region Child Controls
protected CheckBox enableFactors;
protected FileOnlyStatusMessage FOStatus;
protected ConfigOKStatusMessage Status;
protected PlaceHolder OptionHolder;
protected ResourceLinkButton SaveButton;
protected TextBox DateFactor;
protected TextBox ViewFactor;
protected TextBox RatingFactor;
protected TextBox CommentFactor;
protected DropDownList PostsToUse;
#endregion
override protected void OnInit(EventArgs e)
{
this.SaveButton.Click += new EventHandler(this.SaveButton_Click);
this.Load += new EventHandler(this.Page_Load);
base.OnInit(e);
}
private void Page_Load(object sender, EventArgs e)
{
SaveButton.Text = ResourceManager.GetString("Save");
if(!IsPostBack)
{
WeblogConfiguration config = WeblogConfiguration.Instance(false);
if(config.FileOnly)
{
FOStatus.Visible = true;
OptionHolder.Visible = false;
}
else
{
enableFactors.Checked = config.ScorePosts;
ListItem li = PostsToUse.Items.FindByValue(config.PostsToScore.ToString());
if(li != null)
li.Selected = true;
DateFactor.Text = config.DateScoreFactor.ToString();
ViewFactor.Text = config.ViewScoreFactor.ToString();
CommentFactor.Text = config.CommentScoreFactor.ToString();
RatingFactor.Text = config.RatingScoreFactor.ToString();
}
}
}
private void SaveButton_Click(object sender, EventArgs e)
{
if(Page.IsValid)
{
WeblogConfiguration config = WeblogConfiguration.Instance(false);
if(!config.FileOnly)
{
config.ScorePosts = enableFactors.Checked;
config.DateScoreFactor = double.Parse(DateFactor.Text);
config.ViewScoreFactor = double.Parse(ViewFactor.Text);
config.CommentScoreFactor = double.Parse(CommentFactor.Text);
config.RatingScoreFactor = double.Parse(RatingFactor.Text);
config.PostsToScore = Int32.Parse(PostsToUse.SelectedValue);
Status.Visible = true;
config.Save();
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -