1
|
import {Component, Input, OnInit} from '@angular/core';
|
2
|
import {Session, User} from '../../openaireLibrary/login/utils/helper.class';
|
3
|
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
4
|
import {ActivatedRoute} from '@angular/router';
|
5
|
import {EnvironmentSpecificService} from '../../openaireLibrary/utils/properties/environment-specific.service';
|
6
|
import {CommunitiesService} from '../../openaireLibrary/connect/communities/communities.service';
|
7
|
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
|
8
|
import {HelperFunctions} from '../../openaireLibrary/utils/HelperFunctions.class';
|
9
|
import {UserManagementService} from '../../openaireLibrary/services/user-management.service';
|
10
|
import {Title} from '@angular/platform-browser';
|
11
|
|
12
|
@Component({
|
13
|
selector: 'wellcome',
|
14
|
template: `
|
15
|
<div
|
16
|
class="image-front-topbar wellcomePage uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-padding-remove-bottom"
|
17
|
uk-scrollspy="{"target":"[uk-scrollspy-class]","cls":"uk-animation-fade","delay":false}"
|
18
|
tm-header-transparent="light" tm-header-transparent-placeholder=""
|
19
|
uk-height-viewport="offset-top: true">
|
20
|
<div class="uk-container uk-container-large uk-section">
|
21
|
<div *ngIf="showLoading" class="uk-animation-fade uk-container uk-container-large uk-section uk-margin-top uk-width-1-1" role="alert"><span
|
22
|
class="loading-gif uk-align-center"></span></div>
|
23
|
<div *ngIf="communities.length == 0 && !showLoading" class="uk-container uk-container-large uk-section uk-margin-top">
|
24
|
<div class="uk-width-1-2@m uk-width-1-1@s">
|
25
|
<div class="uk-h1">Build an Open Research <b>Gateway</b> for your <b>Community</b></div>
|
26
|
<h4 class="uk-margin-remove-top">Turn Open Science into practice</h4>
|
27
|
<div class="uk-h5 uk-margin-top">Share and link your research results.<br>
|
28
|
Across organizations, across borders.<br>Customized to your needs.
|
29
|
</div>
|
30
|
</div>
|
31
|
<div class="uk-width-1-1 uk-inline uk-margin-large-top uk-margin-large-bottom">
|
32
|
<a class="uk-button portal-button" href="https://beta.connect.openaire.eu/about"> LEARN
|
33
|
HOW</a>
|
34
|
</div>
|
35
|
</div>
|
36
|
<div *ngIf="communities.length > 0 && !showLoading" class="uk-container uk-container-large uk-section-small">
|
37
|
<div class="uk-container">
|
38
|
<div class="uk-grid-match uk-grid-small uk-child-width-1-4@m uk-child-width-1-2@s uk-child-width-1-1@xs
|
39
|
uk-text-center uk-margin-large-top" uk-grid uk-height-match="div > div > .uk-card-media-top">
|
40
|
<div *ngFor="let community of communities;">
|
41
|
<div class="uk-padding-small uk-card uk-card-small uk-card-default communityCard">
|
42
|
<div class="uk-container uk-text-small" *ngIf="community">
|
43
|
<div class="uk-card-media-top uk-padding uk-padding-remove-vertical target uk-flex uk-flex-center uk-flex-middle">
|
44
|
<a [queryParams]="{communityId: community.communityId}" routerLinkActive="router-link-active"
|
45
|
routerLink="/dashboard">
|
46
|
<div>
|
47
|
<img *ngIf="community.logoUrl != null && community.logoUrl != '' " src="{{community.logoUrl}}"
|
48
|
alt="{{(community.title)?community.title:community.shortTitle}} logo">
|
49
|
<span *ngIf="community.logoUrl == null || community.logoUrl == '' " class="uk-icon">
|
50
|
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
|
51
|
stroke="#000"
|
52
|
stroke-width="1.1"
|
53
|
cx="7.7"
|
54
|
cy="8.6"
|
55
|
r="3.5"></circle> <path
|
56
|
fill="none" stroke="#000" stroke-width="1.1"
|
57
|
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
|
58
|
stroke="#000"
|
59
|
stroke-width="1.1"
|
60
|
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
|
61
|
</span>
|
62
|
</div>
|
63
|
</a>
|
64
|
</div>
|
65
|
<div class="uk-card-body uk-padding-remove-horizontal uk-padding-remove-top uk-margin-small-top target">
|
66
|
<a [queryParams]="{communityId: community.communityId}" routerLinkActive="router-link-active"
|
67
|
routerLink="/dashboard">
|
68
|
<div class="uk-text-center uk-text-bold">
|
69
|
<span class="uk-text-small uk-margin-small" *ngIf="community.title">
|
70
|
{{community.title}}
|
71
|
</span>
|
72
|
<span class="uk-text-small uk-margin-small" *ngIf="!community.title && community.shortTitle">
|
73
|
{{community.shortTitle}}
|
74
|
</span>
|
75
|
</div>
|
76
|
</a>
|
77
|
</div>
|
78
|
</div>
|
79
|
</div>
|
80
|
</div>
|
81
|
</div>
|
82
|
</div>
|
83
|
</div>
|
84
|
</div>
|
85
|
</div>
|
86
|
`
|
87
|
})
|
88
|
|
89
|
export class WellcomeComponent implements OnInit {
|
90
|
properties: EnvProperties = null;
|
91
|
public communities: CommunityInfo[] = [];
|
92
|
showLoading: boolean;
|
93
|
private user: User;
|
94
|
|
95
|
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, private _communitiesService: CommunitiesService,
|
96
|
private title: Title,
|
97
|
private userManagementService: UserManagementService) {
|
98
|
}
|
99
|
|
100
|
ngOnInit() {
|
101
|
this.showLoading = true;
|
102
|
this.title.setTitle('Administration Dashboard | OpenAIRE-Connect');
|
103
|
this.propertiesService.loadEnvironment().then(es => {
|
104
|
this.propertiesService.setEnvProperties(es);
|
105
|
this.properties = this.propertiesService.envSpecific;
|
106
|
HelperFunctions.scroll();
|
107
|
this.userManagementService.getUserInfo().subscribe(user => {
|
108
|
this.user = user;
|
109
|
this._communitiesService.getCommunitiesState().subscribe(
|
110
|
communities => {
|
111
|
this.communities = [];
|
112
|
if (!communities || communities.length === 0) {
|
113
|
return;
|
114
|
}
|
115
|
var countCommunities = 0;
|
116
|
var index_managerOfCommunity = null;
|
117
|
for (var i = 0; i < communities.length; i++) {
|
118
|
var com = communities[i];
|
119
|
if (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user)) {
|
120
|
this.communities.push(communities[i]);
|
121
|
} else {
|
122
|
for (var manager of com.managers) {
|
123
|
if (this.user && manager == this.user.email) {
|
124
|
countCommunities++;
|
125
|
index_managerOfCommunity = i;
|
126
|
this.communities.push(communities[i]);
|
127
|
break;
|
128
|
}
|
129
|
}
|
130
|
}
|
131
|
}
|
132
|
this.showLoading = false;
|
133
|
});
|
134
|
});
|
135
|
});
|
136
|
}
|
137
|
}
|