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

using System.Web.UI;
using System.Web.UI.WebControls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Galleries.Components;

namespace CommunityServer.ControlPanel.Controls
{
	/// <summary>
	/// Summary description for CurrentGallery.
	/// </summary>
	public class CurrentGallery : Control
	{
		public CurrentGallery()
		{
		
		}

		protected override void Render(HtmlTextWriter writer)
		{
			BaseGalleryPage GalleryPage = this.Page as BaseGalleryPage;
			Gallery g = null;
			if(GalleryPage != null)
				g = GalleryPage.CurrentGallery;
			
			if(g != null)
			{
				HyperLink link = new HyperLink();
				link.Text = g.Name;
				link.NavigateUrl = GalleryUrls.Instance().ViewGallery(g.ApplicationKey);
				link.RenderControl(writer);
			}
			else
			{
				writer.Write("Unknown");
			}
		}

	}
}
