* Separated the global setup settings from those in the root site's preferences
* Added encoding="form" parameter to most of the macros using the request handler * Renamed commentsMode to commentMode (comments_mode to comment_mode in DB) * Reactivated notifications in a simplified manner * Throw an error in global sendMail() method if arguments are not sufficient * Added HopObject.notify() method * Added HopObject.kind_macro() method (provides the constructor's name in lowercase) * Added Messages.skin containing subskins suited for e-mail output * Removed obsolete skin files * Added reset_action() method for resetting a user's password to Members prototype * Added require() method to Membership prototype; wrapped static require() method around it * Added Membership.notify() method which does all the member-related notification stuff * Send notification on membership removal * Fixed contact form in Membership prototype * Dropped e-mail property from Site prototype (users can be contacted via Membership.contact_action(), Root prototype has extra e-mail property) * Added missing getPermission() method to User prototype, always requiring a privileged user
This commit is contained in:
parent
504260650e
commit
3e8c4c6313
34 changed files with 336 additions and 276 deletions
|
@ -71,6 +71,10 @@ HopObject.prototype.onRequest = function() {
|
|||
return;
|
||||
};
|
||||
|
||||
HopObject.prototype.getPermission = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
HopObject.prototype.delete_action = function() {
|
||||
if (req.postParams.proceed) {
|
||||
//try {
|
||||
|
@ -121,8 +125,25 @@ HopObject.prototype.touch = function() {
|
|||
});
|
||||
};
|
||||
|
||||
HopObject.prototype.getPermission = function() {
|
||||
return true;
|
||||
HopObject.prototype.notify = function(action) {
|
||||
var site = res.handlers.site;
|
||||
if (site.notificationMode === Site.NOBODY) {
|
||||
return;
|
||||
}
|
||||
switch (action) {
|
||||
case "comment":
|
||||
action = "create"; break;
|
||||
}
|
||||
var membership;
|
||||
for (var i=0; i<site.members.size(); i+=1) {
|
||||
membership = site.members.get(i);
|
||||
if (membership.require(site.notificationMode)) {
|
||||
sendMail(root.email, membership.creator.email,
|
||||
gettext("Notification of changes at site {0}", site.title),
|
||||
this.renderSkinAsString("Messages#" + action));
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
HopObject.prototype.input_macro = function(param, name) {
|
||||
|
@ -214,6 +235,16 @@ HopObject.prototype.macro_macro = function(param, handler) {
|
|||
return;
|
||||
};
|
||||
|
||||
HopObject.prototype.kind_macro = function() {
|
||||
var type = this.constructor.name.toLowerCase();
|
||||
switch (type) {
|
||||
default:
|
||||
res.write(gettext(type));
|
||||
break;
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
HopObject.prototype.getFormValue = function(name) {
|
||||
if (req.isPost()) {
|
||||
return req.postParams[name];
|
||||
|
|
20
code/HopObject/Messages.skin
Normal file
20
code/HopObject/Messages.skin
Normal file
|
@ -0,0 +1,20 @@
|
|||
<% #create %>
|
||||
<% gettext 'Dear {0},
|
||||
|
||||
this message wants to inform you that a new {1} was published at {2} by user {3} on {4}.
|
||||
|
||||
Best regards.
|
||||
The Management'
|
||||
<% membership.name %> <% this.kind %> <% this.href %>
|
||||
<% this.modifier %> <% this.modified short %> %>
|
||||
|
||||
|
||||
<% #edit %>
|
||||
<% gettext 'Dear {0},
|
||||
|
||||
this message wants to inform you that the {1} at {2} was modified by user {3} on {4}.
|
||||
|
||||
Best regards.
|
||||
The Management'
|
||||
<% membership.name %> <% this.kind %> <% this.href %>
|
||||
<% this.modifier %> <% this.modified short %> %>
|
Loading…
Add table
Add a link
Reference in a new issue