gallerytemplatedwebcontrol.cs

来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 77 行

CS
77
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using CommunityServer.Components;
using CommunityServer.Controls;
using CommunityServer.Galleries.Components;

namespace CommunityServer.Galleries.Controls
{
	/// <summary>
	/// Base class for skinned gallery controls.
	/// </summary>
	public abstract class GalleryTemplatedWebControl : TemplatedWebControl
	{
		private User _currentUser = null;
		private Gallery _currentGallery = null;
		private PostCategory _currentCategory = null;
		private Picture _currentPicture = null;

		public GalleryTemplatedWebControl():base()
		{
			_currentUser = CSContext.Current.User;			
		}

		/// <exclude />
		protected override String ExternalSkinFileName
		{
			get
			{
				return string.Format("/Galleries/Skin-{0}.ascx",this.GetType().Name);
			}
		}

		public virtual User CurrentUser
		{
			get { return _currentUser; }
		}

		public virtual Gallery CurrentGallery
		{
			get
			{
				if(_currentGallery == null)
					if(CSContext.Current.ApplicationKey != "")
						_currentGallery = Galleries.GetGallery( CSContext.Current.ApplicationKey );
				return _currentGallery;
			}
		}

		public virtual PostCategory CurrentCategory
		{
			get
			{
				if(_currentCategory == null)
					if(CSContext.Current.CategoryID != -1)
						_currentCategory = PostCategories.GetCategory(CSContext.Current.CategoryID, CategoryType.GalleryPicture, CurrentGallery.SectionID, CurrentUser.IsGalleryAdministrator);
				return _currentCategory;
			}
		}
	
		public virtual Picture CurrentPicture
		{
			get
			{
				if(_currentPicture == null)
					if(CSContext.Current.PostID != -1)
						_currentPicture = Pictures.GetPicture(CurrentGallery.SectionID, CSContext.Current.PostID);
				return _currentPicture;
			}
		}
	}
}

⌨️ 快捷键说明

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