aggregatersswriter.cs
来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 103 行
CS
103 行
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using CommunityServer.Components;
namespace CommunityServer.Blogs.Components
{
/// <summary>
/// Summary description for AggregateRssWriter.
/// </summary>
public class AggregateRssWriter : BaseRssWriter
{
protected Group CurrentGroup = null;
protected bool HasGroup
{
get
{
return CurrentGroup != null;
}
}
public AggregateRssWriter(ArrayList posts, Group group, string baseUrl):base(posts,null, baseUrl)
{
CurrentGroup = group;
}
protected override string Title
{
get
{
return CSContext.Current.SiteSettings.SiteName;
}
}
protected override void PostBody(Post p)
{
WeblogPost wp = p as WeblogPost;
if(wp == null)
base.PostBody(p);
else
{
string desc = null;
if(wp.SyndicateExcerpt)
{
if(wp.HasExcerpt)
{
desc = wp.Excerpt;
}
else
{
desc = Formatter.RemoveHtml(p.FormattedBody,500) ;
}
desc = string.Format("{0}...(<a href=\"{1}\">read more</a>)",desc,FormatUrl(BuildLink(p)));
}
else
{
desc = wp.FormattedBody;
}
//agg view on the aggregate post?
if(Weblogs.GetWeblog(wp.SectionID).EnableAggBugs)
desc = string.Format("{0}<img src=\"{1}\" width=\"1\" height=\"1\">",desc,FormatUrl(Globals.GetSiteUrls().AggView(wp.PostID)));
base.WriteElementString("description",desc);
}
}
protected override void WriteChannel()
{
string url = null;
string desc = null;
if(HasGroup)
{
url = BlogUrls.Instance().GroupHome(CurrentGroup.GroupID);
desc = CurrentGroup.Name;
}
else
{
url = BlogUrls.Instance().Home;
desc = CSContext.Current.SiteSettings.SiteDescription;
}
BuildChannel(url,desc);
}
protected override string BuildLink(Post p)
{
return BlogUrls.Instance().Post(p as WeblogPost);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?