import {Component, Input, OnInit} from '@angular/core'; import {Session} from '../../openaireLibrary/login/utils/helper.class'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {ActivatedRoute} from '@angular/router'; import {EnvironmentSpecificService} from '../../openaireLibrary/utils/properties/environment-specific.service'; import {CommunitiesService} from '../../openaireLibrary/connect/communities/communities.service'; import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo'; import {HelperFunctions} from '../../openaireLibrary/utils/HelperFunctions.class'; @Component({ selector: 'wellcome', template: `

A Science Gateway to the future of your Community

Turn Open Science into Practice. It takes your open and linked research outcomes. A service customized to your needs.
` }) export class WellcomeComponent implements OnInit { properties: EnvProperties = null; public communities: CommunityInfo[] = []; constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, private _communitiesService: CommunitiesService) { } ngOnInit() { this.propertiesService.loadEnvironment().then(es => { this.propertiesService.setEnvProperties(es); this.properties = this.propertiesService.envSpecific; HelperFunctions.scroll(); //this._communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe( this._communitiesService.getCommunitiesState().subscribe( communities => { var countCommunities = 0; var index_managerOfCommunity = null; for (var i = 0; i < communities.length; i++) { var com = communities[i]; if (Session.isPortalAdministrator() || Session.isCommunityCurator()) { this.communities.push(communities[i]); } else { for (var manager of com.managers) { if (manager == Session.getUserEmail()) { countCommunities++; index_managerOfCommunity = i; this.communities.push(communities[i]); break; } } } } }); }); } }