style.cs

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 53 行

CS
53
字号
//------------------------------------------------------------------------------
// <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>
	/// Summary description for Style.
	/// </summary>
	public class Style : Control
	{
		public Style()
		{
			GalleryConfig = GalleryConfiguration.Instance();
		}

		protected GalleryConfiguration GalleryConfig = null;

		protected override void Render(HtmlTextWriter writer)
		{
			Gallery gallery = Galleries.GetGallery(CSContext.Current.ApplicationKey);
			if(gallery != null)
			{
				writer.WriteLine(styleFormat,CSSPath(gallery.Theme, "style.css"), "screen");

				if(GalleryConfig.EnableThemes && gallery.SecondaryCSS != null)
					writer.WriteLine(styleFormat,CSSPath(gallery.Theme, gallery.SecondaryCSS), "screen");

				if(GalleryConfig.EnableThemes && gallery.CSSOverride != null)
					writer.WriteLine(styleFormat, GalleryUrls.Instance().CustomCSS(gallery.ApplicationKey), "screen");
			}
		}

		protected string CSSPath(string theme, string fileName)
		{
			if(theme == null || !GalleryConfig.EnableThemes)
				theme = GalleryConfig.DefaultTemplate;

			string path = string.Format("{0}{1}/style/{2}", GalleryConfig.ThemeLocation, theme, fileName);
			return this.ResolveUrl(path);
		}

		static string styleFormat = "<link rel=\"stylesheet\" href=\"{0}\" type=\"text/css\" media=\"{1}\" />";

	}
}

⌨️ 快捷键说明

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