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

📄 panelpage.cs

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

using System;
using System.Collections;
using System.Web;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
using CommunityServer.Controls;

namespace CommunityServer.ControlPanel.UI
{
	/// <summary>
	/// Summary description for PanelPage.
	/// </summary>
	public class PanelPage : CSConfirmationPage
	{
		public PanelPage()
		{
		}

		protected string CreateApplicationCookieName(CSContext context, string app)
		{
			return string.Format("{0}_{1}_{2}", context.SettingsID,context.User.Username,app);
		}



		protected readonly string controlPanelResourceFile = "ControlPanelResources.xml";



        protected void SetLocation()
        {
			UsersOnline.PrivateLocation();
        }

		# region User Preferences

		/// <summary>
		/// Users option to show hover help icons, Will return default values before the OnLoad event
		/// Due to dependancy on CSConect.Current.User
		/// </summary>
		public bool ShowHelpIcons
		{
			get{return Globals.SafeBool(CurrentUser.GetExtendedAttribute("CPShowHelpIcons"),true);}
		}
	
		#endregion

		private User user;
		public User CurrentUser
		{
			get
			{
				if(user == null)
					user = CSContext.Current.User;

				return user;
			}
		}
		protected override void OnInit(EventArgs e)
		{
            base.OnInit (e);

			this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
			Authorize();	
			
		}


		protected override void OnLoad(EventArgs e)
		{
		
			base.OnLoad (e);
		}


		protected virtual void Authorize()
		{
			if(!CSContext.Current.IsAuthenticated)
				Response.Redirect(Globals.GetSiteUrls().Login);
		}


	}

	public class BlogSwitchValidator : IMenuItem
	{
		public bool IsValid(HttpContext context)
		{
			ArrayList al = Weblogs.GetWeblogs(true,false,false);
			return Sections.FilterByAccessControl(al,Permission.Post).Count > 1;
		}
	}
	
	public class GallerySwitchValidator : IMenuItem
	{
		public bool IsValid(HttpContext context)
		{
			ArrayList al = CommunityServer.Galleries.Galleries.GetGalleries(true,false);
			return Sections.FilterByAccessControl(al,Permission.Post).Count > 1;
		}
	}

}

⌨️ 快捷键说明

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