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

📄 manageforumsadmin.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Collections;using CommunityServer.Components;using CommunityServer.Controls;
using CommunityServer.Discussions.Components;

namespace CommunityServer.Discussions.Controls 
{

    /// <summary>
    /// ManageSectionAdmin implementation which enables the creation and management of individual Forums.
    /// </summary>
    public class ManageForumsAdmin : ManageSectionAdmin
    {
		ArrayList allForums;

		protected override void OnInit(EventArgs e) 
		{
			allForums = Forums.GetForums(true, false, false);
			base.OnLoad( e );
		}

        protected override string FormatSubSectionAdmin(Section section)
        {
			ArrayList al = null;

			//ArrayList allForums = Forums.GetForums(true,false,false);
			foreach(Forum f in allForums)
			{
				if(f.ParentID == section.SectionID)
				{
					if(al == null)
						al = new ArrayList();

					al.Add(f);
				}
			}

			if(al == null)
				return null;
			


			string stringToFormat = "<br><b>" + ResourceManager.GetString("Subforums") + "</b>";
			string subForumSeparator = ResourceManager.GetString("CommaSeperator");

			
			Forum forum = section as Forum;
			if(forum == null)
			{
				return null;
			}
			foreach (Forum f in al) 
			{
				stringToFormat = stringToFormat + "<br>&nbsp;&nbsp;<a href=\"" + Globals.GetSiteUrls().AdminForumEdit(f.SectionID) + "\">" + Formatter.CheckStringLength(f.Name, 16) + "</a>";

				ArrayList subsub = null;
				foreach(Forum fx in allForums)
				{
					if(fx.ParentID == f.SectionID)
					{
						if(subsub == null)
							subsub = new ArrayList();

						subsub.Add(fx);
					}
				}

				if(subsub != null && subsub.Count > 0)
				{
					stringToFormat += " (";
					foreach(Forum fx in subsub)
					{
						stringToFormat = stringToFormat + " <a href=\"" + Globals.GetSiteUrls().AdminForumEdit(fx.SectionID) + "\">" + Formatter.CheckStringLength(fx.Name, 16) + "</a>" + subForumSeparator;
					}

					stringToFormat = stringToFormat.Remove( stringToFormat.LastIndexOf(subForumSeparator), 1);
					stringToFormat += ")";

				}
			}

			//stringToFormat = stringToFormat.Remove( stringToFormat.LastIndexOf(subForumSeparator), 1);

			return stringToFormat;
        }

    	protected override bool CheckForDuplicate(string applicationKey)
    	{
			foreach(Forum forum in Forums.GetForums())
				if(string.Compare(forum.ApplicationKey, applicationKey, true) == 0)
					return true;
			return false;
    	}

    	protected override string TitleResourceName
        {
            get {return "ManageForumPermissions_About";}
        }

        protected override ArrayList GetGroups()
        {
            return ForumGroups.GetForumGroups(true,true,this.IsEdit);
        }

        protected override ControlUserMode GetMode
        {
            get{return ControlUserMode.Administrator;}
        }

        protected override string GetAdminGroupLink(int groupID)
        {
            return Globals.GetSiteUrls().AdminForumGroup(groupID);
        }

        protected override string GetNewGroupText()
        {
            return ResourceManager.GetString( "ManageForums_CreateNew" );
        }

        protected override string GroupButtonText()
        {
            return ResourceManager.GetString( "ManageForums_CreateNewGroup" );
        }

        protected override string GetAdminSectionLink(int SectionID)
        {
            return  Globals.GetSiteUrls().AdminForumEdit( SectionID );
        }

        protected override Section CreateBlankSection
        {
            get{return new Forum();}   
        }

        protected override ApplicationType ApplicationType
        {
            get{ return ApplicationType.Forum;}
        }

		protected override Section GetNewSection(string sectionName, int sectionGroupID)
		{
			Section section = base.GetNewSection (sectionName, sectionGroupID);

			// Check to see if it was already blocked
			if(section == null)
				return null;

			// Add the groupID onto the appKey
			section.ApplicationKey += "-" + sectionGroupID;

			// Check to see if it is a duplicate
			if(CheckForDuplicate(section.ApplicationKey) == true)
				return null;

			return section;
		}



    }

}

⌨️ 快捷键说明

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