diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9723f86..01a8c2b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,4 @@ -import {Component, Inject, OnDestroy, OnInit, RendererFactory2, ViewChild, ViewEncapsulation} from '@angular/core'; +import {Component, ElementRef, Inject, OnDestroy, OnInit, RendererFactory2, ViewChild, ViewEncapsulation} from '@angular/core'; import {ActivatedRoute, NavigationEnd, Router} from '@angular/router'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; @@ -88,15 +88,15 @@ import {DOCUMENT} from "@angular/common"; points="7 4 13 10 7 16"> - + - + [showSocialButtons]="true" [showMenuItems]="true" [grantAdvance]="false" [showOpenaire]="true" + [communityId]="community.communityId" [menuItems]=bottomMenuItems [properties]="properties" + [darkBackground]="true" [centered]="true"> + @@ -125,6 +125,7 @@ export class AppComponent implements OnInit, OnDestroy { public images: string[] = []; @ViewChild('modal') modal: AlertModal; @ViewChild('quickContact') quickContact: QuickContactComponent; + @ViewChild('bottom', {read: ElementRef}) bottom: ElementRef; private subscriptions = []; layout: Layout = null; layouts: Layout[] = null; @@ -194,6 +195,27 @@ export class AppComponent implements OnInit, OnDestroy { this._communityService.clearSubscriptions(); this.smoothScroll.clearSubscriptions(); } + + createObservers() { + let options = { + root: null, + rootMargin: '0px', + threshold: 0.1 + }; + let intersectionObserver = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (entry.isIntersecting && this.showQuickContact) { + this.showQuickContact = false; + this.quickContactService.setDisplay(this.showQuickContact); + } else if (!entry.isIntersecting && !this.showQuickContact) { + this.showQuickContact = true; + this.quickContactService.setDisplay(this.showQuickContact); + } + }); + }, options); + intersectionObserver.observe(this.bottom.nativeElement); + this.subscriptions.push(intersectionObserver); + } get isManager() { return Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || (this.communityId && Session.isManager('community', this.communityId, this.user)) @@ -452,6 +474,9 @@ export class AppComponent implements OnInit, OnDestroy { restrictedData ? "" : "/myCommunities", false, [], [], {})); } this.showMenu = true; + setTimeout(() => { + this.createObservers(); + }); } /** diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 767cbb1..517f078 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -3,7 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router'; import {DOCUMENT, Location} from '@angular/common'; import {Meta, Title} from '@angular/platform-browser'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; - import {CommunityService} from "../openaireLibrary/connect/community/community.service"; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; @@ -12,8 +11,6 @@ import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommuni import {Session, User} from '../openaireLibrary/login/utils/helper.class'; import {StatisticsForDashboardComponent} from '../statistics/statistics.component'; import {StringUtils} from '../openaireLibrary/utils/string-utils.class'; - -import {PiwikHelper} from '../utils/piwikHelper'; import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service"; import {SearchCommunityProjectsService} from "../openaireLibrary/connect/projects/searchProjects.service"; import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service"; @@ -140,6 +137,7 @@ export class CommunityComponent { }; disableSelect: boolean = true; openaireEntities= OpenaireEntities; + piwikSiteId; constructor( private element: ElementRef, @@ -206,7 +204,12 @@ export class CommunityComponent { this._meta.updateTag({content: community.title}, "property='og:title'"); this._title.setTitle(community.title); if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subs.push(this._piwikService.trackView(this.properties, community.title, PiwikHelper.getSiteId(this.communityId)).subscribe()); + this.subs.push(this.config.communityInformationState.subscribe(portal => { + if(portal && portal.piwik) { + this.piwikSiteId = portal.piwik; + this.subs.push(this._piwikService.trackView(this.properties, community.title, this.piwikSiteId).subscribe()); + } + })); } if (this.community.zenodoCommunity) { this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe( diff --git a/src/app/learn-how/learn-how.component.ts b/src/app/learn-how/learn-how.component.ts index a5670ee..8a2032c 100644 --- a/src/app/learn-how/learn-how.component.ts +++ b/src/app/learn-how/learn-how.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit} from '@angular/core'; +import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Meta, Title} from '@angular/platform-browser'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; @@ -8,6 +8,7 @@ import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Subscriber} from "rxjs"; import {properties} from "../../environments/environment"; +import {QuickContactService} from '../openaireLibrary/sharedComponents/quick-contact/quick-contact.service'; @Component({ selector: 'learn-how', @@ -208,7 +209,7 @@ import {properties} from "../../environments/environment"; -
+

We look forward to working together and helping you unlock the full potential of your research community through open science.

Contact us
@@ -222,7 +223,7 @@ export class LearnHowComponent implements OnInit { steps: any[] = [ {name: 'All 4 Steps', icon: ''}, {name: '1st Step', icon: ''}, - {name: '2ng Step', icon: ''}, + {name: '2nd Step', icon: ''}, {name: '3rd Step', icon: ''}, {name: '4th Step', icon: ''}, ]; @@ -232,6 +233,8 @@ export class LearnHowComponent implements OnInit { public pageDescription: string = "Learn the process: Build a Gateway to your community's open and linked research outcomes. Customized to your needs."; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'About'}]; properties: EnvProperties = properties; + public showQuickContact: boolean; + @ViewChild('contact') contact: ElementRef; subscriptions = []; constructor( private route: ActivatedRoute, @@ -240,7 +243,8 @@ export class LearnHowComponent implements OnInit { private _title: Title, private seoService: SEOService, private _piwikService: PiwikService, - private helper: HelperService) { + private helper: HelperService, + private quickContactService: QuickContactService) { } public ngOnInit() { @@ -276,6 +280,33 @@ export class LearnHowComponent implements OnInit { }); } + ngAfterViewInit() { + if (typeof window !== "undefined") { + this.createObservers(); + } + } + + createObservers() { + let options = { + root: null, + rootMargin: '200px', + threshold: 1.0 + }; + let intersectionObserver = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (entry.isIntersecting && this.showQuickContact) { + this.showQuickContact = false; + this.quickContactService.setDisplay(this.showQuickContact); + } else if (!entry.isIntersecting && !this.showQuickContact) { + this.showQuickContact = true; + this.quickContactService.setDisplay(this.showQuickContact); + } + }); + }, options); + intersectionObserver.observe(this.contact.nativeElement); + this.subscriptions.push(intersectionObserver); + } + private updateDescription(description: string) { this._meta.updateTag({content: description}, "name='description'"); diff --git a/src/app/utils/piwikHelper.ts b/src/app/utils/piwikHelper.ts index 19f95c2..fdf506a 100644 --- a/src/app/utils/piwikHelper.ts +++ b/src/app/utils/piwikHelper.ts @@ -34,7 +34,8 @@ export class PiwikHelper{ "eutopia":608, "north-america-studies": 609, "iperionhs":610, - "neanias-atmospheric": 613 + "neanias-atmospheric": 613, + "forthem": 625 }; public static getSiteId(communityId:string){ return this.siteIDs[communityId]; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index f0ce921..3b574d9 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -58,9 +58,9 @@ export let properties: EnvProperties = { piwikBaseUrl: 'https://analytics.openaire.eu/piwik.php?idsite=', piwikSiteId: '80', registryUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/registry/', - loginUrl: "http://mpagasas.di.uoa.gr:8080/login-service//openid_connect_login", - userInfoUrl: "http://mpagasas.di.uoa.gr:8080/login-service/userInfo", - logoutUrl: "http://mpagasas.di.uoa.gr:8080/login-service/openid_logout", + loginUrl: "http://mpagasas.di.uoa.gr:19080/login-service//openid_connect_login", + userInfoUrl: "http://mpagasas.di.uoa.gr:19080/login-service/userInfo", + logoutUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_logout", cookieDomain: '.di.uoa.gr', feedbackmail: 'openaire.test@gmail.com', cacheUrl: 'http://dl170.madgik.di.uoa.gr:3000/get?url=',