1
|
import {Component} from '@angular/core';
|
2
|
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
|
3
|
|
4
|
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
5
|
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
|
6
|
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
7
|
|
8
|
import {Session, User} from './openaireLibrary/login/utils/helper.class';
|
9
|
import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
|
10
|
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
|
11
|
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
|
12
|
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
|
13
|
import {Subscriber} from "rxjs";
|
14
|
import {Meta} from "@angular/platform-browser";
|
15
|
import {properties} from "../environments/environment";
|
16
|
|
17
|
@Component({
|
18
|
//changeDetection: ChangeDetectionStrategy.Default,
|
19
|
//encapsulation: ViewEncapsulation.Emulated,
|
20
|
selector: 'app-root',
|
21
|
template: `
|
22
|
<navbar *ngIf="properties && header" [header]="header" [portal]="properties.dashboard" [properties]=properties
|
23
|
[onlyTop]=false [user]="user"
|
24
|
[communityId]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems></navbar>
|
25
|
<schema2jsonld *ngIf="properties" [URL]="properties.domain+properties.baseLink"
|
26
|
[logoURL]="properties.domain+properties.baseLink+'/assets/common-assets/logo-small-explore.png'"
|
27
|
type="home"
|
28
|
name="OpenAIRE | Find and Share research"
|
29
|
description="OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide."></schema2jsonld>
|
30
|
<div class="custom-main-content">
|
31
|
<main>
|
32
|
<router-outlet></router-outlet>
|
33
|
</main>
|
34
|
</div>
|
35
|
<cookie-law *ngIf="isClient" position="bottom">
|
36
|
OpenAIRE uses cookies in order to function properly.<br>
|
37
|
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing
|
38
|
experience possible.
|
39
|
By using the OpenAIRE portal you accept our use of cookies. <a
|
40
|
href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
|
41
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right"
|
42
|
ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
|
43
|
</span></a>
|
44
|
</cookie-law>
|
45
|
<bottom *ngIf="isClient && properties" [properties]="properties"></bottom>
|
46
|
|
47
|
`
|
48
|
|
49
|
})
|
50
|
export class AppComponent {
|
51
|
isClient: boolean = false;
|
52
|
userMenuItems: MenuItem[] = [];
|
53
|
menuItems: RootMenuItem [] = [];
|
54
|
feedbackmail: string;
|
55
|
properties: EnvProperties = properties;
|
56
|
user: User;
|
57
|
header: Header;
|
58
|
logoPath: string = 'assets/common-assets/';
|
59
|
subscriptions = [];
|
60
|
|
61
|
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
|
62
|
private router: Router, private userManagementService: UserManagementService,
|
63
|
private configurationService: ConfigurationService, private _meta: Meta) {
|
64
|
this.userMenuItems.push(new MenuItem("", "My profile", "", "", false, [], [], {}));
|
65
|
this.userMenuItems.push(new MenuItem("", "My ORCID links", "", "/my-orcid-links", false, [], [""], {}));
|
66
|
this.userMenuItems.push(new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], {}));
|
67
|
|
68
|
this.subscriptions.push(router.events.forEach((event) => {
|
69
|
if (event instanceof NavigationStart) {
|
70
|
HelperFunctions.scroll();
|
71
|
}
|
72
|
}));
|
73
|
}
|
74
|
|
75
|
ngOnInit() {
|
76
|
if (typeof document !== 'undefined') {
|
77
|
this.isClient = true;
|
78
|
}
|
79
|
this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity);
|
80
|
this.feedbackmail = this.properties.feedbackmail;
|
81
|
if (this.properties.environment == "production" || this.properties.environment == "development") {
|
82
|
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
83
|
this._meta.updateTag({content: 'all', name: 'robots'});
|
84
|
}));
|
85
|
}
|
86
|
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
87
|
this.user = user;
|
88
|
this.buildMenu();
|
89
|
this.header = {
|
90
|
route: "/",
|
91
|
url: null,
|
92
|
title: 'explore',
|
93
|
logoUrl: this.logoPath + 'logo-large-explore.png',
|
94
|
logoSmallUrl: this.logoPath + 'logo-small-explore.png',
|
95
|
position: 'left',
|
96
|
badge: true
|
97
|
};
|
98
|
}));
|
99
|
}
|
100
|
|
101
|
ngOnDestroy() {
|
102
|
this.subscriptions.forEach(subscription => {
|
103
|
if (subscription instanceof Subscriber) {
|
104
|
subscription.unsubscribe();
|
105
|
}
|
106
|
});
|
107
|
this.configurationService.clearSubscriptions();
|
108
|
this.userManagementService.clearSubscriptions();
|
109
|
}
|
110
|
|
111
|
buildMenu() {
|
112
|
//TODO add check for research results route
|
113
|
this.menuItems = [
|
114
|
{
|
115
|
rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find"], {qf: true}),
|
116
|
items: [
|
117
|
new MenuItem("", "Research Outcomes", "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {qf: true}),
|
118
|
new MenuItem("", "Projects", "", "/search/find/projects/", false, ["project"], ["/search/find/projects"], {}),
|
119
|
new MenuItem("", "Content Providers", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {}),
|
120
|
new MenuItem("", "Organizations", "", "/search/find/organizations/", false, ["organization"], ["/search/find/organizations"], {})
|
121
|
]
|
122
|
},
|
123
|
{
|
124
|
rootItem: new MenuItem("deposit", "Deposit", "", "/participate/deposit/learn-how", false, [], ["/participate/deposit/learn-how"], {}),
|
125
|
//rootItem: new MenuItem("deposit", "Deposit", "", "/participate/deposit/learn-how", false, [], ["/participate/deposit/learn-how"], {}),
|
126
|
items: []
|
127
|
//rootItem: new MenuItem("share", "Share", "", "", false, [], ["/participate/deposit-publications", "/participate/deposit-datasets"], {}),
|
128
|
//items: [new MenuItem("", "Publications", "", "/participate/deposit-publications", false, ["publication"], ["/participate/deposit-publications"], {}),
|
129
|
// new MenuItem("", "Research Data", "", "/participate/deposit-datasets", false, ["dataset"], ["/participate/deposit-datasets"], {})]
|
130
|
},
|
131
|
{
|
132
|
rootItem: new MenuItem("link", "Link", "", "/participate/claim", false, [], ["/participate/claim"], {}),
|
133
|
items: [new MenuItem("", "Start linking", "", "/participate/claim", false, [], ["/participate/claim"], {}),
|
134
|
new MenuItem("", "Learn more", this.properties.claimsInformationLink, "", false, [], [], {})]
|
135
|
},
|
136
|
{
|
137
|
rootItem: new MenuItem("datasources", "Content Providers", "", "", false, ["datasource"], [], {}),
|
138
|
items: [new MenuItem("", "Data Policies", "https://beta.openaire.eu/oa-policies-mandates", "", false, ["datasource"], [""], {}),
|
139
|
new MenuItem("", "Repositories", "", "/search/content-providers", false, ["datasource"], ["/search/content-providers"], {}),
|
140
|
new MenuItem("", "Journals", "", "/search/journals", false, ["datasource"], ["/search/journals"], {}),
|
141
|
new MenuItem("", "Registries", "", "/search/entity-registries", false, ["datasource"], ["/search/entity-registries"], {}),
|
142
|
new MenuItem("", "Browse all", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {})]
|
143
|
}
|
144
|
];
|
145
|
if (Session.isPortalAdministrator(this.user)) {
|
146
|
this.userMenuItems.push(new MenuItem("", "Manage all links", "", "/claims", false, [], ["/claims"], {}));
|
147
|
this.userMenuItems.push(new MenuItem("", "Manage helptexts", this.properties.adminPortalURL + "/openaire/admin-tools/pages", "", true, [], [], {}));
|
148
|
} else if (Session.isClaimsCurator(this.user)) {
|
149
|
this.userMenuItems.push(new MenuItem("", "Manage all links", "", "/claims", false, [], ["/claims"], {}));
|
150
|
|
151
|
}
|
152
|
if (this.user) {
|
153
|
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
154
|
}
|
155
|
}
|
156
|
}
|
157
|
|