2019-03-01 12:34:19 +01:00
import { Component , Directive , ElementRef , Renderer , ChangeDetectionStrategy , ViewEncapsulation , Injector } from '@angular/core' ;
2018-01-26 16:00:07 +01:00
import { Observable } from 'rxjs/Observable' ;
2018-02-12 12:41:40 +01:00
import { ActivatedRoute } from '@angular/router' ;
2018-02-15 12:12:55 +01:00
import { EnvProperties } from './openaireLibrary/utils/properties/env-properties' ;
import { MenuItem , RootMenuItem } from './openaireLibrary/sharedComponents/menu' ;
import { EnvironmentSpecificService } from './openaireLibrary/utils/properties/environment-specific.service' ;
2018-03-16 09:55:38 +01:00
import { CommunitiesService } from "./openaireLibrary/connect/communities/communities.service" ;
import { Session } from './openaireLibrary/login/utils/helper.class' ;
2018-03-29 10:28:04 +02:00
import { ConnectHelper } from './openaireLibrary/connect/connectHelper' ;
2019-04-12 13:05:28 +02:00
import { SubscribeService } from './openaireLibrary/utils/subscribe/subscribe.service' ;
2019-04-11 16:32:07 +02:00
// import {LayoutService} from "./openaireLibrary/services/layout.service";
2018-02-12 12:41:40 +01:00
2018-01-26 16:00:07 +01:00
@Component ( {
//changeDetection: ChangeDetectionStrategy.Default,
//encapsulation: ViewEncapsulation.Emulated,
selector : 'app-root' ,
styles : [ `
` ],
template : `
2018-12-13 15:25:05 +01:00
< navbar * ngIf = "properties && showMenu && !community" [ environment ] = properties.environment portal = "connect" [ onlyTop ] = false [ userMenuItems ] = userMenuItems [ menuItems ] = menuItems
2018-03-22 16:38:42 +01:00
[ ( APIUrl ) ] = "properties.adminToolsAPIURL" [ ( logInUrl ) ] = "properties.loginUrl" [ ( logOutUrl ) ] = "properties.logoutUrl" [ ( cookieDomain ) ] = "properties.cookieDomain" [ showMenu ] = showMenu > < / navbar >
2018-12-13 15:25:05 +01:00
< navbar * ngIf = "properties && showMenu && community" [ environment ] = properties.environment portal = "connect" [ onlyTop ] = false [ ( communityId ) ] = " community.id " [ userMenuItems ] = userMenuItems [ menuItems ] = menuItems
2018-03-22 16:38:42 +01:00
[ ( APIUrl ) ] = "properties.adminToolsAPIURL" [ ( logInUrl ) ] = "properties.loginUrl" [ ( logOutUrl ) ] = "properties.logoutUrl" [ ( cookieDomain ) ] = "properties.cookieDomain" [ ( community ) ] = community [ showMenu ] = showMenu > < / navbar >
2018-03-16 09:55:38 +01:00
2018-01-26 16:00:07 +01:00
< div class = "custom-main-content" >
< main >
< router - outlet > < / r o u t e r - o u t l e t >
< / main >
< / div >
2019-04-11 16:32:07 +02:00
<!-- feedback * ngIf = "isClient && properties" portalName = "Connect" [ feedbackQuestionaire ] = properties . feedbackQuestionaire > < / f e e d b a c k - - >
2018-01-26 16:00:07 +01:00
< cookie - law * ngIf = "isClient" position = "bottom" >
OpenAIRE uses cookies in order to function properly . < br >
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible .
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" >
< 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 >
< / span > < / a >
< / c o o k i e - l a w >
2019-02-01 13:23:31 +01:00
< bottom * ngIf = "properties && isClient && showMenu && !community" [ environment ] = properties.environment [ grantAdvance ] = " false " > < / bottom >
< bottom * ngIf = "properties && isClient && showMenu && community" [ environment ] = properties.environment [ showSocialButtons ] = " true " [ showMenuItems ] = " true " [ grantAdvance ] = " false " [ showOpenaire ] = " true " [ ( communityId ) ] = " community.id " [ ( APIUrl ) ] = " properties.adminToolsAPIURL " [ menuItems ] = bottomMenuItems > < / bottom >
2018-01-26 16:00:07 +01:00
`
} )
export class AppComponent {
isClient :boolean = false ;
2018-02-12 12:41:40 +01:00
userMenuItems :MenuItem [ ] = [ ] ;
menuItems :RootMenuItem [ ] = [ ] ;
2018-05-23 16:46:55 +02:00
bottomMenuItems :MenuItem [ ] = [ ] ;
2018-03-01 12:45:37 +01:00
public community = null ;
2018-03-16 09:55:38 +01:00
properties :EnvProperties ;
showMenu :boolean = false ;
2018-03-22 17:01:06 +01:00
communities = null ;
2019-04-16 16:26:09 +02:00
subscriberOfCommunities = false ;
managerOfCommunities = false ;
2019-04-12 13:05:28 +02:00
2019-04-11 16:32:07 +02:00
// layout = null;
2018-03-01 12:45:37 +01:00
// community: {id:string, name:string, logoUrl:string};
2019-03-19 11:25:25 +01:00
constructor ( private route : ActivatedRoute , private propertiesService :EnvironmentSpecificService ,
2019-04-12 13:05:28 +02:00
private _communitiesService :CommunitiesService , private _subscribeService : SubscribeService , ) { //, private _layoutService: LayoutService) {
2019-03-01 12:34:19 +01:00
2018-02-12 12:41:40 +01:00
}
2018-01-26 16:00:07 +01:00
ngOnInit() {
2018-03-01 17:11:31 +01:00
this . propertiesService . loadEnvironment ( )
. then ( es = > {
this . properties = this . propertiesService . envSpecific ;
2019-04-17 16:48:06 +02:00
var communityId : string = "" ;
2019-04-18 14:50:14 +02:00
this . _communitiesService . updateCommunities ( this . properties , this . properties . communitiesAPI ) ;
2019-04-17 16:48:06 +02:00
if ( this . properties . environment == "development" ) {
this . route . queryParams . subscribe ( data = > {
communityId = data [ 'communityId' ] ;
this . buildMenu ( communityId ) ;
} ) ;
} else {
communityId = ConnectHelper . getCommunityFromDomain ( this . properties . domain ) ;
this . buildMenu ( communityId ) ;
}
/ *
2018-02-12 12:41:40 +01:00
this . route . queryParams . subscribe ( data = > {
2018-03-16 09:55:38 +01:00
var community = null ;
2018-03-22 17:01:06 +01:00
this . community = null ;
2018-03-16 09:55:38 +01:00
this . showMenu = false ;
2018-05-23 14:22:14 +02:00
this . _communitiesService . getCommunities ( this . properties , this . properties . communitiesAPI ) . subscribe (
2018-03-16 09:55:38 +01:00
communities = > {
2019-04-16 16:26:09 +02:00
2018-03-16 09:55:38 +01:00
for ( var com of communities ) {
2019-04-16 16:26:09 +02:00
if ( (
( ( data [ 'communityId' ] && data [ 'communityId' ] != "" && com . communityId == data [ 'communityId' ] )
|| ( ConnectHelper . getCommunityFromDomain ( this . properties . domain ) == com . communityId ) )
&& community != null ) ||
(
! ( ( data [ 'communityId' ] && data [ 'communityId' ] != "" && com . communityId == data [ 'communityId' ] )
|| ( ConnectHelper . getCommunityFromDomain ( this . properties . domain ) == com . communityId ) )
&&
this . managerOfCommunities && this . subscriberOfCommunities ) ) {
break ;
}
2019-04-12 13:05:28 +02:00
if ( Session . isLoggedIn ( ) && com [ 'status' ] != "hidden" ) {
if ( Session . isCommunityCurator ( ) || Session . isPortalAdministrator ( ) ) {
2019-04-16 16:26:09 +02:00
this . managerOfCommunities = true ;
2019-04-12 13:05:28 +02:00
} else if ( com . managers . indexOf ( Session . getUserEmail ( ) ) != - 1 ) {
2019-04-16 16:26:09 +02:00
this . managerOfCommunities = true ;
2019-04-17 16:48:06 +02:00
}
// else if(!this.subscriberOfCommunities){
// // check if subscriber
// this._subscribeService.isSubscribedToCommunity(com.communityId, Session.getUserEmail(), this.properties.adminToolsAPIURL).subscribe (
// isSubscriber => {
// if(isSubscriber) {
// this.subscriberOfCommunities = true;
// }
// },
// error => {
// console.error("Error fetching your subscribed communities")
// });
//
// }
2019-04-12 13:05:28 +02:00
}
2018-03-22 16:38:42 +01:00
if ( ( data [ 'communityId' ] && data [ 'communityId' ] != "" && com . communityId == data [ 'communityId' ] )
2019-03-01 12:34:19 +01:00
|| ( ConnectHelper . getCommunityFromDomain ( this . properties . domain ) == com . communityId ) ) {
2018-03-16 09:55:38 +01:00
community = com ;
2019-04-11 16:32:07 +02:00
// this._layoutService.getLayout(com.communityId,
// this.properties.adminToolsAPIURL + '/').subscribe (
// layout => {
// this.layout = layout;
// document.documentElement.style.setProperty('--portal-main-color', this.layout.color);
// }
// );
2018-03-16 09:55:38 +01:00
this . community = { id : community.communityId , name : ( community . shortTitle ) ? community.shortTitle :community.title , logoUrl :community.logoUrl } ;
this . menuItems = [
2019-02-18 16:15:53 +01:00
{ rootItem : new MenuItem ( "search" , "Search" , "" , "/search/find" , false , [ ] , [ "/search/find" , "/search/find/publications" , "/search/find/datasets" , "/search/find/software" , "/search/find/other" , "/search/find/projects" , "/search/find/dataproviders" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
items : [ new MenuItem ( "" , "Publications" , "" , "/search/find/publications" , false , [ "publication" ] , [ "/search/find/publications" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Research Data" , "" , "/search/find/datasets" , false , [ "dataset" ] , [ "/search/find/datasets" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Software" , "" , "/search/find/software" , false , [ "software" ] , [ "/search/find/software" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Other Research Products" , "" , "/search/find/other" , false , [ "orp" ] , [ "/search/find/other" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Projects" , "" , "/search/find/projects/" , false , [ "project" ] , [ "/search/find/projects" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Content Providers" , "" , "/search/find/dataproviders" , false , [ "datasource" ] , [ "/search/find/dataproviders" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
2018-03-16 09:55:38 +01:00
] } ,
{
2019-02-18 16:15:53 +01:00
rootItem : new MenuItem ( "monitor" , "Monitor" , "" , "/monitor" , false , [ ] , [ "/monitor" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
2018-03-16 09:55:38 +01:00
items : [ ]
} ,
{
2019-02-18 16:15:53 +01:00
rootItem : new MenuItem ( "share" , "Share" , "" , "" , false , [ ] , [ "/participate/deposit-publications" , "/participate/deposit-datasets" , "/participate/share-zenodo" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
2018-11-23 10:52:51 +01:00
items : [
2019-02-18 16:15:53 +01:00
new MenuItem ( "" , "Zenodo Communities" , "" , "/participate/share-zenodo" , false , [ ] , [ "/participate/share-zenodo" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Publications" , "" , "/participate/deposit-publications" , false , [ "publication" ] , [ "/participate/deposit-publications" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Research Data" , "" , "/participate/deposit-datasets" , false , [ "dataset" ] , [ "/participate/deposit-datasets" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ]
2018-03-16 09:55:38 +01:00
} ,
{
2019-02-18 16:15:53 +01:00
rootItem : new MenuItem ( "link" , "Link" , "" , "/participate/claim" , false , [ ] , [ "/participate/claim" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
2018-03-16 09:55:38 +01:00
items : [ ]
}
] ;
2018-03-22 16:38:42 +01:00
2018-03-16 09:55:38 +01:00
}
}
2018-03-22 16:38:42 +01:00
if ( community == null ) {
2018-04-03 14:38:28 +02:00
this . menuItems = [ ] ;
2019-04-12 13:05:28 +02:00
var myCommunities = [ ] ;
2019-04-16 16:26:09 +02:00
if ( this . managerOfCommunities ) {
2019-04-12 13:05:28 +02:00
myCommunities . push ( new MenuItem ( "" , "Managing communities" , "" , "/search/find/communities" , false , [ ] , [ ] , { role : "%22manager%22" } ) )
}
2019-04-16 16:26:09 +02:00
if ( Session . isLoggedIn ( ) ) {
this . _subscribeService . getCommunitiesSubscribedTo ( Session . getUserEmail ( ) , this . properties . adminToolsAPIURL ) . subscribe (
pids = > {
if ( pids . length > 0 ) {
myCommunities . push ( new MenuItem ( "" , "Subscribed to communities" , "" , "/search/find/communities" , false , [ ] , [ ] , { status : "%22subscribed%22" } ) )
}
} ,
error = > {
console . error ( "Error fetching your subscribed communities" )
} ) ;
2019-04-12 13:05:28 +02:00
}
2019-04-16 16:26:09 +02:00
// if(this.subscriberOfCommunities){
// myCommunities.push( new MenuItem("","Subscribed to communities","","/search/find/communities",false,[],[],{status:"%22subscribed%22"}))
// }
2019-04-12 13:05:28 +02:00
this . menuItems . push ( { rootItem : new MenuItem ( "communities" , "Communities" , "" , "/search/find/communities" , false , [ ] , null , { } ) , items : [ ] } ) ;
2019-04-16 16:26:09 +02:00
if ( this . managerOfCommunities || this . subscriberOfCommunities ) {
2019-04-12 13:05:28 +02:00
this . menuItems . push ( { rootItem : new MenuItem ( "myCommunities" , "My Communities" , "" , "" , false , [ ] , [ ] , { } ) , items : myCommunities } ) ;
}
this . menuItems . push ( { rootItem : new MenuItem ( "howto" , "Create Community" , "" , "/how-to-create-community" , false , [ ] , null , { } ) , items : [ ] } ) ;
2018-05-23 16:46:55 +02:00
this . bottomMenuItems = [
2018-05-30 12:24:24 +02:00
new MenuItem ( "" , "About" , "https://beta.openaire.eu/project-factsheets" , "" , false , [ ] , [ ] , { } ) ,
2018-05-23 16:46:55 +02:00
new MenuItem ( "" , "News - Events" , "https://beta.openaire.eu/news-events" , "" , false , [ ] , [ ] , { } ) ,
new MenuItem ( "" , "Blog" , "https://blogs.openaire.eu/" , "" , false , [ ] , [ ] , { } ) ,
new MenuItem ( "" , "Contact us" , "https://beta.openaire.eu/contact-us" , "" , false , [ ] , [ ] , { } )
] ;
2018-12-07 15:21:38 +01:00
// if(this.properties.showContent){
// this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{}));
// }
2018-11-26 14:07:58 +01:00
this . userMenuItems = [
// new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],(data['communityId'] && typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:data['communityId']}),
] ;
2018-05-23 16:46:55 +02:00
} else {
2018-06-12 13:33:29 +02:00
this . bottomMenuItems = [
2019-02-18 16:15:53 +01:00
new MenuItem ( "" , "About" , "" , "/about" , false , [ ] , [ "/about" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Organizations" , "" , "/organizations" , false , [ ] , [ "/organizations" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } )
2018-06-12 13:33:29 +02:00
] ;
if ( this . properties . showContent ) {
this . bottomMenuItems . push ( new MenuItem ( "" , "Content Policy" , "" , "/content" , false , [ ] , [ ] , { } ) ) ;
}
2018-11-26 14:07:58 +01:00
this . userMenuItems = [ new MenuItem ( "" , "My profile" , "" , "" , false , [ ] , [ ] , { } ) ,
2019-02-18 16:15:53 +01:00
new MenuItem ( "" , "My links" , "" , "/myclaims" , false , [ ] , [ "/myclaims" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Invite users" , "" , "/invite" , false , [ ] , [ ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
2018-11-26 14:07:58 +01:00
] ;
2019-04-16 16:26:09 +02:00
if ( this . managerOfCommunities ) {
2019-04-16 12:43:08 +02:00
this . userMenuItems . push ( new MenuItem ( "" , "Support" , "https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611" , "" , false , [ ] , [ ] , { } ) )
2019-04-15 16:08:37 +02:00
}
2018-05-23 16:46:55 +02:00
}
2018-03-16 09:55:38 +01:00
this . showMenu = true ;
} ) ;
2018-02-12 12:41:40 +01:00
} ) ;
2019-04-17 16:48:06 +02:00
* /
2018-01-26 16:00:07 +01:00
if ( typeof document !== 'undefined' ) {
try {
this . isClient = true ;
} catch ( e ) {
}
}
2018-03-01 17:11:31 +01:00
} , error = > {
console . log ( "App couldn't fetch properties" ) ;
console . log ( error ) ;
2018-02-12 12:41:40 +01:00
2018-03-01 17:11:31 +01:00
} ) ;
2018-01-26 16:00:07 +01:00
}
2019-04-17 16:48:06 +02:00
public buildMenu ( communityId : string ) {
var community = null ;
this . community = null ;
this . showMenu = false ;
2019-04-18 14:50:14 +02:00
this . _communitiesService . getCommunitiesState ( ) . subscribe (
2019-04-17 16:48:06 +02:00
communities = > {
for ( var com of communities ) {
if ( ( communityId && communityId != "" && com . communityId == communityId
&& community != null ) ||
(
! ( communityId && communityId != "" && com . communityId == communityId )
&&
this . managerOfCommunities && this . subscriberOfCommunities ) ) {
break ;
}
if ( Session . isLoggedIn ( ) && com [ 'status' ] != "hidden" ) {
if ( Session . isCommunityCurator ( ) || Session . isPortalAdministrator ( ) ) {
this . managerOfCommunities = true ;
} else if ( com . managers . indexOf ( Session . getUserEmail ( ) ) != - 1 ) {
this . managerOfCommunities = true ;
} / * else if ( ! this . subscriberOfCommunities ) {
// check if subscriber
this . _subscribeService . isSubscribedToCommunity ( com . communityId , Session . getUserEmail ( ) , this . properties . adminToolsAPIURL ) . subscribe (
isSubscriber = > {
if ( isSubscriber ) {
this . subscriberOfCommunities = true ;
}
} ,
error = > {
console . error ( "Error fetching your subscribed communities" )
} ) ;
} * /
}
if ( communityId && communityId != "" && com . communityId == communityId ) {
community = com ;
// this._layoutService.getLayout(com.communityId,
// this.properties.adminToolsAPIURL + '/').subscribe (
// layout => {
// this.layout = layout;
// document.documentElement.style.setProperty('--portal-main-color', this.layout.color);
// }
// );
this . community = { id : community.communityId , name : ( community . shortTitle ) ? community.shortTitle :community.title , logoUrl :community.logoUrl } ;
this . menuItems = [
{ rootItem : new MenuItem ( "search" , "Search" , "" , "/search/find" , false , [ ] , [ "/search/find" , "/search/find/publications" , "/search/find/datasets" , "/search/find/software" , "/search/find/other" , "/search/find/projects" , "/search/find/dataproviders" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
items : [ new MenuItem ( "" , "Publications" , "" , "/search/find/publications" , false , [ "publication" ] , [ "/search/find/publications" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Research Data" , "" , "/search/find/datasets" , false , [ "dataset" ] , [ "/search/find/datasets" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Software" , "" , "/search/find/software" , false , [ "software" ] , [ "/search/find/software" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Other Research Products" , "" , "/search/find/other" , false , [ "orp" ] , [ "/search/find/other" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Projects" , "" , "/search/find/projects/" , false , [ "project" ] , [ "/search/find/projects" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Content Providers" , "" , "/search/find/dataproviders" , false , [ "datasource" ] , [ "/search/find/dataproviders" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
] } ,
{
rootItem : new MenuItem ( "monitor" , "Monitor" , "" , "/monitor" , false , [ ] , [ "/monitor" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
items : [ ]
} ,
{
rootItem : new MenuItem ( "share" , "Share" , "" , "" , false , [ ] , [ "/participate/deposit-publications" , "/participate/deposit-datasets" , "/participate/share-zenodo" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
items : [
new MenuItem ( "" , "Zenodo Communities" , "" , "/participate/share-zenodo" , false , [ ] , [ "/participate/share-zenodo" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Publications" , "" , "/participate/deposit-publications" , false , [ "publication" ] , [ "/participate/deposit-publications" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Research Data" , "" , "/participate/deposit-datasets" , false , [ "dataset" ] , [ "/participate/deposit-datasets" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ]
} ,
{
rootItem : new MenuItem ( "link" , "Link" , "" , "/participate/claim" , false , [ ] , [ "/participate/claim" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
items : [ ]
}
] ;
}
}
if ( community == null ) {
this . menuItems = [ ] ;
var myCommunities = [ ] ;
if ( this . managerOfCommunities ) {
myCommunities . push ( new MenuItem ( "" , "Managing communities" , "" , "/search/find/communities" , false , [ ] , [ ] , { role : "%22manager%22" } ) )
}
if ( Session . isLoggedIn ( ) ) {
this . _subscribeService . getCommunitiesSubscribedTo ( Session . getUserEmail ( ) , this . properties . adminToolsAPIURL ) . subscribe (
pids = > {
if ( pids . length > 0 ) {
myCommunities . push ( new MenuItem ( "" , "Subscribed to communities" , "" , "/search/find/communities" , false , [ ] , [ ] , { status : "%22subscribed%22" } ) )
}
} ,
error = > {
console . error ( "Error fetching your subscribed communities" )
} ) ;
}
this . menuItems . push ( { rootItem : new MenuItem ( "communities" , "Communities" , "" , "/search/find/communities" , false , [ ] , null , { } ) , items : [ ] } ) ;
if ( this . managerOfCommunities || this . subscriberOfCommunities ) {
this . menuItems . push ( { rootItem : new MenuItem ( "myCommunities" , "My Communities" , "" , "" , false , [ ] , [ ] , { } ) , items : myCommunities } ) ;
}
this . menuItems . push ( { rootItem : new MenuItem ( "howto" , "Create Community" , "" , "/how-to-create-community" , false , [ ] , null , { } ) , items : [ ] } ) ;
this . bottomMenuItems = [
new MenuItem ( "" , "About" , "https://beta.openaire.eu/project-factsheets" , "" , false , [ ] , [ ] , { } ) ,
new MenuItem ( "" , "News - Events" , "https://beta.openaire.eu/news-events" , "" , false , [ ] , [ ] , { } ) ,
new MenuItem ( "" , "Blog" , "https://blogs.openaire.eu/" , "" , false , [ ] , [ ] , { } ) ,
new MenuItem ( "" , "Contact us" , "https://beta.openaire.eu/contact-us" , "" , false , [ ] , [ ] , { } )
] ;
// if(this.properties.showContent){
// this.bottomMenuItems.push(new MenuItem("","Content Policy","","/content",false,[],[],{}));
// }
this . userMenuItems = [
// new MenuItem("","My links","","/myclaims",false,[],["/myclaims"],(data['communityId'] && typeof document !== 'undefined' && ConnectHelper.isProduction(document.location.hostname))?{}:{communityId:data['communityId']}),
] ;
} else {
this . bottomMenuItems = [
new MenuItem ( "" , "About" , "" , "/about" , false , [ ] , [ "/about" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Organizations" , "" , "/organizations" , false , [ ] , [ "/organizations" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } )
] ;
if ( this . properties . showContent ) {
this . bottomMenuItems . push ( new MenuItem ( "" , "Content Policy" , "" , "/content" , false , [ ] , [ ] , { } ) ) ;
}
this . userMenuItems = [ new MenuItem ( "" , "My profile" , "" , "" , false , [ ] , [ ] , { } ) ,
new MenuItem ( "" , "My links" , "" , "/myclaims" , false , [ ] , [ "/myclaims" ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
new MenuItem ( "" , "Invite users" , "" , "/invite" , false , [ ] , [ ] , this . properties . environment != "development" ? { } : { communityId :community.communityId } ) ,
] ;
if ( this . managerOfCommunities ) {
this . userMenuItems . push ( new MenuItem ( "" , "Support" , "https://openaire-connect.d4science.org/group/openaire-connect-gateway/explore?siteId=172366611" , "" , false , [ ] , [ ] , { } ) )
}
}
this . showMenu = true ;
} ) ;
}
2018-01-26 16:00:07 +01:00
}