[Trunk|Connect]: 1. Add is route enabled in all routes except home page. 2. Delete dropdown from invite page. 3. Add help texts in all pages.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@56645 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-07-22 09:19:34 +00:00
parent 1729eea27d
commit 84d0608a9d
28 changed files with 521 additions and 505 deletions

View File

@ -63,7 +63,7 @@
</div>
</div>
</div>
<helper *ngIf="pageContents && pageContents['top']" [texts]="pageContents['top']"></helper>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
<div *ngIf="(managerOfCommunities.length == 0 && subscriberOfCommunities.length == 0)" class="home-banner image-front-topbar uk-section uk-background-norepeat uk-background-bottom-center uk-background-cover uk-section-secondary uk-section-overlap uk-position-relative uk-preserve-color" uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light" tm-header-transparent-placeholder="">
<div class=" uk-section uk-padding-remove-bottom">
<div class="uk-position-cover"></div>
@ -224,7 +224,7 @@
</a>
</div>
</div>
<helper *ngIf="pageContents && pageContents['bottom']" [texts]="pageContents['bottom']"></helper>
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" [texts]="pageContents['bottom']"></helper>
<div class="contact-banner uk-background-norepeat uk-background-cover uk-section-secondary uk-section-overlap uk-position-relative uk-preserve-color uk-margin-large-top">
<div class="uk-container uk-container-large uk-section">
<div class="uk-flex uk-flex-middle uk-padding" uk-grid>

View File

@ -82,13 +82,13 @@ export class CommunitiesComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -21,7 +21,7 @@ import {OtherPortalsModule} from "../openaireLibrary/sharedComponents/other-port
imports: [
CommonModule, FormsModule, RouterModule,
ManageModule, ErrorMessagesModule,
SearchFormModule, BrowseCommunityModule, HelperModule, GifSliderModule, OtherPortalsModule,
SearchFormModule, BrowseCommunityModule, GifSliderModule, OtherPortalsModule,
HelperModule
],
declarations: [

View File

@ -1,5 +1,5 @@
<ng-template #info>
<helper *ngIf="pageContents && pageContents['right']" [texts]="pageContents['right']"></helper>
<helper *ngIf="pageContents && pageContents['right'] && pageContents['right'].length > 0" [texts]="pageContents['right']"></helper>
<h1 class="uk-margin-auto-top uk-margin-remove-bottom uk-text-bold">OpenAIRE gives you the virtual environment and services designed for your community to:</h1>
<ul class="uk-list uk-list-divider uk-padding uk-padding-remove-left uk-margin-auto-top">
<li><h5><span class="uk-text-bold">Create and Manage</span> your

View File

@ -65,13 +65,13 @@ export class ContactComponent implements OnInit {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -1,4 +1,4 @@
<helper *ngIf="pageContents && pageContents['top']" [texts]="pageContents['top']"></helper>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
<!--
<div class=" uk-section uk-margin-large-top tm-middle uk-container" id="tm-main">
<div class="uk-container uk-margin-bottom">

View File

@ -1,22 +1,23 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import {Meta, Title} from '@angular/platform-browser';
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
@Component({
selector: 'content',
templateUrl: './contentPage.component.html'
selector: 'content',
templateUrl: './contentPage.component.html'
})
export class ContentPageComponent {
properties:EnvProperties;
properties: EnvProperties;
public pageContents = null;
public divContents = null;
constructor ( private route: ActivatedRoute, private _router: Router,
private _meta: Meta, private _title: Title,
private helper: HelperService) {}
constructor(private route: ActivatedRoute, private _router: Router,
private _meta: Meta, private _title: Title,
private helper: HelperService) {
}
public ngOnInit() {
this.route.data
@ -30,28 +31,30 @@ export class ContentPageComponent {
}
private updateDescription(description:string){
this._meta.updateTag({content:description},"name='description'");
this._meta.updateTag({content:description},"property='og:description'");
private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'");
}
private updateTitle(title:string){
var _prefix ="OpenAIRE | ";
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
private updateTitle(title: string) {
var _prefix = "OpenAIRE | ";
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
this._title.setTitle(_title);
this._meta.updateTag({content:_title},"property='og:title'");
this._meta.updateTag({content: _title}, "property='og:title'");
}
private updateUrl(url:string){
this._meta.updateTag({content:url},"property='og:url'");
private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'");
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -1,5 +1,5 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { RouterModule } from '@angular/router';
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@ -17,11 +17,12 @@ import {HelperModule} from "../openaireLibrary/utils/helper/helper.module";
declarations: [
ContentPageComponent
],
providers:[FreeGuard,PreviousRouteRecorder],
providers: [FreeGuard, PreviousRouteRecorder],
exports: [
ContentPageComponent
]
})
export class ContentPageModule{}
export class ContentPageModule {
}

View File

@ -8,13 +8,13 @@ import {FetchZenodoInformation} from "./utils/fetchZenodoInformation.class";
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {PiwikHelper} from "../utils/piwikHelper";
@Component({
selector: 'openaire-deposit',
template: `
<deposit-first-page [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation" [pageContents]="pageContents" [divContents]="divContents"></deposit-first-page>
<deposit-first-page [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation"
[communityId]="communityId"></deposit-first-page>
`
})
@ -23,17 +23,16 @@ export class OpenaireDepositComponent {
piwikSiteId = null;
public pageContents = null;
public divContents = null;
public communityId = null;
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
fetchZenodoInformation: FetchZenodoInformation;
constructor ( private route: ActivatedRoute,
private _router: Router,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
private helper: HelperService) {
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
}
@ -48,11 +47,10 @@ export class OpenaireDepositComponent {
communityId = params['communityId'];
}
if (communityId != null && communityId != '') {
this.communityId = communityId;
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe(
community => {
//this.getDivContents();
this.getPageContents(communityId);
let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage+communityId;
@ -78,17 +76,6 @@ export class OpenaireDepositComponent {
});
}
public getPageContents(communityId: string) {
this.helper.getPageHelpContents(this._router.url, this.properties, communityId).subscribe(contents => {
this.pageContents = contents;
})
}
public getDivContents(communityId: string) {
this.helper.getDivHelpContents(this._router.url, this.properties, communityId).subscribe(contents => {
this.divContents = contents;
})
}
private handleError(message: string, error) {
console.error("Deposit First Page: "+message, error);

View File

@ -4,11 +4,12 @@ import { RouterModule } from '@angular/router';
import {ShareInZenodoComponent} from './shareInZenodo.component';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard";
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: ShareInZenodoComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: ShareInZenodoComponent, canActivate: [FreeGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -1 +1 @@
<helper *ngIf="pageContents && pageContents['top']" [texts]="pageContents['top']"></helper>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>

View File

@ -29,7 +29,7 @@ export class HelperTestComponent implements OnInit{
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.pageContents = contents;
})
}

View File

@ -11,7 +11,7 @@ import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
<div class=" uk-section uk-margin-large-top tm-middle uk-container" id="tm-main">
<div class="uk-container uk-margin-bottom">
<div class="uk-article-title custom-article-title uk-margin-bottom"> Organizations related to the community</div>
<helper *ngIf="pageContents && pageContents['top']" [texts]="pageContents['top']"></helper>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
<affiliations [fullView]="true" [getAffiliationsFromAPI]="true"></affiliations>
</div>
</div>
@ -55,13 +55,13 @@ export class OrganizationsPageComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url.split('?')[0].substring(0), this.properties, this.communityId).subscribe(contents => {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url.split('?')[0].substring(0), this.properties, this.communityId).subscribe(contents => {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -1,27 +1,29 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-dataprovider',
template: `<dataprovider [piwikSiteId]=piwikSiteId></dataprovider>`,
})
export class OpenaireDataProviderComponent{
selector: 'openaire-dataprovider',
template: `
<dataprovider [piwikSiteId]=piwikSiteId [communityId]="communityId"></dataprovider>`,
})
export class OpenaireDataProviderComponent {
piwikSiteId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
communityId = null;
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
constructor(private route: ActivatedRoute) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}
ngOnInit() {
}
ngOnInit() {
}
}

View File

@ -1,25 +1,28 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-dataset',
template: `<dataset [piwikSiteId]=piwikSiteId></dataset>`,
})
export class OpenaireDatasetComponent{
piwikSiteId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
@Component({
selector: 'openaire-dataset',
template: `
<dataset [piwikSiteId]=piwikSiteId [communityId]="communityId"></dataset>`,
})
export class OpenaireDatasetComponent {
piwikSiteId = null;
communityId = null;
constructor(private route: ActivatedRoute) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}
ngOnInit() {
}
}
}

View File

@ -4,16 +4,17 @@ import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-htmlProjectReport',
template: `<htmlProjectReport [piwikSiteId]=piwikSiteId></htmlProjectReport>`,
template: `<htmlProjectReport [piwikSiteId]=piwikSiteId [communityId]="communityId"></htmlProjectReport>`,
})
export class OpenaireHtmlProjectReportComponent{
piwikSiteId = null;
communityId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}

View File

@ -1,26 +1,29 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-organization',
template: `<organization [piwikSiteId]=piwikSiteId></organization>`,
})
export class OpenaireOrganizationComponent{
piwikSiteId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
@Component({
selector: 'openaire-organization',
template: `
<organization [piwikSiteId]=piwikSiteId [communityId]="communityId"></organization>`,
})
export class OpenaireOrganizationComponent {
piwikSiteId = null;
communityId = null;
constructor(private route: ActivatedRoute) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}
ngOnInit() {
}
}
}

View File

@ -1,21 +1,21 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-orp',
template: `<orp [piwikSiteId]=piwikSiteId></orp>`,
template: `<orp [piwikSiteId]=piwikSiteId [communityId]="communityId">></orp>`,
})
export class OpenaireOrpComponent {
piwikSiteId = null;
communityId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}

View File

@ -1,25 +1,28 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-project',
template: `<project [piwikSiteId]=piwikSiteId></project>`,
})
export class OpenaireProjectComponent{
piwikSiteId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
@Component({
selector: 'openaire-project',
template: `
<project [piwikSiteId]=piwikSiteId [communityId]="communityId"></project>`,
})
export class OpenaireProjectComponent {
piwikSiteId = null;
communityId = null;
constructor(private route: ActivatedRoute) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}
ngOnInit() {
}
}
}

View File

@ -1,26 +1,29 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-publication',
template: `<publication [piwikSiteId]=piwikSiteId></publication>`,
})
export class OpenairePublicationComponent{
piwikSiteId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
@Component({
selector: 'openaire-publication',
template: `
<publication [piwikSiteId]=piwikSiteId [communityId]="communityId"></publication>`,
})
export class OpenairePublicationComponent {
piwikSiteId = null;
communityId = null;
constructor(private route: ActivatedRoute) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}
ngOnInit() {
}
}
}

View File

@ -1,26 +1,29 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {Component} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
@Component({
selector: 'openaire-software',
template: `<software [piwikSiteId]=piwikSiteId></software>`,
})
export class OpenaireSoftwareComponent{
piwikSiteId = null;
constructor (private route: ActivatedRoute ) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[communityId];
});
@Component({
selector: 'openaire-software',
template: `
<software [piwikSiteId]=piwikSiteId [communityId]="communityId"></software>`,
})
export class OpenaireSoftwareComponent {
piwikSiteId = null;
communityId = null;
constructor(private route: ActivatedRoute) {
this.route.data
.subscribe((data: { envSpecific: any }) => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
this.piwikSiteId = PiwikHelper.siteIDs[this.communityId];
});
}
ngOnInit() {
}
}
}

View File

@ -8,7 +8,7 @@ import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
@Component({
selector: 'learn-how',
template: `
<helper *ngIf="pageContents && pageContents['top']" [texts]="pageContents['top']"></helper>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
<ng-template #one>
<h5 class="uk-text-bold uk-margin-small-bottom">1. Understanding your needs</h5>
<div>
@ -134,13 +134,13 @@ export class LearnHowComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -8,7 +8,7 @@ import {HelperService} from "../../openaireLibrary/utils/helper/helper.service";
@Component({
selector: 'learn-in-depth',
template: `
<helper *ngIf="pageContents && pageContents['top']" [texts]="pageContents['top']"></helper>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
<div class="image-front-topbar uk-section-overlap uk-position-relative uk-preserve-color" uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light" tm-header-transparent-placeholder="">
<div class="cloud-background uk-background-norepeat uk-background-cover uk-section uk-padding-remove-bottom" >
<div class="uk-container uk-container-large uk-section">
@ -202,13 +202,13 @@ export class LearnInDepthComponent {
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getPageHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url.split('?')[0].substring(0), this.properties, 'connect').subscribe(contents => {
this.helper.getDivHelpContents(this._router.url, this.properties, 'connect').subscribe(contents => {
this.divContents = contents;
})
}

View File

@ -9,7 +9,7 @@ import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guar
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: InviteComponent, canActivate: [LoginGuard, IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] }
{ path: '', component: InviteComponent, canActivate: [LoginGuard, /*IsRouteEnabled*/], canDeactivate: [PreviousRouteRecorder] }
])
]

View File

@ -1,209 +1,195 @@
<div *ngIf="longView == true">
<div class=" uk-section uk-margin-small-top tm-middle uk-container" id="tm-main">
<div class=" uk-section uk-margin-small-top tm-middle uk-container" id="tm-main">
<div class="uk-container uk-margin-bottom">
<div id="invite" 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>
<div class="uk-margin-top">
<errorMessages [status]="[status]" [type]="'community'"></errorMessages>
</div>
<div *ngIf="missingCommunityId" class="uk-alert uk-alert-warning" role="alert">{{missingCommunityId}}</div>
<div *ngIf="successfulSentMessage" class="uk-alert uk-alert-success" role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div>
<div *ngIf="failureSentMessage" class="uk-alert uk-alert-warning" role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div>
<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>
</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">
<tbody>
<!-- <tr>
<td class="uk-text-bold uk-width-1-4@xl uk-width-1-4@m uk-width-1-4@s uk-text-right"></td>
<td class="uk-text-left">
<{{body.salutation}}<br>-->
<!-- <span *ngIf="body.fromName == ''" class="uk-text-muted">
<i>{{body.fromMessage}}...</i>
</span>
<span *ngIf="body.fromName !=''">
{{body.fromMessage}}
<b>{{body.fromName}}</b>
</span>
</td>
</tr> -->
<tr>
<td for="email.body" class="uk-text-bold uk-text-right">Message:</td>
<td *ngIf= "allowEdit()" class="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 uk-button-primary" (click)="invite()">Invite</button>
</div>
</td>
</tr>
<!-- <tr>
<td>
</td>
<td>
<li>Invite by link</li>
</td>
</tr> -->
<!-- <tr>
<td for="link" class="uk-text-bold uk-text-right">Link :</td>
<td class="uk-text-left">
<input placeholder="link" type="text"
class="form-control uk-input uk-width-large@l uk-width-medium@s" id="link"></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" (click)="resetForm(communityId)">Cancel</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="/">Back</a>
</span>
</div>
</div>
<div class="uk-container uk-margin-bottom">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']" styleName="uk-width-1-1"></helper>
<div id="invite" 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>
<div class="uk-margin-top">
<errorMessages [status]="[status]" [type]="'community'"></errorMessages>
</div>
</div>
</div>
</div>
<!-- <div *ngIf="!longView"> -->
<!-- <div class="uk-width-large@m uk-width-1-1@s">
<div class="uk-card uk-card-default uk-card-body uk-padding-small"> -->
<!-- <div class="uk-text-center uk-text-large" uk-toggle="target: #toggle-usage; animation: uk-animation-fade" style="cursor: pointer;">
<span class="uk-margin-small-right uk-icon" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="social" ratio="1">
<line fill="none" stroke="#000" stroke-width="1.1" x1="13.4" y1="14" x2="6.3" y2="10.7"></line><line fill="none" stroke="#000" stroke-width="1.1" x1="13.5" y1="5.5" x2="6.5" y2="8.8"></line><circle fill="none" stroke="#000" stroke-width="1.1" cx="15.5" cy="4.6" r="2.3"></circle><circle fill="none" stroke="#000" stroke-width="1.1" cx="15.5" cy="14.8" r="2.3"></circle><circle fill="none" stroke="#000" stroke-width="1.1" cx="4.5" cy="9.8" r="2.3"></circle></svg>
</span>
Invite users</div> -->
<!-- uk-toggle="target: #toggle-usage; animation: uk-animation-fade" -->
<button *ngIf="!longView" [class]=" ((buttonSizeSmall)?'uk-button-small':'') + ' uk-button uk-button-primary'">
Invite users
</button>
<!-- <div class="uk-text-center uk-text-large" uk-toggle="target: #toggle-usage; animation: uk-animation-fade" style="cursor: pointer;">
<span class="uk-margin-small-right uk-icon" >
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="social" ratio="1">
<line fill="none" stroke="#000" stroke-width="1.1" x1="13.4" y1="14" x2="6.3" y2="10.7"></line><line fill="none" stroke="#000" stroke-width="1.1" x1="13.5" y1="5.5" x2="6.5" y2="8.8"></line><circle fill="none" stroke="#000" stroke-width="1.1" cx="15.5" cy="4.6" r="2.3"></circle><circle fill="none" stroke="#000" stroke-width="1.1" cx="15.5" cy="14.8" r="2.3"></circle><circle fill="none" stroke="#000" stroke-width="1.1" cx="4.5" cy="9.8" r="2.3"></circle></svg>
</span>
Invite users</div> -->
<!-- <div class="uk-inline">
<button class="uk-button uk-button-default" type="button">Click</button>
<div uk-dropdown="mode: click">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.</div>
</div> -->
<!-- hidden="hidden" -->
<div uk-dropdown="mode: click" class="uk-form uk-margin-small uk-alert uk-background-default" id="toggle-usage" >
<div class="uk-margin-top">
<errorMessages [status]="[status]" [type]="'community'"></errorMessages>
<div *ngIf="missingCommunityId" class="uk-alert uk-alert-warning" role="alert">{{missingCommunityId}}</div>
<div *ngIf="successfulSentMessage" class="uk-alert uk-alert-success"
role="alert">{{successfulSentMessage}} {{successfulSentRecipients}}</div>
<div *ngIf="failureSentMessage" class="uk-alert uk-alert-warning"
role="alert">{{failureSentMessage}} {{failureSentRecipients}}</div>
<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 *ngIf="missingCommunityId" class="uk-width-large uk-text-warning uk-text-small uk-margin-top" role="alert">{{missingCommunityId}}</div>
<div *ngIf="successfulSentMessage" class="uk-width-large uk-text-success uk-text-small uk-margin-top" 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>
</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">
<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 uk-button-primary uk-button-small " (click)="invite()">Invite</button>
{{" "}}
<a class=" uk-button uk-button-default uk-button-small " [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>
<table class="uk-table uk-align-center">
<tbody>
<!-- <tr>
<td class="uk-text-bold uk-width-1-4@xl uk-width-1-4@m uk-width-1-4@s uk-text-right"></td>
<td class="uk-text-left">
<{{body.salutation}}<br>-->
<!-- <span *ngIf="body.fromName == ''" class="uk-text-muted">
<i>{{body.fromMessage}}...</i>
</span>
<span *ngIf="body.fromName !=''">
{{body.fromMessage}}
<b>{{body.fromName}}</b>
</span>
</td>
</tr> -->
<tr>
<td for="email.body" class="uk-text-bold uk-text-right">Message:</td>
<td *ngIf="allowEdit()" class="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 uk-button-primary" (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="/">Back</a>
</span>
</div>
</div>
</div>
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
[texts]="pageContents['bottom']" styleName="uk-width-1-1"></helper>
</div>
</div>
</div>
<button *ngIf="!longView" [class]=" ((buttonSizeSmall)?'uk-button-small':'') + ' uk-button uk-button-primary'">
Invite users
</button>
<!--<div uk-dropdown="mode: click" class="uk-form uk-margin-small uk-alert uk-background-default" id="toggle-usage">
<div class="uk-margin-top">
<errorMessages [status]="[status]" [type]="'community'"></errorMessages>
</div>
<div *ngIf="missingCommunityId" class="uk-width-large uk-text-warning uk-text-small uk-margin-top"
role="alert">{{missingCommunityId}}</div>
<div *ngIf="successfulSentMessage" class="uk-width-large uk-text-success uk-text-small uk-margin-top"
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 uk-button-primary uk-button-small " (click)="invite()">Invite</button>
{{" "}}
<a class=" uk-button uk-button-default uk-button-small " [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>
Customize
</a>
</div>
</div>
<!-- </div>
</div> -->
<!-- </div> -->
Customize
</a>
</div>
</div>-->

View File

@ -1,26 +1,26 @@
import {Component, OnInit, Input, ElementRef} from '@angular/core';
import {SimpleChanges, OnChanges} from '@angular/core';
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
import {ActivatedRoute, Router} from '@angular/router';
import {Component, Input, OnInit} from '@angular/core';
import {FormBuilder} from "@angular/forms";
import {ActivatedRoute, Router} from '@angular/router';
import {ConnectHelper} from '../../../openaireLibrary/connect/connectHelper';
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 {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 {EmailService} from '../../../openaireLibrary/utils/email/email.service';
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../../openaireLibrary/utils/errorMessages.component';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class";
import {HelperService} from "../../../openaireLibrary/utils/helper/helper.service";
@Component({
selector: 'invite',
templateUrl: './invite.component.html',
selector: 'invite',
templateUrl: './invite.component.html',
})
export class InviteComponent implements OnInit {
@ -46,7 +46,7 @@ export class InviteComponent implements OnInit {
public email: Email;
public body: Body;
public recipients: string;
public fullname:string;
public fullname: string;
public areValid: boolean = true;
@ -58,52 +58,57 @@ export class InviteComponent implements OnInit {
public status: number = 1;
public errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public pageContents = null;
public divContents = null;
constructor (
private route: ActivatedRoute,
private _router: Router,
public _fb: FormBuilder,
private _emailService: EmailService,
private _communityService: CommunityService) {
constructor(
private route: ActivatedRoute,
private _router: Router,
public _fb: FormBuilder,
private _emailService: EmailService,
private _communityService: CommunityService,
private helper: HelperService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.status = this.errorCodes.LOADING;
}
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.status = this.errorCodes.LOADING;
}
public ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.errorMessage = "";
this.missingCommunityId = "";
this.status = this.errorCodes.LOADING;
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'];
}
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.errorMessage = "";
this.missingCommunityId = "";
this.status = this.errorCodes.LOADING;
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'];
}
this.communityIdParam = (this.properties.environment !="development" )?{}:{communityId:this.communityId};
if (this.communityId != null && this.communityId != '') {
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => {
this.community = community;
this.fullname = Session.getUserFullName();
//console.log("Fullname from session " + Session.getUserFullName());
this.communityIdParam = (this.properties.environment != "development") ? {} : {communityId: this.communityId};
if (this.communityId != null && this.communityId != '') {
//this.getDivContents();
this.getPageContents();
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
community => {
this.community = community;
this.fullname = Session.getUserFullName();
//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.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.handleError("Error getting community with id: " + this.communityId, error);
this.status = this.errorMessages.getErrorCode(error.status);
}
);
@ -112,139 +117,152 @@ export class InviteComponent implements OnInit {
this.missingCommunityId = "There is no community selected!";
}
});
});
HelperFunctions.scroll();
});
HelperFunctions.scroll();
});
}
private getPageContents() {
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
this.divContents = contents;
})
}
public invite() {
this.successfulSentMessage = "";
this.failureSentMessage = "";
this.inviteErrorMessage = "";
this.status = this.errorCodes.LOADING;
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();
if (!this.isEmpty(this.recipients) && this.body.fromName != "") {
if (this.validateEmails()) {
this.composeEmail();
this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/sendMail/", this.email).subscribe(
res => {
this.status = this.errorCodes.DONE;
//console.log("Emails Sent: ",res);
/*if(res == 0) {
this._emailService.sendEmail(this.properties.adminToolsAPIURL + "/sendMail/", this.email).subscribe(
res => {
this.status = this.errorCodes.DONE;
//console.log("Emails Sent: ",res);
/*if(res == 0) {
} else if(res > 1) {
this.successfulSentMessage = res + " emails sent successfully!";
} else {
this.successfulSentMessage = res + " email sent successfully!";
}*/
} else if(res > 1) {
this.successfulSentMessage = res + " emails sent successfully!";
} else {
this.successfulSentMessage = res + " email sent successfully!";
}*/
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'];
}
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;
}
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.showAddRecipientMessage = true;
this.email.recipients = [];
this.status = this.errorCodes.DONE;
}
} else {
this.showAddRecipientMessage = true;
this.status = this.errorCodes.DONE;
}
}
public isEmpty(data: string): boolean {
if (data != undefined && !data.replace(/\s/g, '').length)
return true;
else
return false;
if (data != undefined && !data.replace(/\s/g, '').length)
return true;
else
return false;
}
public resetMessages() {
this.errorMessage = "";
this.successfulSentMessage = "";
this.failureSentMessage = "";
this.inviteErrorMessage = "";
this.errorMessage = "";
this.successfulSentMessage = "";
this.failureSentMessage = "";
this.inviteErrorMessage = "";
}
public validateEmails(): boolean {
if (this.parseEmails()) {
if (Validator.hasValidEmails(this.email.recipients)) {
return this.areValid;
}
if (this.parseEmails()) {
if (Validator.hasValidEmails(this.email.recipients)) {
return this.areValid;
}
this.areValid = false;
return this.areValid;
}
this.areValid = false;
return this.areValid;
}
public parseEmails(): boolean {
let email = new Array<string>();
let email = new Array<string>();
// remove spaces
this.recipients = this.recipients.replace(/\s/g, '');
// remove spaces
this.recipients = this.recipients.replace(/\s/g, '');
// remove commas
email = this.recipients.split(",");
// 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]);
}
// remove empty fields
for (let i = 0; i < email.length; i++) {
if (!(email[i] == "")) {
this.email.recipients.push(email[i]);
}
return true;
}
return true;
}
public composeEmail() {
this.email.body = Composer.formatEmailBodyForInvitation(this.body);
this.email.body = Composer.formatEmailBodyForInvitation(this.body);
}
/*
public handleError(error) {
if(error.status == '401') {
this.status = this.errorCodes.FORBIDDEN;
} else if(error.status == '403') {
this.status = this.errorCodes.FORBIDDEN;
} else if(error.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
} else if(error.status == '500') {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
/*
public handleError(error) {
if(error.status == '401') {
this.status = this.errorCodes.FORBIDDEN;
} else if(error.status == '403') {
this.status = this.errorCodes.FORBIDDEN;
} else if(error.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
} else if(error.status == '500') {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
}
console.log('Server responded: ' + error);
}
console.log('Server responded: ' + error);
}
*/
allowEdit(){
*/
allowEdit() {
var email = Session.getUserEmail();
var index =-1;
if(email && this.community != null && this.community.managers != null){
index = this.community.managers.indexOf(email);
var index = -1;
if (email && this.community != null && this.community.managers != null) {
index = this.community.managers.indexOf(email);
}
return Session.isPortalAdministrator() || Session.isCommunityCurator() || index!=-1;
return Session.isPortalAdministrator() || Session.isCommunityCurator() || index != -1;
}
private handleError(message: string, error) {
console.error("Invite Page (or component): "+message, error);
console.error("Invite Page (or component): " + message, error);
}
}

View File

@ -14,10 +14,12 @@ import {EmailService} from '../../../openaireLibrary/utils/email/e
import {CommunityService} from '../../../openaireLibrary/connect/community/community.service';
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module';
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard";
import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule, ErrorMessagesModule
CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule, ErrorMessagesModule,
HelperModule
],
declarations: [
InviteComponent

View File

@ -56,7 +56,7 @@
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
"adminToolsAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-admin-tools",
"adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools",
"adminToolsCommunity" :"connect",
"datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",