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

📄 aggregateforumrsswriter.cs

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

using System;
using System.Collections;
using CommunityServer.Components;
using CommunityServer.Configuration;

namespace CommunityServer.Discussions.Components
{
	/// <summary>
	/// Summary description for AggregateForumRssWriter.
	/// </summary>
	public class AggregateForumRssWriter : BaseForumsRssWriter
	{
		protected ThreadViewMode CurrentMode = ThreadViewMode.Active;

		public AggregateForumRssWriter(ArrayList threads, ThreadViewMode mode, string baseUrl) : base(threads, null, baseUrl)
		{
			CurrentMode = mode;
		}

		protected override string Title
		{
			get
			{
				string siteName = CSContext.Current.SiteSettings.SiteName;

				switch (CurrentMode)
				{
					case ThreadViewMode.Active:
						return string.Format("{0}: Active Threads", siteName);
//					case ThreadViewMode.MyForums:
//						return string.Format("{0}: My Threads", siteName);
//					case ThreadViewMode.NotRead:
//						return string.Format("{0}: Unread Threads", siteName);
//					case ThreadViewMode.PrivateMessages:
//						return string.Format("{0}: Private Messages", siteName);
					case ThreadViewMode.Unanswered:
						return string.Format("{0}: Unanswered Threads", siteName);
					case ThreadViewMode.Videos:
						return string.Format("{0}: Video Threads", siteName);
					default:
						return siteName;
				}
			}
		}

		protected string Description
		{
			get
			{
				switch (CurrentMode)
				{
					case ThreadViewMode.Active:
						return "Posts with recent activity";
//					case ThreadViewMode.MyForums:
//						return "Posts and Threads you have participated in";
//					case ThreadViewMode.NotRead:
//						return "Posts that you have not read";
//					case ThreadViewMode.PrivateMessages:
//						return "Private messages sent to you from other forum members";
					case ThreadViewMode.Unanswered:
						return "Posts that are unanswered";
					case ThreadViewMode.Videos:
						return "Posts that contain inline videos";
					default:
						return "All Posts";
				}
			}
		}

		protected override void WriteChannel()
		{
			BuildChannel(ForumUrls.Instance().PostsThreadView(CurrentMode), Description, CSConfiguration.GetConfig().DefaultLanguage);
		}

		protected override bool AllowComments
		{
			get { return false; }
		}

		protected override void PostComments(Post p)
		{
			base.PostComments (p);
			this.WriteElementString("comments", FormatUrl(SiteUrls.Instance().Post(p.PostID)));

			string url = FormatUrl(ForumUrls.Instance().CommentRss(p.SectionID, p.PostID));
			CSContext cntx = CSContext.Current;
			if (!cntx.IsUserTokenRequest)
				this.WriteElementString("wfw:commentRss", url);
			else
				this.WriteElementString("wfw:commentRss", SiteUrls.FormatUrlWithUserNameToken(url, cntx.User, true));
		}

		protected override string GetUserName(Post p)
		{
			User u = p.User;
			if (u == null)
				u = Users.GetUser(p.UserID, p.Username, false, true);

			if (u != null)
				return u.DisplayName;
			else
				return p.Username;
		}

	}
}

⌨️ 快捷键说明

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