Project

General

Profile

« Previous | Next » 

Revision 54264

Add a first draft of composer

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/email/composer.ts
1
import {Email} from "./email";
2

  
3
export class Composer {
4
  private static noteBodySize = "14px";
5
  private static noteFontSize = "11px";
6

  
7
  // TODO move to properties
8
  private static openaireEmail = "mailto:openaire.test@gmail.com";
9

  
10

  
11
  private static ifYouAreNotResponsible(): string {
12
    return  "If you are not responsible for this community, please "
13
    + "<a href=\'" + this.openaireEmail + "\'>contact us</a>.";
14
  }
15

  
16
  private static manageNotificationSettings(): string {
17
    // TODO take it from the method down
18
    return "bla";
19
  }
20

  
21
  private static youAreManagerOfTheCommunity(): string {
22
    // TODO take it from the method down
23
    return "bla";
24
  }
25

  
26
  public static composeEmailForNewManager(communityId: string, communityName: string, newCommunityManagers: any): Email {
27
      let email: Email = new Email();
28

  
29
      email.subject = "[OpenAIRE-Connect] " + communityName + ": Welcome new manager";
30
      email.body = "<div style='font-size:" + this.noteBodySize + "'><p>Welcome to OpenAIRE Connect!</p>"
31
                    + "<p>You are receiving this e-mail as you were assigned as manager of the community  <a href='https://beta."
32
                    + communityId + ".openaire.eu/'>" + "\"" + communityName + "\"" + "</a> dashboard. "
33
                    + "In order to access the administration section of your community you must first login using one of the available options. "
34
                    + "<br>The administrative rights are associated to the e-mail address, that was used to send you this message."
35
                    + " If you login with an account associated to a different email, please  <a href='mailto:helpdesk@openaire.eu'>contact us</a>"
36
                    + " or your colleagues, that already have access to the administration tool, to update your e-mail. <br>"
37
                    + "You can access the administration tool by clicking the \"Manage\" button that will be available in the top right corner of the dashboard."
38
                    + "</p>"
39
                    + "OpenAIRE team<br>" + "<a href='https://www.openaire.eu'>www.openaire.eu</a><br>"
40
                    + "<p style='font-size:" + this.noteFontSize + "'>" + this.ifYouAreNotResponsible() + "<p>"
41
                    + "</div>";
42
      email.recipients = newCommunityManagers;
43

  
44
      console.log(email);
45
      return email;
46
  }
47

  
48
  public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string, firstVersionOfManagers: any, managers:any) : Email {
49
      let email: Email;
50

  
51
      email.subject = "[OpenAIRE-Connect] " + communityName + ": Managers list notification";
52
      email.body = "<div style='font-size:14px;'>"
53
                    + "<p>There are updates in the managers list for \"" + communityName + "\" community.<br>"
54
                    + "The list of managers is: " + managers.join(', ') + "</p>"
55
                    + "OpenAIRE team<br>" + "<a href='https://www.openaire.eu'>www.openaire.eu</a><br>"
56
                    + "<p style='font-size:11px;'>You are receiving this e-mail as manager of the community "
57
                    + "<a href='https://beta." + communityId + ".openaire.eu/'>" + communityName + "</a>. "
58
                    + this.ifYouAreNotResponsible()
59
                    + "<br>"
60
                    + "Click  <a href='https://beta.admin.connect.openaire.eu/manage-user-notifications?communityId=" + communityId
61
                    + "'>here</a> to manage your notification settings. </p>"
62
                    + "</div>";
63

  
64
      email.recipients = firstVersionOfManagers;
65
      return email;
66
  }
67
}

Also available in: Unified diff