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

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Files.Components;
using CommunityServer.Components;

namespace CommunityServer.ControlPanel.Files
{
	/// <summary>
	/// Summary description for _default.
	/// </summary>
	public class _default : BaseFilesPage
	{
		protected System.Web.UI.WebControls.Literal Owners;
		protected System.Web.UI.WebControls.Literal DateCreated;
		protected System.Web.UI.WebControls.Literal PostCount;
		protected System.Web.UI.WebControls.Literal PostRecentTitle;
		protected System.Web.UI.WebControls.Literal PostRecentAuthor;
		protected System.Web.UI.WebControls.Literal PostRecentDate;
		protected System.Web.UI.WebControls.Literal CommentCount;
		protected PlaceHolder RecentPostArea;
		protected CommunityServer.ControlPanel.Controls.ResourceControl NoRecentPost;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			CSContext cntx = CSContext.Current;
			PostCount.Text = CurrentFolder.TotalThreads.ToString();
			CommentCount.Text = (CurrentFolder.TotalPosts - CurrentFolder.TotalThreads).ToString();
			DateCreated.Text = CurrentFolder.DateCreated.ToString(cntx.User.Profile.DateFormat);
			
			if (!Globals.IsNullorEmpty(CurrentFolder.MostRecentPostAuthor))
			{
				PostRecentAuthor.Text = CurrentFolder.MostRecentPostAuthor;
				PostRecentDate.Text = CurrentFolder.MostRecentPostDate.ToString(cntx.User.Profile.DateFormat);
			}
			else
			{
				RecentPostArea.Visible = false;
				NoRecentPost.Visible = true;
			}
			
			Owners.Text = CurrentFolder.Owners;
		}

		#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);
		}
		
		/// <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 System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
