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

📄 sectionappearance.ascx.cs

📁 一个ASP.NET下的中文内容管理和社区系统
💻 CS
字号:
namespace ASPNET.StarterKit.Communities.Admin.EditSections
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		Summary description for SectionAppearance.
	/// </summary>
	public abstract class SectionAppearance : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.DropDownList dropThemes;
		protected System.Web.UI.WebControls.DropDownList dropStyles;
		protected System.Web.UI.WebControls.Image imgLogoPreview;
		protected ASPNET.StarterKit.Communities.HtmlTextBox txtPageHeader;
		protected ASPNET.StarterKit.Communities.HtmlTextBox txtPageFooter;
		protected System.Web.UI.WebControls.TextBox txtFooter;
		protected ASPNET.StarterKit.Communities.LengthValidator LengthValidator1;
		protected System.Web.UI.WebControls.TextBox txtPageMetaDesc;
		protected ASPNET.StarterKit.Communities.LengthValidator LengthValidator2;
		protected System.Web.UI.WebControls.TextBox txtPageMetaKeys;
		protected System.Web.UI.WebControls.RadioButton rdlInheritTransformations;
		protected System.Web.UI.WebControls.RadioButton rdlSpecifyTransformations;
		protected System.Web.UI.WebControls.Panel pnlTransformations;
		protected System.Web.UI.WebControls.TextBox txtTransformations;
		protected System.Web.UI.HtmlControls.HtmlInputFile txtLogo;


		#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);
		}
		
		///		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


		public SectionInfo Section;
	    
		public string PageSkin {
			get { return dropThemes.SelectedItem.Value; }
		}
	    
	    
		public string PageStyle {
			get { return dropStyles.SelectedItem.Value; }
		}
	    
		public HttpPostedFile Logo {
			get { return txtLogo.PostedFile; }
		}
	    
	    
		public string PageHeader {
			get { return txtPageHeader.Text; }
		}
	    
	    
		public string PageFooter {
			get { return txtPageFooter.Text; }
		}
	    
	    
		public string Footer {
			get { return txtFooter.Text; }
		}
	    
		public string PageMetaDesc {
			get { return txtPageMetaDesc.Text; }
		}
	    
	    
		public string PageMetaKeys {
			get { return txtPageMetaKeys.Text; }
		}
	    
	    
		public bool InheritTransformations {
			get {
				if (Section != null && Section.ParentSectionID == -1)
					return false;
				else
					return rdlInheritTransformations.Checked;
			}
		}
	    
	    
		public string Transformations {
			get { return txtTransformations.Text; }
		}
	    
	    
		void Page_Load(object sender, System.EventArgs e) {
			if (!IsPostBack) {
	    
				// Initialize Themes
				dropThemes.DataSource = ThemeUtility.GetThemes();
				dropThemes.DataTextField = "ThemeName";
				dropThemes.DataValueField = "ThemePath";
				dropThemes.DataBind();
	    
				// Initialize Styles
				dropStyles.DataSource = ThemeUtility.GetStyles();
				dropStyles.DataTextField = "StyleName";
				dropStyles.DataValueField = "StylePath";
				dropStyles.DataBind();
	    
	    
				if (Section != null) {
					// Initialize values from SectionInfo
					txtPageHeader.Text = Section.PageHeader;
					txtPageFooter.Text = Section.PageFooter;
					txtFooter.Text = Section.Footer;
					txtPageMetaDesc.Text = Section.PageMetaDesc;
					txtPageMetaKeys.Text = Section.PageMetaKeys;
	    
					// Initialize Log Preview
					if (Section.Logo != String.Empty)
					imgLogoPreview.ImageUrl = ResolveUrl("~/" + Section.Logo);
					else
					imgLogoPreview.Visible = false;
	    
					// Initialize transformations
					if (Section.ParentSectionID == -1) {
						pnlTransformations.Visible = false;
					} else {
						rdlInheritTransformations.Checked = Section.InheritTransformations;
						rdlSpecifyTransformations.Checked = !Section.InheritTransformations;
					}
	    
					txtTransformations.Text = Section.Transformations;
	    
					// if not home section, add inherit option
					if (Section.ParentSectionID != -1)
						dropThemes.Items.Insert(0, new ListItem("Inherit", String.Empty));
	    
					// select default theme
					dropThemes.SelectedIndex = -1;
					foreach (ListItem item in dropThemes.Items)
						if (item.Value == Section.Skin)
							item.Selected = true;
	    
					// select default style
					dropStyles.SelectedIndex = -1;
					foreach (ListItem item in dropStyles.Items)
						if (item.Value == Section.Style)
							item.Selected = true;
	    
					// if not home section, add inherit option
					if (Section.ParentSectionID != -1)
						dropStyles.Items.Insert(0, new ListItem("Inherit", String.Empty));
				} else {
						// add inherit option to themes and styles
						dropThemes.Items.Insert(0, new ListItem("Inherit", String.Empty));
						dropStyles.Items.Insert(0, new ListItem("Inherit", String.Empty));
						// hide image logo preview
						imgLogoPreview.Visible = false;
				}
	    
			}
		}

		private void Page_Load()
		{
		
		}




	}
}

⌨️ 快捷键说明

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