diff --git a/src/app/affiliations/affiliations.component.ts b/src/app/affiliations/affiliations.component.ts index c980b4f..43f27d7 100644 --- a/src/app/affiliations/affiliations.component.ts +++ b/src/app/affiliations/affiliations.component.ts @@ -53,7 +53,7 @@ export class AffiliationsComponent { this.properties = properties; if(this.longView) { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe()); + // this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe()); } this.url = this.properties.domain + this._router.url; this.seoService.createLinkForCanonicalURL(this.url); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4d06e93..5dfc9a2 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -10,14 +10,27 @@ const routes: Routes = [ {path: 'my-orcid-links', loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule)}, /** Other Pages */ - {path: '', loadChildren: () => import('./communitywrapper/communityWrapper.module').then(m => m.CommunityWrapperModule)}, + { + path: '', + loadChildren: () => import('./communitywrapper/communityWrapper.module').then(m => m.CommunityWrapperModule) + }, {path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'}, {path: 'about/learn-how', loadChildren: () => import('./learn-how/learn-how.module').then(m => m.LearnHowModule)}, {path: 'about/faq', loadChildren: () => import('./learn-how/faqs/faqs.module').then(m => m.FaqsModule)}, {path: 'get-started', loadChildren: () => import('./get-started/get-started.module').then(m => m.GetStartedModule)}, {path: 'contact-us', loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule)}, {path: 'invite', loadChildren: () => import('./utils/subscribe/invite/invite.module').then(m => m.InviteModule)}, - {path: 'content', loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule), canActivate: [IsCommunity]}, + { + path: 'content', + loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule), + canActivate: [IsCommunity] + }, + {path: 'sdgs', loadChildren: () => import('./sdg/sdg.module').then(m => m.LibSdgModule)}, + { + path: 'fields-of-science', + loadChildren: () => import('./fos/fos.module').then(m => m.LibFosModule), + data: {extraOffset: 100} + }, { path: 'organizations', loadChildren: () => import('./htmlPages/organizations/organizationsPage.module').then(m => m.OrganizationsPageModule), diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5fd807d..92eefcf 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -377,6 +377,8 @@ export class AppComponent implements OnInit, OnDestroy { new MenuItem("", "National Bulletins", "", "/national-bulletins", false, [], ["/national-bulletins"], {}), new MenuItem("", "Subjects", "", "/subjects", false, [], ["/subjects"], {}), new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], {}), + new MenuItem("", "Fields of Science", "", "/fields-of-science", false, [], ["/fields-of-science"], {}), + new MenuItem("", "Sustainable Development Goals", "", "/sdgs", false, [], ["/sdgs"], {}), ] )); this.menuItems.push( diff --git a/src/app/fos/fos-routing.module.ts b/src/app/fos/fos-routing.module.ts new file mode 100644 index 0000000..fdbb09c --- /dev/null +++ b/src/app/fos/fos-routing.module.ts @@ -0,0 +1,20 @@ +import {NgModule} from "@angular/core"; +import {RouterModule} from "@angular/router"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {CommunityFosComponent} from "./fos.component"; +import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: CommunityFosComponent, + canActivate: [IsRouteEnabled], + canDeactivate: [PreviousRouteRecorder] + } + ]) + ] +}) +export class LibFosRoutingModule { +} \ No newline at end of file diff --git a/src/app/fos/fos.component.ts b/src/app/fos/fos.component.ts new file mode 100644 index 0000000..b2e9471 --- /dev/null +++ b/src/app/fos/fos.component.ts @@ -0,0 +1,24 @@ +import {Component} from "@angular/core"; +import {properties} from "../../environments/environment"; +import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; +import {PiwikHelper} from "../utils/piwikHelper"; + +@Component({ + selector: 'community-fos', + template: ` + + ` +}) + +export class CommunityFosComponent { + piwikSiteId; + communityId; + + constructor() { + } + + ngOnInit() { + this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); + this.piwikSiteId = PiwikHelper.getSiteId(this.communityId); + } +} \ No newline at end of file diff --git a/src/app/fos/fos.module.ts b/src/app/fos/fos.module.ts new file mode 100644 index 0000000..5d1d24e --- /dev/null +++ b/src/app/fos/fos.module.ts @@ -0,0 +1,27 @@ +import {CommonModule} from "@angular/common"; +import {NgModule} from "@angular/core"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {LibFosRoutingModule} from "./fos-routing.module"; +import {FosRoutingModule} from "../openaireLibrary/fos/fos-routing.module"; +import {FosModule} from "../openaireLibrary/fos/fos.module"; +import {CommunityFosComponent} from "./fos.component"; + +@NgModule({ + imports: [ + CommonModule, + LibFosRoutingModule, + FosRoutingModule, + FosModule + ], + declarations: [ + CommunityFosComponent + ], + exports: [ + CommunityFosComponent + ], + providers: [ + PreviousRouteRecorder + ] +}) +export class LibFosModule { +} \ No newline at end of file diff --git a/src/app/htmlPages/htmlPage.component.ts b/src/app/htmlPages/htmlPage.component.ts index 8461032..f77366c 100644 --- a/src/app/htmlPages/htmlPage.component.ts +++ b/src/app/htmlPages/htmlPage.component.ts @@ -8,6 +8,7 @@ import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {Subscriber} from "rxjs"; import {properties} from "../../environments/environment"; +import {PiwikHelper} from "../utils/piwikHelper"; @Component({ selector: 'html-page', @@ -21,26 +22,28 @@ export class HtmlPageComponent { properties: EnvProperties = properties; public pageContents = null; public divContents = null; - + @Input() url: string = null; @Input() pageTitle: string; @Input() description: string; private subscriptions = []; communityId; - - constructor(private route: ActivatedRoute, private _router: Router, + piwikSiteId; + + constructor(private route: ActivatedRoute, private _router: Router, private _meta: Meta, private _title: Title, private seoService: SEOService, private _piwikService: PiwikService, private helper: HelperService) { } - + public ngOnInit() { + this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); + this.piwikSiteId = PiwikHelper.getSiteId(this.communityId); if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); } - this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); //TODO set the proper URL this.url = this.properties.domain + this._router.url; this.seoService.createLinkForCanonicalURL(this.url); diff --git a/src/app/sdg/sdg-routing.module.ts b/src/app/sdg/sdg-routing.module.ts new file mode 100644 index 0000000..b1020cd --- /dev/null +++ b/src/app/sdg/sdg-routing.module.ts @@ -0,0 +1,20 @@ +import {NgModule} from "@angular/core"; +import {RouterModule} from "@angular/router"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {CommunitySdgComponent} from "./sdg.component"; +import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: CommunitySdgComponent, + canActivate: [IsRouteEnabled], + canDeactivate: [PreviousRouteRecorder] + } + ]) + ] +}) +export class LibSdgRoutingModule { +} \ No newline at end of file diff --git a/src/app/sdg/sdg.component.ts b/src/app/sdg/sdg.component.ts new file mode 100644 index 0000000..3f29b2a --- /dev/null +++ b/src/app/sdg/sdg.component.ts @@ -0,0 +1,23 @@ +import {Component} from "@angular/core"; +import {properties} from "../../environments/environment"; +import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; +import {PiwikHelper} from "../utils/piwikHelper"; + +@Component({ + selector: 'community-sdg', + template: ` + + ` +}) +export class CommunitySdgComponent { + piwikSiteId; + communityId; + + constructor() { + } + + ngOnInit() { + this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); + this.piwikSiteId = PiwikHelper.getSiteId(this.communityId); + } +} \ No newline at end of file diff --git a/src/app/sdg/sdg.module.ts b/src/app/sdg/sdg.module.ts new file mode 100644 index 0000000..b3c4f2a --- /dev/null +++ b/src/app/sdg/sdg.module.ts @@ -0,0 +1,27 @@ +import {CommonModule} from "@angular/common"; +import {NgModule} from "@angular/core"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {LibSdgRoutingModule} from "./sdg-routing.module"; +import {SdgRoutingModule} from "../openaireLibrary/sdg/sdg-routing.module"; +import {SdgModule} from "../openaireLibrary/sdg/sdg.module"; +import {CommunitySdgComponent} from "./sdg.component"; + +@NgModule({ + imports: [ + CommonModule, + LibSdgRoutingModule, + SdgRoutingModule, + SdgModule + ], + declarations: [ + CommunitySdgComponent + ], + exports: [ + CommunitySdgComponent + ], + providers: [ + PreviousRouteRecorder + ] +}) +export class LibSdgModule { +} \ No newline at end of file diff --git a/src/app/utils/piwikHelper.ts b/src/app/utils/piwikHelper.ts index a5a1989..a8d18e7 100644 --- a/src/app/utils/piwikHelper.ts +++ b/src/app/utils/piwikHelper.ts @@ -27,20 +27,22 @@ export class PiwikHelper{ "inspired-ris":530, "citizen-science":538, "eut":558, - "aurora":560, + "aurora": 560, "ebrains": 592, - "neanias-space":604, - "heritage-science":607, - "eutopia":608, + "neanias-space": 604, + "heritage-science": 607, + "eutopia": 608, "north-america-studies": 609, - "iperionhs":610, + "iperionhs": 610, "neanias-atmospheric": 613, "forthem": 625, "argo-france": 634, - "knowmad": 640 + "knowmad": 640, + "egrise": 710, + "euconexus": 707, + "dth": 719 }; public static getSiteId(communityId:string){ return this.siteIDs[communityId]; } - }