Add a first draft of composer

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54264 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-12-10 13:25:41 +00:00
parent 6db07dc921
commit b4bdc71693
1 changed files with 67 additions and 0 deletions

67
utils/email/composer.ts Normal file
View File

@ -0,0 +1,67 @@
import {Email} from "./email";
export class Composer {
private static noteBodySize = "14px";
private static noteFontSize = "11px";
// TODO move to properties
private static openaireEmail = "mailto:openaire.test@gmail.com";
private static ifYouAreNotResponsible(): string {
return "If you are not responsible for this community, please "
+ "<a href=\'" + this.openaireEmail + "\'>contact us</a>.";
}
private static manageNotificationSettings(): string {
// TODO take it from the method down
return "bla";
}
private static youAreManagerOfTheCommunity(): string {
// TODO take it from the method down
return "bla";
}
public static composeEmailForNewManager(communityId: string, communityName: string, newCommunityManagers: any): Email {
let email: Email = new Email();
email.subject = "[OpenAIRE-Connect] " + communityName + ": Welcome new manager";
email.body = "<div style='font-size:" + this.noteBodySize + "'><p>Welcome to OpenAIRE Connect!</p>"
+ "<p>You are receiving this e-mail as you were assigned as manager of the community <a href='https://beta."
+ communityId + ".openaire.eu/'>" + "\"" + communityName + "\"" + "</a> dashboard. "
+ "In order to access the administration section of your community you must first login using one of the available options. "
+ "<br>The administrative rights are associated to the e-mail address, that was used to send you this message."
+ " If you login with an account associated to a different email, please <a href='mailto:helpdesk@openaire.eu'>contact us</a>"
+ " or your colleagues, that already have access to the administration tool, to update your e-mail. <br>"
+ "You can access the administration tool by clicking the \"Manage\" button that will be available in the top right corner of the dashboard."
+ "</p>"
+ "OpenAIRE team<br>" + "<a href='https://www.openaire.eu'>www.openaire.eu</a><br>"
+ "<p style='font-size:" + this.noteFontSize + "'>" + this.ifYouAreNotResponsible() + "<p>"
+ "</div>";
email.recipients = newCommunityManagers;
console.log(email);
return email;
}
public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string, firstVersionOfManagers: any, managers:any) : Email {
let email: Email;
email.subject = "[OpenAIRE-Connect] " + communityName + ": Managers list notification";
email.body = "<div style='font-size:14px;'>"
+ "<p>There are updates in the managers list for \"" + communityName + "\" community.<br>"
+ "The list of managers is: " + managers.join(', ') + "</p>"
+ "OpenAIRE team<br>" + "<a href='https://www.openaire.eu'>www.openaire.eu</a><br>"
+ "<p style='font-size:11px;'>You are receiving this e-mail as manager of the community "
+ "<a href='https://beta." + communityId + ".openaire.eu/'>" + communityName + "</a>. "
+ this.ifYouAreNotResponsible()
+ "<br>"
+ "Click <a href='https://beta.admin.connect.openaire.eu/manage-user-notifications?communityId=" + communityId
+ "'>here</a> to manage your notification settings. </p>"
+ "</div>";
email.recipients = firstVersionOfManagers;
return email;
}
}