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

using System;
using System.Web.UI.WebControls;
using CommunityServer.ControlPanel.Controls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;
using FormLabel = CommunityServer.ControlPanel.Controls.FormLabel;
using ResourceControl = CommunityServer.ControlPanel.Controls.ResourceControl;
using HelpIcon = CommunityServer.ControlPanel.Controls.HelpIcon;
using ResourceLinkButton = CommunityServer.ControlPanel.Controls.ResourceLinkButton;

namespace CommunityServer.ControlPanel.Photos.Options
{
	/// <summary>
	/// Summary description for AboutOptionsPage.
	/// </summary>
	public class AboutOptionsPage : BaseGalleryPage
	{

		#region Child Controls

        protected TextBox AboutTitle;
        protected Editor AboutDescription;
		protected FormLabel FormLabel1;
		protected FormLabel FormLabel2;
		protected MPContent DescriptionRegion;
		protected MPContent TaskRegion;
		protected MPContainer MPContainer;
		protected ResourceLinkButton SaveButton;
		protected ResourceControl Resourcecontrol1;
		protected ResourceControl Resourcecontrol2;
		protected HelpIcon Helpicon1;
		protected HelpIcon Helpicon2;
		protected HelpIcon Helpicon3;
		protected FormLabel Formlabel7;
		protected PanelTabControl PanelTabControl1;
		protected YesNoRadioButtonList ynEnableAbout;

		#endregion
	
		private void Page_Load(object sender, EventArgs e)
		{
           
			if(!IsPostBack)
			{
			    AboutTitle.Text = this.CurrentGallery.AboutTitle;
                AboutDescription.Text = this.CurrentGallery.AboutDescription;
				ynEnableAbout.SelectedValue = this.CurrentGallery.EnableAbout;
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
			this.SaveButton.Click += new EventHandler(SaveButton_Click);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new EventHandler(this.Page_Load);

		}
		#endregion

        private void SaveButton_Click(object sender, EventArgs e)
        {
            if(Page.IsValid)
            {
                CurrentGallery.AboutTitle = AboutTitle.Text;
                CurrentGallery.AboutDescription = AboutDescription.Text;
				CurrentGallery.EnableAbout = ynEnableAbout.SelectedValue;

            	CommunityServer.Galleries.Galleries.Update(CurrentGallery);

            }
        }
	}
}
