1
|
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
2
|
import {Observable} from 'rxjs/Observable';
|
3
|
import {ActivatedRoute} from '@angular/router';
|
4
|
|
5
|
import { EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
6
|
import{MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
|
7
|
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
8
|
|
9
|
import {Session} from './openaireLibrary/login/utils/helper.class';
|
10
|
|
11
|
@Component({
|
12
|
//changeDetection: ChangeDetectionStrategy.Default,
|
13
|
//encapsulation: ViewEncapsulation.Emulated,
|
14
|
selector: 'app-root',
|
15
|
styles: [`
|
16
|
`],
|
17
|
template: `
|
18
|
|
19
|
<navbar *ngIf= "properties" portal="explore" [environment]=properties.environment [onlyTop]=false [(communityId)]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems
|
20
|
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain"></navbar>
|
21
|
<div class="custom-main-content" >
|
22
|
<main>
|
23
|
<router-outlet></router-outlet>
|
24
|
</main>
|
25
|
</div>
|
26
|
<feedback *ngIf= "isClient && properties" portalName="Explore" [feedbackmail]=feedbackmail></feedback>
|
27
|
<cookie-law *ngIf= "isClient" position="bottom">
|
28
|
OpenAIRE uses cookies in order to function properly.<br>
|
29
|
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
|
30
|
By using the OpenAIRE portal you accept our use of cookies. <a href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
|
31
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
|
32
|
</span></a>
|
33
|
</cookie-law>
|
34
|
<bottom *ngIf= "isClient && properties" [environment]=properties.environment></bottom>
|
35
|
|
36
|
`
|
37
|
|
38
|
})
|
39
|
export class AppComponent {
|
40
|
isClient:boolean = false;
|
41
|
clientLoad = 0;
|
42
|
|
43
|
userMenuItems:MenuItem[] = [ new MenuItem("","My profile","","",false,[],[],{}),
|
44
|
new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],{}),
|
45
|
new MenuItem("","Manage all links","","/claims",true,[],["/claims"],{})]
|
46
|
|
47
|
|
48
|
menuItems:RootMenuItem [] = [
|
49
|
{rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find"],{}),
|
50
|
items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],{}),
|
51
|
new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],{}),
|
52
|
new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],{}),
|
53
|
new MenuItem("","Other Research Products","","/search/find/other",false,["orp"],["/search/find/other"],{}),
|
54
|
new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],{}),
|
55
|
new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{}),
|
56
|
new MenuItem("","Organizations","","/search/find/organizations/",false,["organization"],["/search/find/organizations"],{})
|
57
|
]},
|
58
|
{
|
59
|
rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets"],{}),
|
60
|
items: [new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],{}),
|
61
|
new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],{})]
|
62
|
},
|
63
|
{
|
64
|
rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],{}),
|
65
|
items: []
|
66
|
},
|
67
|
{
|
68
|
rootItem: new MenuItem("datasources","Content Providers","","",false,["datasource"],[],{}),
|
69
|
items: [new MenuItem("","Data Policies","https://beta.openaire.eu/oa-policies-mandates","",false,["datasource"],[""],{}),
|
70
|
new MenuItem("","Repositories","","/search/content-providers",false,["datasource"],["/search/content-providers"],{}),
|
71
|
new MenuItem("","Journals","","/search/journals",false,["datasource"],["/search/journals"],{}),
|
72
|
new MenuItem("","Registries","","/search/entity-registries",false,["datasource"],["/search/entity-registries"],{}),
|
73
|
new MenuItem("","Browse all","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{})]
|
74
|
}
|
75
|
];
|
76
|
|
77
|
|
78
|
|
79
|
feedbackmail:string
|
80
|
properties:EnvProperties;
|
81
|
constructor( private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService) {
|
82
|
}
|
83
|
|
84
|
ngOnInit() {
|
85
|
|
86
|
if (typeof document !== 'undefined') {
|
87
|
try{
|
88
|
this.isClient = true;
|
89
|
|
90
|
}catch (e) {
|
91
|
}
|
92
|
|
93
|
}
|
94
|
this.propertiesService.loadEnvironment()
|
95
|
.then(es => {
|
96
|
this.propertiesService.setEnvProperties(es);
|
97
|
this.properties = this.propertiesService.envSpecific;
|
98
|
this.feedbackmail = this.properties.feedbackmail;
|
99
|
if(Session.isPortalAdministrator()){
|
100
|
this.userMenuItems.push(new MenuItem("","Manage helptexts",
|
101
|
((this.properties.environment == "beta")?"https://beta.admin.connect.openaire.eu":"https://admin.explore.openaire.eu")+"/dashboard?communityId=openaire","",true,[],[],{}))
|
102
|
}
|
103
|
console.log(this.properties.loginUrl);
|
104
|
}, error => {
|
105
|
console.log("App couldn't fetch properties");
|
106
|
console.log(error);
|
107
|
|
108
|
});
|
109
|
}
|
110
|
}
|