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 * 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));
@ -13,15 +12,16 @@ function title_macro(param) {
else else
res.write("[untitled weblog]"); res.write("[untitled weblog]");
this.closeLink(param); this.closeLink(param);
} else }
else
res.write(this.title); 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));
@ -29,23 +29,24 @@ function alias_macro(param) {
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") if (param.as == "editor")
this.renderInputText(this.createInputParam("tagline",param)); this.renderInputText(this.createInputParam("tagline",param));
else if (this.tagline) else if (this.tagline)
res.write(stripTags(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));
@ -55,10 +56,10 @@ function birthdate_macro(param) {
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));
@ -66,10 +67,10 @@ function email_macro(param) {
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));
@ -77,10 +78,10 @@ function bgcolor_macro(param) {
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));
@ -88,10 +89,10 @@ function textfont_macro(param) {
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));
@ -99,10 +100,10 @@ function textsize_macro(param) {
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));
@ -110,10 +111,10 @@ function textcolor_macro(param) {
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));
@ -121,10 +122,10 @@ function linkcolor_macro(param) {
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));
@ -132,10 +133,10 @@ function alinkcolor_macro(param) {
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));
@ -143,10 +144,10 @@ function vlinkcolor_macro(param) {
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));
@ -154,10 +155,10 @@ function titlefont_macro(param) {
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));
@ -165,10 +166,10 @@ function titlesize_macro(param) {
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));
@ -176,10 +177,10 @@ function titlecolor_macro(param) {
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));
@ -187,10 +188,10 @@ function smallfont_macro(param) {
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));
@ -198,10 +199,10 @@ function smallsize_macro(param) {
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));
@ -209,38 +210,40 @@ function smallcolor_macro(param) {
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));
@ -248,18 +251,18 @@ function online_macro(param) {
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));
@ -267,10 +270,10 @@ function hasdiscussions_macro(param) {
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));
@ -278,10 +281,10 @@ function usermaycontrib_macro(param) {
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));
@ -289,10 +292,10 @@ function showdays_macro(param) {
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));
@ -300,10 +303,10 @@ function showarchive_macro(param) {
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));
@ -311,10 +314,10 @@ function enableping_macro(param) {
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");
@ -324,10 +327,10 @@ function longdateformat_macro(param) {
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");
@ -337,12 +340,12 @@ function shortdateformat_macro(param) {
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,7 +561,6 @@ 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();
@ -591,7 +587,6 @@ 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");
@ -627,7 +622,6 @@ 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");
@ -636,7 +630,6 @@ function xmlbutton_macro() {
if (!img) if (!img)
return; return;
this.openLink(param); this.openLink(param);
root.renderImage(img, param); renderImage(img, param);
this.closeLink(); this.closeLink();
} }

View file

@ -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");
} }
} }