⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layouttemplate.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

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

namespace CommunityServer.Galleries.Controls
{
	/// <summary>
	/// Provides the wire up necessary to use the CommunityServer.Controls.LayoutTemplate control 
	/// with Weblog Theming. Unlike controls deriving from WeblogThemedControl, this Layout control 
	/// provides NO security checks. It simply loads it child controls.
	/// </summary>
	public class LayoutTemplate : CommunityServer.Controls.LayoutTemplate
	{
		public LayoutTemplate() : base()
		{
			GalleryConfig = GalleryConfiguration.Instance();
		}

		protected GalleryConfiguration GalleryConfig = null;
		private Gallery gallery = null;

		/// <summary>
		/// Returns the CurrentWeb and calls Authorize
		/// </summary>
		public virtual Gallery CurrentGallery
		{
			get
			{
				if(gallery == null)
					gallery = Galleries.GetGallery(CSContext.Current.ApplicationKey);
				return gallery;
			}
		}

		/// <summary>
		/// Should match the logic found in WeblogThemedControl. Since we can not derive from the same base we have a 
		/// bit of extra logic
		/// </summary>
		protected override void CreateChildControls()
		{
			Controls.Clear();

			bool _skinLoaded = false;
            
			if(SkinTemplate != null ) 
			{
				SkinTemplate.InstantiateIn( this );
				_skinLoaded = true;
			}

			if(!_skinLoaded && this.Page != null)
			{
				string path = ThemeManager.Instance().SkinPath(this.ThemeName,Template);
				Control skin = this.Page.LoadControl( path );
				this.Controls.Add( skin );
				_skinLoaded = true;
			}

			if(_skinLoaded)
				AttachChildControls();

		}

		protected override void OnLoad(System.EventArgs e)
		{
			base.OnLoad (e);
			if(!Page.IsPostBack)
				DataBind();
		}

		public override void DataBind()
		{
			if(hideSideBar && (FindControl(sideBarID) != null))
				FindControl(sideBarID).Visible = false;

			base.DataBind();
		}


		/// <summary>
		/// Return our current theme
		/// </summary>
		protected override string ThemeName
		{
			get { return CurrentGallery.Theme; }
		}

		protected override string ExternalSkinFileName
		{
			get { return Template; }
		}

		private string template = "LayoutTemplate.ascx";
		public string Template
		{
			get { return template;}
			set { template = value;}
		}

		private bool hideSideBar = false;
		public bool HideSideBar
		{
			get { return hideSideBar; }
			set { hideSideBar = value; }
		}

		private string sideBarID = "leftmenu";
		public string SideBarID
		{
			get { return sideBarID; }
			set { sideBarID = value; }
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -