From d0931d2a277dd59837dd25ed19748c2580fb2dde Mon Sep 17 00:00:00 2001
From: "sofia.baltzi"
The purpose of this dashboard is to gather, link & monitor the research results related to your community.
The community dashboard is part of the OpenAIRE-Connect project and currently is in BETA version.
'; // TODO move the initialisation - this.body = {/*salutation: "Dear Sir/Madame,",*/ fromMessage: ", on behalf of ", fromName: this.fullname, paragraphs: this.defaultBody, /*closing: "Kind regards,",*/ signature: "OpenAIRE team", note: ""}; + this.body = {fromMessage: ", on behalf of ", fromName: this.fullname, paragraphs: this.defaultBody, signature: "OpenAIRE team", note: ""}; this.email = {body: "", subject: "[OpenAIRE-Connect] " + community.title, recipients: []}; this.recipients = ""; @@ -132,7 +133,7 @@ export class InviteComponent implements OnInit { this.successfulSentMessage = res + " email sent successfully!"; } - this.body = {/*salutation: "Dear Sir/Madame,",*/ fromMessage: ", on behalf of ", fromName: this.fullname, paragraphs: this.defaultBody, /*closing: "Kind regards,",*/ signature: "OpenAIRE team", note: ""}; + this.body = {fromMessage: ", on behalf of ", fromName: this.fullname, paragraphs: this.defaultBody, signature: "OpenAIRE team", note: ""}; this.email = {body: "", subject: "[OpenAIRE-Connect] " + this.community.title, recipients: []}; this.recipients = ""; }, @@ -161,7 +162,7 @@ export class InviteComponent implements OnInit { public validateEmails(): boolean { if (this.parseEmails()) { - if (this.hasValidEmails()) { + if (Validator.hasValidEmails(this.email.recipients)) { return this.areValid; } } @@ -188,28 +189,6 @@ export class InviteComponent implements OnInit { return true; } - private hasValidEmails(): boolean { - let length = this.email.recipients.length; - - for(let i = 0; i < length; i++) { - if (!this.emailValidator(this.email.recipients[i])){ - // TODO remove console message after final testing - console.log("INVALID EMAIL"); - return false; - } - } - // TODO remove console message after final testing - console.log("ALL EMAILS ARE VALID"); - return true; - } - - private emailValidator(email : any): boolean { - if (email.match("^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$")) - return true; - else - return false; - } - public composeEmail() { // this.email.subject = "[OpenAIRE-Connect] Community_name"; this.email.body = this.formatEmailBody(); @@ -222,11 +201,12 @@ export class InviteComponent implements OnInit { fromMessageAndName = "" + this.body.fromMessage + this.body.fromName + ""; } - let formattedEmail = "" /*+ this.body.closing + "
"*/ + this.body.signature + fromMessageAndName + "
" +
- "www.openaire.eu" + "
" + this.body.signature + fromMessageAndName + "
"
+ + "www.openaire.eu"
+ + "