📄 weblogthemedcontrol.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;
using CommunityServer.Controls;
namespace CommunityServer.Blogs.Controls
{
/// <summary>
/// Summary description for WeblogThemedControl.
/// </summary>
public abstract class WeblogThemedControl : WeblogTemplatedWebControl
{
public WeblogThemedControl()
{
}
private ThemeConfig themeConfig = null;
protected override string ThemeName
{
get{ return CurrentWeblog.Theme;}
}
protected ThemeConfig ThemeConfig
{
get
{
if(themeConfig == null)
themeConfig = ThemeManager.Instance().GetTheme(ThemeName);
return themeConfig;
}
}
/// <summary>
/// All skins should be found in the skin directory and named after the control.
/// </summary>
protected override string ExternalSkinFileName
{
get
{
string name = Globals.IsNullorEmpty(this.SkinName) ? "Skin-" + this.GetType().Name + ".ascx" : SkinName;
return string.Format("Skins/{0}",name);
//return CreateExternalSkinFileName(null);
}
}
protected override bool LoadThemedControl()
{
if(this.Page != null)
{
string path = ThemeManager.Instance().SkinPath(this.ThemeName,ExternalSkinFileName);
Control skin = this.Page.LoadControl( path );
skin.ID="_";
this.Controls.Add( skin );
return true;
}
return false;
}
protected override bool LoadDefaultThemedControl()
{
return false;
}
protected void SetLocation(string text)
{
if(IsPublicBlog)
{
UsersOnline.SetLocation(text,CSContext.Current.RawUrl);
}
else
{
UsersOnline.PrivateLocation();
}
}
protected void SetPageTitle(string text)
{
if(EnableTitle)
{
if(Globals.IsNullorEmpty(text))
text = CurrentWeblog.Name;
else
text = (string.Format("{0} : {1}", CurrentWeblog.Name,text));
CommunityServer.Controls.Head.AddTitle(text,Context);
SetLocation(text);
}
}
protected void SetVisibilityIfExists(string name, bool isVisible)
{
Control cntrl = FindControl(name);
if(cntrl != null)
cntrl.Visible = isVisible;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -