threw out markup and using global functions openMarkupElement() et. al. instead
This commit is contained in:
parent
a491176656
commit
284ee190e0
2 changed files with 226 additions and 230 deletions
|
@ -1,348 +1,351 @@
|
||||||
/**
|
/**
|
||||||
* macro rendering title of weblog
|
* macro rendering title of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title_macro(param) {
|
function title_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("title",param));
|
this.renderInputText(this.createInputParam("title", param));
|
||||||
else {
|
else {
|
||||||
if (param && param.linkto) {
|
if (param && param.linkto) {
|
||||||
this.openLink(param);
|
this.openLink(param);
|
||||||
if (this.title)
|
if (this.title)
|
||||||
res.write(stripTags(this.title));
|
res.write(stripTags(this.title));
|
||||||
else
|
else
|
||||||
res.write("[untitled weblog]");
|
res.write("[untitled weblog]");
|
||||||
this.closeLink(param);
|
this.closeLink(param);
|
||||||
} else
|
}
|
||||||
res.write(this.title);
|
else
|
||||||
}
|
res.write(this.title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering alias of weblog
|
* macro rendering alias of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function alias_macro(param) {
|
function alias_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("alias",param));
|
this.renderInputText(this.createInputParam("alias",param));
|
||||||
else
|
else
|
||||||
res.write(this.alias);
|
res.write(this.alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering tagline of weblog
|
* macro rendering tagline of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function tagline_macro(param) {
|
function tagline_macro(param) {
|
||||||
if (!this.tagline && param.as != "editor")
|
if (!this.tagline && param.as != "editor")
|
||||||
return;
|
return;
|
||||||
if (param.as == "editor")
|
|
||||||
this.renderInputText(this.createInputParam("tagline",param));
|
if (param.as == "editor")
|
||||||
else if (this.tagline)
|
this.renderInputText(this.createInputParam("tagline",param));
|
||||||
res.write(stripTags(this.tagline));
|
else if (this.tagline)
|
||||||
|
res.write(stripTags(this.tagline));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering birthdate of weblog
|
* macro rendering birthdate of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function birthdate_macro(param) {
|
function birthdate_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderDateDropdown(this.createInputParam("birthdate",param));
|
this.renderDateDropdown(this.createInputParam("birthdate",param));
|
||||||
else if (param.format)
|
else if (param.format)
|
||||||
res.write(this.birthdate.format(param.format));
|
res.write(this.birthdate.format(param.format));
|
||||||
else
|
else
|
||||||
res.write(this.birthdate.format("yyyy.MM.dd HH:mm"));
|
res.write(this.birthdate.format("yyyy.MM.dd HH:mm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering email of weblog
|
* macro rendering email of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function email_macro(param) {
|
function email_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("email",param));
|
this.renderInputText(this.createInputParam("email",param));
|
||||||
else
|
else
|
||||||
res.write(this.email);
|
res.write(this.email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering bgcolor of weblog
|
* macro rendering bgcolor of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function bgcolor_macro(param) {
|
function bgcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("bgcolor",param));
|
this.renderInputText(this.createInputParam("bgcolor",param));
|
||||||
else
|
else
|
||||||
renderColor(this.bgcolor);
|
renderColor(this.bgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering textfont of weblog
|
* macro rendering textfont of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function textfont_macro(param) {
|
function textfont_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("textfont",param));
|
this.renderInputText(this.createInputParam("textfont",param));
|
||||||
else
|
else
|
||||||
res.write(this.textfont);
|
res.write(this.textfont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering textsize of weblog
|
* macro rendering textsize of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function textsize_macro(param) {
|
function textsize_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("textsize",param));
|
this.renderInputText(this.createInputParam("textsize",param));
|
||||||
else
|
else
|
||||||
res.write(this.textsize);
|
res.write(this.textsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering textcolor of weblog
|
* macro rendering textcolor of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function textcolor_macro(param) {
|
function textcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("textcolor",param));
|
this.renderInputText(this.createInputParam("textcolor",param));
|
||||||
else
|
else
|
||||||
renderColor(this.textcolor);
|
renderColor(this.textcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering linkcolor of weblog
|
* macro rendering linkcolor of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function linkcolor_macro(param) {
|
function linkcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("linkcolor",param));
|
this.renderInputText(this.createInputParam("linkcolor",param));
|
||||||
else
|
else
|
||||||
renderColor(this.linkcolor);
|
renderColor(this.linkcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering alinkcolor of weblog
|
* macro rendering alinkcolor of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function alinkcolor_macro(param) {
|
function alinkcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("alinkcolor",param));
|
this.renderInputText(this.createInputParam("alinkcolor",param));
|
||||||
else
|
else
|
||||||
renderColor(this.alinkcolor);
|
renderColor(this.alinkcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering vlinkcolor of weblog
|
* macro rendering vlinkcolor of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function vlinkcolor_macro(param) {
|
function vlinkcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("vlinkcolor",param));
|
this.renderInputText(this.createInputParam("vlinkcolor",param));
|
||||||
else
|
else
|
||||||
renderColor(this.vlinkcolor);
|
renderColor(this.vlinkcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering titlefont of weblog
|
* macro rendering titlefont of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function titlefont_macro(param) {
|
function titlefont_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("titlefont",param));
|
this.renderInputText(this.createInputParam("titlefont",param));
|
||||||
else
|
else
|
||||||
res.write(this.titlefont);
|
res.write(this.titlefont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering titlesize of weblog
|
* macro rendering titlesize of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function titlesize_macro(param) {
|
function titlesize_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("titlesize",param));
|
this.renderInputText(this.createInputParam("titlesize",param));
|
||||||
else
|
else
|
||||||
res.write(this.titlesize);
|
res.write(this.titlesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering titlecolor of weblog
|
* macro rendering titlecolor of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function titlecolor_macro(param) {
|
function titlecolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("titlecolor",param));
|
this.renderInputText(this.createInputParam("titlecolor",param));
|
||||||
else
|
else
|
||||||
renderColor(this.titlecolor);
|
renderColor(this.titlecolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering smallfont of weblog
|
* macro rendering smallfont of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function smallfont_macro(param) {
|
function smallfont_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("smallfont",param));
|
this.renderInputText(this.createInputParam("smallfont",param));
|
||||||
else
|
else
|
||||||
res.write(this.smallfont);
|
res.write(this.smallfont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering smallfont-size of weblog
|
* macro rendering smallfont-size of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function smallsize_macro(param) {
|
function smallsize_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("smallsize",param));
|
this.renderInputText(this.createInputParam("smallsize",param));
|
||||||
else
|
else
|
||||||
res.write(this.smallsize);
|
res.write(this.smallsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering smallfont-color of weblog
|
* macro rendering smallfont-color of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function smallcolor_macro(param) {
|
function smallcolor_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("smallcolor",param));
|
this.renderInputText(this.createInputParam("smallcolor",param));
|
||||||
else
|
else
|
||||||
renderColor(this.smallcolor);
|
renderColor(this.smallcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering lastupdate of weblog
|
* macro rendering lastupdate of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastupdate_macro(param) {
|
function lastupdate_macro(param) {
|
||||||
if (!this.lastupdate)
|
if (!this.lastupdate) {
|
||||||
res.write("no updates so far");
|
res.write("no updates so far");
|
||||||
else
|
}
|
||||||
res.write(formatTimestamp(this.lastupdate,param.format));
|
else
|
||||||
|
res.write(this.formatTimestamp(this.lastupdate,param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering createtime of weblog
|
* macro rendering createtime of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function createtime_macro(param) {
|
function createtime_macro(param) {
|
||||||
res.write(formatTimestamp(this.createtime,param.format));
|
res.write(this.formatTimestamp(this.createtime,param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering modifytime of weblog
|
* macro rendering modifytime of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function modifytime_macro(param) {
|
function modifytime_macro(param) {
|
||||||
if (this.modifytime)
|
if (this.modifytime) {
|
||||||
res.write(formatTimestamp(this.modifytime,param.format));
|
res.write(res.write(this.formatTimestamp(this.modifytime,param)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering online-status of weblog
|
* macro rendering online-status of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function online_macro(param) {
|
function online_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputCheckbox(this.createInputParam("online",param));
|
this.renderInputCheckbox(this.createInputParam("online",param));
|
||||||
else
|
else
|
||||||
res.write(this.online ? "yes" : "no");
|
res.write(this.online ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro renders the url to this weblog
|
* macro renders the url to this weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function url_macro(param) {
|
function url_macro(param) {
|
||||||
res.write(this.href());
|
res.write(this.href());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering discussion-flag of weblog
|
* macro rendering discussion-flag of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function hasdiscussions_macro(param) {
|
function hasdiscussions_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputCheckbox(this.createInputParam("discussions",param));
|
this.renderInputCheckbox(this.createInputParam("discussions",param));
|
||||||
else
|
else
|
||||||
res.write(parseInt(this.discussions,10) ? "yes" : "no");
|
res.write(parseInt(this.discussions,10) ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering usercontrib-flag of weblog
|
* macro rendering usercontrib-flag of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function usermaycontrib_macro(param) {
|
function usermaycontrib_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputCheckbox(this.createInputParam("usercontrib",param));
|
this.renderInputCheckbox(this.createInputParam("usercontrib",param));
|
||||||
else
|
else
|
||||||
res.write(parseInt(this.usercontrib,10) ? "yes" : "no");
|
res.write(parseInt(this.usercontrib,10) ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering nr. of days to show on weblog-fontpage
|
* macro rendering nr. of days to show on weblog-fontpage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showdays_macro(param) {
|
function showdays_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("days",param));
|
this.renderInputText(this.createInputParam("days",param));
|
||||||
else
|
else
|
||||||
res.write(this.days);
|
res.write(this.days);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering archive-flag of weblog
|
* macro rendering archive-flag of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showarchive_macro(param) {
|
function showarchive_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputCheckbox(this.createInputParam("archive",param));
|
this.renderInputCheckbox(this.createInputParam("archive",param));
|
||||||
else
|
else
|
||||||
res.write(parseInt(this.archive,10) ? "yes" : "no");
|
res.write(parseInt(this.archive,10) ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering enableping-flag of weblog
|
* macro rendering enableping-flag of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function enableping_macro(param) {
|
function enableping_macro(param) {
|
||||||
if (param.as == "editor")
|
if (param.as == "editor")
|
||||||
this.renderInputCheckbox(this.createInputParam("enableping",param));
|
this.renderInputCheckbox(this.createInputParam("enableping",param));
|
||||||
else
|
else
|
||||||
res.write(parseInt(this.enableping,10) ? "yes" : "no");
|
res.write(parseInt(this.enableping,10) ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering default longdateformat of weblog
|
* macro rendering default longdateformat of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function longdateformat_macro(param) {
|
function longdateformat_macro(param) {
|
||||||
if (param.as == "chooser")
|
if (param.as == "chooser")
|
||||||
this.renderDateformatChooser("long");
|
this.renderDateformatChooser("long");
|
||||||
else if (param.as == "editor")
|
else if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("longdateformat",param));
|
this.renderInputText(this.createInputParam("longdateformat",param));
|
||||||
else
|
else
|
||||||
res.write(this.longdateformat);
|
res.write(this.longdateformat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering default shortdateformat of weblog
|
* macro rendering default shortdateformat of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function shortdateformat_macro(param) {
|
function shortdateformat_macro(param) {
|
||||||
if (param.as == "chooser")
|
if (param.as == "chooser")
|
||||||
this.renderDateformatChooser("short");
|
this.renderDateformatChooser("short");
|
||||||
else if (param.as == "editor")
|
else if (param.as == "editor")
|
||||||
this.renderInputText(this.createInputParam("shortdateformat",param));
|
this.renderInputText(this.createInputParam("shortdateformat",param));
|
||||||
else
|
else
|
||||||
res.write(this.shortdateformat);
|
res.write(this.shortdateformat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro rendering loginStatus of user
|
* macro rendering loginStatus of user
|
||||||
* valid params: - loginSkin
|
* valid params: - loginSkin
|
||||||
* - logoutSkin
|
* - logoutSkin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function loginstatus_macro(param) {
|
function loginstatus_macro(param) {
|
||||||
if (session.user)
|
if (session.user)
|
||||||
this.members.renderSkin("statusloggedin");
|
this.members.renderSkin("statusloggedin");
|
||||||
|
@ -355,7 +358,6 @@ function loginstatus_macro(param) {
|
||||||
* macro rendering two different navigation-skins
|
* macro rendering two different navigation-skins
|
||||||
* depending on user-status & rights
|
* depending on user-status & rights
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function navigation_macro(param) {
|
function navigation_macro(param) {
|
||||||
this.renderSkin("usernavigation");
|
this.renderSkin("usernavigation");
|
||||||
if (!session.user)
|
if (!session.user)
|
||||||
|
@ -372,19 +374,16 @@ function navigation_macro(param) {
|
||||||
* macro writes storylist to response-object
|
* macro writes storylist to response-object
|
||||||
* kept for backwards-compatibility only
|
* kept for backwards-compatibility only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function storylist_macro(param) {
|
function storylist_macro(param) {
|
||||||
res.write(res.data.storylist);
|
res.write(res.data.storylist);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro renders a calendar
|
* macro renders a calendar
|
||||||
* version 2
|
* version 2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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 weblog is disabled
|
// or if archive of this weblog is disabled
|
||||||
|
@ -469,7 +468,6 @@ function calendar_macro(param) {
|
||||||
/**
|
/**
|
||||||
* macro renders age of weblog
|
* macro renders age of weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function age_macro(param) {
|
function age_macro(param) {
|
||||||
if (this.birthdate) {
|
if (this.birthdate) {
|
||||||
if (param && param.format)
|
if (param && param.format)
|
||||||
|
@ -486,7 +484,6 @@ function age_macro(param) {
|
||||||
* macro left for backwards-compatibility
|
* macro left for backwards-compatibility
|
||||||
* calls global image_macro()
|
* calls global image_macro()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function image_macro(param) {
|
function image_macro(param) {
|
||||||
image_macro(param);
|
image_macro(param);
|
||||||
}
|
}
|
||||||
|
@ -496,24 +493,23 @@ function image_macro(param) {
|
||||||
* macro left for backwards-compatibility
|
* macro left for backwards-compatibility
|
||||||
* calls global thumbnail_macro()
|
* calls global thumbnail_macro()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function thumbnail_macro(param) {
|
function thumbnail_macro(param) {
|
||||||
thumbnail_macro(param);
|
thumbnail_macro(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro renders the number of members of this weblog
|
* macro renders the number of members of this weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function membercounter_macro(param) {
|
function membercounter_macro(param) {
|
||||||
res.write(this.members.size());
|
res.write(this.members.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro renders a list of recentyl added/updated stories/comments
|
* macro renders a list of recentyl added/updated stories/comments
|
||||||
* of this weblog
|
* of this weblog
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function history_macro(param) {
|
function history_macro(param) {
|
||||||
if (this.isNotPublic(session.user) && !this.isUserMember(session.user))
|
if (this.isNotPublic(session.user) && !this.isUserMember(session.user))
|
||||||
return;
|
return;
|
||||||
|
@ -527,7 +523,6 @@ function history_macro(param) {
|
||||||
/**
|
/**
|
||||||
* macro renders a list of available locales as dropdown
|
* macro renders a list of available locales as dropdown
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function localechooser_macro(param) {
|
function localechooser_macro(param) {
|
||||||
var locs = java.util.Locale.getAvailableLocales();
|
var locs = java.util.Locale.getAvailableLocales();
|
||||||
var options = new Array();
|
var options = new Array();
|
||||||
|
@ -538,9 +533,11 @@ function localechooser_macro(param) {
|
||||||
if (locs[i].equals(loc))
|
if (locs[i].equals(loc))
|
||||||
var selectedIndex = i;
|
var selectedIndex = i;
|
||||||
}
|
}
|
||||||
res.write(simpleDropDownBox("locale",options,selectedIndex));
|
renderDropDownBox("locale",options,selectedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* macro renders a list of available time zones as dropdown
|
* macro renders a list of available time zones as dropdown
|
||||||
*/
|
*/
|
||||||
|
@ -556,7 +553,7 @@ function timezonechooser_macro(param) {
|
||||||
if (zones[i] == currentZone.getID())
|
if (zones[i] == currentZone.getID())
|
||||||
var selectedIndex = i;
|
var selectedIndex = i;
|
||||||
}
|
}
|
||||||
res.write(simpleDropDownBox("timezone",options,selectedIndex));
|
renderDropDownBox("timezone",options,selectedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -564,26 +561,25 @@ function timezonechooser_macro(param) {
|
||||||
* renders a list of most read pages, ie. a link
|
* renders a list of most read pages, ie. a link
|
||||||
* to a story together with the read counter et al.
|
* to a story together with the read counter et al.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function listMostRead_macro() {
|
function listMostRead_macro() {
|
||||||
var str = "";
|
var str = "";
|
||||||
var storyList = this.mostread.list();
|
var storyList = this.mostread.list();
|
||||||
storyList.sort(this.sortMostReads);
|
storyList.sort(this.sortMostReads);
|
||||||
var len = storyList.length;
|
var len = storyList.length;
|
||||||
var max = 25;
|
var max = 25;
|
||||||
var lim = Math.min(max, len); //len > max ? max : len;
|
var lim = Math.min(max, len); //len > max ? max : len;
|
||||||
var param = new Object();
|
var param = new Object();
|
||||||
for (var i=0; i<lim; i++) {
|
for (var i=0; i<lim; i++) {
|
||||||
var s = storyList[i];
|
var s = storyList[i];
|
||||||
if (s.cache.reads > 0) {
|
if (s.cache.reads > 0) {
|
||||||
s.reads += s.cache.reads;
|
s.reads += s.cache.reads;
|
||||||
s.cache.reads = 0;
|
s.cache.reads = 0;
|
||||||
}
|
}
|
||||||
param.reads = s.reads; // + s.cache.reads;
|
param.reads = s.reads; // + s.cache.reads;
|
||||||
param.rank = i+1;
|
param.rank = i+1;
|
||||||
str += s.renderSkinAsString("mostread", param);
|
str += s.renderSkinAsString("mostread", param);
|
||||||
}
|
}
|
||||||
return(str);
|
return(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -591,35 +587,34 @@ function listMostRead_macro() {
|
||||||
* renders a list of referrers, ie. a link
|
* renders a list of referrers, ie. a link
|
||||||
* to a url together with the read counter et al.
|
* to a url together with the read counter et al.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function listReferrers_macro() {
|
function listReferrers_macro() {
|
||||||
var str = "";
|
var str = "";
|
||||||
var c = getDBConnection("antville");
|
var c = getDBConnection("antville");
|
||||||
error = c.getLastError();
|
error = c.getLastError();
|
||||||
if (error)
|
if (error)
|
||||||
return("Error establishing DB connection: " + error);
|
return("Error establishing DB connection: " + error);
|
||||||
|
|
||||||
// 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(new Date() - 1000 * 60 * 60 * 24); // 24 hours ago
|
var d = new Date(new Date() - 1000 * 60 * 60 * 24); // 24 hours ago
|
||||||
var query = "select *, count(*) as \"COUNT\" from ACCESS where WEBLOG_ID = " + this._id + " and DATE > '" + d.format("yyyy-MM-dd HH:mm:ss") + "' group by REFERRER order by \"COUNT\" desc, REFERRER asc;";
|
var query = "select *, count(*) as \"COUNT\" from ACCESS where WEBLOG_ID = " + this._id + " and DATE > '" + d.format("yyyy-MM-dd HH:mm:ss") + "' group by REFERRER order by \"COUNT\" desc, REFERRER asc;";
|
||||||
var rows = c.executeRetrieval(query);
|
var rows = c.executeRetrieval(query);
|
||||||
error = c.getLastError();
|
error = c.getLastError();
|
||||||
if (error)
|
if (error)
|
||||||
return("Error executing SQL query: " + error);
|
return("Error executing SQL query: " + error);
|
||||||
|
|
||||||
var param = new Object();
|
var param = new Object();
|
||||||
while (rows.next()) {
|
while (rows.next()) {
|
||||||
param.count = rows.getColumnItem("COUNT");
|
param.count = rows.getColumnItem("COUNT");
|
||||||
// these two lines are necessary only for hsqldb connections:
|
// these two lines are necessary only for hsqldb connections:
|
||||||
if (param.count == 0);
|
if (param.count == 0);
|
||||||
continue;
|
continue;
|
||||||
param.referrer = rows.getColumnItem("REFERRER");
|
param.referrer = rows.getColumnItem("REFERRER");
|
||||||
param.text = param.referrer.length > 50 ? param.referrer.substring(0, 50) + "..." : param.referrer;
|
param.text = param.referrer.length > 50 ? param.referrer.substring(0, 50) + "..." : param.referrer;
|
||||||
str += this.renderSkinAsString("referrerItem", param);
|
str += this.renderSkinAsString("referrerItem", param);
|
||||||
}
|
}
|
||||||
rows.release();
|
rows.release();
|
||||||
return(str);
|
return(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -627,16 +622,14 @@ function listReferrers_macro() {
|
||||||
* renders the xml button for use
|
* renders the xml button for use
|
||||||
* when referring to an rss feed
|
* when referring to an rss feed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function xmlbutton_macro() {
|
function xmlbutton_macro() {
|
||||||
var param = new Object();
|
var param = new Object();
|
||||||
param.to = this.href("rss10");
|
param.to = this.href("rss10");
|
||||||
param.name = "xmlbutton";
|
param.name = "xmlbutton";
|
||||||
var img = root.images.get(param.name);
|
var img = root.images.get(param.name);
|
||||||
if (!img)
|
if (!img)
|
||||||
return;
|
return;
|
||||||
this.openLink(param);
|
this.openLink(param);
|
||||||
root.renderImage(img, param);
|
renderImage(img, param);
|
||||||
this.closeLink();
|
this.closeLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,15 @@ function skins_macro(param) {
|
||||||
for (var i in app.skinfiles) {
|
for (var i in app.skinfiles) {
|
||||||
res.write("<b>" + i + "</b>");
|
res.write("<b>" + i + "</b>");
|
||||||
for (var j in app.skinfiles[i]) {
|
for (var j in app.skinfiles[i]) {
|
||||||
res.write("<li>");
|
var linkparam = new Object();
|
||||||
res.write("<a href=\"" + this.href() + "?proto=" + i + "&name=" + j + "\">");
|
linkparam.href = this.href() + "?proto=" + i + "&name=" + j;
|
||||||
|
openMarkupElement("li");
|
||||||
|
openMarkupElement("a", linkparam);
|
||||||
res.write(j);
|
res.write(j);
|
||||||
res.write("</a></li>");
|
closeMarkupElement("a");
|
||||||
|
closeMarkupElement("li");
|
||||||
}
|
}
|
||||||
res.write("<br>");
|
renderMarkupElement("br");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue