1
|
import { Component, Input } from '@angular/core';
|
2
|
import {ActivatedRoute} from '@angular/router';
|
3
|
import 'rxjs';
|
4
|
import{MenuItem} from './menu';
|
5
|
import { ConfigurationService } from '../utils/configuration/configuration.service';
|
6
|
|
7
|
@Component({
|
8
|
selector: 'bottom',
|
9
|
templateUrl: 'bottom.component.html'
|
10
|
})
|
11
|
export class BottomComponent {
|
12
|
|
13
|
@Input() showSocialButtons:boolean = true;
|
14
|
@Input() showOpenaire:boolean = true;
|
15
|
@Input() showMenuItems:boolean = false;
|
16
|
@Input() showCommision:boolean = true;
|
17
|
@Input() assetsPath:string ='assets/common-assets/';
|
18
|
@Input() menuItems:MenuItem [];
|
19
|
|
20
|
@Input() APIUrl;
|
21
|
@Input() communityId;
|
22
|
@Input() environment:string = "beta";
|
23
|
showPage ={};
|
24
|
@Input() grantAdvance:boolean = true;
|
25
|
grantAdvanceText = "OpenAIRE-Advance receives funding from the European Union's Horizon 2020 Research and Innovation programme under Grant Agreement No. 777541."
|
26
|
grantConenctText = "OpenAIRE-Connect receives funding from the European Union's Horizon 2020 Research and Innovation programme under grant agreement No. 731011."
|
27
|
|
28
|
|
29
|
constructor(private config: ConfigurationService, private route: ActivatedRoute,) {
|
30
|
}
|
31
|
|
32
|
ngOnInit() {
|
33
|
this.route.queryParams.subscribe(params => {
|
34
|
if(this.showMenuItems){
|
35
|
if( this.APIUrl && this.communityId ){
|
36
|
this.config.getCommunityInformation(this.APIUrl, this.communityId ).subscribe(data => {
|
37
|
for(var i=0; i< data['pages'].length; i++){
|
38
|
this.showPage[data['pages'][i]["route"]] = data['pages'][i]["isEnabled"];
|
39
|
|
40
|
}
|
41
|
// console.log(this.showPage)
|
42
|
|
43
|
});
|
44
|
}
|
45
|
}
|
46
|
});
|
47
|
}
|
48
|
|
49
|
isEnabled(required, enabled){
|
50
|
|
51
|
if(!required ){
|
52
|
return true;
|
53
|
}
|
54
|
for(let requiredEntity of required){
|
55
|
// console.log("R "+requiredEntity +" E " + enabled[requiredEntity])
|
56
|
if(typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false){
|
57
|
return false;
|
58
|
}
|
59
|
}
|
60
|
return true;
|
61
|
}
|
62
|
}
|