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

📄 aggregatersshandler.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using CommunityServer.Components;

namespace CommunityServer.Blogs.Components
{
	/// <summary>
	/// Summary description for AggregateRssHandler.
	/// </summary>
	public class AggregateRssHandler : BaseWeblogSyndicationHandler
	{
		public AggregateRssHandler()
		{
			//
			// TODO: Add constructor logic here
			//
		}

        protected Group CurrentGroup = null;

        protected bool HasGroup
        {
            get
            {
                return CurrentGroup != null;
            }
        }

        protected override void ProcessFeed()
        {
            int groupID = Globals.SafeInt(Context.Request.QueryString["GroupID"],-1);
            if(groupID > -1)
                CurrentGroup = WeblogGroups.GetWeblogGroup(groupID,true,false);

            base.ProcessFeed ();
        }

        protected override Section GetCurrentSection
        {
            get
            {
                return null;
            }
        }



	    protected override int CacheTime
	    {
	        get { return 120; }
	    }

	    protected override string CacheKey
	    {
	        get
	        {
                if(!HasGroup)
                    return string.Format("WeblogAggregate:{0}:IndividualRss",CSContext.Current.SiteSettings.SettingsID);
                else
                    return string.Format("WeblogAggregate:{0}:GroupID{1}",CSContext.Current.SiteSettings.SettingsID,CurrentGroup.GroupID);
	        }
	    }

	    protected override CachedFeed BuildFeed()
	    {
            BlogThreadQuery query = new BlogThreadQuery();
            query.BlogPostType = BlogPostType.Post;
            query.IncludeCategories = false;
            query.PageIndex = 0;
            query.PageSize = WeblogConfiguration.Instance().AggregatePostCount;
			query.IgnorePaging = true;
            query.SortBy = BlogThreadSortBy.MostRecent;
            query.SortOrder = SortOrder.Descending;
            query.IsPublished = true;
			query.PostConfig = BlogPostConfig.IsCommunityAggregated | BlogPostConfig.IsAggregated;
			query.FilterByList = Sections.FilterByAccessControl(Weblogs.GetWeblogs(false,true,false),Permission.View);
           
            if(HasGroup)
                query.BlogGroupID = CurrentGroup.GroupID;

            
            ThreadSet threads = WeblogPosts.GetBlogThreads(query,true);
            BaseRssWriter writer = null;

            
            writer = new AggregateRssWriter(threads.Threads,this.CurrentGroup,this.BaseUrl);
           
            DateTime dt =  threads.Threads.Count > 0 ? ((WeblogPost)threads.Threads[0]).PostDate : DateTime.Now;
            
            return new CachedFeed(dt,null,writer.GetXml());
	    }
	}
}

⌨️ 快捷键说明

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