⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comments.aspx.cs

📁 community server 源码
💻 CS
📖 第 1 页 / 共 2 页
字号:
//------------------------------------------------------------------------------
// <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.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;
using CPResourceManager = CommunityServer.ControlPanel.Components.ResourceManager;

namespace CommunityServer.ControlPanel.Blogs
{

    public class CommentActionsPopup : ClientPopulatedPopupMenu
    {
        protected override void OnInit(EventArgs e)
        {
            //this.ResourceName = "ContactPopupMenu_Text";
            this.Text = "Actions";
            base.OnInit (e);
        }

        protected override void OnPreRender(EventArgs e)
        {
            this.Parameters = new string[1];
            this.Parameters[0] = this.PostID.ToString();
            base.OnPreRender (e);
        }


        protected override System.Collections.ArrayList ClientMenuItemFormats
        {
            get
            {
                ArrayList list = new ArrayList();
                ClientMenuItemFormat format = null;

                format = new ClientMenuItemFormat();
                format.NavigateUrl = ViewUrl;
                format.Text = "View";
                format.ClientSideDisplayFunction = "new Function('parms', 'return true;')";
                list.Add(format);

                //<a href="javascript:Telligent_Modal.Open('commenteditor.aspx?cid=<%# DataBinder.Eval(Container.DataItem,"PostID") %>', 625, 475, refreshCallback);">

                format = new ClientMenuItemFormat();
                //format.NavigateUrl = ApproveUrl;
                format.Text = "Edit";
                format.ClientSideDisplayFunction = "new Function('parms', 'return true;')";
                format.ClientSideCommand = ModalHelper.BuildHandler(this.Page, "commenteditor.aspx?cid={0}",625,475,"refreshCallback");
                list.Add(format);


                format = new ClientMenuItemFormat();
                format.NavigateUrl = ApproveUrl;
                format.Text = "Publish";
                format.ClientSideDisplayFunction = "new Function('parms', 'return true;')";
                list.Add(format);

                format = new ClientMenuItemFormat();
                format.NavigateUrl = ModerateUrl;
                format.Text = "Unpublish";
                format.ClientSideDisplayFunction = "new Function('parms', 'return true;')";
                list.Add(format);

                format = new ClientMenuItemFormat();
                //format.NavigateUrl = DeleteUrl;
                format.Text = "Delete";
                format.ClientSideDisplayFunction = "new Function('parms', 'return true;')";
                //format.ClientSideCommand = "if(confirm('" + CommunityServer.ControlPanel.Components.ResourceManager.GetString("CP_Blog_Comments_Delete_Warning") +"')){window.location = " + this.DeleteUrl + ";}";
                format.ClientSideCommand =   "if(confirm('"+ CommunityServer.ControlPanel.Components.ResourceManager.GetString("CP_Blog_Comments_Delete_Warning") + "'  )){window.location = '" + this.DeleteUrl + "';}";
                //format.ClientSideCommand = "if(confirm('Yes or No')){alert('Yes');};";
                list.Add(format);
                return list;
            }
        }
   
        public string DeleteUrl;
        public string ApproveUrl;
        public string ViewUrl;
        public string ModerateUrl;
        public int PostID;
    }

	/// <summary>
	/// Summary description for PostEditorPage.
	/// </summary>
	public class CommentsPage : BaseBlogPage
	{
		protected CommunityServer.ControlPanel.Controls.ControlPanelSelectedNavigation SelectedNavigation1;
		protected CommunityServer.Controls.MPContent DescriptionRegion;
		protected CommunityServer.Controls.MPContent TaskRegion;
		protected CommunityServer.ControlPanel.Controls.ResourceControl Resourcecontrol1;
		protected CommunityServer.ControlPanel.Controls.ResourceControl Resourcecontrol2;
		protected CommunityServer.Controls.MPContainer MPContainer;
        protected Repeater theComments;

        protected IButton ActionButton;
        protected HelpIcon Helpicon1;
        protected ResourceControl FeedbackFilterLabel;
        protected DropDownList filterPost;
        protected DropDownList filterBlogPostType;
        protected DropDownList filterPublished;
        protected IButton FilterButton;
        protected Modal Modal1;
        protected DropDownList ActionList;
		protected DropDownList SpamFilter;
        protected IPagedControl csPager;

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

        [AjaxMethod(IncludeControlValuesWithCallBack=false)]
        public void Toggle(int postid)
        {
            WeblogPost post = WeblogPosts.GetPost(postid,false,false,false);
            post.IsApproved = !post.IsApproved;
            if(post.IsApproved)
            {
                if (((post.PostStatus & PostStatus.Spam) == PostStatus.Spam) || ((post.PostStatus & PostStatus.LikelySpam) == PostStatus.LikelySpam))
                {
					post.PostStatus &= ~PostStatus.Spam;
					post.PostStatus &= ~PostStatus.LikelySpam;
                    post.PostStatus |= PostStatus.Ham;
                    post.SpamScore = 0;
                }
            }
            WeblogPosts.Update(post);
        }

        /// <summary>
        /// The users prefered Grid Page Size, Will return default values before the OnLoad event
        /// Due to dependancy on CSConect.Current.User
        /// </summary>
        public int DefaultPageSize
        {
            get
            {
                    return Globals.SafeInt(this.CurrentUser.GetExtendedAttribute("CPPageSize"),10);
            }
        }

		private void Page_Load(object sender, EventArgs e)
		{
            AjaxManager.Register(this,"Comments");

            if(!this.IsCallBack)
            {
            theComments.ItemCreated +=new RepeaterItemEventHandler(theComments_ItemCreated);
            JavaScript.RegisterRefresh(this);
            //FilterButton.Click +=new EventHandler(FilterButton_Click);
            FilterButton.Attributes.Add("onclick", "redirectUrl();");
                if(!IsPostBack)
                {

                    BindFilters();

                    string action = Request.QueryString["action"];
                    if(action != null)
                        HandleActions(action);

                    CSContext context = CSContext.Current;

                    int parentid = context.GetIntFromQueryString("pid",-1);
                    int bpt = context.GetIntFromQueryString("bpt",-1);
                    int sf = context.GetIntFromQueryString("spam", 0); 

                    BlogThreadQuery query = new BlogThreadQuery();
                    query.SectionID = CurrentWeblog.SectionID;
			
                    // Show posts for an inactive section if the user is an admin
                    query.RequireSectionIsActive = !context.User.IsAdministrator;

                    query.PageSize = this.DefaultPageSize;
                    query.PageIndex = context.PageIndex;
                    query.ParentID = parentid;

                    if(bpt == -1)
                        query.BlogPostType = BlogPostType.Comment | BlogPostType.PersonalComment | BlogPostType.Trackback;
                    else
                    {
                        query.BlogPostType = (BlogPostType)bpt;
                    }
            	
                    CommunityServer.Spam.SpamConfiguration spamConfig = CommunityServer.Spam.SpamConfiguration.Instance();
                    switch(sf)
                    {
                        case 0: 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -