您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->SpaceBuilder v1.0正式版源码>>BlogControls/BaseControls/WeblogThemedControl.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
普通视图
		            
1//------------------------------------------------------------------------------ 2// <copyright company="Tunynet"> 3// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4// </copyright> 5//------------------------------------------------------------------------------ 6 7using System.Web.UI; 8using SpaceBuilder.Blogs.Components; 9using SpaceBuilder.Components; 10using SpaceBuilder.Configuration; 11using SpaceBuilder.Controls.BaseClasses; 12using SpaceBuilder.Security; 13using SpaceBuilder.Utils; 14using SpaceBuilder.Controls; 15using SpaceBuilder.Posts.Permissions; 16using System; 17using TunyNet.Utils; 18 19namespace SpaceBuilder.Blogs.Controls 20{ 21 /// <summary> 22 /// 博客主题控件基类 23 /// </summary> 24 /// <remarks> 暂时去掉主题功能</remarks> 25 public abstract class WeblogThemedControl : UserDomainThemedControl 26 { 27 public WeblogThemedControl() 28 : base() 29 {} 30 31 /// <summary> 32 /// All skins should be found in the skin directory and named after the control. 33 /// </summary> 34 protected override string ExternalSkinFileName 35 { 36 get 37 { 38 string name = ValueHelper.IsNullOrEmpty(this.SkinName) ? "Skin-" + this.GetType().Name + ".ascx" : SkinName; 39 return string.Format("Skins/Blogs/{0}", name); 40 } 41 } 42 43 protected override void SetPageTitle(string text) 44 { 45 if (ValueHelper.IsNullOrEmpty(text)) 46 text = CurrentWeblog.SectionName; 47 else 48 text = string.Format("{1}{0}{2}",SBContext.Current.BrowserTitleSeparator, text, CurrentWeblog.SectionName); 49 50 base.SetPageTitle(text); 51 } 52 53 /// <summary> 54 /// 检查Blog是否存在,并且用户是否有阅读的权限 55 /// </summary> 56 protected virtual void Authorize(Weblog w) 57 { 58 if (w == null) 59 PermissionBase.RedirectOrExcpetion(SBExceptionType.SectionNotFound, string.Format("Weblog {0} could not be found", SBContext.Current.UserDomainName)); 60 61 Permissions.AccessCheck(w, Permission.View, this.CurrentUser); 62 } 63 64 private Weblog _currentWeblog = null; 65 public virtual Weblog CurrentWeblog 66 { 67 get 68 { 69 if ((_currentWeblog == null) || (!_currentWeblog.ApplicationKey.Equals(SBContext.Current.UserDomainName, StringComparison.CurrentCultureIgnoreCase))) 70 { 71 //ApplicationKey 与 UserDomainName 相同 72 _currentWeblog = Weblogs.GetWeblog(SBContext.Current.UserDomainName, true, true); 73 74 if (!this.CurrentUser.IsBlogAdministrator) 75 Authorize(_currentWeblog); 76 } 77 return _currentWeblog; 78 } 79 } 80 81 82 } 83} 84
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:SpaceBuilder v1.0正式版源码