if weblog is offline, display error message as rss item instead of 404 http error.

This commit is contained in:
Tobi Schäfer 2001-10-22 09:45:13 +00:00
parent 4b5b1bd851
commit 65d50f8439

View file

@ -1,25 +1,32 @@
if (!this.online) res.contentType = "text/xml";
res.redirect("notfound");
var base = "http://" + getProperty("server") + getProperty("baseURI"); var base = "http://" + getProperty("server") + getProperty("baseURI");
var now = new Date(); var now = new Date();
var param1 = new Object(); var param1 = new Object();
var size = this.allstories.size(); if (this.online) {
var max = req.data.max ? req.data.max : 7; var size = this.allstories.size();
if (max > size) var max = req.data.max ? req.data.max : 7;
max = size; if (max > size)
max = size;
var items = "";
for (var i=0; i<max; i++) { var items = "";
var story = this.allstories.get(i); for (var i=0; i<max; i++) {
if (story.online) { var story = this.allstories.get(i);
param1.itemLink = base + story.href(); if (story.online) {
param1.itemTitle = encodeXml(story.title); param1.itemLink = base + story.href();
param1.itemDescription = encodeXml(story.text); param1.itemTitle = encodeXml(story.title);
items += this.renderSkinAsString("rssItem", param1); param1.itemDescription = encodeXml(story.text);
items += this.renderSkinAsString("rssItem", param1);
}
} }
} }
else {
param1.itemLink = "";
param1.itemTitle = encodeXml("Access denied");
param1.itemDescription = encodeXml("This weblog is offline.");
items = this.renderSkinAsString("rssItem", param1);
}
var param2 = new Object(); var param2 = new Object();
param2.title = encodeXml(this.title); param2.title = encodeXml(this.title);
@ -33,5 +40,4 @@ param2.webMaster = this.creator.email;
param2.language = this.language; param2.language = this.language;
param2.items = items; param2.items = items;
res.contentType = "text/xml";
this.renderSkin("rssChannel", param2); this.renderSkin("rssChannel", param2);