antville/code/Story/delete.hac
2002-12-01 19:26:40 +00:00

31 lines
No EOL
905 B
Text

checkIfLoggedIn(this.href(req.action));
var deny = this.isDeleteDenied(session.user);
if (deny) {
res.message = getMessage("error",deny);
res.redirect(this.site.href());
}
if (req.data.submit == "cancel" || req.data.cancel)
res.redirect(path.site.stories.href());
else if (req.data.submit == "delete" || req.data.remove) {
var result = this.site.stories.deleteStory(this);
res.message = result.message;
res.redirect(path.site.stories.href());
}
res.data.action = this.href(req.action);
res.data.title = this.site.title;
if (this.title)
res.data.title += " - " + encode(this.title);
var skinParam = new Object();
if (this.title)
skinParam.what = "the story "" + this.title + """;
else
skinParam.what = "a story";
skinParam.what += " from <b>" + this.creator.name + "</b>";
res.data.body = this.renderSkinAsString("delete",skinParam);
path.site.renderSkin("page");