2008-01-04 17:34:04 +00:00
|
|
|
|
// The Antville Project
|
|
|
|
|
|
// http://code.google.com/p/antville
|
|
|
|
|
|
//
|
2014-07-04 17:16:51 +02:00
|
|
|
|
// Copyright 2001–2014 by the Workers of Antville.
|
2008-01-04 17:34:04 +00:00
|
|
|
|
//
|
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the ``License'');
|
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
|
//
|
2014-07-04 15:32:18 +02:00
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2008-01-04 17:34:04 +00:00
|
|
|
|
//
|
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
|
// distributed under the License is distributed on an ``AS IS'' BASIS,
|
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
2007-09-14 00:16:06 +00:00
|
|
|
|
relocateProperty(Membership, "username", "name");
|
|
|
|
|
|
relocateProperty(Membership, "createtime", "created");
|
|
|
|
|
|
relocateProperty(Membership, "modifytime", "modified");
|
|
|
|
|
|
relocateProperty(Membership, "user", "creator");
|
|
|
|
|
|
|
|
|
|
|
|
Membership.prototype.username_macro = function(param) {
|
2014-07-04 15:32:18 +02:00
|
|
|
|
if (param.linkto && (param.linkto !== "edit" ||
|
|
|
|
|
|
this.user !== session.user)) {
|
|
|
|
|
|
html.link({href: this.href(param.linkto)}, this.name);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
res.write(this.name);
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
2008-04-21 13:52:13 +00:00
|
|
|
|
}
|
2007-09-14 00:16:06 +00:00
|
|
|
|
|
|
|
|
|
|
Membership.prototype.url_macro = function(param) {
|
2014-07-04 15:32:18 +02:00
|
|
|
|
var url;
|
|
|
|
|
|
if (url = this.user.url) {
|
|
|
|
|
|
if (param.as === "link") {
|
|
|
|
|
|
delete param.as;
|
|
|
|
|
|
link_filter(url, param, url);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
res.write(url);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
2008-04-21 13:52:13 +00:00
|
|
|
|
}
|
2007-09-14 00:16:06 +00:00
|
|
|
|
|
|
|
|
|
|
Membership.prototype.level_macro = function(param) {
|
2014-07-04 15:32:18 +02:00
|
|
|
|
if (param.as === "editor") {
|
|
|
|
|
|
this.select_macro(param, "role");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
res.write(this.role);
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
2008-04-21 13:35:50 +00:00
|
|
|
|
}
|
2007-09-14 00:16:06 +00:00
|
|
|
|
|
|
|
|
|
|
Membership.prototype.editlink_macro = function(param) {
|
2014-07-04 15:32:18 +02:00
|
|
|
|
return this.link_macro(param, "edit");
|
2008-04-21 13:52:13 +00:00
|
|
|
|
}
|
2007-09-14 00:16:06 +00:00
|
|
|
|
|
|
|
|
|
|
Membership.prototype.deletelink_macro = function(param) {
|
2014-07-04 15:32:18 +02:00
|
|
|
|
return this.link_macro(param, "delete");
|
2008-04-21 13:52:13 +00:00
|
|
|
|
}
|
2007-09-14 00:16:06 +00:00
|
|
|
|
|
|
|
|
|
|
Membership.prototype.unsubscribelink_macro = function(param) {
|
2014-07-04 15:32:18 +02:00
|
|
|
|
return res.handlers.site.link_macro(param, "unsubscribe");
|
2008-04-21 13:52:13 +00:00
|
|
|
|
}
|