63 lines
2.1 KiB
Text
63 lines
2.1 KiB
Text
res.contentType = "text/xml";
|
|
|
|
var url = encodeXml(this.href());
|
|
var w3fmt = "yyyy-MM-dd'T'HH:mm:ss'+01:00'";
|
|
|
|
var now = new Date();
|
|
var param1 = new Object();
|
|
var param2 = new Object();
|
|
|
|
var size = this.allstories.size();
|
|
var max = req.data.max ? parseInt(req.data.max) : 7;
|
|
max = Math.min(max, size, 7);
|
|
|
|
if (max > 0 && this.online) {
|
|
param2.resources = "";
|
|
param2.items = "";
|
|
for (var i=0; i<max; i++) {
|
|
var story = this.allstories.get(i);
|
|
param1.itemUrl = story.href();
|
|
param1.itemTitle = story.title ? encodeXml(story.title) : "";
|
|
param1.authorName = encodeXml(story.author.name);
|
|
param1.authorMail = encodeXml(story.author.email);
|
|
param1.year = now.getYear();
|
|
param1.subject = story.topic ? encodeXml(story.topic) : "";
|
|
param1.date = story.modifytime.format(w3fmt);
|
|
var skin = createSkin(story.text);
|
|
var str = this.renderSkinAsString(skin);
|
|
str = this.rssConvertHtmlImageToHtmlLink(str);
|
|
param1.itemDescription = encodeXml(str);
|
|
param2.items += renderSkinAsString("rss10Item", param1);
|
|
param2.resources += renderSkinAsString("rss10Resource", param1);
|
|
}
|
|
param2.textinput = this.renderSkinAsString("rssTextInput", param2);
|
|
param2.creatorName = encodeXml(this.creator.name);
|
|
param2.creatorMail = encodeXml(this.creator.email);
|
|
param2.date = max > 0 ? this.lastUpdate.format(w3fmt): this.createtime.format(w3fmt);
|
|
}
|
|
else {
|
|
param1.itemUrl = url;
|
|
param1.authorName = "Antville Weblog Tool";
|
|
param1.authorMail = encodeXml(getProperty("adminEmail"));
|
|
param1.date = this.createtime.format(w3fmt);
|
|
param2.creatorName = param1.authorName;
|
|
param2.creatorMail = param1.authorMail;
|
|
param2.date = param1.date;
|
|
if (max < 1) {
|
|
param1.itemTitle = "Welcome to " + encodeXml(this.title) + "!";
|
|
param1.itemDescription = "This weblog doesn't contain any stories, yet";
|
|
}
|
|
else {
|
|
param1.itemTitle = "Access denied";
|
|
param1.itemDescription = "This weblog is offline.";
|
|
}
|
|
}
|
|
|
|
param2.title = encodeXml(this.title);
|
|
param2.url = url;
|
|
param2.description = this.tagline ? encodeXml(this.tagline) : "";
|
|
param2.year = now.getYear();
|
|
param2.updateBase = this.createtime.format(w3fmt);
|
|
param2.language = this.language;
|
|
|
|
renderSkin("rss10Channel", param2);
|