gallerycategoryrsswriter.cs

来自「community server 源码」· CS 代码 · 共 71 行

CS
71
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Collections;
using CommunityServer.Components;

namespace CommunityServer.Galleries.Components
{
	/// <summary>
	/// Generates an XML feed by a specific category
	/// </summary>
	public class GalleryCategoryRssWriter : GalleryRssWriter
	{

		protected ArrayList categories;

		public GalleryCategoryRssWriter(ArrayList categories, Gallery gallery, string baseUrl) : base(new ArrayList(), gallery, baseUrl)
		{
			this.categories = categories;
		}

        //Should we support enclosures?
        protected override string EnclosureUrl(PostAttachmentMetaData pa)
        {
            return null;
        }

        protected override void WritePostEnclosure(Post p)
        {
            
        }

		/// <summary>
		/// Appends the CategoryName to Title element
		/// </summary>
		protected override string Title
		{
			get
			{
				return string.Concat(base.Title, " : ", Category.Name);
			}
		}

		protected override void WriteChannel()
		{
			foreach(PostCategory c in categories)
			{
				Category = c;
				// Determine whether to write Categories or Tags to the RSS feed
				if (CurrentGallery.CategorizationType == CategorizationType.Album)
					BuildChannel(GalleryUrls.Instance().ViewCategory(CurrentGallery.ApplicationKey, c.CategoryID), c.Description, CurrentGallery.DefaultLanguage);
				else
					BuildChannel(GalleryUrls.Instance().TagsBrowser(CurrentGallery.ApplicationKey, new string[] {c.Name}), string.Format("{0}: {1}", ResourceManager.GetString("Tags"), c.Name), CurrentGallery.DefaultLanguage);
			}
		}

		protected override bool AllowComments
		{
			get
			{
				return base.AllowComments && CurrentGallery.EnableCommentsDefault;
			}
		}


	}
}

⌨️ 快捷键说明

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