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

📄 sectionedit.aspx.cs

📁 community server 源码
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.ControlPanel.Controls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;
using ResourceControl = CommunityServer.ControlPanel.Controls.ResourceControl;
using ResourceManager = CommunityServer.ControlPanel.Components.ResourceManager;
using ResourceLinkButton = CommunityServer.ControlPanel.Controls.ResourceLinkButton;

namespace CommunityServer.ControlPanel.BlogAdmin
{
	/// <summary>
	/// Summary description for SectionEdit.
	/// </summary>
	public class SectionEdit : BaseBlogAdminPage
	{

		#region Child Controls
		
		protected MPContent DescriptionRegion;
		protected MPContent TaskRegion;
		protected ResourceLinkButton SaveButton;
		protected MPContainer MPContainer;
		protected ControlPanel.Controls.StatusMessage Status;
	
		protected SectionEditControl SectionDetails1;
		protected Literal RegionTitle;
		protected ResourceControl RegionDescription;
		protected ControlPanelSelectedNavigation SelectedNavigation1;
		
		#endregion

		private int sectionID;
		private CSContext context;
		private int groupID;
	
		private bool isNew
		{
			get{return sectionID <= 0;}
		}

		private bool hasGroups
		{
			get {return WeblogGroups.GetWeblogGroups(true, true, true).Count <= 0; }
		}


		private void Page_Load(object sender, EventArgs e)
		{
			SaveButton.Text = Components.ResourceManager.GetString("Save");

			context = CSContext.Current;
			sectionID = context.GetIntFromQueryString("SectionID", -1);
			groupID = context.GetIntFromQueryString("GroupID", -1);

			if(hasGroups)
			{
				Status.Success = false;
				Status.Text = Components.ResourceManager.GetString("CP_BlogAdmin_SectionEdit_NoBlogGroups");
				Status.Visible = true;
				SectionDetails1.Visible = false;
				RegionDescription.Visible = false;
				SaveButton.Visible = false;
			}

			if(isNew)
			{
				RegionTitle.Text = Components.ResourceManager.GetString("CP_BlogAdmin_SectionEdit_New");
				SectionDetails1.GroupID = groupID;
			}
			else
			{
				Weblog w = Weblogs.GetWeblog(sectionID); 
				RegionTitle.Text  = string.Format(ResourceManager.GetString("CP_BlogAdmin_SectionEdit_Edit"), w.Name);
				SelectedNavigation1.SelectedNavItem="BlogBlogs";
			}

			SectionDetails1.SectionID = sectionID;
		}

		#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);
			this.SaveButton.Click += new EventHandler(this.SaveButton_Click);
		}

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new EventHandler(this.Page_Load);

		}


		#endregion

		public void SaveButton_Click(object sender, EventArgs e)
		{
			if(!Page.IsValid)
				return;

			if(!SectionDetails1.Save())
				return;

			if(context.ReturnUrl != null && context.ReturnUrl.Length > 0)
				context.Context.Response.Redirect(context.ReturnUrl);
			else
				context.Context.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("blog_ControlPanel_AdminBlogs"));
		}

	}
}

⌨️ 快捷键说明

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