gallerypicturesrsswriter.cs
来自「本系统是在asp版《在线文件管理器》的基础上设计制作」· CS 代码 · 共 90 行
CS
90 行
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Collections;
using CommunityServer.Components;
namespace CommunityServer.Galleries.Components
{
/// <summary>
/// Generates an XML feed by a specific category
/// </summary>
public class GalleryPicturesRssWriter : BaseRssWriter
{
public GalleryPicturesRssWriter(ArrayList posts, Gallery gallery, string baseUrl) : base(posts, gallery, baseUrl)
{
Category = null;
}
public GalleryPicturesRssWriter(ArrayList posts, Gallery gallery, string baseUrl, PostCategory category) : base(posts, gallery, baseUrl)
{
Category = category;
}
/// <summary>
/// Appends the CategoryName to Title element
/// </summary>
protected override string Title
{
get
{
if(Category != null)
return base.Title + " : " + Category.Name;
else
return base.Title;
}
}
protected PostCategory Category = null;
protected Gallery CurrentGallery
{
get { return CurrentSection as Gallery; }
}
protected override bool AllowComments
{
get
{
return base.AllowComments; // && CurrentWeblog.EnableComments;
}
}
protected override string BuildLink(Post p)
{
if(Category != null)
return GalleryUrls.Instance().ViewPicture(CurrentSection.ApplicationKey, Category.CategoryID, p as Picture);
else
return GalleryUrls.Instance().ViewPicture(CurrentSection.ApplicationKey, p as Picture);
}
protected override void PostBody(Post p)
{
string description = "<div><a href='";
if(Category != null)
description += GalleryUrls.Instance().ViewPicture(CurrentSection.ApplicationKey, Category.CategoryID, p as Picture);
else
description += GalleryUrls.Instance().ViewPicture(CurrentSection.ApplicationKey, p as Picture);
description += "'><img src='";
description += GalleryUrls.Instance().PictureUrl(CurrentSection.ApplicationKey, p.PostID, GalleryImageType.Thumbnail);
description += "' alt='" + p.Subject + "' border='0'></a></div>";
description += p.FormattedBody;
this.WriteElementString("description", description);
}
protected override void WriteChannel()
{
if(Category != null)
BuildChannel(GalleryUrls.Instance().ViewCategory(CurrentSection.ApplicationKey, Category.CategoryID), Category.Description);
else
BuildChannel(GalleryUrls.Instance().ViewGallery(CurrentSection.ApplicationKey), CurrentGallery.Description);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?