106 lines
No EOL
2.1 KiB
JavaScript
106 lines
No EOL
2.1 KiB
JavaScript
/**
|
|
* macro rendering username
|
|
*/
|
|
|
|
function name_macro(param) {
|
|
if (this.url)
|
|
Html.link({href: this.url}, this.name);
|
|
else
|
|
res.write(this.name);
|
|
}
|
|
|
|
/**
|
|
* macro rendering password
|
|
*/
|
|
|
|
function password_macro(param) {
|
|
if (param.as == "editor")
|
|
Html.password(this.createInputParam("password", param));
|
|
return;
|
|
}
|
|
|
|
|
|
/**
|
|
* macro rendering URL
|
|
*/
|
|
|
|
function url_macro(param) {
|
|
if (param.as == "editor")
|
|
Html.input(this.createInputParam("url", param));
|
|
else
|
|
res.write(this.url);
|
|
}
|
|
|
|
|
|
/**
|
|
* macro rendering email
|
|
*/
|
|
|
|
function email_macro(param) {
|
|
if (param.as == "editor")
|
|
Html.input(this.createInputParam("email", param));
|
|
else
|
|
res.write(this.email);
|
|
}
|
|
|
|
/**
|
|
* macro rendering checkbox for publishemail
|
|
*/
|
|
|
|
function publishemail_macro(param) {
|
|
if (param.as == "editor") {
|
|
var inputParam = this.createCheckBoxParam("publishemail", param);
|
|
if (req.data.save && !req.data.publishemail)
|
|
delete inputParam.checked;
|
|
Html.checkBox(inputParam);
|
|
} else
|
|
res.write(this.publishemail ? "yes" : "no");
|
|
}
|
|
|
|
/**
|
|
* macro renders a list of memberships of this user
|
|
* meaning all memberships where level > 0
|
|
*/
|
|
|
|
function membershiplist_macro(param) {
|
|
if (!this.memberships.size())
|
|
res.writeln("-----");
|
|
else {
|
|
for (var i=0;i<this.memberships.size();i++)
|
|
this.memberships.get(i).renderSkin("membership");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* macro renders a list of subscriptions of this user
|
|
* meaning all memberships where level == 0
|
|
*/
|
|
|
|
function subscriptionlist_macro(param) {
|
|
if (!this.subscriptions.size())
|
|
res.writeln("-----");
|
|
else {
|
|
for (var i=0;i<this.subscriptions.size();i++)
|
|
this.subscriptions.get(i).renderSkin("subscription");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* macro renders the sites the user is a member of or has subscribed to
|
|
* in order of their last update-timestamp
|
|
*/
|
|
|
|
function sitelist_macro(param) {
|
|
if (!this.size())
|
|
res.writeln("-----");
|
|
else {
|
|
var l = session.user.list();
|
|
l.sort(this.sortSubscriptions);
|
|
for (var i in l) {
|
|
var s = l[i].site;
|
|
if (!s)
|
|
continue;
|
|
s.renderSkin("preview");
|
|
}
|
|
}
|
|
} |