threw out markup and using global functions openMarkupElement() et. al. instead

This commit is contained in:
Tobi Schäfer 2002-06-03 16:57:07 +00:00
parent a491176656
commit 284ee190e0
2 changed files with 226 additions and 230 deletions

View file

@ -1,7 +1,6 @@
/**
* macro rendering title of weblog
*/
function title_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("title", param));
@ -13,15 +12,16 @@ function title_macro(param) {
else
res.write("[untitled weblog]");
this.closeLink(param);
} else
}
else
res.write(this.title);
}
}
/**
* macro rendering alias of weblog
*/
function alias_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("alias",param));
@ -29,23 +29,24 @@ function alias_macro(param) {
res.write(this.alias);
}
/**
* macro rendering tagline of weblog
*/
function tagline_macro(param) {
if (!this.tagline && param.as != "editor")
return;
if (param.as == "editor")
this.renderInputText(this.createInputParam("tagline",param));
else if (this.tagline)
res.write(stripTags(this.tagline));
}
/**
* macro rendering birthdate of weblog
*/
function birthdate_macro(param) {
if (param.as == "editor")
this.renderDateDropdown(this.createInputParam("birthdate",param));
@ -55,10 +56,10 @@ function birthdate_macro(param) {
res.write(this.birthdate.format("yyyy.MM.dd HH:mm"));
}
/**
* macro rendering email of weblog
*/
function email_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("email",param));
@ -66,10 +67,10 @@ function email_macro(param) {
res.write(this.email);
}
/**
* macro rendering bgcolor of weblog
*/
function bgcolor_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("bgcolor",param));
@ -77,10 +78,10 @@ function bgcolor_macro(param) {
renderColor(this.bgcolor);
}
/**
* macro rendering textfont of weblog
*/
function textfont_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("textfont",param));
@ -88,10 +89,10 @@ function textfont_macro(param) {
res.write(this.textfont);
}
/**
* macro rendering textsize of weblog
*/
function textsize_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("textsize",param));
@ -99,10 +100,10 @@ function textsize_macro(param) {
res.write(this.textsize);
}
/**
* macro rendering textcolor of weblog
*/
function textcolor_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("textcolor",param));
@ -110,10 +111,10 @@ function textcolor_macro(param) {
renderColor(this.textcolor);
}
/**
* macro rendering linkcolor of weblog
*/
function linkcolor_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("linkcolor",param));
@ -121,10 +122,10 @@ function linkcolor_macro(param) {
renderColor(this.linkcolor);
}
/**
* macro rendering alinkcolor of weblog
*/
function alinkcolor_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("alinkcolor",param));
@ -132,10 +133,10 @@ function alinkcolor_macro(param) {
renderColor(this.alinkcolor);
}
/**
* macro rendering vlinkcolor of weblog
*/
function vlinkcolor_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("vlinkcolor",param));
@ -143,10 +144,10 @@ function vlinkcolor_macro(param) {
renderColor(this.vlinkcolor);
}
/**
* macro rendering titlefont of weblog
*/
function titlefont_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("titlefont",param));
@ -154,10 +155,10 @@ function titlefont_macro(param) {
res.write(this.titlefont);
}
/**
* macro rendering titlesize of weblog
*/
function titlesize_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("titlesize",param));
@ -165,10 +166,10 @@ function titlesize_macro(param) {
res.write(this.titlesize);
}
/**
* macro rendering titlecolor of weblog
*/
function titlecolor_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("titlecolor",param));
@ -176,10 +177,10 @@ function titlecolor_macro(param) {
renderColor(this.titlecolor);
}
/**
* macro rendering smallfont of weblog
*/
function smallfont_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("smallfont",param));
@ -187,10 +188,10 @@ function smallfont_macro(param) {
res.write(this.smallfont);
}
/**
* macro rendering smallfont-size of weblog
*/
function smallsize_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("smallsize",param));
@ -198,10 +199,10 @@ function smallsize_macro(param) {
res.write(this.smallsize);
}
/**
* macro rendering smallfont-color of weblog
*/
function smallcolor_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("smallcolor",param));
@ -209,38 +210,40 @@ function smallcolor_macro(param) {
renderColor(this.smallcolor);
}
/**
* macro rendering lastupdate of weblog
*/
function lastupdate_macro(param) {
if (!this.lastupdate)
if (!this.lastupdate) {
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
*/
function createtime_macro(param) {
res.write(formatTimestamp(this.createtime,param.format));
res.write(this.formatTimestamp(this.createtime,param));
}
/**
* macro rendering modifytime of weblog
*/
function modifytime_macro(param) {
if (this.modifytime)
res.write(formatTimestamp(this.modifytime,param.format));
if (this.modifytime) {
res.write(res.write(this.formatTimestamp(this.modifytime,param)));
}
}
/**
* macro rendering online-status of weblog
*/
function online_macro(param) {
if (param.as == "editor")
this.renderInputCheckbox(this.createInputParam("online",param));
@ -248,18 +251,18 @@ function online_macro(param) {
res.write(this.online ? "yes" : "no");
}
/**
* macro renders the url to this weblog
*/
function url_macro(param) {
res.write(this.href());
}
/**
* macro rendering discussion-flag of weblog
*/
function hasdiscussions_macro(param) {
if (param.as == "editor")
this.renderInputCheckbox(this.createInputParam("discussions",param));
@ -267,10 +270,10 @@ function hasdiscussions_macro(param) {
res.write(parseInt(this.discussions,10) ? "yes" : "no");
}
/**
* macro rendering usercontrib-flag of weblog
*/
function usermaycontrib_macro(param) {
if (param.as == "editor")
this.renderInputCheckbox(this.createInputParam("usercontrib",param));
@ -278,10 +281,10 @@ function usermaycontrib_macro(param) {
res.write(parseInt(this.usercontrib,10) ? "yes" : "no");
}
/**
* macro rendering nr. of days to show on weblog-fontpage
*/
function showdays_macro(param) {
if (param.as == "editor")
this.renderInputText(this.createInputParam("days",param));
@ -289,10 +292,10 @@ function showdays_macro(param) {
res.write(this.days);
}
/**
* macro rendering archive-flag of weblog
*/
function showarchive_macro(param) {
if (param.as == "editor")
this.renderInputCheckbox(this.createInputParam("archive",param));
@ -300,10 +303,10 @@ function showarchive_macro(param) {
res.write(parseInt(this.archive,10) ? "yes" : "no");
}
/**
* macro rendering enableping-flag of weblog
*/
function enableping_macro(param) {
if (param.as == "editor")
this.renderInputCheckbox(this.createInputParam("enableping",param));
@ -311,10 +314,10 @@ function enableping_macro(param) {
res.write(parseInt(this.enableping,10) ? "yes" : "no");
}
/**
* macro rendering default longdateformat of weblog
*/
function longdateformat_macro(param) {
if (param.as == "chooser")
this.renderDateformatChooser("long");
@ -324,10 +327,10 @@ function longdateformat_macro(param) {
res.write(this.longdateformat);
}
/**
* macro rendering default shortdateformat of weblog
*/
function shortdateformat_macro(param) {
if (param.as == "chooser")
this.renderDateformatChooser("short");
@ -337,12 +340,12 @@ function shortdateformat_macro(param) {
res.write(this.shortdateformat);
}
/**
* macro rendering loginStatus of user
* valid params: - loginSkin
* - logoutSkin
*/
function loginstatus_macro(param) {
if (session.user)
this.members.renderSkin("statusloggedin");
@ -355,7 +358,6 @@ function loginstatus_macro(param) {
* macro rendering two different navigation-skins
* depending on user-status & rights
*/
function navigation_macro(param) {
this.renderSkin("usernavigation");
if (!session.user)
@ -372,19 +374,16 @@ function navigation_macro(param) {
* macro writes storylist to response-object
* kept for backwards-compatibility only
*/
function storylist_macro(param) {
res.write(res.data.storylist);
return;
}
/**
* macro renders a calendar
* version 2
*/
function calendar_macro(param) {
// do nothing if there is not a single story :-))
// or if archive of this weblog is disabled
@ -469,7 +468,6 @@ function calendar_macro(param) {
/**
* macro renders age of weblog
*/
function age_macro(param) {
if (this.birthdate) {
if (param && param.format)
@ -486,7 +484,6 @@ function age_macro(param) {
* macro left for backwards-compatibility
* calls global image_macro()
*/
function image_macro(param) {
image_macro(param);
}
@ -496,24 +493,23 @@ function image_macro(param) {
* macro left for backwards-compatibility
* calls global thumbnail_macro()
*/
function thumbnail_macro(param) {
thumbnail_macro(param);
}
/**
* macro renders the number of members of this weblog
*/
function membercounter_macro(param) {
res.write(this.members.size());
}
/**
* macro renders a list of recentyl added/updated stories/comments
* of this weblog
*/
function history_macro(param) {
if (this.isNotPublic(session.user) && !this.isUserMember(session.user))
return;
@ -527,7 +523,6 @@ function history_macro(param) {
/**
* macro renders a list of available locales as dropdown
*/
function localechooser_macro(param) {
var locs = java.util.Locale.getAvailableLocales();
var options = new Array();
@ -538,9 +533,11 @@ function localechooser_macro(param) {
if (locs[i].equals(loc))
var selectedIndex = i;
}
res.write(simpleDropDownBox("locale",options,selectedIndex));
renderDropDownBox("locale",options,selectedIndex);
}
/**
* macro renders a list of available time zones as dropdown
*/
@ -556,7 +553,7 @@ function timezonechooser_macro(param) {
if (zones[i] == currentZone.getID())
var selectedIndex = i;
}
res.write(simpleDropDownBox("timezone",options,selectedIndex));
renderDropDownBox("timezone",options,selectedIndex);
}
@ -564,7 +561,6 @@ function timezonechooser_macro(param) {
* renders a list of most read pages, ie. a link
* to a story together with the read counter et al.
*/
function listMostRead_macro() {
var str = "";
var storyList = this.mostread.list();
@ -591,7 +587,6 @@ function listMostRead_macro() {
* renders a list of referrers, ie. a link
* to a url together with the read counter et al.
*/
function listReferrers_macro() {
var str = "";
var c = getDBConnection("antville");
@ -627,7 +622,6 @@ function listReferrers_macro() {
* renders the xml button for use
* when referring to an rss feed
*/
function xmlbutton_macro() {
var param = new Object();
param.to = this.href("rss10");
@ -636,7 +630,6 @@ function xmlbutton_macro() {
if (!img)
return;
this.openLink(param);
root.renderImage(img, param);
renderImage(img, param);
this.closeLink();
}

View file

@ -6,12 +6,15 @@ function skins_macro(param) {
for (var i in app.skinfiles) {
res.write("<b>" + i + "</b>");
for (var j in app.skinfiles[i]) {
res.write("<li>");
res.write("<a href=\"" + this.href() + "?proto=" + i + "&name=" + j + "\">");
var linkparam = new Object();
linkparam.href = this.href() + "?proto=" + i + "&name=" + j;
openMarkupElement("li");
openMarkupElement("a", linkparam);
res.write(j);
res.write("</a></li>");
closeMarkupElement("a");
closeMarkupElement("li");
}
res.write("<br>");
renderMarkupElement("br");
}
}