- changed to use AntvilleLib methods
- changed all preferences related macros since the site preferences are xml-encoded now - discussions_macro() and addtofront_macro() now don't need an input type hidden anymore to preserve the submitted state
This commit is contained in:
parent
9a1e050afe
commit
f3d757c996
1 changed files with 121 additions and 110 deletions
|
@ -3,17 +3,17 @@
|
||||||
*/
|
*/
|
||||||
function title_macro(param) {
|
function title_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("title", param));
|
Html.input(this.createInputParam("title", param));
|
||||||
else {
|
else {
|
||||||
if (param && param.linkto) {
|
if (param && param.linkto) {
|
||||||
if (param.linkto == "main")
|
if (param.linkto == "main")
|
||||||
param.linkto = "";
|
param.linkto = "";
|
||||||
openLink(this.href(param.linkto));
|
Html.openLink(this.href(param.linkto));
|
||||||
if (this.title && this.title.trim())
|
if (this.title && this.title.trim())
|
||||||
res.write(stripTags(this.title));
|
res.write(stripTags(this.title));
|
||||||
else
|
else
|
||||||
res.write("<i>[untitled]</i>");
|
res.write("<i>[untitled]</i>");
|
||||||
closeLink();
|
Html.closeLink();
|
||||||
} else
|
} else
|
||||||
res.write(this.title);
|
res.write(this.title);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ function title_macro(param) {
|
||||||
*/
|
*/
|
||||||
function alias_macro(param) {
|
function alias_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("alias",param));
|
Html.input(this.createInputParam("alias", param));
|
||||||
else
|
else
|
||||||
res.write(this.alias);
|
res.write(this.alias);
|
||||||
}
|
}
|
||||||
|
@ -35,13 +35,10 @@ function alias_macro(param) {
|
||||||
* macro rendering tagline
|
* macro rendering tagline
|
||||||
*/
|
*/
|
||||||
function tagline_macro(param) {
|
function tagline_macro(param) {
|
||||||
if (!this.tagline && param.as != "editor")
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("tagline",param));
|
Html.input(this.preferences.createInputParam("tagline", param));
|
||||||
else if (this.tagline)
|
else if (this.preferences.getProperty("tagline"))
|
||||||
res.write(stripTags(this.tagline));
|
res.write(stripTags(this.preferences.getProperty("tagline")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +47,7 @@ function tagline_macro(param) {
|
||||||
*/
|
*/
|
||||||
function email_macro(param) {
|
function email_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("email",param));
|
Html.input(this.createInputParam("email", param));
|
||||||
else
|
else
|
||||||
res.write(this.email);
|
res.write(this.email);
|
||||||
}
|
}
|
||||||
|
@ -61,9 +58,9 @@ function email_macro(param) {
|
||||||
*/
|
*/
|
||||||
function bgcolor_macro(param) {
|
function bgcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("bgcolor",param));
|
Html.input(this.preferences.createInputParam("bgcolor", param));
|
||||||
else
|
else
|
||||||
renderColor(this.bgcolor);
|
renderColor(this.preferences.getProperty("bgcolor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,9 +69,9 @@ function bgcolor_macro(param) {
|
||||||
*/
|
*/
|
||||||
function textfont_macro(param) {
|
function textfont_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("textfont",param));
|
Html.input(this.preferences.createInputParam("textfont", param));
|
||||||
else
|
else
|
||||||
res.write(this.textfont);
|
res.write(this.preferences.getProperty("textfont"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,9 +80,9 @@ function textfont_macro(param) {
|
||||||
*/
|
*/
|
||||||
function textsize_macro(param) {
|
function textsize_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("textsize",param));
|
Html.input(this.preferences.createInputParam("textsize", param));
|
||||||
else
|
else
|
||||||
res.write(this.textsize);
|
res.write(this.preferences.getProperty("textsize"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,9 +91,9 @@ function textsize_macro(param) {
|
||||||
*/
|
*/
|
||||||
function textcolor_macro(param) {
|
function textcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("textcolor",param));
|
Html.input(this.preferences.createInputParam("textcolor", param));
|
||||||
else
|
else
|
||||||
renderColor(this.textcolor);
|
renderColor(this.preferences.getProperty("textcolor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,9 +102,9 @@ function textcolor_macro(param) {
|
||||||
*/
|
*/
|
||||||
function linkcolor_macro(param) {
|
function linkcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("linkcolor",param));
|
Html.input(this.preferences.createInputParam("linkcolor", param));
|
||||||
else
|
else
|
||||||
renderColor(this.linkcolor);
|
renderColor(this.preferences.getProperty("linkcolor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,9 +113,9 @@ function linkcolor_macro(param) {
|
||||||
*/
|
*/
|
||||||
function alinkcolor_macro(param) {
|
function alinkcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("alinkcolor",param));
|
Html.input(this.preferences.createInputParam("alinkcolor", param));
|
||||||
else
|
else
|
||||||
renderColor(this.alinkcolor);
|
renderColor(this.preferences.getProperty("alinkcolor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,9 +124,9 @@ function alinkcolor_macro(param) {
|
||||||
*/
|
*/
|
||||||
function vlinkcolor_macro(param) {
|
function vlinkcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("vlinkcolor",param));
|
Html.input(this.preferences.createInputParam("vlinkcolor", param));
|
||||||
else
|
else
|
||||||
renderColor(this.vlinkcolor);
|
renderColor(this.preferences.getProperty("vlinkcolor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,9 +135,9 @@ function vlinkcolor_macro(param) {
|
||||||
*/
|
*/
|
||||||
function titlefont_macro(param) {
|
function titlefont_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("titlefont",param));
|
Html.input(this.preferences.createInputParam("titlefont", param));
|
||||||
else
|
else
|
||||||
res.write(this.titlefont);
|
res.write(this.preferences.getProperty("titlefont"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,9 +146,9 @@ function titlefont_macro(param) {
|
||||||
*/
|
*/
|
||||||
function titlesize_macro(param) {
|
function titlesize_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("titlesize",param));
|
Html.input(this.preferences.createInputParam("titlesize", param));
|
||||||
else
|
else
|
||||||
res.write(this.titlesize);
|
res.write(this.preferences.getProperty("titlesize"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,9 +157,9 @@ function titlesize_macro(param) {
|
||||||
*/
|
*/
|
||||||
function titlecolor_macro(param) {
|
function titlecolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("titlecolor",param));
|
Html.input(this.preferences.createInputParam("titlecolor", param));
|
||||||
else
|
else
|
||||||
renderColor(this.titlecolor);
|
renderColor(this.preferences.getProperty("titlecolor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,9 +168,9 @@ function titlecolor_macro(param) {
|
||||||
*/
|
*/
|
||||||
function smallfont_macro(param) {
|
function smallfont_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("smallfont",param));
|
Html.input(this.preferences.createInputParam("smallfont", param));
|
||||||
else
|
else
|
||||||
res.write(this.smallfont);
|
res.write(this.preferences.getProperty("smallfont"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,9 +179,9 @@ function smallfont_macro(param) {
|
||||||
*/
|
*/
|
||||||
function smallsize_macro(param) {
|
function smallsize_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("smallsize",param));
|
Html.input(this.preferences.createInputParam("smallsize", param));
|
||||||
else
|
else
|
||||||
res.write(this.smallsize);
|
res.write(this.preferences.getProperty("smallsize"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,9 +190,9 @@ function smallsize_macro(param) {
|
||||||
*/
|
*/
|
||||||
function smallcolor_macro(param) {
|
function smallcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("smallcolor",param));
|
Html.input(this.preferences.createInputParam("smallcolor", param));
|
||||||
else
|
else
|
||||||
renderColor(this.smallcolor);
|
renderColor(this.preferences.getProperty("smallcolor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,9 +200,9 @@ function smallcolor_macro(param) {
|
||||||
* macro rendering lastupdate
|
* macro rendering lastupdate
|
||||||
*/
|
*/
|
||||||
function lastupdate_macro(param) {
|
function lastupdate_macro(param) {
|
||||||
if (!this.lastupdate)
|
if (this.lastupdate)
|
||||||
|
res.write(formatTimestamp(this.lastupdate, param.format));
|
||||||
return;
|
return;
|
||||||
return (formatTimestamp(this.lastupdate,param.format));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,9 +210,12 @@ function lastupdate_macro(param) {
|
||||||
* macro rendering online-status
|
* macro rendering online-status
|
||||||
*/
|
*/
|
||||||
function online_macro(param) {
|
function online_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor") {
|
||||||
renderInputCheckbox(this.createInputParam("online",param));
|
var inputParam = this.createInputParam("online", param);
|
||||||
else if (this.online)
|
if ((req.data.save && req.data.online) || (!req.data.save && this.online))
|
||||||
|
inputParam.checked = "checked";
|
||||||
|
Html.checkBox(inputParam);
|
||||||
|
} else if (this.online)
|
||||||
res.write(param.yes ? param.yes : "yes");
|
res.write(param.yes ? param.yes : "yes");
|
||||||
else
|
else
|
||||||
res.write(param.no ? param.no : "no");
|
res.write(param.no ? param.no : "no");
|
||||||
|
@ -226,10 +226,15 @@ function online_macro(param) {
|
||||||
* macro rendering discussion-flag
|
* macro rendering discussion-flag
|
||||||
*/
|
*/
|
||||||
function hasdiscussions_macro(param) {
|
function hasdiscussions_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor") {
|
||||||
renderInputCheckbox(this.createInputParam("discussions",param));
|
var inputParam = this.preferences.createInputParam("discussions", param);
|
||||||
else
|
if ((req.data.save && req.data.discussions) ||
|
||||||
res.write(this.discussions ? "yes" : "no");
|
(!req.data.save && this.preferences.getProperty("discussions")))
|
||||||
|
inputParam.checked = "checked";
|
||||||
|
Html.checkBox(inputParam);
|
||||||
|
} else
|
||||||
|
res.write(this.preferences.getProperty("discussions") ? "yes" : "no");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,10 +242,14 @@ function hasdiscussions_macro(param) {
|
||||||
* macro rendering usercontrib-flag
|
* macro rendering usercontrib-flag
|
||||||
*/
|
*/
|
||||||
function usermaycontrib_macro(param) {
|
function usermaycontrib_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor") {
|
||||||
renderInputCheckbox(this.createInputParam("usercontrib",param));
|
var inputParam = this.preferences.createInputParam("usercontrib", param);
|
||||||
else
|
if ((req.data.save && req.data.usercontrib) ||
|
||||||
res.write(this.usercontrib ? "yes" : "no");
|
(!req.data.save && this.preferences.getProperty("usercontrib")))
|
||||||
|
inputParam.checked = "checked";
|
||||||
|
Html.checkBox(inputParam);
|
||||||
|
} else
|
||||||
|
res.write(this.preferences.getProperty("usercontrib") ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,9 +258,9 @@ function usermaycontrib_macro(param) {
|
||||||
*/
|
*/
|
||||||
function showdays_macro(param) {
|
function showdays_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("days",param));
|
Html.input(this.preferences.createInputParam("days", param));
|
||||||
else
|
else
|
||||||
res.write(this.days);
|
res.write(this.preferences.getProperty("days"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,10 +268,14 @@ function showdays_macro(param) {
|
||||||
* macro rendering archive-flag
|
* macro rendering archive-flag
|
||||||
*/
|
*/
|
||||||
function showarchive_macro(param) {
|
function showarchive_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor") {
|
||||||
renderInputCheckbox(this.createInputParam("archive",param));
|
var inputParam = this.preferences.createInputParam("archive", param);
|
||||||
else
|
if ((req.data.save && req.data.archive) ||
|
||||||
res.write(this.archive ? "yes" : "no");
|
(!req.data.save && this.preferences.getProperty("archive")))
|
||||||
|
inputParam.checked = "checked";
|
||||||
|
Html.checkBox(inputParam);
|
||||||
|
} else
|
||||||
|
res.write(this.preferences.getProperty("archive") ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,9 +283,12 @@ function showarchive_macro(param) {
|
||||||
* macro rendering enableping-flag
|
* macro rendering enableping-flag
|
||||||
*/
|
*/
|
||||||
function enableping_macro(param) {
|
function enableping_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor") {
|
||||||
renderInputCheckbox(this.createInputParam("enableping",param));
|
var inputParam = this.createInputParam("enableping", param);
|
||||||
else
|
if ((req.data.save && req.data.enableping) || (!req.data.save && this.enableping))
|
||||||
|
inputParam.checked = "checked";
|
||||||
|
Html.checkBox(inputParam);
|
||||||
|
} else
|
||||||
res.write(this.enableping ? "yes" : "no");
|
res.write(this.enableping ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,11 +298,13 @@ function enableping_macro(param) {
|
||||||
*/
|
*/
|
||||||
function longdateformat_macro(param) {
|
function longdateformat_macro(param) {
|
||||||
if (param.as == "chooser")
|
if (param.as == "chooser")
|
||||||
this.renderDateformatChooser("long");
|
renderDateformatChooser("longdateformat",
|
||||||
|
this.getLocale(),
|
||||||
|
this.preferences.getProperty("longdateformat"));
|
||||||
else if (param.as == "editor")
|
else if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("longdateformat",param));
|
Html.input(this.preferences.createInputParam("longdateformat", param));
|
||||||
else
|
else
|
||||||
res.write(this.longdateformat);
|
res.write(this.preferences.getProperty("longdateformat"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -295,11 +313,13 @@ function longdateformat_macro(param) {
|
||||||
*/
|
*/
|
||||||
function shortdateformat_macro(param) {
|
function shortdateformat_macro(param) {
|
||||||
if (param.as == "chooser")
|
if (param.as == "chooser")
|
||||||
this.renderDateformatChooser("short");
|
renderDateformatChooser("shortdateformat",
|
||||||
|
this.getLocale(),
|
||||||
|
this.preferences.getProperty("shortdateformat"));
|
||||||
else if (param.as == "editor")
|
else if (param.as == "editor")
|
||||||
renderInputText(this.createInputParam("shortdateformat",param));
|
Html.input(this.preferences.createInputParam("shortdateformat", param));
|
||||||
else
|
else
|
||||||
res.write(this.shortdateformat);
|
res.write(this.preferences.getProperty("shortdateformat"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -327,7 +347,7 @@ function navigation_macro(param) {
|
||||||
if (!session.user)
|
if (!session.user)
|
||||||
return;
|
return;
|
||||||
if (!param["for"] || param["for"] == "contributors") {
|
if (!param["for"] || param["for"] == "contributors") {
|
||||||
if (this.usercontrib || req.data.memberlevel >= CONTRIBUTOR)
|
if (this.preferences.getProperty("usercontrib") || req.data.memberlevel >= CONTRIBUTOR)
|
||||||
this.renderSkin("contribnavigation");
|
this.renderSkin("contribnavigation");
|
||||||
}
|
}
|
||||||
if (!param["for"] || param["for"] == "admins") {
|
if (!param["for"] || param["for"] == "admins") {
|
||||||
|
@ -355,7 +375,7 @@ function storylist_macro(param) {
|
||||||
function calendar_macro(param) {
|
function calendar_macro(param) {
|
||||||
// do nothing if there is not a single story :-))
|
// do nothing if there is not a single story :-))
|
||||||
// or if archive of this site is disabled
|
// or if archive of this site is disabled
|
||||||
if (!this.allstories.size() || !this.archive)
|
if (!this.allstories.size() || !this.preferences.getProperty("archive"))
|
||||||
return;
|
return;
|
||||||
// define variables needed in this function
|
// define variables needed in this function
|
||||||
var calParam = new Object();
|
var calParam = new Object();
|
||||||
|
@ -377,9 +397,9 @@ function calendar_macro(param) {
|
||||||
weekBuf.append(this.renderSkinAsString("calendardayheader", dayParam));
|
weekBuf.append(this.renderSkinAsString("calendardayheader", dayParam));
|
||||||
}
|
}
|
||||||
weekParam.week = weekBuf.toString();
|
weekParam.week = weekBuf.toString();
|
||||||
calBuf.append(this.renderSkinAsString("calendarweek",weekParam));
|
calBuf.append(this.renderSkinAsString("calendarweek", weekParam));
|
||||||
|
|
||||||
cal.set(java.util.Calendar.DATE,1);
|
cal.set(java.util.Calendar.DATE, 1);
|
||||||
// check whether there's a day or a story in path
|
// check whether there's a day or a story in path
|
||||||
// if so, use it to determine the month to render
|
// if so, use it to determine the month to render
|
||||||
if (path.story)
|
if (path.story)
|
||||||
|
@ -387,11 +407,11 @@ function calendar_macro(param) {
|
||||||
else if (path.day)
|
else if (path.day)
|
||||||
var today = path.day.groupname.toString();
|
var today = path.day.groupname.toString();
|
||||||
if (today) {
|
if (today) {
|
||||||
// instead of using the global parseTimestamp-function
|
// instead of using String.toDate
|
||||||
// we do it manually here to avoid that a day like 20021001
|
// we do it manually here to avoid that a day like 20021001
|
||||||
// would be changed to 20020930 in some cases
|
// would be changed to 20020930 in some cases
|
||||||
cal.set(java.util.Calendar.YEAR,parseInt(today.substring(0,4),10));
|
cal.set(java.util.Calendar.YEAR, parseInt(today.substring(0, 4), 10));
|
||||||
cal.set(java.util.Calendar.MONTH,parseInt(today.substring(4,6),10)-1);
|
cal.set(java.util.Calendar.MONTH, parseInt(today.substring(4, 6), 10)-1);
|
||||||
}
|
}
|
||||||
// nr. of empty days in rendered calendar before the first day of month appears
|
// nr. of empty days in rendered calendar before the first day of month appears
|
||||||
var pre = (7-firstDayOfWeek+cal.get(java.util.Calendar.DAY_OF_WEEK)) % 7;
|
var pre = (7-firstDayOfWeek+cal.get(java.util.Calendar.DAY_OF_WEEK)) % 7;
|
||||||
|
@ -404,7 +424,7 @@ function calendar_macro(param) {
|
||||||
calParam.year = cal.get(java.util.Calendar.YEAR);
|
calParam.year = cal.get(java.util.Calendar.YEAR);
|
||||||
|
|
||||||
// pre-render the year and month so we only have to append the days as we loop
|
// pre-render the year and month so we only have to append the days as we loop
|
||||||
var currMonth = formatTimestamp(cal.getTime(), "yyyyMM");
|
var currMonth = formatTimestamp(new Date(cal.getTime().getTime()), "yyyyMM");
|
||||||
// remember the index of the first and last days within this month.
|
// remember the index of the first and last days within this month.
|
||||||
// this is needed to optimize previous and next month links.
|
// this is needed to optimize previous and next month links.
|
||||||
var lastDayIndex = 9999999;
|
var lastDayIndex = 9999999;
|
||||||
|
@ -418,7 +438,7 @@ function calendar_macro(param) {
|
||||||
dayParam.day = " ";
|
dayParam.day = " ";
|
||||||
else {
|
else {
|
||||||
var currGroupname = currMonth+daycnt.format("00");
|
var currGroupname = currMonth+daycnt.format("00");
|
||||||
var linkText = daycnt < 10 ? " "+daycnt+" " : daycnt;
|
var linkText = daycnt < 10 ? " " + daycnt + " " : daycnt.toString();
|
||||||
var currGroup = this.get(currGroupname);
|
var currGroup = this.get(currGroupname);
|
||||||
if (currGroup) {
|
if (currGroup) {
|
||||||
var idx = this.contains(currGroup);
|
var idx = this.contains(currGroup);
|
||||||
|
@ -428,7 +448,7 @@ function calendar_macro(param) {
|
||||||
if (idx < lastDayIndex)
|
if (idx < lastDayIndex)
|
||||||
lastDayIndex = idx;
|
lastDayIndex = idx;
|
||||||
}
|
}
|
||||||
dayParam.day = "<a href=\"" + currGroup.href() + "\">" + linkText + "</a>";
|
dayParam.day = Html.linkAsString(currGroup.href(), linkText);
|
||||||
} else {
|
} else {
|
||||||
dayParam.day = linkText;
|
dayParam.day = linkText;
|
||||||
}
|
}
|
||||||
|
@ -439,14 +459,14 @@ function calendar_macro(param) {
|
||||||
weekBuf.append(this.renderSkinAsString(dayParam.skin, dayParam));
|
weekBuf.append(this.renderSkinAsString(dayParam.skin, dayParam));
|
||||||
}
|
}
|
||||||
weekParam.week = weekBuf.toString();
|
weekParam.week = weekBuf.toString();
|
||||||
calBuf.append(this.renderSkinAsString("calendarweek",weekParam));
|
calBuf.append(this.renderSkinAsString("calendarweek", weekParam));
|
||||||
}
|
}
|
||||||
// set day to last day of month and try to render next month
|
// set day to last day of month and try to render next month
|
||||||
// check what the last day of the month is
|
// check what the last day of the month is
|
||||||
calParam.back = this.renderLinkToPrevMonth(firstDayIndex,currMonth+"01",monthNames);
|
calParam.back = this.renderLinkToPrevMonth(firstDayIndex, currMonth + "01", monthNames);
|
||||||
calParam.forward = this.renderLinkToNextMonth(lastDayIndex,currMonth+"31",monthNames);
|
calParam.forward = this.renderLinkToNextMonth(lastDayIndex, currMonth + "31", monthNames);
|
||||||
calParam.calendar = calBuf.toString();
|
calParam.calendar = calBuf.toString();
|
||||||
this.renderSkin("calendar",calParam);
|
this.renderSkin("calendar", calParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -489,7 +509,7 @@ function membercounter_macro(param) {
|
||||||
* of this site
|
* of this site
|
||||||
*/
|
*/
|
||||||
function history_macro(param) {
|
function history_macro(param) {
|
||||||
if (this.isNotPublic(session.user,req.data.memberlevel))
|
if (this.isAccessDenied(session.user, req.data.memberlevel))
|
||||||
return;
|
return;
|
||||||
if (!param.show)
|
if (!param.show)
|
||||||
param.show = 5;
|
param.show = 5;
|
||||||
|
@ -498,7 +518,9 @@ function history_macro(param) {
|
||||||
this.lastmod.prefetchChildren(0, parseInt(param.show, 10));
|
this.lastmod.prefetchChildren(0, parseInt(param.show, 10));
|
||||||
while (cnt < param.show && this.lastmod.get(i)) {
|
while (cnt < param.show && this.lastmod.get(i)) {
|
||||||
var item = this.lastmod.get(i++);
|
var item = this.lastmod.get(i++);
|
||||||
if (!item.story || (item.story.online && item.story.discussions && item.site.discussions)) {
|
if (!item.story ||
|
||||||
|
(item.story.online && item.story.discussions &&
|
||||||
|
item.site.preferences.getProperty("discussions"))) {
|
||||||
item.renderSkin("historyview");
|
item.renderSkin("historyview");
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
@ -519,19 +541,8 @@ function localechooser_macro(param) {
|
||||||
/**
|
/**
|
||||||
* macro renders a list of available time zones as dropdown
|
* macro renders a list of available time zones as dropdown
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function timezonechooser_macro(param) {
|
function timezonechooser_macro(param) {
|
||||||
var zones = java.util.TimeZone.getAvailableIDs();
|
renderTimeZoneChooser(this.getTimeZone());
|
||||||
var options = new Array();
|
|
||||||
var format = new java.text.DecimalFormat ("-0;+0");
|
|
||||||
var currentZone = this.getTimeZone();
|
|
||||||
for (var i in zones) {
|
|
||||||
var zone = java.util.TimeZone.getTimeZone (zones[i]);
|
|
||||||
options[i] = "GMT"+(format.format(zone.getRawOffset()/3600000))+" ("+zones[i]+")";
|
|
||||||
if (zones[i] == currentZone.getID())
|
|
||||||
var selectedIndex = i;
|
|
||||||
}
|
|
||||||
renderDropDownBox("timezone",options,selectedIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -560,7 +571,7 @@ function listReferrers_macro() {
|
||||||
var c = getDBConnection("antville");
|
var c = getDBConnection("antville");
|
||||||
var dbError = c.getLastError();
|
var dbError = c.getLastError();
|
||||||
if (dbError)
|
if (dbError)
|
||||||
return (getMessage("error","database",dbError));
|
return getMessage("error.database", dbError);
|
||||||
// we're doing this with direct db access here
|
// we're doing this with direct db access here
|
||||||
// (there's no need to do it with prototypes):
|
// (there's no need to do it with prototypes):
|
||||||
var d = new Date();
|
var d = new Date();
|
||||||
|
@ -572,7 +583,7 @@ function listReferrers_macro() {
|
||||||
var rows = c.executeRetrieval(query);
|
var rows = c.executeRetrieval(query);
|
||||||
var dbError = c.getLastError();
|
var dbError = c.getLastError();
|
||||||
if (dbError)
|
if (dbError)
|
||||||
return (getMessage("error","database",dbError));
|
return getMessage("error.database", dbError);
|
||||||
var skinParam = new Object();
|
var skinParam = new Object();
|
||||||
var referrer;
|
var referrer;
|
||||||
while (rows.next()) {
|
while (rows.next()) {
|
||||||
|
@ -595,9 +606,9 @@ function xmlbutton_macro(param) {
|
||||||
var img = root.images.get("xmlbutton");
|
var img = root.images.get("xmlbutton");
|
||||||
if (!img)
|
if (!img)
|
||||||
return;
|
return;
|
||||||
openLink(this.href("rss"));
|
Html.openLink(this.href("rss"));
|
||||||
renderImage(img, param);
|
renderImage(img, param);
|
||||||
closeLink();
|
Html.closeLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -613,18 +624,18 @@ function searchbox_macro(param) {
|
||||||
* function renders the months of the archive
|
* function renders the months of the archive
|
||||||
*/
|
*/
|
||||||
function monthlist_macro(param) {
|
function monthlist_macro(param) {
|
||||||
if (!this.stories.size() || !this.archive)
|
if (!this.stories.size() || !this.preferences.getProperty("archive"))
|
||||||
return;
|
return;
|
||||||
var size = param.limit ? Math.min(this.size(),param.limit) : this.size();
|
var size = param.limit ? Math.min(this.size(), param.limit) : this.size();
|
||||||
for (var i=0;i<size;i++) {
|
for (var i=0;i<size;i++) {
|
||||||
var curr = this.get(i);
|
var curr = this.get(i);
|
||||||
var next = this.get(i+1);
|
var next = this.get(i+1);
|
||||||
if (!next || next.groupname.substring(0,6) < curr.groupname.substring(0,6)) {
|
if (!next || next.groupname.substring(0, 6) < curr.groupname.substring(0, 6)) {
|
||||||
res.write(param.itemprefix);
|
res.write(param.itemprefix);
|
||||||
openLink(curr.href());
|
Html.openLink(curr.href());
|
||||||
var ts = parseTimestamp(curr.groupname.substring(0,6),"yyyyMM");
|
var ts = curr.groupname.substring(0, 6).toDate("yyyyMM", this.getTimeZone());
|
||||||
res.write(formatTimestamp(ts,param.format ? param.format : "MMMM yyyy"));
|
res.write(formatTimestamp(ts, param.format ? param.format : "MMMM yyyy"));
|
||||||
closeLink();
|
Html.closeLink();
|
||||||
res.write(param.itemsuffix);
|
res.write(param.itemsuffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue