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

📄 aggregatersswriter.cs

📁 community server 源码
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Collections;
using CommunityServer.Components;

namespace CommunityServer.Files.Components
{
	/// <summary>
	/// Summary description for AggregateRssWriter.
	/// </summary>
	public class AggregateRssWriter : BaseRssWriter
	{
        protected Group CurrentGroup = null;

        protected bool HasGroup
        {
            get
            {
                return CurrentGroup != null;
            }
        }
        public AggregateRssWriter(ArrayList posts, Group group, string baseUrl):base(posts,null, baseUrl)
        {
			CurrentGroup = group;
        }

        protected override string Title
        {
            get
            {
                return CSContext.Current.SiteSettings.SiteName;
            }
        }

        protected override string EnclosureUrl(PostAttachmentMetaData pa)
        {
            if(pa.IsRemote)
                return pa.FileName;

            //Folder f = Folders.GetFolder(pa.SectionID);

            return this.BaseUrl + FileGalleryUrls.Instance().Download(pa.PostID);
        }

        protected override void PostBody(Post p)
        {
            Entry fgp = p as Entry;
            if(fgp == null)
                base.PostBody(p);
            else
            {
                string desc = null;
//                if(fgp.SyndicateExcerpt)
//                {
//                    if(fgp.HasExcerpt)
//                    {
//                        desc = fgp.Excerpt;
//                    }
//                    else
//                    {
//                        desc = Formatter.RemoveHtml(p.RenderedBody(PostTarget.Syndication),500) ;
//                    }
//
//                    desc = string.Format("{0}...(<a href=\"{1}\">read more</a>)",desc,FormatUrl(BuildLink(p)));
//                }
//                else
                {
                    desc = p.RenderedBody(PostTarget.Syndication);
                }
            
				//agg view on the aggregate post?

//				if(Folders.GetFolder(fgp.SectionID).EnableAggBugs)
//					desc = string.Format("{0}<img src=\"{1}\" width=\"1\" height=\"1\">",desc,FormatUrl(Globals.GetSiteUrls().AggView(wp.PostID)));

                base.WriteElementString("description",desc);
            }
           
        }


        protected override void WriteItem(Post p)
        {
            base.WriteItem (p);
        }


        protected override void WriteChannel()
        {
            string url = null;
            string desc = null;
            if(HasGroup)
            {
                url = FileGalleryUrls.Instance().ViewFolderGroup(CurrentGroup.GroupID);
                desc = CurrentGroup.Name;
            }
            else
            {
                url = FileGalleryUrls.Instance().Home;
                desc = CSContext.Current.SiteSettings.SiteDescription;

            }
            
            BuildChannel(url,desc);
        }
        protected override string BuildLink(Post p)
        {
            return FileGalleryUrls.Instance().ViewEntry(p.Section.ApplicationKey, p.PostID);
        }

		protected override string GetUserName(Post p)
		{
			Entry fgp = p as Entry;
			if (fgp == null)
				return base.GetUserName(p);
			else
				return Globals.HtmlDecode(fgp.DisplayName);
		}

	}
}

⌨️ 快捷键说明

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