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

using System.Web;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;
using CommunityServer.Mail.Common.Components;
using Telligent.Registration;

namespace CommunityServer.ControlPanel.Blogs
{
	/// <summary>
	/// Summary description for SkinTabValidator.
	/// </summary>
	public class BlogByEmailTabValidator : IMenuItem
	{
		public bool IsValid(HttpContext context)
		{
			BaseBlogPage BlogPage = HttpContext.Current.Handler as BaseBlogPage;
			Weblog w = BlogPage.CurrentWeblog;
			if(w != null)
			{
				if (CSContext.Current.SiteSettings.EnableMailGateway)
				{
					MailingList list = MailingLists.GetMailingList(w.SectionID);
					if(list != null)
						return list.IsMailingList;
				}
			}
			return false;
		}
	}
}
