2019-05-23 15:38:44 +02:00
|
|
|
import {Component} from '@angular/core';
|
2019-10-17 14:21:24 +02:00
|
|
|
import {ActivatedRoute, NavigationEnd, NavigationStart, Router} from '@angular/router';
|
2019-05-23 15:38:44 +02:00
|
|
|
|
|
|
|
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
|
|
|
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
|
|
|
|
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
|
|
|
import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
|
2019-06-13 14:40:03 +02:00
|
|
|
import {FilterInfo, PortalAggregators} from "./utils/aggregators";
|
2019-09-24 14:42:17 +02:00
|
|
|
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
|
|
|
|
import {User} from "./openaireLibrary/login/utils/helper.class";
|
2020-11-18 18:01:52 +01:00
|
|
|
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
|
|
|
|
import {portalProperties} from "../environments/environment-aggregator";
|
2020-11-23 13:28:46 +01:00
|
|
|
import {properties} from "../environments/environment";
|
|
|
|
import {ConnectHelper} from "./openaireLibrary/connect/connectHelper";
|
2019-05-23 15:38:44 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
template: `
|
2020-11-23 13:28:46 +01:00
|
|
|
<div *ngIf="agg">
|
|
|
|
<navbar *ngIf="properties && loginCheck && header" portal="aggregator" [properties]=properties [onlyTop]=false
|
|
|
|
[user]="user" [userMenuItems]="userMenuItems"
|
|
|
|
[communityId]="properties.adminToolsCommunity" [menuItems]=menuItems
|
|
|
|
[userMenu]="true" [header]="header"></navbar>
|
|
|
|
<div class="custom-main-content">
|
|
|
|
<main>
|
|
|
|
<router-outlet></router-outlet>
|
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
<cookie-law *ngIf="isClient" position="bottom">
|
|
|
|
OpenAIRE uses cookies in order to function properly.<br>
|
|
|
|
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing
|
|
|
|
experience possible.
|
|
|
|
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">
|
2019-05-23 15:38:44 +02:00
|
|
|
<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>
|
|
|
|
</span></a>
|
2020-11-23 13:28:46 +01:00
|
|
|
</cookie-law>
|
|
|
|
<bottom *ngIf="isClient && properties" [properties]=properties></bottom>
|
|
|
|
</div>
|
2019-05-23 15:38:44 +02:00
|
|
|
`
|
2020-11-23 13:28:46 +01:00
|
|
|
|
2019-05-23 15:38:44 +02:00
|
|
|
})
|
|
|
|
export class AppComponent {
|
|
|
|
isClient: boolean = false;
|
2020-11-23 13:28:46 +01:00
|
|
|
menuItems: RootMenuItem [] = [];
|
|
|
|
userMenuItems: MenuItem[] = [];
|
2019-06-13 14:40:03 +02:00
|
|
|
community = null;
|
2019-10-17 14:21:24 +02:00
|
|
|
id: string = null;
|
2020-11-23 13:28:46 +01:00
|
|
|
properties: EnvProperties = properties;
|
2019-09-24 14:42:17 +02:00
|
|
|
user: User;
|
|
|
|
loginCheck: boolean = false;
|
2020-11-23 13:28:46 +01:00
|
|
|
footer = portalProperties.sectionFooter;
|
|
|
|
header: Header;
|
|
|
|
agg: FilterInfo = null;
|
|
|
|
|
|
|
|
constructor(private propertiesService: EnvironmentSpecificService,
|
|
|
|
private userManagementService: UserManagementService) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
if (typeof document !== 'undefined') {
|
|
|
|
this.isClient = true;
|
|
|
|
}
|
|
|
|
this.id = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
|
|
|
this.agg = PortalAggregators.getFilterInfoByMenuId(this.id);
|
|
|
|
if (this.agg) {
|
|
|
|
this.header = {
|
|
|
|
route: '/',
|
|
|
|
url: null,
|
|
|
|
title: this.agg.title,
|
|
|
|
logoUrl: this.agg.logoUrl,
|
|
|
|
logoSmallUrl: this.agg.logoUrl,
|
|
|
|
position: 'left',
|
|
|
|
badge: true
|
|
|
|
};
|
|
|
|
this.buildMenu();
|
|
|
|
}
|
|
|
|
this.userManagementService.getUserInfo().subscribe(user => {
|
|
|
|
this.user = user;
|
|
|
|
this.loginCheck = true;
|
|
|
|
this.userMenuItems = [];
|
|
|
|
if (this.user) {
|
|
|
|
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
2019-05-23 15:38:44 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-11-23 13:28:46 +01:00
|
|
|
|
2019-10-17 14:21:24 +02:00
|
|
|
private buildMenu() {
|
|
|
|
this.menuItems = [
|
2020-11-23 13:28:46 +01:00
|
|
|
{rootItem: new MenuItem("home", "Home", "", "/", false, [], null, {}), items: []},
|
2019-10-17 14:21:24 +02:00
|
|
|
{
|
2020-11-23 13:28:46 +01:00
|
|
|
rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], null, {}),
|
2020-11-18 18:01:52 +01:00
|
|
|
items: []
|
2020-11-23 13:28:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
rootItem: new MenuItem("deposit", "Deposit", "", "/participate/deposit/learn-how", false, [], null, {}),
|
|
|
|
//rootItem: new MenuItem("deposit", "Deposit", "", "/participate/deposit/learn-how", false, [], ["/participate/deposit/learn-how"], {}),
|
|
|
|
items: []
|
|
|
|
//rootItem: new MenuItem("share", "Share", "", "", false, [], null, {}),
|
|
|
|
//items: [new MenuItem("", "Publications", "", "/participate/deposit-publications", false, ["publication"], null, {}),
|
|
|
|
// new MenuItem("", "Research Data", "", "/participate/deposit-datasets", false, ["dataset"], null, {})]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
rootItem: new MenuItem("link", "Link", "", "/participate/claim", false, [], null, {}),
|
|
|
|
items: [new MenuItem("", "Start linking", "", "/participate/claim", false, [], null, {}),
|
|
|
|
new MenuItem("", "Learn more", this.properties.claimsInformationLink, "", false, [], [], {})]
|
2019-10-17 14:21:24 +02:00
|
|
|
}
|
|
|
|
];
|
2020-11-23 13:28:46 +01:00
|
|
|
let params = {};
|
|
|
|
params[this.agg.queryFieldName] = this.agg.valueId;
|
|
|
|
if ((portalProperties.entities.publication.isEnabled && portalProperties.entities.publication.simpleSearchPage) ||
|
2020-11-18 18:01:52 +01:00
|
|
|
(portalProperties.entities.dataset.isEnabled && portalProperties.entities.dataset.simpleSearchPage) ||
|
|
|
|
(portalProperties.entities.software.isEnabled && portalProperties.entities.software.simpleSearchPage) ||
|
2020-11-23 13:28:46 +01:00
|
|
|
portalProperties.entities.other.isEnabled && portalProperties.entities.other.simpleSearchPage) {
|
|
|
|
|
|
|
|
this.menuItems[1].items.push(new MenuItem("", "Research outcomes", "", "/search/find/research-outcomes", false, [], [], params))
|
2020-11-18 18:01:52 +01:00
|
|
|
}
|
2020-11-23 13:28:46 +01:00
|
|
|
|
|
|
|
if (portalProperties.entities.project.isEnabled && portalProperties.entities.project.simpleSearchPage) {
|
|
|
|
this.menuItems[1].items.push(new MenuItem("", "Projects", "", "/search/find/projects/", false, [], [],
|
|
|
|
{cf: true}))
|
2020-11-18 18:01:52 +01:00
|
|
|
}
|
2020-11-23 13:28:46 +01:00
|
|
|
if (portalProperties.entities.datasource.isEnabled && portalProperties.entities.datasource.simpleSearchPage) {
|
|
|
|
this.menuItems[1].items.push(new MenuItem("", "Content Providers", "", "/search/find/dataproviders", false, [], [], params))
|
2020-11-18 18:01:52 +01:00
|
|
|
}
|
2020-11-23 13:28:46 +01:00
|
|
|
if (portalProperties.entities.organization.isEnabled && portalProperties.entities.organization.simpleSearchPage) {
|
|
|
|
this.menuItems[1].items.push(new MenuItem("", "Organizations", "", "/search/find/organizations/", false, [], [], params))
|
2019-05-23 15:38:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|