温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
1//------------------------------------------------------------------------------ 2
// <copyright company="Tunynet"> 3
// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4
// </copyright> 5
//------------------------------------------------------------------------------ 6
7
using System; 8
using System.Collections.Generic; 9
using System.Text; 10
using SpaceBuilder.Components; 11
using System.Web.UI.WebControls; 12
using System.Collections; 13
using SpaceBuilder.Blogs.Components; 14
using SpaceBuilder.Controls.BaseClasses; 15
using SpaceBuilder.Configuration; 16
17
namespace SpaceBuilder.Blogs.Controls 18
{ 19
public class MyBlogThreadsBlock : UserDomainThemedControl 20
{ 21
SBContext wlContext = SBContext.Current; 22
23
protected override void OnInit(EventArgs e) 24
{ 25
if (SkinName == null) 26
SkinName = "Blogs/Skin-MyWeblogThreadsBlock.ascx"; 27
28
wlContext = SBContext.Current; 29
base.OnInit(e); 30
this.EnableViewState = false; 31
} 32
33
Child Controls 40
41
protected override void AttachChildControls() 42
{ 43
blogTagList = FindControl("BlogTagList") as Literal; 44
45
myBlogThreadRepeater = FindControl("MyBlogThreadRepeater") as BlogThreadRepeater; 46
myBlogThreadRepeater.UserID = CurrentDomainUser.UserID; 47
} 48
49
protected override void OnLoad(EventArgs e) 50
{ 51
if (!SBConfiguration.Instance().EnableBlog || CurrentDomainUser.UserDomainMenuIsDisabled(UserDomainMenuType.Blog) || !Privacys.ValidatePrivacys(CurrentDomainUser,PrivacyItem.ChannelBlog,SBContext.Current.User)) 52
{ 53
this.Visible = false; 54
return; 55
} 56
57
base.OnLoad(e); 58
if (!Page.IsPostBack) 59
Bind(); 60
} 61
62
private void Bind() 63
{ 64
if (blogTagList != null) 65
{ 66
List<UserTag> tags = SpaceBuilder.Components.Tags.GetUserTags(CurrentDomainUser.UserID, TagType.Blog); 67
if (tags != null && tags.Count > 5) 68
tags = tags.GetRange(0, 5); 69
70
foreach (UserTag tag in tags) 71
{ 72
blogTagList.Text += string.Format("<a href='{0}' title='查看该标签内的文章({1})'>{2}</a> ", GlobalUrls.Instance().ShowBlogPostsByTag(CurrentUserDomainName, tag.TagName), tag.ItemCount, tag.TagName); 73
} 74
} 75
76
} 77
} 78
} 79





}
}