baseforumsyndicationhandler.cs

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

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

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

namespace CommunityServer.Discussions.Components
{
	/// <summary>
	/// Base class for all Forum Syndication feeds
	/// </summary>
	public abstract class BaseForumSyndicationHandler : BaseSyndicationHandler
	{

		protected ForumConfiguration _forumConfig;
		protected ForumConfiguration ForumConfig
		{
			get
			{
				if (_forumConfig == null)
					_forumConfig = ForumConfiguration.Instance();

				return _forumConfig;
			}
		}

		public BaseForumSyndicationHandler()
		{
		}

		/// <summary>
		/// The length of time the feed should be cached in seconds.
		/// </summary>
		protected override int CacheTime
		{
			get
			{
				return CSCache.SecondFactorCalculate(ForumConfig.RssCacheWindowInSeconds);
			}
		}

		/// <summary>
		/// The Fully Qualifed part of the Url for the current request
		/// </summary>
		protected override string BaseUrl
		{
			get { return Globals.HostPath(Context.Request.Url); }
		}


		private Forum _forum;
		protected override Section GetCurrentSection
		{
			get
			{
				if(_forum == null)
				{
					_forum = Forums.GetForum(CSContext.Current.SectionID, true, false);
					if(_forum == null)
						throw new CSException(CSExceptionType.SectionNotFound,"The forum could not be found");

					Permissions.AccessCheck(_forum,Permission.Read,CSContext.Current.User);
				}
				return _forum;
			}
		}


	}
}

⌨️ 快捷键说明

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