antville/code/Root/macros.js

78 lines
1.6 KiB
JavaScript

/**
* macro rendering loginStatus of user
* valid params: - loginSkin
* - logoutSkin
*/
function loginstatus_macro(param) {
if (session.user)
this.members.renderSkin("statusloggedin");
else if (req.action != "login")
this.members.renderSkin("statusloggedout");
}
/**
* macro is left here for backwards-compatibility only
*/
function sitelist_macro(param) {
sitelist_macro(param);
}
/**
* macro renders the number of site (either all or just the public ones)
*/
function sitecounter_macro(param) {
if (param.count == "all")
var size = root.size();
else
var size = this.public.size();
if (size == 0)
res.write(param.no ? param.no : size);
else if (size == 1)
res.write(param.one ? param.one : size);
else
res.write(size + (param.more ? param.more : ""));
return;
}
/**
* macro renders the root url
*/
function url_macro(param) {
if (param.path)
res.write(this.href(param.path));
else
res.write(this.href());
}
/**
* macro renders the system-title of this antville-installation
*/
function systitle_macro(param) {
res.write(this.getSysTitle());
}
/**
* macro renders the system-url of this antville-installation
*/
function sysurl_macro(param) {
res.write(this.getSysUrl());
}
/**
* macro renders a link to the sysmgr if user has sysadmin rights
*/
function managelink_macro(param) {
if (!session.user || !session.user.sysadmin)
return;
openLink(root.href("manage"));
res.write(param.text ? param.text : "system management");
closeLink();
return;
}