📄 gallerypicturesrsswriter.cs
字号:
//------------------------------------------------------------------------------
// <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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -