2018-01-11 11:55:54 +01:00
|
|
|
import { Component, Input } from '@angular/core';
|
2017-12-19 13:53:46 +01:00
|
|
|
// import 'rxjs/Rx';
|
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
|
|
import {Observable} from 'rxjs/Observable';
|
|
|
|
|
|
|
|
import {Session} from '../login/utils/helper.class';
|
|
|
|
import { ConfigurationService } from '../utils/configuration/configuration.service';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'navbar',
|
|
|
|
templateUrl: 'navigationBar.component.html'
|
|
|
|
})
|
|
|
|
export class NavigationBarComponent {
|
2018-01-11 11:55:54 +01:00
|
|
|
@Input() portal:string = "connect";
|
|
|
|
@Input() onlyTop ;
|
|
|
|
@Input() logoPath:string = "assets/";
|
|
|
|
@Input() userMenu;
|
2018-01-11 16:20:43 +01:00
|
|
|
@Input() logInUrl;
|
|
|
|
@Input() logOutUrl;
|
|
|
|
@Input() userMenuItems = [
|
|
|
|
|
|
|
|
{title: "My profile",
|
|
|
|
url:"",
|
|
|
|
route:"",
|
|
|
|
needsAuthorization:false},
|
|
|
|
{title: "My claims",
|
|
|
|
url:"",
|
|
|
|
route:"/myclaims",
|
|
|
|
needsAuthorization:false},
|
|
|
|
{title: "Manage all claims",
|
|
|
|
url:"",
|
|
|
|
route:"/claims",
|
|
|
|
needsAuthorization:true
|
|
|
|
}
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
@Input() menuItems = [
|
|
|
|
{rootItem:{
|
|
|
|
title: "Search",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find"
|
|
|
|
|
|
|
|
},items:[
|
|
|
|
{title: "Publications",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find/publications",
|
|
|
|
entitiesRequired:["publication"],
|
|
|
|
routeRequired:["/search/find/publications"]},
|
|
|
|
{title: "Research Data",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find/datasets",
|
|
|
|
entitiesRequired:["dataset"],
|
|
|
|
routeRequired:["/search/find/datasets"]},
|
|
|
|
{title: "Software",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find/software",
|
|
|
|
entitiesRequired:["software"],
|
|
|
|
routeRequired:["/search/find/software"]},
|
|
|
|
{title: "Projects",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find/projects",
|
|
|
|
entitiesRequired:["projects"],
|
|
|
|
routeRequired:["/search/find/projects"]},
|
|
|
|
{title: "Content Providers",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find/dataproviders",
|
|
|
|
entitiesRequired:["projects"],
|
|
|
|
routeRequired:["/search/find/projects"]},
|
|
|
|
{title: "Organizations",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find/organizations",
|
|
|
|
entitiesRequired:["projects"],
|
|
|
|
routeRequired:["/search/find/projects"]},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{rootItem:{
|
|
|
|
title: "Share",
|
|
|
|
url:"",
|
|
|
|
route:""
|
|
|
|
|
|
|
|
},items:[
|
|
|
|
{title: "Publications",
|
|
|
|
url:"",
|
|
|
|
route:"/participate/deposit-publications",
|
|
|
|
entitiesRequired:["publication"],
|
|
|
|
routeRequired:["/participate/deposit-publications"]},
|
|
|
|
{title: "Research Data",
|
|
|
|
url:"",
|
|
|
|
route:"/participate/deposit-datasets",
|
|
|
|
entitiesRequired:["dataset"],
|
|
|
|
routeRequired:["/participate/deposit-datasets"]}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
{rootItem:{
|
|
|
|
title: "Link",
|
|
|
|
url:"",
|
|
|
|
route:"/participate/claim",
|
|
|
|
entitiesRequired:[],
|
|
|
|
routeRequired:["/participate/claim"]
|
|
|
|
|
|
|
|
},items:[]
|
|
|
|
},
|
|
|
|
{rootItem:{
|
|
|
|
title: "Content Providers",
|
|
|
|
url:"",
|
|
|
|
route:""
|
|
|
|
|
|
|
|
|
|
|
|
},items:[
|
|
|
|
{title: "Data Policies",
|
|
|
|
url:"https://beta.openaire.eu/oa-policies-mandates",
|
|
|
|
route:"",
|
|
|
|
entitiesRequired:[],
|
|
|
|
routeRequired:[]},
|
|
|
|
{title: "Repositories",
|
|
|
|
url:"",
|
|
|
|
route:"/search/content-providers",
|
|
|
|
entitiesRequired:[],
|
|
|
|
routeRequired:["/search/content-providers"]},
|
|
|
|
{title: "Journals",
|
|
|
|
url:"",
|
|
|
|
route:"/search/journals",
|
|
|
|
entitiesRequired:[],
|
|
|
|
routeRequired:["/search/journals"]},
|
|
|
|
{title: "Registries",
|
|
|
|
url:"",
|
|
|
|
route:"/search/entity-registries",
|
|
|
|
entitiesRequired:[],
|
|
|
|
routeRequired:["/search/entity-registries"]},
|
|
|
|
{title: "Browse all",
|
|
|
|
url:"",
|
|
|
|
route:"/search/find/dataproviders",
|
|
|
|
entitiesRequired:[],
|
|
|
|
routeRequired:["/search/find/dataproviders"]}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
];
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
<li *ngIf="showDataProviders" class="uk-nav-header uk-parent">
|
|
|
|
Content Providers
|
|
|
|
<ul class="uk-nav-sub">
|
|
|
|
<li><a href="https://beta.openaire.eu/oa-policies-mandates" class="uk-offcanvas-close custom-offcanvas-close" >Data Policies</a></li>
|
|
|
|
<li><a routerLinkActive="uk-link" routerLink="/search/content-providers" class="uk-offcanvas-close custom-offcanvas-close" >Repositories</a></li>
|
|
|
|
<li><a routerLinkActive="uk-link" routerLink="/search/journals" class="uk-offcanvas-close custom-offcanvas-close" >Journals</a></li>
|
|
|
|
<li><a routerLinkActive="uk-link" routerLink="/search/entity-registries" class="uk-offcanvas-close custom-offcanvas-close" >Registries/ Databases</a></li>
|
|
|
|
<li><a routerLinkActive="uk-link" routerLink="/search/find/dataproviders" class="uk-offcanvas-close custom-offcanvas-close" >Browse all</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>*/
|
2017-12-19 13:53:46 +01:00
|
|
|
public isAuthorized: boolean = false;
|
|
|
|
sub:any;
|
|
|
|
isClient:boolean = false;
|
|
|
|
|
|
|
|
showPublications:boolean= false;
|
|
|
|
showDatasets:boolean= false;
|
|
|
|
showSoftware:boolean=false;
|
|
|
|
showProjects:boolean= false;
|
|
|
|
showDataProviders:boolean= false;
|
|
|
|
showOrganizations:boolean= false;
|
|
|
|
showDepositDatasets:boolean= false;
|
|
|
|
showDepositPublications:boolean= false;
|
|
|
|
showLinking:boolean= false;
|
|
|
|
specialAnnouncementContent:string= null;
|
|
|
|
|
|
|
|
|
|
|
|
constructor( private router: Router, private route: ActivatedRoute, private config: ConfigurationService) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2018-01-11 16:20:43 +01:00
|
|
|
console.log(this.menuItems);
|
2017-12-19 13:53:46 +01:00
|
|
|
if (typeof document !== 'undefined') {
|
|
|
|
try{
|
|
|
|
this.isClient = true;
|
|
|
|
}catch (e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this.initialize();
|
|
|
|
this.sub = this.route.queryParams.subscribe(params => {
|
|
|
|
this.initialize();
|
|
|
|
});
|
2018-01-11 11:55:54 +01:00
|
|
|
|
|
|
|
if(this.userMenu == "true"){
|
|
|
|
this.userMenu = true;
|
|
|
|
}
|
|
|
|
else if(this.userMenu == "false"){
|
|
|
|
this.userMenu = false;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
this.userMenu = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.onlyTop == "true"){
|
|
|
|
this.onlyTop = true;
|
|
|
|
}
|
|
|
|
else if(this.onlyTop == "false"){
|
|
|
|
this.onlyTop = false;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
this.onlyTop = false;
|
|
|
|
}
|
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
// const entityOne = this.config.isEntityEnabled("publication");
|
|
|
|
// const entityTwo = this.config.isEntityEnabled("dataset");
|
|
|
|
// const entityThree = this.config.isEntityEnabled("project");
|
|
|
|
// const entityFour = this.config.isEntityEnabled("organization");
|
|
|
|
// const entityFive = this.config.isEntityEnabled("datasource");
|
|
|
|
// const entitySix = this.config.isEntityEnabled("software");
|
|
|
|
// const entity7 = this.config.isPageEnabled("participate/deposit-publications");
|
|
|
|
// const entity8 = this.config.isPageEnabled("participate/deposit-datasets");
|
|
|
|
// const entity9 = this.config.isPageEnabled("participate/claim");
|
|
|
|
// const example = Observable.zip(entityOne,entityTwo,entityThree,entityFour,entityFive,entitySix, entity7, entity8, entity9);
|
|
|
|
// const subscribe = example.subscribe(data => {
|
|
|
|
// console.log("Got the respond")
|
|
|
|
// this.showPublications = data[0];
|
|
|
|
// this.showDatasets = data[1];
|
|
|
|
// this.showProjects = data[2];
|
|
|
|
// this.showOrganizations = data[3];
|
|
|
|
// this.showDataProviders = data[4];
|
|
|
|
// this.showSoftware = data[5];
|
|
|
|
// this.showDepositPublications = data[6];
|
|
|
|
// this.showDepositDatasets = data[7];
|
|
|
|
// this.showLinking = data[8];
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
ngOnDestroy(){
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
}
|
|
|
|
initialize(){
|
|
|
|
if(Session.isLoggedIn() && Session.isUserValid() && Session.isAdminUser()){
|
|
|
|
this.isAuthorized = true;
|
|
|
|
}else {
|
|
|
|
this.isAuthorized = false;
|
|
|
|
}
|
|
|
|
this.config.isEntityEnabled("publication").subscribe(data => {
|
2018-01-11 11:55:54 +01:00
|
|
|
this.showPublications = data;
|
2017-12-19 13:53:46 +01:00
|
|
|
});
|
|
|
|
this.config.isEntityEnabled("dataset").subscribe(data => { this.showDatasets = data;});
|
|
|
|
this.config.isEntityEnabled("software").subscribe(data => { this.showSoftware = data;})
|
|
|
|
this.config.isEntityEnabled("project").subscribe(data => { this.showProjects = data;});
|
|
|
|
this.config.isEntityEnabled("organization").subscribe(data => { this.showOrganizations = data;});
|
|
|
|
this.config.isEntityEnabled("datasource").subscribe(data => { this.showDataProviders = data;});
|
|
|
|
|
|
|
|
this.config.isPageEnabled("participate/deposit-publications").subscribe(data => { this.showDepositPublications = data;});
|
|
|
|
this.config.isPageEnabled("participate/deposit-datasets").subscribe(data => { this.showDepositDatasets = data;});
|
|
|
|
this.config.isPageEnabled("participate/claim").subscribe(data => { this.showLinking = data;});
|
|
|
|
this.config.getSpecialAnouncementContent().subscribe(data => { this.specialAnnouncementContent = data;});
|
|
|
|
}
|
|
|
|
onClick(id: string) {
|
|
|
|
var el: HTMLElement = document.getElementById(id);
|
|
|
|
el.classList.remove('uk-open');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|