📄 layouttemplate.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Web.UI;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
namespace CommunityServer.Blogs.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()
{
WeblogConfig = WeblogConfiguration.Instance();
}
protected WeblogConfiguration WeblogConfig = null;
private Weblog weblog = null;
/// <summary>
/// Returns the CurrentWeb and calls Authorize
/// </summary>
public virtual Weblog CurrentWeblog
{
get
{
if(weblog == null)
weblog = Weblogs.GetWeblog(CSContext.Current.ApplicationKey,true);
return weblog;
}
}
/// <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();
}
/// <summary>
/// Return our current theme
/// </summary>
protected override string ThemeName
{
get
{
if(WeblogConfig.EnableThemes)
return CurrentWeblog.Theme;
else
return WeblogConfig.DefaultTheme;
}
}
protected override string ExternalSkinFileName
{
get{ return Template;}
}
private string _template = "LayoutTemplate.ascx";
public string Template
{
get{ return _template;}
set { _template = value;}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -