Site.sendNotification (type, obj)
send e-mail notification if necessary

  • Parameter String:
    type of changes (e.g. createStory)
  • Parameter HopObject:
    the HopObject the changes were applied to
Sourcecode in Site/objectFunctions.js:
1:   function sendNotification(type, obj) {
2:      var notify = this.preferences.getProperty("notify_" + type);
3:      if (!notify || notify == 0)
4:         return;
5:      var recipients = new Array();
6:      for (var i=0; i<this.members.size(); i++) {
7:         var m = this.members.get(i);
8:         if ((type != "update" && m.user == obj.creator) || (type == "update" && m.user == obj.modifier))
9:            continue;
10:        if (notify == 1 && m.level >= CONTENTMANAGER)
11:           recipients.push(m.user.email);
12:        else if (notify == 2 && m.level >= CONTRIBUTOR)
13:           recipients.push(m.user.email);
14:     }
15:     if (recipients.length > 0) {
16:        var param = {
17:           user: obj.modifier ? obj.modifier.name :
18:              (obj.creator ? obj.creator.name : null),
19:           url: obj.href()
20:        };
21:        var sender = root.sys_title + "<" + root.sys_email + ">";
22:        var subject = getMessage("mail.notification");
23:        var body = this.renderSkinAsString("notificationMail", param);
24:        sendMail(sender, recipients, subject, body);
25:     }
26:     return;
27:  }