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

📄 iframehost.aspx.cs

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

using System;
using CommunityServer.Components;
using CommunityServer.ControlPanel.Controls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;
using CommunityServer.Files.Components;
using StatusMessage = CommunityServer.ControlPanel.Controls.StatusMessage;
using Style = CommunityServer.Controls.Style;
using ResourceLinkButton = CommunityServer.ControlPanel.Controls.ResourceLinkButton;

namespace CommunityServer.ControlPanel.FileAdmin
{
	/// <summary>
	/// Summary description for IFrameHost.
	/// </summary>
	public class IFrameHost : BaseFilesAdminPage
	{

		#region Child Controls

		protected FolderEditControl SectionEdit;
		protected GroupEditControl GroupEdit;
		protected Style Style1;
		protected Style Style2;
		protected Style Style3;
		protected Script Script1;
		protected Script Script2;
		protected Head Head1;
		protected ResourceLinkButton Save;
		protected CommunityServer.Controls.MPContent bcr;
		protected StatusMessage Status;

		#endregion

		private void Page_Load(object sender, EventArgs e)
		{

			Status.Visible = false;

			CSContext cntx = CSContext.Current;
			// ID Notes:  -1 = add, 0 = do not display, >0 = edit
			int groupID = cntx.GetIntFromQueryString("GroupID", 0);
			int sectionID = cntx.GetIntFromQueryString("SectionID", 0);

			// Determine whether to display the SectionEdit control or GroupEdit control
			if (groupID > 0 && sectionID != 0)
			{
				SectionEdit.Visible = true;
				SectionEdit.SectionID = sectionID;
				Save.Visible = true;
			}
			else if (groupID > 0)
			{
				GroupEdit.Visible = true;
				GroupEdit.ApplicationType = ApplicationType.FileGallery;
				GroupEdit.GroupID = groupID;
				SectionEdit.SectionID = -1;
				Save.Visible = true;
			}
			else
			{
				GroupEdit.Visible = false;
				Save.Visible = false;
			}

			if ( !Page.IsPostBack ) 
			{
				// Display a message if a Group or Section was just added/deleted
				if (cntx.GetIntFromQueryString("SectionDeleted", -1) > 0)
					DisplayStatusMessage(true, "CP_Forums_SectionEdit_StatusDeleteSuccess");

			}

		}

		#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);
			Save.Click += new EventHandler(Save_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 System.EventHandler(this.Page_Load);

		}
		#endregion

		private void DisplayStatusMessage(bool success, string resourceName)
		{
			Status.Success = success;
			Status.Visible = true;
			Status.ResourceName = resourceName;
		}

		private void Save_Click(object sender, EventArgs e)
		{
			Folder folder = null;
			bool redirect = false;

			string script = @"
					<script language=""javascript"">
						{0};
					</script>";

			if(!Page.IsValid)
				return;

			if(SectionEdit.Visible)
			{
				folder = SectionEdit.Save();
				if (folder != null)
				{
					redirect = true;
					string command = string.Format("window.top.updateSectionNode('{0}', '{1}')", folder.Name, folder.IsActive); 
					script = string.Format(script, command); 
				}
			}
			if(GroupEdit.Visible)
			{
				redirect = GroupEdit.Save();
			
				string command = string.Format("window.top.updateGroupNode('{0}')", GroupEdit.CurrentGroupName); 
				script = string.Format(script, command); 
			}
			if(redirect)
			{
				DisplayStatusMessage(true, "CP_SaveSuccessful");

				Page.RegisterStartupScript("Redirect",script) ;
			}

		}
	}
}

⌨️ 快捷键说明

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