1 |
51634
|
argiro.kok
|
import { Component, Input } from '@angular/core';
|
2 |
54206
|
argiro.kok
|
import {ActivatedRoute} from '@angular/router';
|
3 |
55964
|
argiro.kok
|
import 'rxjs';
|
4 |
52162
|
argiro.kok
|
import{MenuItem} from './menu';
|
5 |
|
|
import { ConfigurationService } from '../utils/configuration/configuration.service';
|
6 |
55995
|
argiro.kok
|
import {EnvProperties} from "../utils/properties/env-properties";
|
7 |
59074
|
konstantin
|
import {Subscription} from "rxjs";
|
8 |
50169
|
argiro.kok
|
|
9 |
|
|
@Component({
|
10 |
|
|
selector: 'bottom',
|
11 |
51634
|
argiro.kok
|
templateUrl: 'bottom.component.html'
|
12 |
50169
|
argiro.kok
|
})
|
13 |
|
|
export class BottomComponent {
|
14 |
|
|
|
15 |
54678
|
argiro.kok
|
@Input() showSocialButtons:boolean = true;
|
16 |
53381
|
argiro.kok
|
@Input() showOpenaire:boolean = true;
|
17 |
54678
|
argiro.kok
|
@Input() showMenuItems:boolean = false;
|
18 |
|
|
@Input() showCommision:boolean = true;
|
19 |
52004
|
argiro.kok
|
@Input() assetsPath:string ='assets/common-assets/';
|
20 |
52162
|
argiro.kok
|
@Input() menuItems:MenuItem [];
|
21 |
54347
|
argiro.kok
|
|
22 |
52162
|
argiro.kok
|
@Input() communityId;
|
23 |
55995
|
argiro.kok
|
// @Input() environment:string = "beta";
|
24 |
52162
|
argiro.kok
|
showPage ={};
|
25 |
54678
|
argiro.kok
|
@Input() grantAdvance:boolean = true;
|
26 |
58530
|
argiro.kok
|
grantAdvanceText = "OpenAIRE-Advance receives funding from the European Union's Horizon 2020 Research and Innovation programme under Grant Agreement No. 777541.";
|
27 |
58635
|
argiro.kok
|
grantConenctText = "OpenAIRE-Connect receives funding from the European Union's Horizon 2020 Research and Innovation programme under grant agreement No. 731011 and No. 777541.";
|
28 |
55995
|
argiro.kok
|
@Input() properties:EnvProperties;
|
29 |
58530
|
argiro.kok
|
@Input() darkBackground:boolean=true;
|
30 |
|
|
@Input() centered:boolean=false;
|
31 |
|
|
sectionClass= "uk-section-primary";
|
32 |
54678
|
argiro.kok
|
|
33 |
59074
|
konstantin
|
subs: Subscription[] = [];
|
34 |
|
|
|
35 |
54206
|
argiro.kok
|
constructor(private config: ConfigurationService, private route: ActivatedRoute,) {
|
36 |
50169
|
argiro.kok
|
}
|
37 |
52162
|
argiro.kok
|
|
38 |
|
|
ngOnInit() {
|
39 |
58530
|
argiro.kok
|
if(!this.darkBackground){
|
40 |
|
|
this.sectionClass= " footer-light-background";
|
41 |
|
|
}
|
42 |
59074
|
konstantin
|
this.subs.push(this.route.queryParams.subscribe(params => {
|
43 |
54678
|
argiro.kok
|
if(this.showMenuItems){
|
44 |
55995
|
argiro.kok
|
if( this.properties.adminToolsAPIURL && this.communityId ){
|
45 |
59074
|
konstantin
|
//this.subs.push(this.config.getCommunityInformation(this.properties, this.communityId ).subscribe(data => {
|
46 |
|
|
this.subs.push(this.config.communityInformationState.subscribe(data => {
|
47 |
|
|
if(data) {
|
48 |
|
|
for (var i = 0; i < data['pages'].length; i++) {
|
49 |
|
|
this.showPage[data['pages'][i]["route"]] = data['pages'][i]["isEnabled"];
|
50 |
52162
|
argiro.kok
|
|
51 |
59074
|
konstantin
|
}
|
52 |
|
|
// console.log(this.showPage)
|
53 |
54206
|
argiro.kok
|
}
|
54 |
59074
|
konstantin
|
}));
|
55 |
52162
|
argiro.kok
|
}
|
56 |
|
|
}
|
57 |
59074
|
konstantin
|
}));
|
58 |
52162
|
argiro.kok
|
}
|
59 |
|
|
|
60 |
59074
|
konstantin
|
public ngOnDestroy() {
|
61 |
|
|
for (let sub of this.subs) {
|
62 |
|
|
sub.unsubscribe();
|
63 |
|
|
}
|
64 |
|
|
}
|
65 |
|
|
|
66 |
52162
|
argiro.kok
|
isEnabled(required, enabled){
|
67 |
54206
|
argiro.kok
|
|
68 |
52162
|
argiro.kok
|
if(!required ){
|
69 |
|
|
return true;
|
70 |
|
|
}
|
71 |
|
|
for(let requiredEntity of required){
|
72 |
54206
|
argiro.kok
|
// console.log("R "+requiredEntity +" E " + enabled[requiredEntity])
|
73 |
52162
|
argiro.kok
|
if(typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false){
|
74 |
|
|
return false;
|
75 |
|
|
}
|
76 |
|
|
}
|
77 |
|
|
return true;
|
78 |
|
|
}
|
79 |
|
|
}
|