- adapted res.dependsOn() statements in stylesheet and javascript actions because of the new layout objects
- first step in tuning rss_action() - using StringBuffers instead of normal variables
This commit is contained in:
parent
de42b3cc6c
commit
a6ecf1c2b4
1 changed files with 40 additions and 33 deletions
|
@ -89,10 +89,10 @@ function safescripts_action() {
|
|||
/**
|
||||
* wrapper to make style.skin public
|
||||
*/
|
||||
|
||||
function stylesheet_action() {
|
||||
res.dependsOn(this.modifytime);
|
||||
res.dependsOn(app.skinfiles["site"]["style"]);
|
||||
res.dependsOn(res.handlers.layout.modifytime);
|
||||
res.dependsOn(res.handlers.layout.skins.getSkinSource("site", "style"));
|
||||
res.digest();
|
||||
res.contentType = "text/css";
|
||||
this.renderSkin("style");
|
||||
|
@ -106,7 +106,8 @@ function stylesheet_action() {
|
|||
|
||||
function javascript_action() {
|
||||
res.dependsOn(this.modifytime);
|
||||
res.dependsOn(app.skinfiles["site"]["javascript"]);
|
||||
res.dependsOn(res.handlers.layout.modifytime);
|
||||
res.dependsOn(res.handlers.layout.skins.getSkinSource("site", "javascript"));
|
||||
res.digest();
|
||||
res.contentType = "text/javascript";
|
||||
this.renderSkin("javascript");
|
||||
|
@ -144,28 +145,34 @@ function rss_action() {
|
|||
res.digest();
|
||||
|
||||
var now = new Date();
|
||||
var systitle = root.getSysTitle();
|
||||
var systitle = root.getTitle();
|
||||
var sdf = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
sdf.setTimeZone(new java.util.SimpleTimeZone(0, "UTC"));
|
||||
|
||||
if (req.data.show == "all") {
|
||||
var collection = this.allcontent;
|
||||
} else if (req.data.show == "day") {
|
||||
var collection = this.get(req.data.day);
|
||||
} else if (req.data.show == "topic") {
|
||||
var collection = this.topics.get(req.data.topic);
|
||||
} else {
|
||||
var collection = this.allstories;
|
||||
var collection;
|
||||
switch (req.data.show) {
|
||||
case "all" :
|
||||
collection = this.allcontent;
|
||||
break;
|
||||
case "day" :
|
||||
collection = this.get(req.data.day);
|
||||
break;
|
||||
case "topic" :
|
||||
collection = this.topics.get(req.data.topic);
|
||||
break;
|
||||
default :
|
||||
collection = this.allstories;
|
||||
}
|
||||
var size = (collection != null) ? collection.size() : 0;
|
||||
|
||||
var max = req.data.max ? parseInt(req.data.max) : 7;
|
||||
max = Math.min(max, size);
|
||||
max = Math.min(max, 10);
|
||||
|
||||
var param = new Object();
|
||||
if (max > 0 && this.online) {
|
||||
var items = "";
|
||||
var resources = "";
|
||||
var items = new java.lang.StringBuffer();
|
||||
var resources = new java.lang.StringBuffer();
|
||||
collection.prefetchChildren(0, max);
|
||||
for (var i=0; i<max; i++) {
|
||||
var story = collection.get(i);
|
||||
|
@ -188,8 +195,8 @@ function rss_action() {
|
|||
param.date = sdf.format(story.createtime);
|
||||
param.subject = story.topic ? story.topic : "";
|
||||
param.year = story.createtime.getYear();
|
||||
items += story.renderSkinAsString("rssItem", param);
|
||||
resources += story.renderSkinAsString("rssResource", param);
|
||||
items.append(story.renderSkinAsString("rssItem", param));
|
||||
resources.append(story.renderSkinAsString("rssResource", param));
|
||||
}
|
||||
|
||||
param = new Object();
|
||||
|
@ -202,8 +209,8 @@ function rss_action() {
|
|||
param.email = this.creator.email.entitize();
|
||||
param.year = now.getYear();
|
||||
param.lastupdate = max > 0 ? sdf.format(this.lastUpdate): sdf.format(this.createtime);
|
||||
param.items = items;
|
||||
param.resources = resources;
|
||||
param.items = items.toString();
|
||||
param.resources = resources.toString();
|
||||
this.renderSkin("rss", param);
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +225,7 @@ function getfile_action() {
|
|||
if (f) {
|
||||
f.requestcnt++;
|
||||
res.contentType = f.mimetype;
|
||||
res.redirect(getProperty("fileUrl") + this.alias + "/" + f.name);
|
||||
res.redirect(f.getUrl());
|
||||
} else {
|
||||
res.message = getMessage("error.fileNotFound", req.data.name);
|
||||
res.redirect(this.href());
|
||||
|
|
Loading…
Add table
Reference in a new issue