Project

General

Profile

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
import {Session} from './openaireLibrary/login/utils/helper.class';
9

    
10
@Component({
11
  //changeDetection: ChangeDetectionStrategy.Default,
12
  //encapsulation: ViewEncapsulation.Emulated,
13
  selector: 'app-root',
14
  styles: [`
15
  `],
16
  template: `
17

    
18
        <navbar *ngIf= "properties  " portal="monitor" onlyTop=false    [userMenuItems]=userMenuItems [menuItems]=menuItems logoPath="assets/"
19
        [(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl"  [(cookieDomain)]="properties.cookieDomain"
20
         ></navbar>
21

    
22

    
23
                   <div class="custom-main-content"   >
24
                      <main>
25
                       <router-outlet></router-outlet>
26
                     </main>
27
                    </div>
28
          <feedback *ngIf= "isClient && properties" portalName="Connect" [feedbackmail]=properties.feedbackmail></feedback>
29
          <cookie-law *ngIf= "isClient" position="bottom">
30
              OpenAIRE uses cookies in order to function properly.<br>
31
              Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
32
              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">
33
              <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>
34
              </span></a>
35
          </cookie-law>
36
           <bottom *ngIf= "isClient" [menuItems]=bottomMenuItems></bottom>
37

    
38
`
39

    
40
})
41
export class AppComponent {
42
  isClient:boolean = false;
43
  userMenuItems:MenuItem[] =[];
44
  menuItems:RootMenuItem []=[];
45
  bottomMenuItems:MenuItem[] =[];
46
  properties:EnvProperties;
47

    
48
  constructor(  private  route: ActivatedRoute, private propertiesService:EnvironmentSpecificService  ) {
49
   }
50

    
51
   ngOnInit() {
52
     this.propertiesService.loadEnvironment()
53
             .then(es => {
54
                 this.propertiesService.setEnvProperties(es);
55
                 this.properties = this.propertiesService.envSpecific;
56
                 this.bottomMenuItems =[
57
                 new MenuItem("","About","https://beta.openaire.eu/project-factsheets","",false,[],[],{}),
58
                 new MenuItem("","News - Events","https://beta.openaire.eu/news-events","",false,[],[],{}),
59
                 new MenuItem("","Blog","https://blogs.openaire.eu/","",false,[],[],{}),
60
                 new MenuItem("","Contact us","https://beta.openaire.eu/contact-us","",false,[],[],{})
61
               ];
62
               this.userMenuItems =[
63
                  //new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],{})
64
                ];
65
    //  this.route.queryParams.subscribe(data => {
66
     //
67
    //  });
68
     if (typeof document !== 'undefined') {
69
       try{
70
         this.isClient = true;
71
       }catch (e) {
72
       }
73
     }
74
   }, error => {
75
     console.log("App couldn't fetch properties");
76
       console.log(error);
77

    
78
   });
79
   }
80
}
(2-2/4)