Delete previous version of invite to subscribe

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@53699 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-11-09 15:58:55 +00:00
parent 81407f0627
commit 0b9a3a10b4
3 changed files with 0 additions and 113 deletions

View File

@ -1,63 +0,0 @@
import { Component, Input, ViewChild } from '@angular/core';
import { Location } from '@angular/common';
import {ActivatedRoute} from '@angular/router';
import { EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {InviteService} from './invite.service';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
@Component({
selector: 'invite',
template: `
<form class="uk-form-stacked">
<div>
<label class="uk-form-label">Subject</label>
<input type="text" placeholder="Subject" [(ngModel)]=subject name="subject">
</div>
<div>
<div class="uk-form-label">Message</div>
<textarea cols="" rows="6" placeholder="Email message..." [(ngModel)]=body name="body"></textarea>
</div>
<a class="uk-button uk-button-primary" (click)="invite()"> Invite</a>
</form>
`
})
export class InviteComponent {
@Input() communityName:boolean;
@Input() communityId:string;
properties:EnvProperties;
subject:string;
body:string;
recipients:string[] = [];
constructor (private route: ActivatedRoute,
private _inviteService: InviteService
) {
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.subject = "["+this.communityName+"] Invitation to join community";
this.body = "Dear sir or madame, \n\nWe would like to invite you to join "+this.communityName +
" OpenAIRE community (beta."+this.communityId+".openaire.eu)";
});
}
invite(){
var email = Session.getUserEmail();
//TODO
this._inviteService.inviteUsers( this.properties.adminToolsAPIURL,this.subject, this.body, ["argirok@di.uoa.gr"]).subscribe (
res => {
console.log(res);
});
}
}

View File

@ -1,24 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import {FormsModule} from '@angular/forms';
import { InviteService } from './invite.service';
import {InviteComponent} from './invite.component';
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
@NgModule({
imports: [
CommonModule, RouterModule, AlertModalModule, FormsModule
],
declarations: [
InviteComponent
],
providers:[
InviteService
],
exports: [
InviteComponent
]
})
export class InviteModule { }

View File

@ -1,26 +0,0 @@
import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import {COOKIE} from "../../openaireLibrary/login/utils/helper.class"
@Injectable()
export class InviteService {
constructor(private http:Http) {
}
inviteUsers(url:string, subject:string, body:string, recipients:string[]){
var email = {"subject":subject, "body":body, recipients: recipients };
return this.http.post(url+"/email", JSON.stringify(email), this.getAuthOptionsWithBody())
.map(res => <any> res.json())
.do(res => {console.log("Response is "+res)});
}
public getAuthOptionsWithBody():RequestOptions{
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
let options = new RequestOptions({ headers: headers, withCredentials:true });
return options;
}
}