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

using System;
using CommunityServer.Components;
using CommunityServer.Discussions.Components;

namespace CommunityServer.Discussions.Controls
{
	/// <summary>
	/// Summary description for AggregateRssLink.
	/// </summary>
	public class AggregateRssLink : BaseRssLink
	{
		protected override bool IsInvalid()
		{
			return false;
		}

		protected override bool IsAvailableToPublic()
		{
			return csContext.User.IsAnonymous || !csContext.SiteSettings.EnableSecureSyndication;
		}

		protected override string Url
		{
			get { return ForumUrls.Instance().RssAggregate(Mode); }
		}

		[System.ComponentModel.DefaultValue(ThreadViewMode.Default)]
		public virtual ThreadViewMode Mode
		{
			get
			{
				Object state = ViewState["Mode"];
				if (state != null)
				{
					return (ThreadViewMode)state;
				}

				return ThreadViewMode.Default;
			}
			set { ViewState["Mode"] = value; }
		}

        protected override void SetRssAutoDiscovery()
        {
            SetRssAutoDiscovery("Forums Rss", base.HRef);
        }

	}

}
