[Connect | Trunk]: Add subscriber invite module from library

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60969 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-04-23 16:27:37 +00:00
parent cfb73f8a37
commit c0a20f5908
6 changed files with 78 additions and 433 deletions

View File

@ -56,9 +56,9 @@ import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
<router-outlet></router-outlet> <router-outlet></router-outlet>
</main> </main>
</div> </div>
<div id="subscribeAndInviteBtn" *ngIf="isClient && properties && community"> <div id="subscribeAndInviteBtn" *ngIf="isClient && community">
<subscribe [communityId]="community.id" [properties]="properties"></subscribe> <subscribe [communityId]="community.id"></subscribe>
<invite *ngIf="isManager" [longView]=false [buttonSizeSmall]=false [properties]="properties"></invite> <invite *ngIf="isManager" [longView]="false"></invite>
</div> </div>
<!--feedback *ngIf= "isClient && properties" portalName="Connect" [feedbackQuestionaire]=properties.feedbackQuestionaire></feedback--> <!--feedback *ngIf= "isClient && properties" portalName="Connect" [feedbackQuestionaire]=properties.feedbackQuestionaire></feedback-->
<cookie-law *ngIf="isClient" position="bottom"> <cookie-law *ngIf="isClient" position="bottom">
@ -86,14 +86,11 @@ import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
}) })
export class AppComponent { export class AppComponent {
isClient: boolean = false; isClient: boolean = false;
userMenuItems: MenuItem[] = []; userMenuItems: MenuItem[] = [];
menuItems: RootMenuItem [] = []; menuItems: RootMenuItem [] = [];
bottomMenuItems: MenuItem[] = []; bottomMenuItems: MenuItem[] = [];
public community = null; public community = null;
properties: EnvProperties; properties: EnvProperties = properties;
showMenu: boolean = false; showMenu: boolean = false;
communities = null; communities = null;
user: User; user: User;
@ -122,7 +119,6 @@ export class AppComponent {
} }
ngOnInit() { ngOnInit() {
this.properties = properties;
this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI); this._communitiesService.updateCommunities(this.properties, this.properties.communitiesAPI);
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
try { try {

View File

@ -1,139 +1,22 @@
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld> <schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld>
<div *ngIf="longView">
<div *ngIf="longView == true" class=""> <div class="uk-section uk-padding-remove-top">
<div class="uk-section uk-padding-remove-top tm-middle" id="tm-main">
<breadcrumbs addClass="uk-margin-large-left uk-margin-remove-bottom uk-margin-small-top" <breadcrumbs addClass="uk-margin-large-left uk-margin-remove-bottom uk-margin-small-top"
[breadcrumbs]="breadcrumbs"></breadcrumbs> [breadcrumbs]="breadcrumbs"></breadcrumbs>
<div class="uk-container uk-margin-bottom"> <div class="uk-container uk-margin-bottom">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" <helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper> [texts]="pageContents['top']"></helper>
<div id="invite" class=" uk-card uk-card-default uk-padding uk-margin-top"> <div class=" uk-card uk-card-default uk-padding uk-margin-top">
<div class="uk-text-large uk-text-center uk-width-5-6@l uk-width ">Invite users to subscribe</div> <h5 class="uk-text-center">Invite users to subscribe</h5>
<div class="uk-margin-top"> <div *ngIf="subscriberInvite.loading" class="uk-height-large uk-position-relative">
<errorMessages [status]="[status]" [type]="'community'"></errorMessages> <loading class="uk-position-center"></loading>
</div> </div>
<div *ngIf="missingCommunityId" class="uk-alert uk-alert-warning" role="alert">{{missingCommunityId}}</div> <div class="uk-padding uk-padding-remove-horizontal" [class.uk-hidden]="subscriberInvite.loading">
<div *ngIf="successfulSentMessage" class="uk-alert uk-alert-success" <subscriber-invite #subscriberInvite [user]="user"></subscriber-invite>
role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div> <div class="uk-flex uk-flex-right uk-margin-medium-top">
<div *ngIf="failureSentMessage" class="uk-alert uk-alert-warning" <a class="uk-button uk-button-default" routerLink="/">Cancel</a>
role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div> <button [class.uk-disabled]="!subscriberInvite.valid" class="uk-button portal-button uk-margin-small-left" (click)="subscriberInvite.invite()">Invite</button>
<div *ngIf="inviteErrorMessage" class="uk-alert uk-alert-warning" role="alert">{{inviteErrorMessage}}</div>
<div *ngIf="communityId != null && status == errorCodes.DONE">
<table class="uk-table uk-align-center">
<tbody>
<!-- <tr>
<td>
</td>
<td>
<li>Invite by email</li>
</td>
</tr> -->
<tr>
<td for="from" class="uk-text-bold uk-width-1-4 uk-text-right">From <span
class="uk-text-danger uk-text-bold">*</span> :
</td>
<td class="uk-text-left uk-width-expand">
<input placeholder="Type your name" type="text" (click)="resetMessages()"
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)]="body.fromName"
id="from" required>
<div *ngIf="!body.fromName" class="uk-width-large uk-text-danger uk-text-small">Please add your name.
</div> </div>
</td>
</tr>
<tr>
<td for="recipients" class="uk-text-bold uk-text-right">To <span
class="uk-text-danger uk-text-bold">*</span> :
</td>
<td class="uk-text-left">
<input placeholder="email" type="text" (click)="resetMessages(); areValid=true"
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)]="recipients"
id="recipients"
required>
<div *ngIf="areValid && !showAddRecipientMessage" class="uk-width-medium uk-text-muted uk-text-small">
separate multiple emails with a comma
</div>
<div *ngIf="recipients && !areValid" class="uk-width-large uk-text-danger uk-text-small">Please add
valid email/s.
</div>
<div *ngIf="isEmpty(recipients) && showAddRecipientMessage"
class="uk-width-large uk-text-danger uk-text-small">Please add a recipient.
</div>
</td>
</tr>
</tbody>
</table>
<div class="boundary-align uk-panel uk-placeholder">
<table class="uk-table uk-align-center uk-padding">
<tbody>
<tr>
<td for="email.body" class="uk-text-bold">Message:</td>
<td *ngIf="allowEdit()" class="uk-width-expand uk-text-left">
<ckeditor (click)="resetMessages()"
class="form-control" [(ngModel)]="body.paragraphs" id="message"
debounce="400"
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]', removeButtons: 'Save,NewPage,DocProps,Preview,Print',
extraPlugins: 'divarea'}">
<!-- <id="contentTag"-->
<!--(ready)="onReady($event)"-->
<!--(focus)="onFocus($event)"-->
<!--[config]="{uiColor: '#99000'}"-->
<!--(blur)="onBlur($event)"-->
<!--(change)="onChange($event)"-->
</ckeditor>
</td>
<td *ngIf="!allowEdit()" class="uk-text-left">
<div [innerHtml]="body.paragraphs"></div>
</td>
</tr>
<tr>
<td></td>
<td class="uk-text-left">
<!-- {{body.closing}}<br> -->
{{body.signature}}
<span *ngIf="body.fromName == ''" class="uk-text-muted">
<i>{{body.fromMessage}}...</i>
</span>
<span *ngIf="body.fromName !=''">
{{body.fromMessage}}
<b>{{body.fromName}}</b>
</span>
<br><a href="https://www.openaire.eu">www.openaire.eu</a>
</td>
</tr>
</tbody>
</table>
</div>
<table class="uk-table uk-align-center">
<tbody>
<tr>
<td class="uk-text-bold uk-width-3-5@xl uk-width-3-5@m uk-width-3-5@s uk-text-right"></td>
<td>
<div class="uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-text-danger uk-text-bold">*
Required fields
</div>
</td>
</tr>
<tr>
<td class="uk-text-right"></td>
<td>
<div
class="uk-grid-margin uk-first-column uk-align-center uk-text-left uk-padding uk-padding-remove-top uk-padding-remove-bottom">
<button class="uk-button portal-button" (click)="invite()">Invite</button>
</div>
</td>
</tr>
</tbody>
</table>
<div class="uk-text-left">
<span uk-icon="chevron-left"></span><span class="uk-margin-small-left">
<a [queryParams]="communityIdParam" routerLinkActive="router-link-active"
routerLink="/" class="portal-link">Back</a>
</span>
</div>
</div> </div>
</div> </div>
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" <helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
@ -142,8 +25,7 @@
</div> </div>
</div> </div>
<div *ngIf="!longView" class="uk-margin-small-top"> <div *ngIf="!longView" class="uk-margin-small-top">
<button <button id="invite" class="uk-button portal-button uk-button-small uk-width-1-1">
[class]=" ((buttonSizeSmall)?'uk-button-small':'') + ' uk-button portal-button uk-button-small uk-width-1-1'">
<span class="uk-icon uk-flex uk-flex-middle"> <span class="uk-icon uk-flex uk-flex-middle">
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"> <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
<path d="M0 0h24v24H0z" fill="none"></path> <path d="M0 0h24v24H0z" fill="none"></path>
@ -153,47 +35,15 @@
<span class="space">Invite users</span> <span class="space">Invite users</span>
</span> </span>
</button> </button>
<div uk-dropdown="mode: click" class="uk-form uk-margin-small uk-alert uk-background-default" id="toggle-usage"> <div #dropdown uk-dropdown="mode: click" [class.uk-hidden]="subscriberInvite.loading" class="uk-form uk-margin-small uk-alert uk-background-default" id="toggle-usage" style="width: 300px;">
<div class="uk-margin-top"> <div>
<errorMessages [status]="[status]" [type]="'community'"></errorMessages> <subscriber-invite #subscriberInvite [user]="user" [longView]="false"></subscriber-invite>
</div> <div class="uk-flex uk-flex-middle uk-child-width-1-2 uk-margin-small-top">
<div *ngIf="missingCommunityId" class="uk-width-large uk-text-warning uk-text-small uk-margin-top" <span><a class="uk-button uk-button-default uk-button-small" (click)="close(dropdown)" routerLink="/invite">Customize</a></span>
role="alert">{{missingCommunityId}}</div> <span class="uk-flex uk-flex-right">
<div *ngIf="successfulSentMessage" class="uk-width-large uk-text-success uk-text-small uk-margin-top" <button [class.uk-disabled]="!subscriberInvite.valid" class="portal-button uk-button uk-button-small" (click)="subscriberInvite.invite();close(dropdown)">Send</button>
role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div>
<div *ngIf="failureSentMessage" class="uk-width-large uk-text-warning uk-text-small uk-margin-top"
role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div>
<div *ngIf="inviteErrorMessage" class="uk-width-large uk-text-warning uk-text-small uk-margin-top"
role="alert">{{inviteErrorMessage}}</div>
<div *ngIf="recipients && !areValid" class="uk-width-large uk-text-danger uk-text-small uk-margin-top">Please add
valid email/s.
</div>
<div *ngIf="isEmpty(recipients) && showAddRecipientMessage"
class="uk-width-large uk-text-danger uk-text-small uk-margin-top">Please add a recipient.
</div>
<input (click)="resetMessages(); areValid=true" placeholder="Type e-mails" type="text"
class="form-control uk-input uk-form-small uk-form" [(ngModel)]="recipients" id="recipients"
required>
<div class="uk-width-medium uk-text-muted uk-text-small">separate with commas</div>
<div class="uk-margin-small-top uk-text-center ">
<button class=" uk-button portal-button ignoreCommunityPanelBackground uk-button-small " (click)="invite()">
Invite
</button>
{{" "}}
<a class=" uk-button uk-button-default uk-button-small ignoreCommunityPanelBackground "
[queryParams]="communityIdParam"
routerLinkActive="router-link-active" routerLink="/invite">
<span class="uk-margin-xsmall-left uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="cog"
ratio="0.8"><circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle><path
fill="none" stroke="#000"
d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg>
</span> </span>
Customize </div>
</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,119 +1,57 @@
import {Component, Input, OnInit} from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
import {FormBuilder} from "@angular/forms";
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {ConnectHelper} from '../../../openaireLibrary/connect/connectHelper';
import {Email} from '../../../openaireLibrary/utils/email/email';
import {Body} from '../../../openaireLibrary/utils/email/body';
import {Validator} from '../../../openaireLibrary/utils/email/validator';
import {Composer} from '../../../openaireLibrary/utils/email/composer';
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
import {EmailService} from '../../../openaireLibrary/utils/email/email.service'; import {User} from '../../../openaireLibrary/login/utils/helper.class';
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component';
import {Session, User} from '../../../openaireLibrary/login/utils/helper.class';
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
import {HelperService} from "../../../openaireLibrary/utils/helper/helper.service"; import {HelperService} from "../../../openaireLibrary/utils/helper/helper.service";
import {Meta, Title} from "@angular/platform-browser"; import {Meta, Title} from "@angular/platform-browser";
import {SEOService} from "../../../openaireLibrary/sharedComponents/SEO/SEO.service"; import {SEOService} from "../../../openaireLibrary/sharedComponents/SEO/SEO.service";
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service"; import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
import {PiwikHelper} from "../../piwikHelper";
import {UserManagementService} from "../../../openaireLibrary/services/user-management.service"; import {UserManagementService} from "../../../openaireLibrary/services/user-management.service";
import {Breadcrumb} from "../../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {Subscriber, Subscription} from "rxjs"; import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
declare var UIkit;
@Component({ @Component({
selector: 'invite', selector: 'invite',
templateUrl: './invite.component.html', templateUrl: './invite.component.html',
}) })
export class InviteComponent implements OnInit { export class InviteComponent implements OnInit {
@Input() longView: boolean = true; @Input() longView: boolean = true;
@Input() communityId = null; @Input() communityId = null;
@Input() buttonSizeSmall = true; public properties: EnvProperties = properties;
@Input() properties: EnvProperties;
public community = null;
//public showLoading: boolean = true;
public errorMessage: string = '';
public successfulSentMessage: string = '';
public successfulSentRecipients: string[] = [];
public failureSentMessage: string = '';
public failureSentRecipients: string[] = [];
public inviteErrorMessage: string = '';
public missingCommunityId: string = '';
public showAddRecipientMessage: boolean = false;
public showAddNameMessage: boolean = false;
public email: Email;
public body: Body;
public recipients: string;
public fullname: string;
public areValid: boolean = true;
private ckeditorContent: string;
// public defaultBody ='';
public communityIdParam = {};
public status: number = 1;
public errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public pageContents = null;
public divContents = null;
public url: string = null;
public pageTitle: string = "Invite"; public pageTitle: string = "Invite";
private user: User; public user: User;
public url: string;
public pageContents;
public divContents
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'invite'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'invite'}];
private subs: Subscription[] = [];
subs: Subscription[] = [];
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
public _fb: FormBuilder,
private _emailService: EmailService,
private _communityService: CommunityService,
private helper: HelperService,
private _meta: Meta, private _meta: Meta,
private helper: HelperService,
private _title: Title, private _title: Title,
private seoService: SEOService, private seoService: SEOService,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private userManageService: UserManagementService) { private userManageService: UserManagementService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.status = this.errorCodes.LOADING;
} }
public ngOnInit() { public ngOnInit() {
if(!this.properties) {
this.properties = properties;
}
if(this.properties) {
this.errorMessage = "";
this.missingCommunityId = "";
this.status = this.errorCodes.LOADING;
this.subs.push(this.userManageService.getUserInfo().subscribe( this.subs.push(this.userManageService.getUserInfo().subscribe(
user => { user => {
this.user = user; this.user = user;
this.init(); }));
}, this.getPageContents();
error => { this.url = this.properties.domain + this._router.url;
this.init(); this.seoService.createLinkForCanonicalURL(this.url);
} this.updateUrl(this.url );
)); this.updateTitle(this.pageTitle);
//this.init(); this.updateDescription("OpenAIRE - Connect, Community Gateway, research community, invite");
}
} }
ngOnDestroy() { ngOnDestroy() {
@ -124,55 +62,6 @@ export class InviteComponent implements OnInit {
} }
} }
private init() {
this.subs.push(this.route.queryParams.subscribe(
communityId => {
//if(!this.communityId && typeof document !== 'undefined'){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if (!this.communityId) {
this.communityId = communityId['communityId'];
}
if (this.longView) {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
}
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);
this.updateUrl(this.url);
this.updateTitle(this.pageTitle);
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community, invite");
}
this.communityIdParam = (this.properties.environment != "development") ? {} : {communityId: this.communityId};
if (this.communityId != null && this.communityId != '') {
//this.getDivContents();
this.getPageContents();
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
this.fullname = (this.user) ? this.user.fullname : null;
//console.log("Fullname from session " + Session.getUserFullName());
this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname);
this.email = Composer.initializeInvitationsEmail(community.title);
this.recipients = "";
this.status = this.errorCodes.DONE;
},
error => {
//this.handleError(error)
this.handleError("Error getting community with id: " + this.communityId, error);
this.status = this.errorMessages.getErrorCode(error.status);
}
));
} else {
this.status = this.errorCodes.DONE;
this.missingCommunityId = "There is no community selected!";
}
}));
}
private getPageContents() { private getPageContents() {
this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
@ -185,109 +74,6 @@ export class InviteComponent implements OnInit {
})); }));
} }
public invite() {
this.successfulSentMessage = "";
this.failureSentMessage = "";
this.inviteErrorMessage = "";
this.status = this.errorCodes.LOADING;
HelperFunctions.scroll();
if (!this.isEmpty(this.recipients) && this.body.fromName != "") {
if (this.validateEmails()) {
this.composeEmail();
this.subs.push(this._emailService.sendEmail(this.properties, this.email).subscribe(
res => {
this.status = this.errorCodes.DONE;
if (res['success']) {
this.successfulSentMessage = "Email sent successfully to: ";
this.successfulSentRecipients = res['success'];
}
if (res['failure']) {
this.failureSentMessage = "There was an error sending email to: ";
this.failureSentRecipients = res['failure'];
}
this.body = Composer.initializeInvitationsBody(this.communityId, this.community.title, this.fullname);
this.email = Composer.initializeInvitationsEmail(this.community.title);
this.recipients = "";
},
error => {
//console.log(error);
this.handleError("Error inviting emails: " + JSON.stringify(this.recipients) + " to community with id: " + this.communityId + " by: " + this.fullname, error);
this.status = this.errorCodes.DONE;
this.inviteErrorMessage = "There was an error sending emails. Please try again.";
}
));
} else {
this.email.recipients = [];
this.status = this.errorCodes.DONE;
}
} else {
this.showAddRecipientMessage = true;
this.status = this.errorCodes.DONE;
}
}
public isEmpty(data: string): boolean {
return data != undefined && !data.replace(/\s/g, '').length;
}
public resetMessages() {
this.errorMessage = "";
this.successfulSentMessage = "";
this.failureSentMessage = "";
this.inviteErrorMessage = "";
}
public validateEmails(): boolean {
if (this.parseEmails()) {
if (Validator.hasValidEmails(this.email.recipients)) {
return this.areValid;
}
}
this.areValid = false;
return this.areValid;
}
public parseEmails(): boolean {
let email = new Array<string>();
// remove spaces
this.recipients = this.recipients.replace(/\s/g, '');
// remove commas
email = this.recipients.split(",");
// remove empty fields
for (let i = 0; i < email.length; i++) {
if (!(email[i] == "")) {
this.email.recipients.push(email[i]);
}
}
return true;
}
public composeEmail() {
this.email.body = Composer.formatEmailBodyForInvitation(this.body);
}
allowEdit() {
if (!this.user) {
return false;
}
var email = this.user.email;
var index = -1;
if (email && this.community != null && this.community.managers != null) {
index = this.community.managers.indexOf(email);
}
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1;
}
private handleError(message: string, error) {
console.error("Invite Page (or component): " + message, error);
}
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");
@ -302,4 +88,9 @@ export class InviteComponent implements OnInit {
private updateUrl(url: string) { private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'"); this._meta.updateTag({content: url}, "property='og:url'");
} }
close(element) {
UIkit.dropdown(element).hide();
this
}
} }

View File

@ -16,11 +16,16 @@ import {Schema2jsonldModule} from "../../../openaireLibrary/sharedComponents/sch
import {SEOServiceModule} from "../../../openaireLibrary/sharedComponents/SEO/SEOService.module"; import {SEOServiceModule} from "../../../openaireLibrary/sharedComponents/SEO/SEOService.module";
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service"; import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
import {BreadcrumbsModule} from "../../../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; import {BreadcrumbsModule} from "../../../openaireLibrary/utils/breadcrumbs/breadcrumbs.module";
import {SubscriberInviteModule} from "../../../openaireLibrary/sharedComponents/subscriber-invite/subscriber-invite.module";
import {LoadingModule} from "../../../openaireLibrary/utils/loading/loading.module";
import {IconsService} from "../../../openaireLibrary/utils/icons/icons.service";
import {cog, send} from "../../../openaireLibrary/utils/icons/icons";
import {IconsModule} from "../../../openaireLibrary/utils/icons/icons.module";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule, CommonModule, FormsModule, CKEditorModule, ErrorMessagesModule, RouterModule, CommonModule, FormsModule, CKEditorModule, ErrorMessagesModule,
HelperModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule HelperModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, SubscriberInviteModule, LoadingModule, IconsModule
], ],
declarations: [ declarations: [
InviteComponent InviteComponent
@ -35,4 +40,8 @@ import {BreadcrumbsModule} from "../../../openaireLibrary/utils/breadcrumbs/brea
] ]
}) })
export class InviteBasicModule { } export class InviteBasicModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([send, cog])
}
}

View File

@ -26,10 +26,10 @@ declare var UIkit: any;
<a class="uk-alert-close" uk-close></a> <a class="uk-alert-close" uk-close></a>
<p>Please login first to subscribe</p> <p>Please login first to subscribe</p>
</div> </div>
<button *ngIf="loading" class="uk-button portal-button uk-button-small uk-width-1-1"> <button *ngIf="loading" id="subscribe" class="uk-button portal-button uk-button-small uk-width-1-1">
<span class="uk-icon"><loading [top_margin]="false" [size]="'small'" [color]="null"></loading></span> <span class="uk-icon"><loading [top_margin]="false" [size]="'small'" [color]="null"></loading></span>
</button> </button>
<button *ngIf="!subscribed && !loading" class="uk-button portal-button uk-button-small uk-width-1-1" <button *ngIf="!subscribed && !loading" id="subscribe" class="uk-button portal-button uk-button-small uk-width-1-1"
(click)="subscribe()"> (click)="subscribe()">
<span class="uk-icon uk-flex uk-flex-middle"> <span class="uk-icon uk-flex uk-flex-middle">
<svg height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <svg height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@ -40,7 +40,7 @@ declare var UIkit: any;
<span class="space">Subscribe</span> <span class="space">Subscribe</span>
</span> </span>
</button> </button>
<button *ngIf="subscribed && !loading" class="subscribed-button uk-button uk-button-small uk-width-1-1" <button *ngIf="subscribed && !loading" id="subscribe" class="subscribed-button uk-button uk-button-small uk-width-1-1"
(click)="confirmOpen()" [disabled]="isManager" [attr.uk-tooltip]="isManager?'You cannot unsubscribe because you are a manager':null"> (click)="confirmOpen()" [disabled]="isManager" [attr.uk-tooltip]="isManager?'You cannot unsubscribe because you are a manager':null">
<span class="uk-icon uk-flex uk-flex-middle"> <span class="uk-icon uk-flex uk-flex-middle">
<svg height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <svg height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@ -71,7 +71,7 @@ export class SubscribeComponent {
loading: boolean = false; loading: boolean = false;
subscribed: boolean = null; subscribed: boolean = null;
@Input() properties: EnvProperties = properties; properties: EnvProperties = properties;
members: number = 0; members: number = 0;
@Output() countSubscribersEvent = new EventEmitter(); @Output() countSubscribersEvent = new EventEmitter();
showLoginAlert: Boolean = false; showLoginAlert: Boolean = false;

View File

@ -109,15 +109,14 @@ div:not(.connect_App) bottom .uk-totop {
top: calc(30% - 47px); top: calc(30% - 47px);
} }
#subscribeAndInviteBtn button { #subscribeAndInviteBtn #subscribe,
#subscribeAndInviteBtn #invite {
width: 125px; width: 125px;
height: 35px; height: 35px;
border-right: none; border-right: none;
/*border-top-right-radius: 0;*/ border-radius: 4px 0 0 4px;
/*border-bottom-right-radius: 0;*/ box-shadow: 0 2px 6px #00000038;
border-radius: 4px 0px 0px 4px; border-width: 0;
box-shadow: 0px 2px 6px #00000038;
border-width: 0px;
} }
.subscribed-button { .subscribed-button {