diff --git a/package.json b/package.json index 4a61f04..7515f9f 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "datatables.net": "^1.10.16", "datatables.net-dt": "^1.10.16", "jquery": "^3.2.1", + "ng2-ckeditor": "1.1.9", "ngx-json-ld": "0.1.6", "rxjs": "^5.4.2", "ts-md5": "^1.2.0", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index da661c9..100030a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -9,6 +9,7 @@ import { OpenaireErrorPageComponent } from './error/errorPage.component'; const routes: Routes = [ { path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, { path: 'my-communities', loadChildren: './my-communities/communities.module#MyCommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, + { path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, { path: 'about', loadChildren: './htmlPages/about/aboutPage.module#AboutPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, { path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, { path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }}, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2f34c7b..fab08ff 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -6,6 +6,8 @@ import {RouterModule} from '@angular/router'; import {BrowserModule} from '@angular/platform-browser'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; +import {CKEditorModule} from 'ng2-ckeditor'; + import {AppComponent} from './app.component'; import {OpenaireErrorPageComponent} from './error/errorPage.component'; @@ -31,6 +33,8 @@ import {CommunitiesService} from './openaireLibrary/connect/communi CommonModule, HttpModule, ErrorModule, + CKEditorModule, + FormsModule, NavigationBarModule, FeedbackModule, BottomModule, CookieLawModule, BrowserModule.withServerTransition({appId: 'my-app'}), diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index f853f33..2287318 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -170,3 +170,5 @@ + + diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index d53620b..26d765f 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -15,7 +15,7 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {SubscribeModule} from '../utils/subscribe/subscribe.module'; -import {InviteModule} from '../utils/subscribe/invite.module'; +import {InviteModule} from '../utils/subscribe/invite/invite.module'; import {ManageModule} from '../utils/manage/manage.module'; import {StatisticsModule} from "../statistics/statistics.module"; diff --git a/src/app/utils/subscribe/invite/invite-routing.module.ts b/src/app/utils/subscribe/invite/invite-routing.module.ts new file mode 100644 index 0000000..9223c7c --- /dev/null +++ b/src/app/utils/subscribe/invite/invite-routing.module.ts @@ -0,0 +1,16 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {InviteComponent} from './invite.component'; +import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard'; +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: InviteComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class InviteRoutingModule { } diff --git a/src/app/utils/subscribe/invite/invite.component.html b/src/app/utils/subscribe/invite/invite.component.html new file mode 100644 index 0000000..22d0ab3 --- /dev/null +++ b/src/app/utils/subscribe/invite/invite.component.html @@ -0,0 +1,166 @@ +
+
+ +
+ +
+
Invite users to subscribe
+ + + + + + + + + + + + + + +
From: + +
To * : + + + + {{email.recipients}} +
separate multiple emails with a comma
+
+
+ + + + + + + + + + + + + + + + + +
+ {{body.salutation}}
+ + {{body.fromMessage}}... + + + {{body.fromMessage}} + {{body.fromName}} + +
Message: + + + + + + + + +
+ {{body.closing}}
+ {{body.signature}} +
+
+ + + + + + + + + + + + + +
* Required fields
+
+
+ +
+
+ +
+ Back +
+
+
+
+
+ diff --git a/src/app/utils/subscribe/invite/invite.component.ts b/src/app/utils/subscribe/invite/invite.component.ts new file mode 100644 index 0000000..1987aa7 --- /dev/null +++ b/src/app/utils/subscribe/invite/invite.component.ts @@ -0,0 +1,79 @@ +import {Component, OnInit, Input} from '@angular/core'; +import {SimpleChanges, OnChanges} from '@angular/core'; +import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms"; +import {ActivatedRoute, Router} from '@angular/router'; + +import {Email} from '../../../openaireLibrary/utils/email/email'; +import {Body} from '../../../openaireLibrary/utils/email/body'; + +import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; +import {EmailService} from '../../../openaireLibrary/utils/email/email.service'; + +@Component({ + selector: 'invite', + templateUrl: './invite.component.html', +}) + +export class InviteComponent implements OnInit { + + @Input() longView: boolean = true; + + private properties: EnvProperties = null; + public email: Email; + public body: Body; + + private ckeditorContent: string; + + public defaultBody = '
Dear Sir/Madame,

OpenAIRE invites you to subscribe in _Community_name_ dashboard.

The community dashboard is part of the OpenAIRE-Connect project

Kind regards,
OpenAIRE team

' + public defaultBody2 = 'OpenAIRE invites you to subscribe in Community_name dashboard.

The community dashboard is part of the OpenAIRE-Connect project

' + + @Input() communityId = null; + + constructor ( + private route: ActivatedRoute, + private _router: Router, + public _fb: FormBuilder, + private _emailService: EmailService) { } + + + public ngOnInit() { + this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.body = {salutation: "Dear Sir/Madame,", fromMessage: "On behalf of ", fromName: "", paragraphs: "", closing: "Kind regards,", signature: "OpenAIRE team"}; + this.email = {body: "", subject: "", recipients: []}; + + }); + } + + public invite() { + if (this.email.recipients != null) { + this.composeEmail(); + console.log(this.email.body); + + this._emailService.sendEmail(this.properties.sendMailUrl, this.email).subscribe( + res => console.log("Mail has been sent successfully!") + , + error => console.log(error) + ); + } + } + + public composeEmail() { + this.email.subject = "Argiro is going to tell me about the subject"; + this.email.body = this.formatEmailBody(); + } + + public formatEmailBody(): string { + let fromMessageAndName = ""; + + if (this.body.fromName != "") { + fromMessageAndName = "" + this.body.fromMessage + this.body.fromName + ""; + } + + let formattedEmail = "
" + this.body.salutation + "
" + + "

" + fromMessageAndName + "..." + "

" + + "

" + this.body.closing + "
" + this.body.signature + "

"; + + return formattedEmail; + } +} diff --git a/src/app/utils/subscribe/invite/invite.module.ts b/src/app/utils/subscribe/invite/invite.module.ts new file mode 100644 index 0000000..4d8a5c4 --- /dev/null +++ b/src/app/utils/subscribe/invite/invite.module.ts @@ -0,0 +1,31 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {RouterModule} from '@angular/router'; +import {CKEditorModule} from 'ng2-ckeditor'; + +import {InviteComponent} from './invite.component'; +import {InviteRoutingModule} from './invite-routing.module'; + +import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; + +import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard'; +import {EmailService} from '../../../openaireLibrary/utils/email/email.service'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule + ], + declarations: [ + InviteComponent + ], + providers: [ + FreeGuard, PreviousRouteRecorder, + EmailService + ], + exports: [ + InviteComponent + ] +}) + +export class InviteModule { } diff --git a/src/assets/env-properties.json b/src/assets/env-properties.json index a283cbe..755feaf 100644 --- a/src/assets/env-properties.json +++ b/src/assets/env-properties.json @@ -103,6 +103,8 @@ "searchLinkToAdvancedOrganizations" : "/search/advanced/organizations", "searchLinkToAdvancedPeople" : "/search/advanced/people", + "sendMailUrl": "http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools/sendMail", + "lastIndexInformationLink" : "https://www.openaire.eu/aggregation-and-content-provision-workflows", "showLastIndexInformationLink" : true, diff --git a/src/index.html b/src/index.html index d634d5f..852d04e 100644 --- a/src/index.html +++ b/src/index.html @@ -61,6 +61,8 @@ + +