From 11cf47ac5abf1076b110459895901a3f730862de Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 22 Jul 2019 09:16:50 +0000 Subject: [PATCH] [Trunk|Library]: Add Helper on search Page, landings and deposit first page. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56644 d315682c-612b-4755-9ff5-7f18f6832af3 --- deposit/depositFirstPage.component.ts | 34 +- .../dataProvider/dataProvider.component.html | 432 ++++---- .../dataProvider/dataProvider.component.ts | 751 +++++++------- .../dataProvider/dataProvider.module.ts | 10 +- landingPages/dataset/dataset.component.html | 416 ++++---- landingPages/dataset/dataset.component.ts | 429 ++++---- landingPages/dataset/dataset.module.ts | 42 +- .../htmlProjectReport.component.ts | 529 +++++----- .../htmlProjectReport.module.ts | 5 +- .../organization/organization.component.html | 308 +++--- .../organization/organization.component.ts | 975 +++++++++--------- .../organization/organization.module.ts | 42 +- landingPages/orp/orp.component.html | 290 +++--- landingPages/orp/orp.component.ts | 405 ++++---- landingPages/orp/orp.module.ts | 45 +- landingPages/project/project.component.html | 705 +++++++------ landingPages/project/project.component.ts | 686 ++++++------ landingPages/project/project.module.ts | 11 +- landingPages/project/projectService.module.ts | 19 +- .../publication/publication.component.html | 823 ++++++++------- .../publication/publication.component.ts | 559 +++++----- .../publication/publication.module.ts | 3 +- landingPages/software/software.component.html | 432 ++++---- landingPages/software/software.component.ts | 375 ++++--- landingPages/software/software.module.ts | 35 +- .../searchUtils/searchPage.component.html | 35 +- .../searchUtils/searchPage.component.ts | 23 +- utils/helper/helper.service.ts | 8 + 28 files changed, 4563 insertions(+), 3864 deletions(-) diff --git a/deposit/depositFirstPage.component.ts b/deposit/depositFirstPage.component.ts index a6cb658d..a9b04de0 100644 --- a/deposit/depositFirstPage.component.ts +++ b/deposit/depositFirstPage.component.ts @@ -1,8 +1,9 @@ import {Component, Input} from '@angular/core'; import {ZenodoInformationClass} from './utils/zenodoInformation.class'; import {EnvProperties} from "../utils/properties/env-properties"; -import {ActivatedRoute} from "@angular/router"; +import {ActivatedRoute, Router} from "@angular/router"; import {PiwikService} from "../utils/piwik/piwik.service"; +import {HelperService} from "../utils/helper/helper.service"; @Component({ selector: 'deposit-first-page', @@ -134,11 +135,11 @@ import {PiwikService} from "../utils/piwik/piwik.service"; <!– grey-background–>
- +
--> - + ` }) @@ -147,20 +148,27 @@ export class DepositFirstPageComponent { @Input() piwikSiteId = null; piwiksub:any; - @Input() pageContents = null; - @Input() divContents = null; + @Input() communityId = null; + + public pageContents = null; + public divContents = null; public keyword: string; public depositRoute = "/search-deposit"; public searchPlaceHolder = "Search for repositories by title, country, organization, subject..."; properties:EnvProperties; - constructor (private route: ActivatedRoute, private _piwikService:PiwikService) {} + constructor (private route: ActivatedRoute, private _piwikService:PiwikService, + private helper: HelperService, + private _router: Router) {} + + ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; - + //this.getDivContents(); + this.getPageContents(); if (!this.zenodoInformation) { this.zenodoInformation = new ZenodoInformationClass(); } @@ -177,6 +185,18 @@ export class DepositFirstPageComponent { }); } + public getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } + + public getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + ngOnDestroy() { if(this.piwiksub){ this.piwiksub.unsubscribe(); diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 5c732c2d..c9fc6b43 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -1,15 +1,20 @@ -
+
-
+
-
- - - +
+ + + -
- -
+
+ +
- + - -
{{dataProviderInfo.officialName}}
+ +
{{dataProviderInfo.officialName}}
{{dataProviderInfo.type}}{{" "}} - + + [queryParams]="{datasourceId: dataProviderInfo.compatibility.id}" routerLinkActive="router-link-active" + routerLink="/search/dataprovider"> {{dataProviderInfo.compatibility.info}} {{dataProviderInfo.compatibility.info}} + [queryParams]="{datasourceId: dataProviderInfo.compatibility.id}" routerLinkActive="router-link-active" + routerLink="/search/dataprovider"> {{dataProviderInfo.compatibility.name}} @@ -47,225 +58,242 @@
    -
  • Results with funding information: - {{dataProviderInfo.aggregationStatus.fundedContent | number}} -
  • -
  • Collected full-texts: - {{dataProviderInfo.aggregationStatus.fulltexts | number}} -
  • -
  • OAI-PMH: - +
  • + Results with funding information: + {{dataProviderInfo.aggregationStatus.fundedContent | number}} +
  • +
  • + Collected full-texts: + {{dataProviderInfo.aggregationStatus.fulltexts | number}} +
  • +
  • OAI-PMH: + {{dataProviderInfo.oaiPmhURL}} -
  • -
  • +
  • +
  • Detailed content provider information (OpenDOAR) -
  • -
  • +
  • +
  • Detailed content provider information (Re3data) -
  • + -
  • Countries: {{dataProviderInfo.countries.join(", ")}}
  • +
  • Countries: {{dataProviderInfo.countries.join(", ")}}
-
--> + +
+
+ +
  • + Metrics +
    + + + + + + +
    +
  • -
  • - Metrics -
    - - - - - - -
    -
  • - - +
    -
    -
    -
    -
    - Share - Bookmark -
    - -
    +
    +
    +
    + Share - Bookmark + +
    + + +
    +
    +
    - -
    diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index b898bfbb..54701bfc 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -1,44 +1,41 @@ - -import {merge as observableMerge, Observable} from 'rxjs'; -import {Component, ViewChild} from '@angular/core'; -import {Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {merge as observableMerge} from 'rxjs'; +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; +import {EnvProperties} from '../../utils/properties/env-properties'; - -import {EnvProperties} from '../../utils/properties/env-properties'; - -import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; -import {DataProviderService} from './dataProvider.service'; -import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; -import {SearchPublicationsService} from '../../services/searchPublications.service'; -import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import {SearchDatasetsService} from '../../services/searchDatasets.service'; -import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; -import {SearchSoftwareService} from '../../services/searchSoftware.service'; -import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class'; -import {SearchOrpsService} from '../../services/searchOrps.service'; -import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import {SearchProjectsService} from '../../services/searchProjects.service'; -import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; -import {RelatedDatasourcesTabComponent} from './relatedDatasourcesTab.component'; -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; +import {DataProviderService} from './dataProvider.service'; +import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; +import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; +import {SearchSoftwareService} from '../../services/searchSoftware.service'; +import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class'; +import {SearchOrpsService} from '../../services/searchOrps.service'; +import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; +import {SearchProjectsService} from '../../services/searchProjects.service'; +import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {RouterHelper} from '../../utils/routerHelper.class'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ - selector: 'dataprovider', - templateUrl: 'dataProvider.component.html', - }) + selector: 'dataprovider', + templateUrl: 'dataProvider.component.html', +}) export class DataProviderComponent { @Input() piwikSiteId = null; + @Input() communityId = null; public dataProviderInfo: DataProviderInfo; public datasourceId: string; @@ -61,13 +58,13 @@ export class DataProviderComponent { // Statistics tab variables public statsClicked: boolean = false; public docsTimelineUrl: string; - public docsTypesUrl:string; - public docsFunderUrl:string; - public dataProjectsUrl:string ; - public pubsProjectsUrl:string; + public docsTypesUrl: string; + public docsFunderUrl: string; + public dataProjectsUrl: string; + public pubsProjectsUrl: string; // Variables for publications, research data, projects, content providers, related content providers tabs - public fetchPublications : FetchPublications; + public fetchPublications: FetchPublications; public fetchDatasets: FetchDatasets; public fetchSoftware: FetchSoftware; public fetchOrps: FetchOrps; @@ -82,10 +79,12 @@ export class DataProviderComponent { // Active tab variable for responsiveness - show tabs only if main request is completed public activeTab: string = ""; - public showTabs:boolean = false; + public showTabs: boolean = false; - public routerHelper:RouterHelper = new RouterHelper(); - public errorCodes:ErrorCodes = new ErrorCodes(); + public routerHelper: RouterHelper = new RouterHelper(); + public errorCodes: ErrorCodes = new ErrorCodes(); + public pageContents = null; + public divContents = null; // Request results of each tab only the one time (first time tab is clicked) private reloadPublications: boolean = true; @@ -100,401 +99,447 @@ export class DataProviderComponent { piwiksub: any; subInfo: any; relatedDatasourcesSub: any; - properties:EnvProperties; + properties: EnvProperties; - constructor (private _dataproviderService: DataProviderService, - private _piwikService:PiwikService, - private route: ActivatedRoute, - private _meta: Meta, - private _title: Title, - private _router: Router, - private _searchPublicationsService: SearchPublicationsService, - private _searchDatasetsService: SearchDatasetsService, - private _searchSoftwareService: SearchSoftwareService, - private _searchOrpsService: SearchOrpsService, - private _searchProjectsService: SearchProjectsService, - private _searchDataprovidersService: SearchDataprovidersService, - private seoService: SEOService) { - this.fetchPublications = new FetchPublications(this._searchPublicationsService); - this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); - this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); - this.fetchOrps = new FetchOrps(this._searchOrpsService); - this.fetchProjects = new FetchProjects(this._searchProjectsService); - this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); + constructor(private _dataproviderService: DataProviderService, + private _piwikService: PiwikService, + private route: ActivatedRoute, + private _meta: Meta, + private _title: Title, + private _router: Router, + private _searchPublicationsService: SearchPublicationsService, + private _searchDatasetsService: SearchDatasetsService, + private _searchSoftwareService: SearchSoftwareService, + private _searchOrpsService: SearchOrpsService, + private _searchProjectsService: SearchProjectsService, + private _searchDataprovidersService: SearchDataprovidersService, + private seoService: SEOService, + private helper: HelperService) { + this.fetchPublications = new FetchPublications(this._searchPublicationsService); + this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); + this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); + this.fetchOrps = new FetchOrps(this._searchOrpsService); + this.fetchProjects = new FetchProjects(this._searchProjectsService); + this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); - } + } - ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { + ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; - this.updateUrl(data.envSpecific.baseLink+this._router.url); + //this.getDivContents(); + this.getPageContents(); + this.updateUrl(data.envSpecific.baseLink + this._router.url); - }); - this.sub = this.route.queryParams.subscribe(data => { + }); + this.sub = this.route.queryParams.subscribe(data => { this.updateTitle("Content provider"); this.updateDescription(""); this.datasourceId = data['datasourceId']; - if(this.datasourceId){ - this.getDataProviderInfo(this.datasourceId); + if (this.datasourceId) { + this.getDataProviderInfo(this.datasourceId); } HelperFunctions.scroll(); - }); - } + }); + } - ngOnDestroy() { - if(this.sub){ - this.sub.unsubscribe(); - } - if(this.piwiksub){ - this.piwiksub.unsubscribe(); - } - if(this.subInfo) { + private getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } + + private getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + + ngOnDestroy() { + if (this.sub) { + this.sub.unsubscribe(); + } + if (this.piwiksub) { + this.piwiksub.unsubscribe(); + } + if (this.subInfo) { this.subInfo.unsubscribe(); - } + } - if(this.relatedDatasourcesSub) { - this.relatedDatasourcesSub.unsubscribe(); - } - } - private getDataProviderInfo(id:string) { + if (this.relatedDatasourcesSub) { + this.relatedDatasourcesSub.unsubscribe(); + } + } + + private getDataProviderInfo(id: string) { this.warningMessage = ''; - this.errorMessage="" + this.errorMessage = "" this.showLoading = true; this.dataProviderInfo = null; - this.showTabs = false ; - if(this.datasourceId==null || this.datasourceId==''){ + this.showTabs = false; + if (this.datasourceId == null || this.datasourceId == '') { this.showLoading = false; - this.warningMessage="No valid datasource id"; - }else{ + this.warningMessage = "No valid datasource id"; + } else { this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe( data => { - this.dataProviderInfo = data; - this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url); - if (typeof document !== 'undefined') { - this.getDataProviderAggregationStatus(this.dataProviderInfo.originalId); - } - this.initTabs(); - this.showTabs = true ; - this.updateTitle(this.dataProviderInfo.title.name); - this.updateDescription("Content provider, "+this.dataProviderInfo.title.name); - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe(); - } + this.dataProviderInfo = data; + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url); + if (typeof document !== 'undefined') { + this.getDataProviderAggregationStatus(this.dataProviderInfo.originalId); + } + this.initTabs(); + this.showTabs = true; + this.updateTitle(this.dataProviderInfo.title.name); + this.updateDescription("Content provider, " + this.dataProviderInfo.title.name); + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe(); + } - this.showLoading = false; + this.showLoading = false; - if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) { - this.activeTab = this.dataProviderInfo.tabs[0].name; - } + if (this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) { + this.activeTab = this.dataProviderInfo.tabs[0].name; + } }, err => { //console.log(err); - this.handleError("Error getting content provider for id: "+this.datasourceId, err); + this.handleError("Error getting content provider for id: " + this.datasourceId, err); this.errorMessage = 'No dataProvider found'; this.showLoading = false; this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDataProviders); } ); } - } + } - private getDataProviderAggregationStatus(originalId: string) { - this.subInfo = this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe( - data => { - this.dataProviderInfo.aggregationStatus = data; - }, - err => { - //console.log(err); - this.handleError("Error getting content provider aggregation status for id: "+this.datasourceId, err); - } - ); - } + private getDataProviderAggregationStatus(originalId: string) { + this.subInfo = this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe( + data => { + this.dataProviderInfo.aggregationStatus = data; + }, + err => { + //console.log(err); + this.handleError("Error getting content provider aggregation status for id: " + this.datasourceId, err); + } + ); + } - private updateDescription(description:string) { - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string) { - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(_title); - this._meta.updateTag({content:_title},"property='og:title'"); - } - private updateUrl(url:string) { - this._meta.updateTag({content:url},"property='og:url'"); - } + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } - private initTabs(){ + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } - if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) { - this.reloadPublications = true; - this.reloadDatasets = true; - this.reloadSoftware = true; - this.reloadOrps = true; - this.reloadProjects = true; - this.reloadDataproviders = true; - this.reloadRelatedDatasources = true; - this.statsClicked = false; + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } - //this.search(this.dataProviderInfo.tabs[0].content, 1, 10); - this.count(1, 0); + private initTabs() { - this.metricsClicked = false; + if (this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) { + this.reloadPublications = true; + this.reloadDatasets = true; + this.reloadSoftware = true; + this.reloadOrps = true; + this.reloadProjects = true; + this.reloadDataproviders = true; + this.reloadRelatedDatasources = true; + this.statsClicked = false; - this.viewsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcRepoViews","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; - */ + //this.search(this.dataProviderInfo.tabs[0].content, 1, 10); + this.count(1, 0); - this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /* - this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; - */ + this.metricsClicked = false; - this.docsTimelineUrl =this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.datasourceId+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": -30, "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=100%&h=250'; - this.docsTypesUrl = this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; - this.docsFunderUrl =this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; - this.dataProjectsUrl =this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Data"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; - this.pubsProjectsUrl =this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoViews","dtsrcName":"' + this.datasourceId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ - //if({"name": "Publications", "content": "publicationsTab"} in this.dataProviderInfo.tabs) { - //if(this.dataProviderInfo.tabs.some(function (tab) { - // return tab.name === 'Publications'; - //})) { - // this.relatedDataprovidersResultsType = 'publications'; - this.fetchAggregatorsPublications = new FetchPublications(this._searchPublicationsService); - //} else { - // this.relatedDataprovidersResultsType = 'datasets'; - this.fetchAggregatorsDatasets = new FetchDatasets(this._searchDatasetsService); - //} - this.fetchAggregatorsSoftware = new FetchSoftware(this._searchSoftwareService); - this.fetchAggregatorsOrps = new FetchOrps(this._searchOrpsService); - } - if(this.dataProviderInfo.resultsBy == "collectedFrom") { - //this.paramsForSearchLink = "?collectedFrom="+this.datasourceId+"&co=and"; - this.paramsForSearchLink = this.routerHelper.createQueryParams(['collectedFrom', 'cl'], [this.datasourceId, 'and']); - } else if (this.dataProviderInfo.resultsBy == "hostedBy") { - //this.paramsForSearchLink = "?hostedBy="+this.datasourceId+"&ho=and"; - this.paramsForSearchLink = this.routerHelper.createQueryParams(['hostedBy', 'hs'], [this.datasourceId, 'and']); - } + this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","dtsrcName":"' + this.datasourceId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /* + this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ - } + this.docsTimelineUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"' + this.datasourceId + '","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": -30, "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=100%&h=250'; + this.docsTypesUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + this.docsFunderUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + this.dataProjectsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Data"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + this.pubsProjectsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"' + this.datasourceId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; - private count(page: number, size: number) { - for(let i=0; i {}, - err => {}, - () => { this.preprocessRelatedDatasources(); } - ) + private searchRelatedDatasources(page: number, size: number) { + // Currently no counting is done for this tab. Following condition is always false - this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties); - this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties); - this.fetchAggregatorsSoftware.getAggregatorResults(this.datasourceId, page, size, this.properties); - this.fetchAggregatorsOrps.getAggregatorResults(this.datasourceId, page, size, this.properties); - } else { - this.loadingRelatedDatasources = false; - } + if (this.reloadRelatedDatasources && + (this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING || + this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE) + && + (this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.LOADING || + this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE) + && + (this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.LOADING || + this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE) + && + (this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.LOADING || + this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE)) { + this.relatedDatasourcesSub = observableMerge(this.fetchAggregatorsPublications.requestComplete, this.fetchAggregatorsDatasets.requestComplete, this.fetchAggregatorsSoftware.requestComplete, this.fetchAggregatorsOrps.requestComplete) + .subscribe( + data => { + }, + err => { + }, + () => { + this.preprocessRelatedDatasources(); + } + ) - - this.reloadRelatedDatasources = false; - } - - private countRelatedDatasources(page: number, size: number) { this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties); this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties); this.fetchAggregatorsSoftware.getAggregatorResults(this.datasourceId, page, size, this.properties); this.fetchAggregatorsOrps.getAggregatorResults(this.datasourceId, page, size, this.properties); - } - - - private preprocessRelatedDatasources() { - if( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE || - this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE || - this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE || - this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE ) { - this.dataProviderInfo.relatedDatasources = new Map(); - } - for(let result of this.fetchAggregatorsPublications.results) { - if(!this.dataProviderInfo.relatedDatasources.has(result.id)) { - this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": result.count, "countDatasets": "0", "countSoftware": "0", "countOrps": "0"}); - } else { - this.dataProviderInfo.relatedDatasources.get(result.id).countPublications = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countPublications + result.count)+""; - } - } - - for(let result of this.fetchAggregatorsDatasets.results) { - if(!this.dataProviderInfo.relatedDatasources.has(result.id)) { - this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": "0", "countDatasets": result.count, "countSoftware": "0", "countOrps": "0"}); - } else { - this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count)+""; - } - } - - for(let result of this.fetchAggregatorsSoftware.results) { - if(!this.dataProviderInfo.relatedDatasources.has(result.id)) { - this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": "0", "countDatasets": "0", "countSoftware": result.count, "countOrps": "0"}); - } else { - this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware + result.count)+""; - } - } - - for(let result of this.fetchAggregatorsOrps.results) { - if(!this.dataProviderInfo.relatedDatasources.has(result.id)) { - this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": "0", "countDatasets": "0", "countSoftware": "0", "countOrps": result.count}); - } else { - this.dataProviderInfo.relatedDatasources.get(result.id).countOrps = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countOrps + result.count)+""; - } - } + } else { this.loadingRelatedDatasources = false; } - public metricsResults($event) { - this.totalViews = $event.totalViews; - this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; + + this.reloadRelatedDatasources = false; + } + + private countRelatedDatasources(page: number, size: number) { + this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties); + this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties); + this.fetchAggregatorsSoftware.getAggregatorResults(this.datasourceId, page, size, this.properties); + this.fetchAggregatorsOrps.getAggregatorResults(this.datasourceId, page, size, this.properties); + } + + + private preprocessRelatedDatasources() { + if (this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE || + this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE || + this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE || + this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE) { + this.dataProviderInfo.relatedDatasources = new Map(); + } + for (let result of this.fetchAggregatorsPublications.results) { + if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { + this.dataProviderInfo.relatedDatasources.set(result.id, { + "name": result.name, + "countPublications": result.count, + "countDatasets": "0", + "countSoftware": "0", + "countOrps": "0" + }); + } else { + this.dataProviderInfo.relatedDatasources.get(result.id).countPublications = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countPublications + result.count) + ""; + } } - private handleError(message: string, error) { - console.error("Content Provider Landing Page: "+message, error); + for (let result of this.fetchAggregatorsDatasets.results) { + if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { + this.dataProviderInfo.relatedDatasources.set(result.id, { + "name": result.name, + "countPublications": "0", + "countDatasets": result.count, + "countSoftware": "0", + "countOrps": "0" + }); + } else { + this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count) + ""; + } } + + for (let result of this.fetchAggregatorsSoftware.results) { + if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { + this.dataProviderInfo.relatedDatasources.set(result.id, { + "name": result.name, + "countPublications": "0", + "countDatasets": "0", + "countSoftware": result.count, + "countOrps": "0" + }); + } else { + this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware + result.count) + ""; + } + } + + for (let result of this.fetchAggregatorsOrps.results) { + if (!this.dataProviderInfo.relatedDatasources.has(result.id)) { + this.dataProviderInfo.relatedDatasources.set(result.id, { + "name": result.name, + "countPublications": "0", + "countDatasets": "0", + "countSoftware": "0", + "countOrps": result.count + }); + } else { + this.dataProviderInfo.relatedDatasources.get(result.id).countOrps = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countOrps + result.count) + ""; + } + } + this.loadingRelatedDatasources = false; + } + + public metricsResults($event) { + this.totalViews = $event.totalViews; + this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; + } + + private handleError(message: string, error) { + console.error("Content Provider Landing Page: " + message, error); + } } diff --git a/landingPages/dataProvider/dataProvider.module.ts b/landingPages/dataProvider/dataProvider.module.ts index 7a94495a..5c0a4acd 100644 --- a/landingPages/dataProvider/dataProvider.module.ts +++ b/landingPages/dataProvider/dataProvider.module.ts @@ -31,19 +31,19 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu import {SoftwareServiceModule} from '../../services/softwareService.module'; import {OrpsServiceModule} from '../../services/orpsService.module'; -// import { DataProviderRoutingModule } from './dataProvider-routing.module'; import {FreeGuard} from'../../login/freeGuard.guard'; import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import {ShowPublisherModule} from "../landing-utils/showPublisher.module"; +import {HelperModule} from "../../utils/helper/helper.module"; @NgModule({ imports: - [CommonModule, FormsModule, RouterModule, - TabResultModule, IFrameModule, ErrorMessagesModule, MetricsModule, LandingModule, - DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule, - SoftwareServiceModule, OrpsServiceModule, PagingModule, Schema2jsonldModule, SEOServiceModule, ShowPublisherModule], + [CommonModule, FormsModule, RouterModule, + TabResultModule, IFrameModule, ErrorMessagesModule, MetricsModule, LandingModule, + DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule, + SoftwareServiceModule, OrpsServiceModule, PagingModule, Schema2jsonldModule, SEOServiceModule, ShowPublisherModule, HelperModule], declarations: [PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent, RelatedDatasourcesTabComponent, DataProviderComponent, SoftwareTabComponent, OrpsTabComponent diff --git a/landingPages/dataset/dataset.component.html b/landingPages/dataset/dataset.component.html index 50294d7a..1b2ee649 100644 --- a/landingPages/dataset/dataset.component.html +++ b/landingPages/dataset/dataset.component.html @@ -1,29 +1,39 @@ -
    +
    -
    - -
    - - - - - -
    -
    - - +
    +
    + + + +
    + +
    + +

    - {{datasetInfo.types.join(", ")}}{{" "}} - {{datasetInfo.languages.join(", ")}}{{" "}} - {{datasetInfo.countries.join(", ")}}{{" "}} + {{datasetInfo.types.join(", ")}}{{" "}} + {{datasetInfo.languages.join(", ")}}{{" "}} + {{datasetInfo.countries.join(", ")}}{{" "}} - {{datasetInfo.accessMode}}{{" "}} - {{" "}} + {{datasetInfo.accessMode}}{{" "}} + {{" "}} + title="{{buildCurationTooltip()}}"> Record in preview @@ -35,36 +45,42 @@ -
    - - ({{datasetInfo.date}}) +
    + + ({{datasetInfo.date}})
      -
    • Embargo end date: {{datasetInfo.embargoEndDate}}
    • -
    • - -
    • -
    • - +
    • Embargo end date: {{datasetInfo.embargoEndDate}}
    • +
    • + +
    • +
    • + -
    • +
    -
    -
    +
    +
    {{datasetInfo.description.substring(0, showNumDescription)}}... + >... View more
    -
    +
    View less @@ -94,146 +110,156 @@
    + -
  • - - Related Research Results - - - ({{relatedResearchResultsNum | number}}) - - -
    - -
    -
    -
    {{provenanceaction}}
    +
  • + + Related Research Results + + + ({{relatedResearchResultsNum | number}}) + + +
    + +
    +
    +
    {{provenanceaction}}
    - -
    -
    -
    -
  • - -
  • - - Similar Research Results - - - ({{datasetInfo.similarResearchResults.length | number}}) - - -
    - -
    - -
    +
    -
  • +
    +
    + -
  • - - Metrics - -
  • + +
  • + + Metrics + +
    + - - + + - - + - -
    -
  • + +
    + -
  • - - Other Versions - ({{datasetInfo.deletedByInferenceIds.length | number}}) - -
    - -
    -
  • +
  • + + Other Versions + ({{datasetInfo.deletedByInferenceIds.length | number}}) + +
    + +
    +
  • -
    - -
    -
    -
    -
    Share - Bookmark
    -
    - - -
      + +
      +
      +
      +
      Share - Bookmark
      + +
      + + +
      • - +
      • - +
      • -
      • -
        -
        Related to
        -
        - +
      • +
        +
        Related to
        +
        + {{item['labelContext']}} -> {{item['labelCategory']}} : {{item['labelConcept']}} - - {{item['labelContext']}} - -> {{item['labelCategory']}} - : {{item['labelConcept']}} - -
        + + {{item['labelContext']}} + -> {{item['labelCategory']}} + : {{item['labelConcept']}} + +
      • -
        +
      • @@ -255,41 +281,71 @@ -
      -
    + + -
    - +
    + +
    - +
    +
    - -
    -
    +
    diff --git a/landingPages/dataset/dataset.component.ts b/landingPages/dataset/dataset.component.ts index aefe2bab..40b2d334 100644 --- a/landingPages/dataset/dataset.component.ts +++ b/landingPages/dataset/dataset.component.ts @@ -1,231 +1,262 @@ -import {Component, ViewChild} from '@angular/core'; -import {Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; -import {Observable} from 'rxjs'; +import {DatasetInfo} from '../../utils/entities/datasetInfo'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {RouterHelper} from '../../utils/routerHelper.class'; -import {DatasetInfo} from '../../utils/entities/datasetInfo'; -import {EnvProperties} from '../../utils/properties/env-properties'; -import {RouterHelper} from '../../utils/routerHelper.class'; - -import {DatasetService} from './dataset.service'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {DatasetService} from './dataset.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ - selector: 'dataset', - templateUrl: 'dataset.component.html', + selector: 'dataset', + templateUrl: 'dataset.component.html', }) export class DatasetComponent { - @Input() piwikSiteId = null; - public datasetInfo: DatasetInfo; - public datasetId : string ; + @Input() piwikSiteId = null; + @Input() communityId = null; + public datasetInfo: DatasetInfo; + public datasetId: string; - // APP BOX variables - public showAllCollectedFrom: boolean = false; - public showAllDownloadFrom: boolean = false; - public showAllPublishedIn: boolean = false; + // APP BOX variables + public showAllCollectedFrom: boolean = false; + public showAllDownloadFrom: boolean = false; + public showAllPublishedIn: boolean = false; - public thresholdDescription: number = 270; - public showNumDescription: number = 270; - - // Metrics tab variables - public metricsClicked: boolean; - public viewsFrameUrl: string; - public downloadsFrameUrl: string; - public totalViews: number; - public totalDownloads: number; - public pageViews: number; + public thresholdDescription: number = 270; + public showNumDescription: number = 270; - // Custom tab paging variables - public referencesPage: number = 1; - public pageSize: number = 10; + // Metrics tab variables + public metricsClicked: boolean; + public viewsFrameUrl: string; + public downloadsFrameUrl: string; + public totalViews: number; + public totalDownloads: number; + public pageViews: number; - // Active tab variable for responsiveness - public activeTab: string = "References"; + // Custom tab paging variables + public referencesPage: number = 1; + public pageSize: number = 10; - // Map counting variable - public relatedResearchResultsNum: number = 0; + // Active tab variable for responsiveness + public activeTab: string = "References"; - // Message variables - public warningMessage = ""; - public errorMessage = ""; - public showLoading: boolean = true; + // Map counting variable + public relatedResearchResultsNum: number = 0; - public routerHelper:RouterHelper = new RouterHelper(); + // Message variables + public warningMessage = ""; + public errorMessage = ""; + public showLoading: boolean = true; + public pageContents = null; + public divContents = null; - private result ; - sub: any; piwiksub: any; infoSub: any; - properties:EnvProperties; + public routerHelper: RouterHelper = new RouterHelper(); - constructor (private _datasetService: DatasetService, - private _piwikService:PiwikService, - private route: ActivatedRoute, - private router: Router, - private _meta: Meta, - private _title: Title, - private _router: Router, - private seoService: SEOService) { - } + private result; + sub: any; + piwiksub: any; + infoSub: any; + properties: EnvProperties; - ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.updateUrl(data.envSpecific.baseLink+this._router.url); + constructor(private _datasetService: DatasetService, + private _piwikService: PiwikService, + private route: ActivatedRoute, + private router: Router, + private _meta: Meta, + private _title: Title, + private _router: Router, + private seoService: SEOService, + private helper: HelperService) { + } - }); - this.sub = this.route.queryParams.subscribe(params => { - this.datasetInfo = null; - this.updateTitle("Dataset"); - this.updateDescription(""); + ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); + this.updateUrl(data.envSpecific.baseLink + this._router.url); - this.datasetId = params['datasetId']; + }); + this.sub = this.route.queryParams.subscribe(params => { + this.datasetInfo = null; + this.updateTitle("Dataset"); + this.updateDescription(""); - if(this.datasetId){ - this.getDatasetInfo(this.datasetId); - }else{ - this.showLoading = false; - this.warningMessage="No valid research data id"; - } + this.datasetId = params['datasetId']; - this.metricsClicked = false; - - this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - */ - - this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; - */ - this.scroll(); - }); - - } - - ngOnDestroy() { - if(this.sub){ - this.sub.unsubscribe(); + if (this.datasetId) { + this.getDatasetInfo(this.datasetId); + } else { + this.showLoading = false; + this.warningMessage = "No valid research data id"; } - if(this.piwiksub){ - this.piwiksub.unsubscribe(); - } - if(this.infoSub) { - this.infoSub.unsubscribe(); + + this.metricsClicked = false; + + this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.datasetId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + */ + + this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.datasetId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ + this.scroll(); + }); + + } + + private getPageContents() { + this.helper.getPageHelpContents(this.router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } + + private getDivContents() { + this.helper.getDivHelpContents(this.router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + + ngOnDestroy() { + if (this.sub) { + this.sub.unsubscribe(); + } + if (this.piwiksub) { + this.piwiksub.unsubscribe(); + } + if (this.infoSub) { + this.infoSub.unsubscribe(); + } + } + + private getDatasetInfo(id: string) { + this.warningMessage = ''; + this.errorMessage = "" + this.showLoading = true; + + this.datasetInfo = null; + + this.infoSub = this._datasetService.getDatasetInfo(id, this.properties).subscribe( + data => { + this.datasetInfo = data; + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDataset + this.datasetInfo.record["result"]["header"]["dri:objIdentifier"]); + /* + if(this.datasetInfo.title.name != undefined && this.datasetInfo.title.name!= ''){ + this.updateTitle(this.datasetInfo.title.name); + this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name); + } + */ + if (this.datasetInfo.title) { + this.updateTitle(this.datasetInfo.title); + this.updateDescription((this.datasetInfo.description ? (this.datasetInfo.description) : ("," + this.datasetInfo.title))); + } + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, this.datasetInfo.title/*.name*/, this.piwikSiteId).subscribe(); + } + + this.result = [] + this.result = { + id: id, + type: "dataset", + source: "openaire", + title: this.datasetInfo.title, + url: '', + result: '', + accessRights: /*this.datasetInfo.title.accessMode*/ this.datasetInfo.accessMode, + embargoEndDate: '' + }; + + let relatedResearchResultsNum = 0; + if (this.datasetInfo.relatedResearchResults != undefined) { + this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) { + relatedResearchResultsNum += value.length; + }); + } + this.relatedResearchResultsNum = relatedResearchResultsNum; + + this.showLoading = false; + }, + err => { + //console.log(err) + this.handleError("Error getting research data for id: " + this.datasetId, err); + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDatasets); + this.errorMessage = 'No research data found'; + this.showLoading = false; } + ); + } + + // showChange($event) { + // this.showAllReferences=$event.value; + // } + + public metricsResults($event) { + this.totalViews = $event.totalViews; + this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } + + public buildCurationTooltip() { + let tooltipContent: string = "
    "; + + tooltipContent += "

    Record in preview

    "; + tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; + + return tooltipContent; + } + + public getKeys(map) { + return Array.from(map.keys()); + } + + private handleError(message: string, error) { + console.error("Research Data Landing Page: " + message, error); + } + + public updateReferencesPage($event) { + this.referencesPage = $event.value; + } + + public totalPages(totalResults: number): number { + let totalPages: any = totalResults / this.pageSize; + if (!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, this.pageSize) + 1); } + return totalPages; + } - private getDatasetInfo(id:string) { - this.warningMessage = ''; - this.errorMessage="" - this.showLoading = true; + public scroll() { + HelperFunctions.scroll(); + } - this.datasetInfo = null; - - this.infoSub = this._datasetService.getDatasetInfo(id, this. properties).subscribe( - data => { - this.datasetInfo = data; - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDataset + this.datasetInfo.record["result"]["header"]["dri:objIdentifier"]); - /* - if(this.datasetInfo.title.name != undefined && this.datasetInfo.title.name!= ''){ - this.updateTitle(this.datasetInfo.title.name); - this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name); - } - */ - if(this.datasetInfo.title){ - this.updateTitle(this.datasetInfo.title); - this.updateDescription((this.datasetInfo.description?(this.datasetInfo.description):(","+this.datasetInfo.title))); - } - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, this.datasetInfo.title/*.name*/, this.piwikSiteId).subscribe(); - } - - this.result = [] - this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: /*this.datasetInfo.title.accessMode*/ this.datasetInfo.accessMode, embargoEndDate: ''}; - - let relatedResearchResultsNum = 0; - if(this.datasetInfo.relatedResearchResults != undefined) { - this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) { - relatedResearchResultsNum += value.length; - }); - } - this.relatedResearchResultsNum = relatedResearchResultsNum; - - this.showLoading = false; - }, - err => { - //console.log(err) - this.handleError("Error getting research data for id: "+this.datasetId, err); - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToDatasets); - this.errorMessage = 'No research data found'; - this.showLoading = false; - } - ); - } - - // showChange($event) { - // this.showAllReferences=$event.value; - // } - - public metricsResults($event) { - this.totalViews = $event.totalViews; - this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; - } - - private updateDescription(description:string){ - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string){ - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(_title); - this._meta.updateTag({content:_title},"property='og:title'"); - } - private updateUrl(url:string){ - this._meta.updateTag({content:url},"property='og:url'"); - } - - public buildCurationTooltip() { - let tooltipContent: string = "
    "; - - tooltipContent += "

    Record in preview

    "; - tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; - - return tooltipContent; - } - public getKeys( map) { - return Array.from(map.keys()); - } - - private handleError(message: string, error) { - console.error("Research Data Landing Page: "+message, error); - } - - public updateReferencesPage($event) { - this.referencesPage = $event.value; - } - - public totalPages(totalResults: number): number { - let totalPages:any = totalResults/this.pageSize; - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, this.pageSize) + 1); - } - return totalPages; - } - - public scroll() { - HelperFunctions.scroll(); - } - isRouteAvailable(routeToCheck:string){ + isRouteAvailable(routeToCheck: string) { for (let i = 0; i < this.router.config.length; i++) { - let routePath:string = this.router.config[i].path; - if(routePath == routeToCheck){ + let routePath: string = this.router.config[i].path; + if (routePath == routeToCheck) { return true; } } diff --git a/landingPages/dataset/dataset.module.ts b/landingPages/dataset/dataset.module.ts index 214d7c55..767ded56 100644 --- a/landingPages/dataset/dataset.module.ts +++ b/landingPages/dataset/dataset.module.ts @@ -1,40 +1,38 @@ -// import {MaterialModule} from '@angular/material'; -import {NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {FormsModule} from '@angular/forms'; -import {RouterModule} from '@angular/router'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {RouterModule} from '@angular/router'; -import {SharedModule} from '../../shared/shared.module'; +import {SharedModule} from '../../shared/shared.module'; -import {DatasetComponent} from './dataset.component'; +import {DatasetComponent} from './dataset.component'; -import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; -// import {DatasetRoutingModule} from './dataset-routing.module'; -import {LandingModule} from '../landing-utils/landing.module'; -import {ResultLandingModule} from '../landing-utils/resultLanding.module'; -import {MetricsModule} from '../landing-utils/metrics.module'; -import {AltMetricsModule} from '../../utils/altmetrics.module'; +import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';; +import {LandingModule} from '../landing-utils/landing.module'; +import {ResultLandingModule} from '../landing-utils/resultLanding.module'; +import {MetricsModule} from '../landing-utils/metrics.module'; +import {AltMetricsModule} from '../../utils/altmetrics.module'; import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module'; -import {IFrameModule} from '../../utils/iframe.module'; -import {PagingModule} from '../../utils/paging.module'; +import {IFrameModule} from '../../utils/iframe.module'; +import {PagingModule} from '../../utils/paging.module'; -import {DatasetService} from './dataset.service'; +import {DatasetService} from './dataset.service'; -import {FreeGuard} from'../../login/freeGuard.guard'; -import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; +import {FreeGuard} from '../../login/freeGuard.guard'; +import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; -import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; +import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module'; -import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; +import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/deletedByInference.module"; +import {HelperModule} from "../../utils/helper/helper.module"; @NgModule({ imports: [ - //MaterialModule.forRoot(), CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, - ShowAuthorsModule, DeletedByInferenceModule + ShowAuthorsModule, DeletedByInferenceModule, HelperModule ], declarations: [ DatasetComponent diff --git a/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/landingPages/htmlProjectReport/htmlProjectReport.component.ts index 43bf7531..77c932d5 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -1,278 +1,305 @@ -import {Component, Input} from '@angular/core'; -import {ActivatedRoute, Params, Router} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; -import {Observable} from 'rxjs'; +import {EnvProperties} from '../../utils/properties/env-properties'; -import {EnvProperties} from '../../utils/properties/env-properties'; - -import {HtmlProjectReportService} from './htmlProjectReport.service'; -import {ProjectService} from '../project/project.service'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {HtmlProjectReportService} from './htmlProjectReport.service'; +import {ProjectService} from '../project/project.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; +import {HelperService} from "../../utils/helper/helper.service"; declare var UIkit: any; @Component({ - selector: 'htmlProjectReport', - template: ` -
    -
    -
    + selector: 'htmlProjectReport', + template: ` +
    +
    +
    + +
    + + -
    - - +
    +

    {{header1}}

    +

    {{header2}}

    -
    -

    {{header1}}

    -

    {{header2}}

    - -
    - -
    - -
    + +
    + +
    - + +
    -
    + +
    -
    - ` - }) -export class HtmlProjectReportComponent{ + ` +}) +export class HtmlProjectReportComponent { @Input() piwikSiteId = null; - private projectId: string; - private totalResults: number = 10; - private resultsType: string = "publication"; + @Input() communityId = null; + private projectId: string; + private totalResults: number = 10; + private resultsType: string = "publication"; - public header1: string = ""; - public header2: string = ""; - public htmlResult: string = ""; + public header1: string = ""; + public header2: string = ""; + public htmlResult: string = ""; - public sub: any; piwiksub: any; - public subHTML: any; - public subHTMLInfo: any; + public sub: any; + piwiksub: any; + public subHTML: any; + public subHTMLInfo: any; - public warningMessage: string = ""; - public errorMessage: string = ""; - public showLoading: boolean = true; - properties:EnvProperties; + public warningMessage: string = ""; + public errorMessage: string = ""; + public showLoading: boolean = true; + properties: EnvProperties; + public pageContents = null; + public divContents = null; - constructor ( private route: ActivatedRoute, - private htmlService: HtmlProjectReportService, - private _piwikService:PiwikService, - private _projectService: ProjectService, - private _meta: Meta, - private _title: Title, - private _router: Router, - private seoService: SEOService) { - } + constructor(private route: ActivatedRoute, + private htmlService: HtmlProjectReportService, + private _piwikService: PiwikService, + private _projectService: ProjectService, + private _meta: Meta, + private _title: Title, + private _router: Router, + private helper: HelperService, + private seoService: SEOService) { + } - ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.updateUrl(data.envSpecific.baseLink+this._router.url); - this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url); + ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); + this.updateUrl(data.envSpecific.baseLink + this._router.url); + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url); - }); - this.sub = this.route.queryParams.subscribe(params => { - this.projectId = params['projectId']; - - if (params['size'] == parseInt(params['size'], 10)) { - this.totalResults = params['size']; - } else { - this.showLoading = false; - this.warningMessage="Requested size is not an integer"; - } - - if(params['type'] && (params['type'] == "publication" || params['type'] == "dataset" || params['type'] == "software" || params['type'] == "other")){ - if(params['type'] == "publication") { - this.resultsType = 'publication'; - } else if(params['type'] == "dataset") { - this.resultsType = 'research data'; - } else if(params['type'] == "software") { - this.resultsType = 'software'; - } else if(params['type'] == "other") { - this.resultsType = "other research product"; - } - - var title = "Project's "+this.resultsType+" report"; - var description = "project, project "+ this.resultsType +" report, funding, open access, publications, research data, software, other research products"; - this.updateTitle(title); - this.updateDescription(description); - - - } else { - this.showLoading = false; - this.warningMessage="Requested type should be publication or research data or software or other research product"; - } - - //showLoading is true if no warnings - if(this.showLoading) { - if(this.projectId) { - this.createHeaders(); - } else { - this.showLoading = false; - this.warningMessage="No valid project id"; - } - } - }); - } - - ngOnDestroy() { - this.sub.unsubscribe(); - if(this.piwiksub){ - this.piwiksub.unsubscribe(); - } - if(this.subHTML) { - this.subHTML.unsubscribe(); - } - if(this.subHTMLInfo) { - this.subHTMLInfo.unsubscribe(); - } - } - - private createHeaders() { - this.subHTMLInfo = this._projectService.getHTMLInfo(this.projectId, this.properties).subscribe( - data => { - this.createHeader1(data); - if(data.acronym) { - this.updateTitle(data.acronym+" "+this.resultsType+" report"); - } else if(data.title){ - this.updateTitle(data.title+" "+this.resultsType+" report"); - } - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, ((data.acronym)?data.acronym:data.title)+" "+this.resultsType+" report", this.piwikSiteId).subscribe(); - } - }, - err => { - this.handleError("Error getting html information for project id: "+this.projectId, err); - //console.log(err); - this.createClipboard(); - } - ); - - if(this.resultsType == "publication") { - this.header2 += this.totalResults.toLocaleString('en-US') + " publications"; - } else if(this.resultsType == "research data") { - this.header2 += this.totalResults.toLocaleString('en-US') + " research data"; - } else if(this.resultsType == "software") { - this.header2 += this.totalResults.toLocaleString('en-US') + " software"; - } else if(this.resultsType == "other research product") { - this.header2 += this.totalResults.toLocaleString('en-US') + " other"; - } - } - - private createClipboard() { - let intro: string = ''; - intro += ''; - intro += ''; - intro += ''+this.header1+'' - intro += ''; - - if (typeof window !== 'undefined') { - this.subHTML = this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType, this.properties.csvAPIURL).subscribe( - data => { - //let body: string = intro+'

    '+this.header1+'

    '+this.header2+'

    '+data+''; - let body: string = intro+'

    '+this.header1+'

    '+this.header2+'

    '; - body += ""+data+"
    TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
    "; - body += ''; - - //this.htmlResult = data; - this.htmlResult = ""+data+"
    TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
    "; - - let clipboard; - let Clipboard; - Clipboard = require('clipboard'); - clipboard = new Clipboard('.clipBtn', { - /*target: function(trigger) { - return document.getElementById("clipboard"); - }*/ - text: function(trigger) { - return body;//document.getElementById("clipboard").getAttribute('innerHTML');//"aaaa"+tmp+"oo"; - } - }); - - this.showLoading = false; - }, - err => { - //console.log(err); - this.handleError("Error getting html for id: "+this.projectId, err); - - this.errorMessage = 'Service not available'; - this.showLoading = false; - } - ); - } - } - - createHeader1(data: {"title": string, "acronym": string, "callIdentifier": string}) { - if(this.resultsType == "publication") { - this.header1 += "Publications"; - } else if(this.resultsType == "research data") { - this.header1 += "Research Data"; - } else if(this.resultsType == "software") { - this.header1 += "Software"; - } else if(this.resultsType == "other research product") { - this.header1 += "Other Research Products"; - } - - if(data != undefined) { - if(data.title != undefined && data.title != "") { - this.header1 += data.title; - } - if((data.title != undefined && data.title != "") && - ((data.acronym != undefined && data.acronym != "") || - (data.callIdentifier != undefined && data.callIdentifier != ""))) { - this.header1 += "("; - } - if(data.acronym != undefined && data.acronym != "") { - this.header1 += data.acronym + " - "; - } - if(data.callIdentifier != undefined && data.callIdentifier != "") { - this.header1 += data.callIdentifier; - } - if((data.title != undefined && data.title != "") && - ((data.acronym != undefined && data.acronym != "") || - (data.callIdentifier != undefined && data.callIdentifier != ""))) { - this.header1 += ")"; - } - } - - this.createClipboard(); - } - - public copied() { - UIkit.notification({ - message : 'Raw html is copied. Please paste it on an html file.', - status : 'success', - timeout : 3000, - pos : 'top-center' }); + this.sub = this.route.queryParams.subscribe(params => { + this.projectId = params['projectId']; + + if (params['size'] == parseInt(params['size'], 10)) { + this.totalResults = params['size']; + } else { + this.showLoading = false; + this.warningMessage = "Requested size is not an integer"; + } + + if (params['type'] && (params['type'] == "publication" || params['type'] == "dataset" || params['type'] == "software" || params['type'] == "other")) { + if (params['type'] == "publication") { + this.resultsType = 'publication'; + } else if (params['type'] == "dataset") { + this.resultsType = 'research data'; + } else if (params['type'] == "software") { + this.resultsType = 'software'; + } else if (params['type'] == "other") { + this.resultsType = "other research product"; + } + + var title = "Project's " + this.resultsType + " report"; + var description = "project, project " + this.resultsType + " report, funding, open access, publications, research data, software, other research products"; + this.updateTitle(title); + this.updateDescription(description); + + + } else { + this.showLoading = false; + this.warningMessage = "Requested type should be publication or research data or software or other research product"; + } + + //showLoading is true if no warnings + if (this.showLoading) { + if (this.projectId) { + this.createHeaders(); + } else { + this.showLoading = false; + this.warningMessage = "No valid project id"; + } + } + }); + } + + private getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } + + private getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + + ngOnDestroy() { + this.sub.unsubscribe(); + if (this.piwiksub) { + this.piwiksub.unsubscribe(); + } + if (this.subHTML) { + this.subHTML.unsubscribe(); + } + if (this.subHTMLInfo) { + this.subHTMLInfo.unsubscribe(); + } + } + + private createHeaders() { + this.subHTMLInfo = this._projectService.getHTMLInfo(this.projectId, this.properties).subscribe( + data => { + this.createHeader1(data); + if (data.acronym) { + this.updateTitle(data.acronym + " " + this.resultsType + " report"); + } else if (data.title) { + this.updateTitle(data.title + " " + this.resultsType + " report"); + } + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, ((data.acronym) ? data.acronym : data.title) + " " + this.resultsType + " report", this.piwikSiteId).subscribe(); + } + }, + err => { + this.handleError("Error getting html information for project id: " + this.projectId, err); + //console.log(err); + this.createClipboard(); + } + ); + + if (this.resultsType == "publication") { + this.header2 += this.totalResults.toLocaleString('en-US') + " publications"; + } else if (this.resultsType == "research data") { + this.header2 += this.totalResults.toLocaleString('en-US') + " research data"; + } else if (this.resultsType == "software") { + this.header2 += this.totalResults.toLocaleString('en-US') + " software"; + } else if (this.resultsType == "other research product") { + this.header2 += this.totalResults.toLocaleString('en-US') + " other"; + } + } + + private createClipboard() { + let intro: string = ''; + intro += ''; + intro += ''; + intro += '' + this.header1 + '' + intro += ''; + + if (typeof window !== 'undefined') { + this.subHTML = this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType, this.properties.csvAPIURL).subscribe( + data => { + //let body: string = intro+'

    '+this.header1+'

    '+this.header2+'

    '+data+''; + let body: string = intro + '

    ' + this.header1 + '

    ' + this.header2 + '

    '; + body += "" + data + "
    TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
    "; + body += ''; + + //this.htmlResult = data; + this.htmlResult = "" + data + "
    TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
    "; + + let clipboard; + let Clipboard; + Clipboard = require('clipboard'); + clipboard = new Clipboard('.clipBtn', { + /*target: function(trigger) { + return document.getElementById("clipboard"); + }*/ + text: function (trigger) { + return body;//document.getElementById("clipboard").getAttribute('innerHTML');//"aaaa"+tmp+"oo"; + } + }); + + this.showLoading = false; + }, + err => { + //console.log(err); + this.handleError("Error getting html for id: " + this.projectId, err); + + this.errorMessage = 'Service not available'; + this.showLoading = false; + } + ); + } + } + + createHeader1(data: { "title": string, "acronym": string, "callIdentifier": string }) { + if (this.resultsType == "publication") { + this.header1 += "Publications"; + } else if (this.resultsType == "research data") { + this.header1 += "Research Data"; + } else if (this.resultsType == "software") { + this.header1 += "Software"; + } else if (this.resultsType == "other research product") { + this.header1 += "Other Research Products"; } - private updateDescription(description:string){ - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string){ - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(_title); - this._meta.updateTag({content:_title},"property='og:title'"); - } - private updateUrl(url:string){ - this._meta.updateTag({content:url},"property='og:url'"); + if (data != undefined) { + if (data.title != undefined && data.title != "") { + this.header1 += data.title; + } + if ((data.title != undefined && data.title != "") && + ((data.acronym != undefined && data.acronym != "") || + (data.callIdentifier != undefined && data.callIdentifier != ""))) { + this.header1 += "("; + } + if (data.acronym != undefined && data.acronym != "") { + this.header1 += data.acronym + " - "; + } + if (data.callIdentifier != undefined && data.callIdentifier != "") { + this.header1 += data.callIdentifier; + } + if ((data.title != undefined && data.title != "") && + ((data.acronym != undefined && data.acronym != "") || + (data.callIdentifier != undefined && data.callIdentifier != ""))) { + this.header1 += ")"; + } } - private handleError(message: string, error) { - console.error("Html Project Report Page: "+message, error); - } + this.createClipboard(); + } + + public copied() { + UIkit.notification({ + message: 'Raw html is copied. Please paste it on an html file.', + status: 'success', + timeout: 3000, + pos: 'top-center' + }); + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } + + private handleError(message: string, error) { + console.error("Html Project Report Page: " + message, error); + } } diff --git a/landingPages/htmlProjectReport/htmlProjectReport.module.ts b/landingPages/htmlProjectReport/htmlProjectReport.module.ts index 286365e0..a31e42e4 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.module.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.module.ts @@ -11,10 +11,13 @@ import {HtmlProjectReportComponent} from './htmlProjectReport.component'; import {FreeGuard} from'../../login/freeGuard.guard'; import {PiwikServiceModule} from '../../utils/piwik/piwikService.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; +import {HelperModule} from "../../utils/helper/helper.module"; +import {RouterModule} from '@angular/router'; @NgModule({ imports: [ - CommonModule, FormsModule, ProjectServiceModule,PiwikServiceModule, SEOServiceModule + CommonModule, FormsModule, ProjectServiceModule, PiwikServiceModule, SEOServiceModule, HelperModule, + RouterModule ], declarations: [ HtmlProjectReportComponent diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index ce586783..cc774d59 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -1,164 +1,204 @@ -
    +
    -
    +
    -
    - - - +
    + + + - - -
    - - - -
    -
    -
    +
    diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 1e64f67e..7d4ab666 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -1,533 +1,552 @@ -import {Component, ViewChild} from '@angular/core'; -import {ElementRef, Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {Component, ElementRef, Input, ViewChild} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; -import {Observable, Subject} from 'rxjs'; - -import {OrganizationService} from '../../services/organization.service'; -import {OrganizationInfo} from '../../utils/entities/organizationInfo'; -import {ReportsService} from '../../services/reports.service'; -import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import {OrganizationService} from '../../services/organization.service'; +import {OrganizationInfo} from '../../utils/entities/organizationInfo'; +import {ReportsService} from '../../services/reports.service'; +import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; // import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; +import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; // import {SearchDatasetsService} from '../../services/searchDatasets.service'; -import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; -import {SearchProjectsService} from '../../services/searchProjects.service'; -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {SearchingProjectsTabComponent} from '../landing-utils/searchingProjectsInTab.component'; -import {RouterHelper} from '../../utils/routerHelper.class'; +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {SearchProjectsService} from '../../services/searchProjects.service'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {SearchingProjectsTabComponent} from '../landing-utils/searchingProjectsInTab.component'; +import {RouterHelper} from '../../utils/routerHelper.class'; -import {ModalLoading} from '../../utils/modal/loading.component'; -import {AlertModal} from '../../utils/modal/alert'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import {StringUtils} from '../../utils/string-utils.class'; -import {EnvProperties} from '../../utils/properties/env-properties'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {ModalLoading} from '../../utils/modal/loading.component'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {StringUtils} from '../../utils/string-utils.class'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ - selector: 'organization', - templateUrl: 'organization.component.html', + selector: 'organization', + templateUrl: 'organization.component.html', }) export class OrganizationComponent { @Input() piwikSiteId = null; - public organizationInfo: OrganizationInfo; - public organizationId: string; + @Input() communityId = null; - // Message variables - public warningMessage = ""; - public errorMessage = ""; - public showLoading: boolean = true; + public organizationInfo: OrganizationInfo; + public organizationId: string; - // CSV variables - public downloadURLAPI: string; - public csvProjectParamsHead: string; - public csvPublicationParamsHead: string; - public csvParamsTail: string; - public csvAffiliatedPublications: string; + // Message variables + public warningMessage = ""; + public errorMessage = ""; + public showLoading: boolean = true; - // Active tab variable for responsiveness - public activeTab: string = "Publications"; + // CSV variables + public downloadURLAPI: string; + public csvProjectParamsHead: string; + public csvPublicationParamsHead: string; + public csvParamsTail: string; + public csvAffiliatedPublications: string; - // Variables for publications, research data, projects, dataproviders tabs - public fetchPublications: FetchPublications; - public linkToSearchPublications: string = ""; - // public fetchDatasets: FetchDatasets; - // public linkToSearchDatasets: string = ""; - public fetchProjects: FetchProjects; - public fetchDataproviders : FetchDataproviders; - public linkToSearchDataproviders:string = ""; - //public projectFunders:string[] = []; + // Active tab variable for responsiveness + public activeTab: string = "Publications"; - // Variables for projects query (query results only if projects tab is clicked) - public projectsClicked: boolean = false; - @ViewChild (SearchingProjectsTabComponent) searchingProjectsTabComponent : SearchingProjectsTabComponent ; + // Variables for publications, research data, projects, dataproviders tabs + public fetchPublications: FetchPublications; + public linkToSearchPublications: string = ""; + // public fetchDatasets: FetchDatasets; + // public linkToSearchDatasets: string = ""; + public fetchProjects: FetchProjects; + public fetchDataproviders: FetchDataproviders; + public linkToSearchDataproviders: string = ""; + //public projectFunders:string[] = []; - @ViewChild (ModalLoading) loading : ModalLoading ; - // Alert box when CSV: Project Publications for a funder is requested - @ViewChild('AlertModalApplyAll') alertApplyAll; - // Alert box when something is wrong with CSV requests - @ViewChild('AlertModalCsvError') alertCsvError; + // Variables for projects query (query results only if projects tab is clicked) + public projectsClicked: boolean = false; + @ViewChild(SearchingProjectsTabComponent) searchingProjectsTabComponent: SearchingProjectsTabComponent; - public routerHelper:RouterHelper = new RouterHelper(); - public errorCodes:ErrorCodes = new ErrorCodes(); + @ViewChild(ModalLoading) loading: ModalLoading; + // Alert box when CSV: Project Publications for a funder is requested + @ViewChild('AlertModalApplyAll') alertApplyAll; + // Alert box when something is wrong with CSV requests + @ViewChild('AlertModalCsvError') alertCsvError; - //private projectsNum: number = 0; - //private fundersSet: Set; - //private emptyFundersSet: boolean = true; + public routerHelper: RouterHelper = new RouterHelper(); + public errorCodes: ErrorCodes = new ErrorCodes(); + public pageContents = null; + public divContents = null; - // Request results for publications, research data and content providers only the one time (first time tab is clicked) - private reloadPublications: boolean = true; - // private reloadDatasets: boolean = true; - private reloadDataproviders: boolean = true; + //private projectsNum: number = 0; + //private fundersSet: Set; + //private emptyFundersSet: boolean = true; - // Helper variables to specify funder in downloadPublicationsFile function - private funder: string; - private funderId: string; - private funderCountPublications: number; - sub: any; - infoSub: any; - piwiksub: any; - downloadFileSub: any; - downloadFilePiwikSub: any; - countProjectsSub: any; - countPublSub: any; - downloadProjectPublSub: any; - properties:EnvProperties; - //private ngUnsubscribe: Subject = new Subject(); + // Request results for publications, research data and content providers only the one time (first time tab is clicked) + private reloadPublications: boolean = true; + // private reloadDatasets: boolean = true; + private reloadDataproviders: boolean = true; - constructor (private element: ElementRef, - private _organizationService: OrganizationService, - private _piwikService:PiwikService, - private route: ActivatedRoute, - private _searchDataprovidersService: SearchDataprovidersService, - private _reportsService: ReportsService, - private _searchPublicationsService: SearchPublicationsService, - // private _searchDatasetsService: SearchDatasetsService, - private _searchProjectsService: SearchProjectsService, - private _meta: Meta, - private _title: Title, - private _router: Router, - private seoService: SEOService) { + // Helper variables to specify funder in downloadPublicationsFile function + private funder: string; + private funderId: string; + private funderCountPublications: number; + sub: any; + infoSub: any; + piwiksub: any; + downloadFileSub: any; + downloadFilePiwikSub: any; + countProjectsSub: any; + countPublSub: any; + downloadProjectPublSub: any; + properties: EnvProperties; - this.fetchPublications = new FetchPublications(this._searchPublicationsService); - // this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); - this.fetchProjects = new FetchProjects(this._searchProjectsService); - this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); + //private ngUnsubscribe: Subject = new Subject(); + + constructor(private element: ElementRef, + private _organizationService: OrganizationService, + private _piwikService: PiwikService, + private route: ActivatedRoute, + private _searchDataprovidersService: SearchDataprovidersService, + private _reportsService: ReportsService, + private _searchPublicationsService: SearchPublicationsService, + // private _searchDatasetsService: SearchDatasetsService, + private _searchProjectsService: SearchProjectsService, + private _meta: Meta, + private _title: Title, + private _router: Router, + private helper: HelperService, + private seoService: SEOService) { + + this.fetchPublications = new FetchPublications(this._searchPublicationsService); + // this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); + this.fetchProjects = new FetchProjects(this._searchProjectsService); + this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); + } + + ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); + this.updateUrl(data.envSpecific.baseLink + this._router.url); + }); + this.sub = this.route.queryParams.subscribe(params => { + this.organizationInfo = null; + this.updateTitle("Organization"); + this.updateDescription(""); + this.projectsClicked = false; + + this.organizationId = params['organizationId']; + + if (this.organizationId) { + this.getOrganizationInfo(); + } else { + this.showLoading = false; + this.warningMessage = "No valid organization id"; + } + + HelperFunctions.scroll(); + + this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))'; + + }); + + this.downloadURLAPI = this.properties.csvAPIURL; + this.csvAffiliatedPublications = this.downloadURLAPI + "?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact \"" + this.organizationId + "\"))"; + this.csvProjectParamsHead = 'format=csv&type=projects&fq=( (oaftype exact project)and (funder exact "'; + //this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact '; + } + + private getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } + + private getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + + + ngOnDestroy() { + if (this.sub) { + this.sub.unsubscribe(); + } + if (this.piwiksub) { + this.piwiksub.unsubscribe(); + } + if (this.infoSub) { + this.infoSub.unsubscribe(); + } + if (this.downloadFileSub) { + this.downloadFileSub.unsubscribe(); + } + if (this.downloadFilePiwikSub) { + this.downloadFilePiwikSub.unsubscribe(); + } + if (this.countProjectsSub) { + this.countProjectsSub.unsubscribe(); + } + if (this.countPublSub) { + this.countPublSub.unsubscribe(); + } + if (this.downloadProjectPublSub) { + this.downloadProjectPublSub.unsubscribe(); } - ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.updateUrl(data.envSpecific.baseLink+this._router.url); - }); - this.sub = this.route.queryParams.subscribe(params => { - this.organizationInfo=null; - this.updateTitle("Organization"); - this.updateDescription(""); - this.projectsClicked = false; + /* + this.ngUnsubscribe.next(); + this.ngUnsubscribe.complete(); + */ + } - this.organizationId = params['organizationId']; + private getOrganizationInfo() { - if(this.organizationId){ - this.getOrganizationInfo(); - }else{ - this.showLoading = false; - this.warningMessage="No valid organization id"; - } + this.warningMessage = ''; + this.errorMessage = "" + this.showLoading = true; - HelperFunctions.scroll(); + this.organizationInfo = null; - this.csvParamsTail = '" and relorganizationid exact "'+this.organizationId+'" ))'; + this.infoSub = this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe( + data => { + if (data == null) { + this.showLoading = false; + this.errorMessage = 'No organization found'; + } else { + this.organizationInfo = data; + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrganization + this.organizationInfo.objIdentifier); + this.updateTitle(this.organizationInfo.title.name); + this.updateDescription("Organization, country, " + this.organizationInfo.title.name + ((this.organizationInfo.title.name && this.organizationInfo.title.name != this.organizationInfo.name) ? (", " + this.organizationInfo.name) : "")); + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, this.organizationInfo.title.name, this.piwikSiteId).subscribe(); + } + var refineFields: string [] = ["funder"]; - }); + //this.searchPublications(); + this.fetchPublications.getNumForEntity("organization", this.organizationId, this.properties); + // this.fetchDatasets.getNumForEntity("organization", this.organizationId, this.properties); + this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0, refineFields, this.properties); - this.downloadURLAPI =this.properties.csvAPIURL; - this.csvAffiliatedPublications = this.downloadURLAPI+"?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact \""+this.organizationId+"\"))"; - this.csvProjectParamsHead = 'format=csv&type=projects&fq=( (oaftype exact project)and (funder exact "'; - //this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact '; + this.fetchDataproviders.getNumForEntity("organization", this.organizationId, this.properties); + + this.showLoading = false; + + /*let projectsNum = 0; + + if(this.organizationInfo.projects != undefined) { + this.fundersSet = new Set(); + this.organizationInfo.projects.forEach(function (value, key, map) { + projectsNum += value.length; + this.fundersSet.add(key); + }.bind(this)); + } + + this.projectsNum = projectsNum;*/ + } + }, + err => { + //console.log(err) + this.handleError("Error getting organization for id: " + this.organizationId, err); + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrganizations); + this.errorMessage = 'No organization found'; + this.showLoading = false; + } + ); + } + + /* + private handleClick(funder: string) { + if(this.emptyFundersSet) { + this.fundersSet.clear(); + this.emptyFundersSet = false; + } + + if(this.fundersSet.has(funder)) { + this.fundersSet.delete(funder); + + if(this.fundersSet.size == 0) { + this.organizationInfo.projects.forEach(function (value, key, map) { + this.fundersSet.add(key); + }.bind(this)); + this.emptyFundersSet = true; + } + console.info(funder+" funder deleted"); + } else { + this.fundersSet.add(funder); + console.info(funder+" funder added"); + } + } + */ + //private getProjectsData(key: string): any { + //return this.projectsData; + //} + + private searchPublications() { + this.fetchPublications.getResultsForEntity("organization", this.organizationId, 1, 10, this.properties); + this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications; + //if(this.fetchPublications.searchUtils.totalResults > 0) { + this.reloadPublications = false; + //this.activeTab = "Publications"; + //} else { + //this.projectsClicked = true; + //} + } + + // private searchDatasets() { + // this.fetchDatasets.getResultsForEntity("organization", this.organizationId, 1, 10,this.properties); + // this.linkToSearchPublications = this.properties.searchLinkToAdvancedDatasets; + // this.reloadDatasets = false; + // } + + private searchDataproviders() { + this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10, this.properties); + this.linkToSearchDataproviders = this.properties.searchLinkToAdvancedDataProviders; + + //if(this.fetchDataproviders.searchUtils.totalResults > 0) { + this.reloadDataproviders = false; + //this.activeTab = "Content Providers"; + //} else { + + //} + } + + public searchPublicationsInit() { + if (this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) { + this.searchPublications(); } + } + // public searchDatasetsInit() { + // if(this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) { + // this.searchDatasets(); + // } + // } - ngOnDestroy() { - if(this.sub){ - this.sub.unsubscribe(); - } - if(this.piwiksub){ - this.piwiksub.unsubscribe(); - } - if(this.infoSub) { - this.infoSub.unsubscribe(); - } - if(this.downloadFileSub) { - this.downloadFileSub.unsubscribe(); - } - if(this.downloadFilePiwikSub) { - this.downloadFilePiwikSub.unsubscribe(); - } - if(this.countProjectsSub) { - this.countProjectsSub.unsubscribe(); - } - if(this.countPublSub) { - this.countPublSub.unsubscribe(); - } - if(this.downloadProjectPublSub) { - this.downloadProjectPublSub.unsubscribe(); - } - - /* - this.ngUnsubscribe.next(); - this.ngUnsubscribe.complete(); - */ + public searchDataprovidersInit() { + if (this.reloadDataproviders && this.fetchDataproviders.searchUtils.totalResults > 0) { + this.searchDataproviders(); } + } - private getOrganizationInfo () { + public downloadFile(url: string, filename: string) { - this.warningMessage = ''; - this.errorMessage="" - this.showLoading = true; + this.openLoading(); + this.setMessageLoading("Downloading CSV file"); - this.organizationInfo = null; + this.downloadFileSub = this._reportsService.downloadCSVFile(url).subscribe( + data => { + this.closeLoading(); - this.infoSub = this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe( + var url = window.URL.createObjectURL(data); + var a = window.document.createElement('a'); + window.document.body.appendChild(a); + a.setAttribute('style', 'display: none'); + a.href = url; + a.download = filename + ".csv"; + a.click(); + window.URL.revokeObjectURL(url); + a.remove(); // remove the element + + //window.open(window.URL.createObjectURL(data)); + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe(); + } + }, + err => { + //console.log("Error downloading the file."); + this.handleError("Error downloading file: " + filename + ".csv", err); + + this.closeLoading(); + this.confirmOpenCsvError(); + }/*, + () => console.log('Completed file download.')*/ + ); + } + + private downloadPublicationsFile(funder: string, funderId: string, count: number) { + + this.openLoading(); + this.setMessageLoading("Downloading CSV file"); + + let response: string[] = []; + let totalResponse: string = ""; + let projects = []; + let counter: number = count; + let title: boolean = false; + let title_index: number = 0; + + let filename: string = 'funder-project-publications-report'; + + this.countProjectsSub = this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + funderId + '" ) ', 1, count, [], this.properties).subscribe( + data => { + projects = data[1]; + for (let index = 0; index < projects.length; index++) { + this.countPublSub = this._searchPublicationsService.numOfEntityPublications(projects[index].id, "project", this.properties).subscribe( data => { - if(data == null) { - this.showLoading = false; - this.errorMessage = 'No organization found'; - } else { - this.organizationInfo = data; - this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this.properties.searchLinkToOrganization + this.organizationInfo.objIdentifier); - this.updateTitle(this.organizationInfo.title.name); - this.updateDescription("Organization, country, "+this.organizationInfo.title.name +((this.organizationInfo.title.name && this.organizationInfo.title.name != this.organizationInfo.name)?(", "+this.organizationInfo.name):"") ); - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, this.organizationInfo.title.name, this.piwikSiteId).subscribe(); + //if(data == 0 && title) { // if no publications for this project + if (data == 0 && (counter > 1 || title)) { // if no publications for this project + counter--; + response[index] = ""; + //console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]); + + if (counter == 0) { + //for(let i=count-1; i>=0; i--) { + for (let i = 0; i < projects.length; i++) { + if (response[i] != "") { + if (i == title_index) { + totalResponse = response[i] + totalResponse; + } else { + totalResponse += response[i]; + } } - var refineFields:string [] = ["funder"]; + } + this.closeLoading(); - //this.searchPublications(); - this.fetchPublications.getNumForEntity("organization", this.organizationId, this.properties); - // this.fetchDatasets.getNumForEntity("organization", this.organizationId, this.properties); - this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0,refineFields,this.properties); - - this.fetchDataproviders.getNumForEntity("organization", this.organizationId,this.properties); - - this.showLoading = false; - - /*let projectsNum = 0; - - if(this.organizationInfo.projects != undefined) { - this.fundersSet = new Set(); - this.organizationInfo.projects.forEach(function (value, key, map) { - projectsNum += value.length; - this.fundersSet.add(key); - }.bind(this)); - } - - this.projectsNum = projectsNum;*/ + var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'})); + var a = window.document.createElement('a'); + window.document.body.appendChild(a); + a.setAttribute('style', 'display: none'); + a.href = csvurl; + a.download = filename + ".csv"; + a.click(); + window.URL.revokeObjectURL(csvurl); + a.remove(); // remove the element } + } else { + let url: string; + if (!title) { + title_index = index; + //console.info(title_index); + url = this.downloadURLAPI + "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \"" + projects[index].id + "\"))" + } else { + url = this.downloadURLAPI + "?format=csv-special-notitle&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \"" + projects[index].id + "\"))" + } + title = true; + + this.downloadProjectPublSub = this._reportsService.getCSVResponse(url).subscribe( + data => { + counter--; + response[index] = data; + //console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]); + + if (counter == 0) { + //for(let i=count-1; i>=0; i--) { + for (let i = 0; i < projects.length; i++) { + if (response[i] != "") { + if (i == title_index) { + totalResponse = response[i] + totalResponse; + } else { + totalResponse += response[i]; + } + } + } + this.closeLoading(); + + var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'})); + var a = window.document.createElement('a'); + window.document.body.appendChild(a); + a.setAttribute('style', 'display: none'); + a.href = csvurl; + a.download = filename + ".csv"; + a.click(); + window.URL.revokeObjectURL(csvurl); + a.remove(); // remove the element + } + }, + err => { + this.handleError("Error downloading file: " + filename, err); + + this.closeLoading(); + this.confirmOpenCsvError(); + }/*, + () => console.log('Completed file download.')*/ + ); + } }, err => { - //console.log(err) - this.handleError("Error getting organization for id: "+this.organizationId, err); - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrganizations); - this.errorMessage = 'No organization found'; - this.showLoading = false; - } - ); - } + this.handleError("Error getting number of publications for project with id: " + projects[index].id, err); + }); + } + }, + err => { + this.handleError("Error getting projects for organization with id: " + this.organizationId, err); -/* - private handleClick(funder: string) { - if(this.emptyFundersSet) { - this.fundersSet.clear(); - this.emptyFundersSet = false; - } - - if(this.fundersSet.has(funder)) { - this.fundersSet.delete(funder); - - if(this.fundersSet.size == 0) { - this.organizationInfo.projects.forEach(function (value, key, map) { - this.fundersSet.add(key); - }.bind(this)); - this.emptyFundersSet = true; - } - console.info(funder+" funder deleted"); - } else { - this.fundersSet.add(funder); - console.info(funder+" funder added"); - } - } -*/ - //private getProjectsData(key: string): any { - //return this.projectsData; - //} - - private searchPublications() { - this.fetchPublications.getResultsForEntity("organization", this.organizationId, 1, 10,this.properties); - this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications; - //if(this.fetchPublications.searchUtils.totalResults > 0) { - this.reloadPublications = false; - //this.activeTab = "Publications"; - //} else { - //this.projectsClicked = true; - //} - } - - // private searchDatasets() { - // this.fetchDatasets.getResultsForEntity("organization", this.organizationId, 1, 10,this.properties); - // this.linkToSearchPublications = this.properties.searchLinkToAdvancedDatasets; - // this.reloadDatasets = false; - // } - - private searchDataproviders() { - this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10,this.properties); - this.linkToSearchDataproviders = this.properties.searchLinkToAdvancedDataProviders; - - //if(this.fetchDataproviders.searchUtils.totalResults > 0) { - this.reloadDataproviders = false; - //this.activeTab = "Content Providers"; - //} else { - - //} - } - - public searchPublicationsInit() { - if(this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) { - this.searchPublications(); - } - } - - // public searchDatasetsInit() { - // if(this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) { - // this.searchDatasets(); - // } - // } - - public searchDataprovidersInit() { - if(this.reloadDataproviders && this.fetchDataproviders.searchUtils.totalResults > 0) { - this.searchDataproviders(); - } - } - - public downloadFile(url:string, filename: string){ - - this.openLoading(); - this.setMessageLoading("Downloading CSV file"); - - this.downloadFileSub = this._reportsService.downloadCSVFile(url).subscribe( - data => { - this.closeLoading(); - - var url = window.URL.createObjectURL(data); - var a = window.document.createElement('a'); - window.document.body.appendChild(a); - a.setAttribute('style', 'display: none'); - a.href = url; - a.download = filename+".csv"; - a.click(); - window.URL.revokeObjectURL(url); - a.remove(); // remove the element - - //window.open(window.URL.createObjectURL(data)); - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe(); - } - }, - err => { - //console.log("Error downloading the file."); - this.handleError("Error downloading file: "+filename+".csv", err); - - this.closeLoading(); - this.confirmOpenCsvError(); - }/*, - () => console.log('Completed file download.')*/ - ); - } - - private downloadPublicationsFile(funder: string, funderId:string, count:number){ - - this.openLoading(); - this.setMessageLoading("Downloading CSV file"); - - let response: string[] = []; - let totalResponse: string = ""; - let projects = []; - let counter: number = count; - let title: boolean = false; - let title_index: number = 0; - - let filename: string = 'funder-project-publications-report'; - - this.countProjectsSub = this._searchProjectsService.getProjectsForOrganizations(this.organizationId,' and (funder exact "'+ funderId + '" ) ',1,count,[], this.properties).subscribe( - data => - { - projects = data[1]; - for(let index=0; index < projects.length; index++) { - this.countPublSub = this._searchPublicationsService.numOfEntityPublications(projects[index].id, "project", this.properties).subscribe( - data => - { - //if(data == 0 && title) { // if no publications for this project - if(data == 0 && (counter > 1 || title)) { // if no publications for this project - counter--; - response[index] = ""; - //console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]); - - if(counter == 0) { - //for(let i=count-1; i>=0; i--) { - for(let i=0; i < projects.length; i++) { - if(response[i] != "") { - if(i == title_index) { - totalResponse = response[i]+totalResponse; - } else { - totalResponse += response[i]; - } - } - } - this.closeLoading(); - - var csvurl = window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })); - var a = window.document.createElement('a'); - window.document.body.appendChild(a); - a.setAttribute('style', 'display: none'); - a.href = csvurl; - a.download = filename+".csv"; - a.click(); - window.URL.revokeObjectURL(csvurl); - a.remove(); // remove the element - } - } else { - let url: string; - if(!title) { - title_index = index; - //console.info(title_index); - url = this.downloadURLAPI+"?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \""+projects[index].id+"\"))" - } else { - url = this.downloadURLAPI+"?format=csv-special-notitle&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \""+projects[index].id+"\"))" - } - title = true; - - this.downloadProjectPublSub = this._reportsService.getCSVResponse(url).subscribe( - data => - { - counter--; - response[index] = data; - //console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]); - - if(counter == 0) { - //for(let i=count-1; i>=0; i--) { - for(let i=0; i < projects.length; i++) { - if(response[i] != "") { - if(i == title_index) { - totalResponse = response[i]+totalResponse; - } else { - totalResponse += response[i]; - } - } - } - this.closeLoading(); - - var csvurl = window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })); - var a = window.document.createElement('a'); - window.document.body.appendChild(a); - a.setAttribute('style', 'display: none'); - a.href = csvurl; - a.download = filename+".csv"; - a.click(); - window.URL.revokeObjectURL(csvurl); - a.remove(); // remove the element - } - }, - err => { - this.handleError("Error downloading file: "+filename, err); - - this.closeLoading(); - this.confirmOpenCsvError(); - }/*, - () => console.log('Completed file download.')*/ - ); - } - }, - err => { - this.handleError("Error getting number of publications for project with id: "+projects[index].id, err); - }); - } - }, - err => { - this.handleError("Error getting projects for organization with id: "+this.organizationId, err); - - this.closeLoading(); - this.confirmOpenCsvError(); - } - ); - } - - private updateDescription(description:string) { - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string){ - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(_title); - this._meta.updateTag({content:_title},"property='og:title'"); - } - private updateUrl(url:string){ - this._meta.updateTag({content:url},"property='og:url'"); - } - - private openLoading(){ - if(this.loading){ - this.loading.open(); + this.closeLoading(); + this.confirmOpenCsvError(); } - } - private closeLoading(){ - if(this.loading){ - this.loading.close(); - } - } - private setMessageLoading(message: string){ - if(this.loading){ - this.loading.message = message; - } - } + ); + } - public confirmOpenApplyAll(funder: string, funderId:string, funderCountPublications:number){ - this.alertApplyAll.cancelButton = true; - this.alertApplyAll.okButton = true; - this.alertApplyAll.alertTitle = "CSV FILE"; - this.alertApplyAll.message = "Do you wish to download a CSV file? Note that this process may take a while."; - this.alertApplyAll.okButtonText = "Yes"; - this.alertApplyAll.cancelButtonText = "No"; - this.alertApplyAll.open(); + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } - this.funder = funder; - this.funderId = funderId; - this.funderCountPublications = funderCountPublications; - } - public confirmCloseApplyAll(data){ - this.downloadPublicationsFile(this.funder, this.funderId, this.funderCountPublications); - } + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } - public confirmOpenCsvError(){ - this.alertCsvError.cancelButton = false; - this.alertCsvError.okButton = true; - this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE"; - this.alertCsvError.message = "There was an error in csv downloading. Please try again later."; - this.alertCsvError.okButtonText = "OK"; - this.alertCsvError.open(); - } + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } - encodeURI(input: string): string { - return StringUtils.URIEncode(input); + private openLoading() { + if (this.loading) { + this.loading.open(); } + } - private handleError(message: string, error) { - console.error("Organizaton Landing Page: "+message, error); + private closeLoading() { + if (this.loading) { + this.loading.close(); } + } + + private setMessageLoading(message: string) { + if (this.loading) { + this.loading.message = message; + } + } + + public confirmOpenApplyAll(funder: string, funderId: string, funderCountPublications: number) { + this.alertApplyAll.cancelButton = true; + this.alertApplyAll.okButton = true; + this.alertApplyAll.alertTitle = "CSV FILE"; + this.alertApplyAll.message = "Do you wish to download a CSV file? Note that this process may take a while."; + this.alertApplyAll.okButtonText = "Yes"; + this.alertApplyAll.cancelButtonText = "No"; + this.alertApplyAll.open(); + + this.funder = funder; + this.funderId = funderId; + this.funderCountPublications = funderCountPublications; + } + + public confirmCloseApplyAll(data) { + this.downloadPublicationsFile(this.funder, this.funderId, this.funderCountPublications); + } + + public confirmOpenCsvError() { + this.alertCsvError.cancelButton = false; + this.alertCsvError.okButton = true; + this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE"; + this.alertCsvError.message = "There was an error in csv downloading. Please try again later."; + this.alertCsvError.okButtonText = "OK"; + this.alertCsvError.open(); + } + + encodeURI(input: string): string { + return StringUtils.URIEncode(input); + } + + private handleError(message: string, error) { + console.error("Organizaton Landing Page: " + message, error); + } } diff --git a/landingPages/organization/organization.module.ts b/landingPages/organization/organization.module.ts index 79249f1e..66371843 100644 --- a/landingPages/organization/organization.module.ts +++ b/landingPages/organization/organization.module.ts @@ -1,30 +1,30 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {RouterModule} from '@angular/router'; import {LoadingModalModule} from '../../utils/modal/loadingModal.module'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {ErrorMessagesModule} from '../../utils/errorMessages.module'; -import { OrganizationServiceModule} from '../../services/organizationService.module'; +import {OrganizationServiceModule} from '../../services/organizationService.module'; // import { ProjectsServiceModule} from '../../services/projectsService.module'; -import { OrganizationComponent } from './organization.component'; -// import { OrganizationRoutingModule } from './organization-routing.module'; - -import { LandingModule } from '../landing-utils/landing.module'; -import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module'; +import {OrganizationComponent} from './organization.component'; +import {LandingModule} from '../landing-utils/landing.module'; +import {TabResultModule} from '../../searchPages/searchUtils/tabResult.module'; import {DataProvidersServiceModule} from '../../services/dataProvidersService.module'; import {ReportsServiceModule} from '../../services/reportsService.module'; import {PublicationsServiceModule} from '../../services/publicationsService.module'; // import {DatasetsServiceModule} from '../../services/datasetsService.module'; import {ProjectsServiceModule} from '../../services/projectsService.module'; -import { SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module'; -import {FreeGuard} from'../../login/freeGuard.guard'; +import {SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module'; +import {FreeGuard} from '../../login/freeGuard.guard'; import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; -import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; +import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module'; +import {HelperModule} from "../../utils/helper/helper.module"; + @NgModule({ imports: [ @@ -38,19 +38,19 @@ import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; SearchingProjectsTabModule, OrganizationServiceModule, PublicationsServiceModule, - // DatasetsServiceModule, ProjectsServiceModule, - Schema2jsonldModule, SEOServiceModule + Schema2jsonldModule, SEOServiceModule, HelperModule ], declarations: [ - OrganizationComponent, + OrganizationComponent, ], - providers:[ + providers: [ FreeGuard, IsRouteEnabled - ], + ], exports: [ - OrganizationComponent - ] + OrganizationComponent + ] }) -export class OrganizationModule { } +export class OrganizationModule { +} diff --git a/landingPages/orp/orp.component.html b/landingPages/orp/orp.component.html index cd58a711..8b293035 100644 --- a/landingPages/orp/orp.component.html +++ b/landingPages/orp/orp.component.html @@ -2,18 +2,31 @@
    - - - + + +
    +
    - - - {{orpInfo.types.join(", ")}}{{" "}} - {{orpInfo.languages.join(", ")}}{{" "}} - {{orpInfo.countries.join(", ")}}{{" "}} - {{orpInfo.accessMode}}{{" "}} + + + {{orpInfo.types.join(", ")}}{{" "}} + {{orpInfo.languages.join(", ")}}{{" "}} + {{orpInfo.countries.join(", ")}}{{" "}} + {{orpInfo.accessMode}}{{" "}} @@ -22,7 +35,7 @@ {{" "}} -
    +
    ({{orpInfo.date}})
    @@ -30,7 +43,8 @@
      -
    • Embargo end date: {{orpInfo.embargoEndDate}}
    • +
    • Embargo end date: {{orpInfo.embargoEndDate}}
    • @@ -42,16 +56,21 @@

    -
    +
    {{orpInfo.description.substring(0, showNumDescription)}}... + >... View more
    -
    +
    View less @@ -59,43 +78,49 @@
    +
  • Related Research Results - ({{relatedResearchResultsNum | number}}) + ({{relatedResearchResultsNum | number}})
    {{provenanceaction}}
    - +
    @@ -105,12 +130,13 @@ Similar Research Results - ({{orpInfo.similarResearchResults.length | number}}) + ({{orpInfo.similarResearchResults.length | number}})
    - +
  • @@ -120,25 +146,27 @@ Metrics
    - + + [url]=viewsFrameUrl width="100%" height="250">
    -
  • +
  • Other Versions ({{orpInfo.deletedByInferenceIds.length | number}})
    - +
  • @@ -147,7 +175,7 @@
    -
    Share - Bookmark
    +
    Share - Bookmark
    -
  • -
    -
    Related to
    -
    - +
  • +
    +
    Related to
    +
    + {{item['labelContext']}} -> {{item['labelCategory']}} : {{item['labelConcept']}} - - {{item['labelContext']}} - -> {{item['labelCategory']}} - : {{item['labelConcept']}} - -
    + + {{item['labelContext']}} + -> {{item['labelCategory']}} + : {{item['labelConcept']}} + +
  • -
  • -
  • +
  • +
  • -
    - Cite this research product -
    -
    - -
    +
    + Cite this research product +
    +
    + +
    -
  • - - + +
    + +
    +
    +
    + +
    + +
    - - -
    -
    -
    +
    +
    diff --git a/landingPages/orp/orp.component.ts b/landingPages/orp/orp.component.ts index ae4a55aa..0da8d889 100644 --- a/landingPages/orp/orp.component.ts +++ b/landingPages/orp/orp.component.ts @@ -1,217 +1,248 @@ -import {Component, ViewChild} from '@angular/core'; -import {Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; -import {Observable} from 'rxjs'; +import {OrpInfo} from '../../utils/entities/orpInfo'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {RouterHelper} from '../../utils/routerHelper.class'; -import {OrpInfo} from '../../utils/entities/orpInfo'; -import {EnvProperties} from '../../utils/properties/env-properties'; -import {RouterHelper} from '../../utils/routerHelper.class'; - -import {OrpService} from './orp.service'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {OrpService} from './orp.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ - selector: 'orp', - templateUrl: 'orp.component.html', + selector: 'orp', + templateUrl: 'orp.component.html', }) export class OrpComponent { - @Input() piwikSiteId = null; - public orpInfo: OrpInfo; - public orpId : string ; + @Input() piwikSiteId = null; + @Input() communityId = null; + public orpInfo: OrpInfo; + public orpId: string; - // APP BOX variables - public showAllCollectedFrom: boolean = false; - public showAllDownloadFrom: boolean = false; - public showAllPublishedIn: boolean = false; + // APP BOX variables + public showAllCollectedFrom: boolean = false; + public showAllDownloadFrom: boolean = false; + public showAllPublishedIn: boolean = false; - public thresholdDescription: number = 270; - public showNumDescription: number = 270; - - // Metrics tab variables - public metricsClicked: boolean; - public viewsFrameUrl: string; - public downloadsFrameUrl: string; - public totalViews: number; - public totalDownloads: number; - public pageViews: number; + public thresholdDescription: number = 270; + public showNumDescription: number = 270; - // Custom tab paging variables - public referencesPage: number = 1; - public pageSize: number = 10; + // Metrics tab variables + public metricsClicked: boolean; + public viewsFrameUrl: string; + public downloadsFrameUrl: string; + public totalViews: number; + public totalDownloads: number; + public pageViews: number; - // Active tab variable for responsiveness - public activeTab: string = "References"; + // Custom tab paging variables + public referencesPage: number = 1; + public pageSize: number = 10; - // Map counting variable - public relatedResearchResultsNum: number = 0; + // Active tab variable for responsiveness + public activeTab: string = "References"; - // Message variables - public warningMessage = ""; - public errorMessage = ""; - public showLoading: boolean = true; + // Map counting variable + public relatedResearchResultsNum: number = 0; - public routerHelper:RouterHelper = new RouterHelper(); + // Message variables + public warningMessage = ""; + public errorMessage = ""; + public showLoading: boolean = true; + public pageContents = null; + public divContents = null; - private result ; - sub: any; piwiksub: any; infoSub: any; - properties:EnvProperties; + public routerHelper: RouterHelper = new RouterHelper(); - constructor (private _orpService: OrpService, - private _piwikService:PiwikService, - private route: ActivatedRoute, - private router: Router, - private _meta: Meta, - private _title: Title, - private _router: Router, - private seoService: SEOService) { - } + private result; + sub: any; + piwiksub: any; + infoSub: any; + properties: EnvProperties; - ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.updateUrl(data.envSpecific.baseLink+this._router.url); + constructor(private _orpService: OrpService, + private _piwikService: PiwikService, + private route: ActivatedRoute, + private router: Router, + private _meta: Meta, + private _title: Title, + private _router: Router, + private helper: HelperService, + private seoService: SEOService) { + } - }); - this.sub = this.route.queryParams.subscribe(params => { - this.orpInfo = null; - this.updateTitle("Other Research Product"); - this.updateDescription(""); - this.orpId = params['orpId']; + ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); + this.updateUrl(data.envSpecific.baseLink + this._router.url); - if(this.orpId){ - this.getOrpInfo(this.orpId); - }else{ - this.showLoading = false; - this.warningMessage="No valid research product id"; - } + }); + this.sub = this.route.queryParams.subscribe(params => { + this.orpInfo = null; + this.updateTitle("Other Research Product"); + this.updateDescription(""); + this.orpId = params['orpId']; - this.metricsClicked = false; - - this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.orpId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - - this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.orpId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - - this.scroll(); - }); - - } - - ngOnDestroy() { - if(this.sub){ - this.sub.unsubscribe(); + if (this.orpId) { + this.getOrpInfo(this.orpId); + } else { + this.showLoading = false; + this.warningMessage = "No valid research product id"; } - if(this.piwiksub){ - this.piwiksub.unsubscribe(); - } - if(this.infoSub) { - this.infoSub.unsubscribe(); + + this.metricsClicked = false; + + this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.orpId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + + this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.orpId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + + this.scroll(); + }); + + } + + private getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } + + private getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + + ngOnDestroy() { + if (this.sub) { + this.sub.unsubscribe(); + } + if (this.piwiksub) { + this.piwiksub.unsubscribe(); + } + if (this.infoSub) { + this.infoSub.unsubscribe(); + } + } + + private getOrpInfo(id: string) { + this.warningMessage = ''; + this.errorMessage = "" + this.showLoading = true; + + this.orpInfo = null; + + this.infoSub = this._orpService.getOrpInfo(id, this.properties).subscribe( + data => { + this.orpInfo = data; + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrp + this.orpInfo.record["result"]["header"]["dri:objIdentifier"]); + if (this.orpInfo.title) { + this.updateTitle(this.orpInfo.title); + this.updateDescription((this.orpInfo.description ? (this.orpInfo.description) : ("," + this.orpInfo.title))); + } + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, this.orpInfo.title, this.piwikSiteId).subscribe(); + } + + this.result = [] + this.result = { + id: id, + type: "orp", + source: "openaire", + title: this.orpInfo.title, + url: '', + result: '', + accessRights: this.orpInfo.accessMode, + embargoEndDate: '' + }; + + let relatedResearchResultsNum = 0; + if (this.orpInfo.relatedResearchResults != undefined) { + this.orpInfo.relatedResearchResults.forEach(function (value, key, map) { + relatedResearchResultsNum += value.length; + }); + } + this.relatedResearchResultsNum = relatedResearchResultsNum; + + this.showLoading = false; + }, + err => { + //console.log(err) + this.handleError("Error getting other research product for id: " + this.orpId, err); + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrps); + this.errorMessage = 'No research product found'; + this.showLoading = false; } + ); + } + + public metricsResults($event) { + this.totalViews = $event.totalViews; + this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } + + public buildCurationTooltip() { + let tooltipContent: string = "
    "; + + tooltipContent += "

    Record in preview

    "; + tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; + + return tooltipContent; + } + + public getKeys(map) { + return Array.from(map.keys()); + } + + public scroll() { + HelperFunctions.scroll(); + } + + private handleError(message: string, error) { + console.error("Other Research Product Landing Page: " + message, error); + } + + public updateReferencesPage($event) { + this.referencesPage = $event.value; + } + + public totalPages(totalResults: number): number { + let totalPages: any = totalResults / this.pageSize; + if (!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, this.pageSize) + 1); } + return totalPages; + } - private getOrpInfo(id:string) { - this.warningMessage = ''; - this.errorMessage="" - this.showLoading = true; - - this.orpInfo = null; - - this.infoSub = this._orpService.getOrpInfo(id, this. properties).subscribe( - data => { - this.orpInfo = data; - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrp + this.orpInfo.record["result"]["header"]["dri:objIdentifier"]); - if(this.orpInfo.title){ - this.updateTitle(this.orpInfo.title); - this.updateDescription((this.orpInfo.description?(this.orpInfo.description):(","+this.orpInfo.title))); - } - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, this.orpInfo.title, this.piwikSiteId).subscribe(); - } - - this.result = [] - this.result = {id: id, type :"orp", source : "openaire", title: this.orpInfo.title,url: '', result: '', accessRights: this.orpInfo.accessMode, embargoEndDate: ''}; - - let relatedResearchResultsNum = 0; - if(this.orpInfo.relatedResearchResults != undefined) { - this.orpInfo.relatedResearchResults.forEach(function (value, key, map) { - relatedResearchResultsNum += value.length; - }); - } - this.relatedResearchResultsNum = relatedResearchResultsNum; - - this.showLoading = false; - }, - err => { - //console.log(err) - this.handleError("Error getting other research product for id: "+this.orpId, err); - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrps); - this.errorMessage = 'No research product found'; - this.showLoading = false; - } - ); - } - - public metricsResults($event) { - this.totalViews = $event.totalViews; - this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; - } - - private updateDescription(description:string){ - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string){ - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(_title); - this._meta.updateTag({content:_title},"property='og:title'"); - } - private updateUrl(url:string){ - this._meta.updateTag({content:url},"property='og:url'"); - } - - public buildCurationTooltip() { - let tooltipContent: string = "
    "; - - tooltipContent += "

    Record in preview

    "; - tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; - - return tooltipContent; - } - public getKeys( map) { - return Array.from(map.keys()); - } - - public scroll() { - HelperFunctions.scroll(); - } - - private handleError(message: string, error) { - console.error("Other Research Product Landing Page: "+message, error); - } - - public updateReferencesPage($event) { - this.referencesPage = $event.value; - } - - public totalPages(totalResults: number): number { - let totalPages:any = totalResults/this.pageSize; - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, this.pageSize) + 1); - } - return totalPages; - } - isRouteAvailable(routeToCheck:string){ + isRouteAvailable(routeToCheck: string) { for (let i = 0; i < this.router.config.length; i++) { - let routePath:string = this.router.config[i].path; - if(routePath == routeToCheck){ + let routePath: string = this.router.config[i].path; + if (routePath == routeToCheck) { return true; } } diff --git a/landingPages/orp/orp.module.ts b/landingPages/orp/orp.module.ts index 2c3447fd..30f136c0 100644 --- a/landingPages/orp/orp.module.ts +++ b/landingPages/orp/orp.module.ts @@ -1,29 +1,29 @@ -import {NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {FormsModule} from '@angular/forms'; -import {RouterModule} from '@angular/router'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {RouterModule} from '@angular/router'; -import {SharedModule} from '../../shared/shared.module'; +import {SharedModule} from '../../shared/shared.module'; -import {OrpComponent} from './orp.component'; +import {OrpComponent} from './orp.component'; -import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; -import {LandingModule} from '../landing-utils/landing.module'; -import {ResultLandingModule} from '../landing-utils/resultLanding.module'; -import {MetricsModule} from '../landing-utils/metrics.module'; -import {AltMetricsModule} from '../../utils/altmetrics.module'; +import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; +import {LandingModule} from '../landing-utils/landing.module'; +import {ResultLandingModule} from '../landing-utils/resultLanding.module'; +import {MetricsModule} from '../landing-utils/metrics.module'; +import {AltMetricsModule} from '../../utils/altmetrics.module'; import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module'; -import {IFrameModule} from '../../utils/iframe.module'; -import {PagingModule} from '../../utils/paging.module'; +import {IFrameModule} from '../../utils/iframe.module'; +import {PagingModule} from '../../utils/paging.module'; -import {OrpService} from './orp.service'; +import {OrpService} from './orp.service'; -import {FreeGuard} from'../../login/freeGuard.guard'; -import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; +import {FreeGuard} from '../../login/freeGuard.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; -import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; -import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; +import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module'; +import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/deletedByInference.module"; +import {HelperModule} from "../../utils/helper/helper.module"; @NgModule({ @@ -31,17 +31,18 @@ import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/dele CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, - ShowAuthorsModule, DeletedByInferenceModule + ShowAuthorsModule, DeletedByInferenceModule, HelperModule ], declarations: [ OrpComponent ], - providers:[ - OrpService, FreeGuard, IsRouteEnabled + providers: [ + OrpService, FreeGuard ], exports: [ OrpComponent ] }) -export class OrpModule { } +export class OrpModule { +} diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 8ba58a95..57cefc62 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -1,15 +1,23 @@ -
    +
    -
    +
    -
    - - - +
    + + + -
    -
    - +
    + +
    +

    @@ -17,29 +25,43 @@ {{projectName}} - ({{projectInfo.contractNum}}) + ({{projectInfo.contractNum}})

    -
    {{projectInfo.title}} ({{projectInfo.contractNum}})
    +
    {{projectInfo.title}} + ({{projectInfo.contractNum}}) +
    Project{{" "}} {{projectInfo.funder}}{{" "}} - + Open Access mandate for Publications and Research Data {{" "}} - Open Access mandate for Publications{{" "}} - Special Clause 39{{" "}} - Open Access mandate for Research Data{{" "}} + Open Access mandate for Publications{{" "}} + Special Clause 39{{" "}} + Open Access mandate for Research Data{{" "}}
    + + +
  • + + Other Research Products + + ({{fetchOrps.searchUtils.totalResults | number}}) + + + +
  • + +
  • + + Statistics + +
    + + +
    + +
    +

    Research Results

    + +

    Access Mode of Research Results

    + +

    By Datasource of Research Results

    + +
    +
    +
    +
  • + +
  • + + Metrics + +
    + - - + + - - + - -
    -
  • + +
    + @@ -403,161 +436,235 @@
    --> -
    - -
    -
    -
    - Share - Bookmark
    -
    -
    - Application Box -
    -
    - -
    + +
  • + + + Get {{projectInfo.funder}} report (HTML) + +
  • +
  • + + + Get {{projectInfo.funder}} report (CSV) + +
  • +
  • + + + + Deposit + +
  • + + +
  • + + +
  • + + +
    + + -
    - +
    + +
    + +
    - -
    - +
    + + + +
    - - - - -
    -
    -
    +
    diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 957ef137..a020904c 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -1,43 +1,41 @@ -import {Component, ViewChild} from '@angular/core'; -import {Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Params} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {Component, Input, ViewChild} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; -import {Observable} from 'rxjs'; +import {ProjectService} from './project.service'; +import {ProjectInfo} from '../../utils/entities/projectInfo'; +import {RouterHelper} from '../../utils/routerHelper.class'; -import {ProjectService} from './project.service'; -import {ProjectInfo} from '../../utils/entities/projectInfo'; -import {RouterHelper} from '../../utils/routerHelper.class'; +import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; +import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; +import {SearchSoftwareService} from '../../services/searchSoftware.service'; +import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class'; +import {SearchOrpsService} from '../../services/searchOrps.service'; -import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; -import {SearchPublicationsService} from '../../services/searchPublications.service'; -import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import {SearchDatasetsService} from '../../services/searchDatasets.service'; -import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; -import {SearchSoftwareService} from '../../services/searchSoftware.service'; -import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class'; -import {SearchOrpsService} from '../../services/searchOrps.service'; +import {ModalLoading} from '../../utils/modal/loading.component'; -import {ModalLoading} from '../../utils/modal/loading.component'; +import {ReportsService} from '../../services/reports.service'; +import {ErrorCodes} from '../../utils/properties/errorCodes' -import {ReportsService} from '../../services/reports.service'; -import {ErrorCodes} from '../../utils/properties/errorCodes' - -import {PiwikService} from '../../utils/piwik/piwik.service'; -import {EnvProperties} from '../../utils/properties/env-properties'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ - selector: 'project', - templateUrl: 'project.component.html', - }) + selector: 'project', + templateUrl: 'project.component.html', +}) -export class ProjectComponent{ +export class ProjectComponent { @Input() piwikSiteId = null; + @Input() communityId = null; public projectInfo: ProjectInfo; - public projectId : string ; + public projectId: string; public projectName: string; // Metrics tab variables @@ -60,7 +58,7 @@ export class ProjectComponent{ public software_dynamic: string; public orps_dynamic: string; - public project ; + public project; // CSV variables public downloadURLAPI: string; @@ -84,419 +82,457 @@ export class ProjectComponent{ private reloadOrps: boolean = true; // Variables for publications, research data, software tabs - public fetchPublications : FetchPublications; + public fetchPublications: FetchPublications; public linkToSearchPublications = ""; - public fetchDatasets : FetchDatasets; + public fetchDatasets: FetchDatasets; public linkToSearchDatasets = ""; public fetchSoftware: FetchSoftware; public linkToSearchSoftware = ""; public fetchOrps: FetchOrps; public linkToSearchOrps = ""; - public routerHelper:RouterHelper = new RouterHelper(); - public errorCodes:ErrorCodes = new ErrorCodes(); + public routerHelper: RouterHelper = new RouterHelper(); + public errorCodes: ErrorCodes = new ErrorCodes(); + public pageContents = null; + public divContents = null; - @ViewChild (ModalLoading) loading : ModalLoading ; + @ViewChild(ModalLoading) loading: ModalLoading; // Alert box when something is wrong with CSV requests @ViewChild('AlertModalCsvError') alertCsvError; - sub: any; piwiksub: any; infoSub: any; downloadFilePiwikSub: any; -properties:EnvProperties; - constructor ( private _projectService: ProjectService, - private _piwikService:PiwikService, - private route: ActivatedRoute, - private router: Router, - private _searchPublicationsService: SearchPublicationsService, - private _searchDatasetsService: SearchDatasetsService, - private _searchSoftwareService: SearchSoftwareService, - private _searchOrpsService: SearchOrpsService, - private _reportsService: ReportsService, - private _meta: Meta, - private _title: Title, - private _router: Router, + sub: any; + piwiksub: any; + infoSub: any; + downloadFilePiwikSub: any; + properties: EnvProperties; + + constructor(private _projectService: ProjectService, + private _piwikService: PiwikService, + private route: ActivatedRoute, + private router: Router, + private _searchPublicationsService: SearchPublicationsService, + private _searchDatasetsService: SearchDatasetsService, + private _searchSoftwareService: SearchSoftwareService, + private _searchOrpsService: SearchOrpsService, + private _reportsService: ReportsService, + private _meta: Meta, + private _title: Title, + private _router: Router, + private helper: HelperService, private seoService: SEOService) { } ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.updateUrl(data.envSpecific.baseLink+this._router.url); + this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); + this.updateUrl(data.envSpecific.baseLink + this._router.url); }); - this.sub = this.route.queryParams.subscribe(params => { - this.metricsClicked = false; - this.statsClicked = false; - this.fetchPublications = new FetchPublications( this._searchPublicationsService); - this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); - this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); - this.fetchOrps = new FetchOrps(this._searchOrpsService); + this.sub = this.route.queryParams.subscribe(params => { + this.metricsClicked = false; + this.statsClicked = false; + this.fetchPublications = new FetchPublications(this._searchPublicationsService); + this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); + this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); + this.fetchOrps = new FetchOrps(this._searchOrpsService); - var title = "Project"; - var description = ""; + var title = "Project"; + var description = ""; - this.updateTitle(title); - this.updateDescription(description); + this.updateTitle(title); + this.updateDescription(description); this.projectId = params['projectId']; var grantId = params['grantId']; var funder = params['funder']; - if(this.projectId){ - this.getProjectInfo(this.projectId); - this.actionsAfterLoadId(); - }else if(grantId && funder){ - this.getProjectInfoByGrantId(grantId,funder); - }else{ + if (this.projectId) { + this.getProjectInfo(this.projectId); + this.actionsAfterLoadId(); + } else if (grantId && funder) { + this.getProjectInfoByGrantId(grantId, funder); + } else { - this.showLoading = false; - this.warningMessage="No valid project id"; + this.showLoading = false; + this.warningMessage = "No valid project id"; } this.downloadURLAPI = this.properties.csvAPIURL; this.createClipboard(); - this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \""+this.projectId+"\"))"; - this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact \""+this.projectId+"\"))"; - this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact \""+this.projectId+"\"))"; - this.csvParamsOrps = "?format=csv-special&type=other&fq=(((oaftype exact result) and (resulttypeid exact other)) and (relprojectid exact \""+this.projectId+"\"))"; + this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \"" + this.projectId + "\"))"; + this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact \"" + this.projectId + "\"))"; + this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact \"" + this.projectId + "\"))"; + this.csvParamsOrps = "?format=csv-special&type=other&fq=(((oaftype exact result) and (resulttypeid exact other)) and (relprojectid exact \"" + this.projectId + "\"))"; HelperFunctions.scroll(); - }); -} + }); + } -actionsAfterLoadId(){ - this.publications_dynamic = - ""; + private getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } - this.datasets_dynamic = - ""; + private getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } - this.software_dynamic = - ""; + actionsAfterLoadId() { + this.publications_dynamic = + ""; - this.orps_dynamic = - ""; + this.datasets_dynamic = + ""; + + this.software_dynamic = + ""; + + this.orps_dynamic = + ""; + + this.getProjectInfo(this.projectId); + //this.searchPublications(); + this.fetchPublications.getNumForEntity("project", this.projectId, this.properties); + this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties); + this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties); + this.fetchOrps.getNumForEntity("project", this.projectId, this.properties); + } - this.getProjectInfo(this.projectId); - //this.searchPublications(); - this.fetchPublications.getNumForEntity("project", this.projectId, this.properties); - this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties); - this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties); - this.fetchOrps.getNumForEntity("project", this.projectId, this.properties); -} ngOnDestroy() { - if(this.sub){ + if (this.sub) { this.sub.unsubscribe(); } - if(this.piwiksub){ + if (this.piwiksub) { this.piwiksub.unsubscribe(); } - if(this.infoSub) { + if (this.infoSub) { this.infoSub.unsubscribe(); } - if(this.downloadFilePiwikSub) { + if (this.downloadFilePiwikSub) { this.downloadFilePiwikSub.unsubscribe(); } } private createClipboard() { - if(typeof window !== 'undefined') { + if (typeof window !== 'undefined') { - let publ_clipboard, datasets_clipboard, software_clipboard, orps_clipboard; - let Clipboard; - Clipboard = require('clipboard'); - publ_clipboard = new Clipboard('.publ_clipboard_btn'); - datasets_clipboard = new Clipboard('.datasets_clipboard_btn'); - software_clipboard = new Clipboard('.software_clipboard_btn'); - orps_clipboard = new Clipboard('.orps_clipboard_btn'); - } + let publ_clipboard, datasets_clipboard, software_clipboard, orps_clipboard; + let Clipboard; + Clipboard = require('clipboard'); + publ_clipboard = new Clipboard('.publ_clipboard_btn'); + datasets_clipboard = new Clipboard('.datasets_clipboard_btn'); + software_clipboard = new Clipboard('.software_clipboard_btn'); + orps_clipboard = new Clipboard('.orps_clipboard_btn'); + } } private searchPublications() { this.fetchPublications.getResultsForEntity("project", this.projectId, 1, 10, this.properties); this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications;// + "?project=" + this.projectId+"&pr=and"; //if(this.fetchPublications.searchUtils.totalResults > 0) { - //this.activeTab = "Publications"; + //this.activeTab = "Publications"; //} else { - //this.searchDatasetsInit(); + //this.searchDatasetsInit(); //} this.reloadPublications = false; } private searchDatasets() { - this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10, this.properties); - this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;// + "?project=" + this.projectId+"&pr=and"; + this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10, this.properties); + this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;// + "?project=" + this.projectId+"&pr=and"; - this.reloadDatasets = false; - //this.activeTab = "Research Data"; + this.reloadDatasets = false; + //this.activeTab = "Research Data"; } private searchSoftware() { - this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10, this.properties); - this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware; - this.reloadSoftware = false; + this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10, this.properties); + this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware; + this.reloadSoftware = false; } private searchOrps() { - this.fetchOrps.getResultsForEntity("project", this.projectId, 1, 10, this.properties); - this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps; - this.reloadOrps = false; + this.fetchOrps.getResultsForEntity("project", this.projectId, 1, 10, this.properties); + this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps; + this.reloadOrps = false; } public searchPublicationsInit() { - if(this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) { - this.searchPublications(); - } else if(this.fetchPublications.searchUtils.totalResults == 0) { - //this.statsClicked=true; - //this.activeTab = "Statistics"; - } + if (this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) { + this.searchPublications(); + } else if (this.fetchPublications.searchUtils.totalResults == 0) { + //this.statsClicked=true; + //this.activeTab = "Statistics"; + } } public searchDatasetsInit() { - if(this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) { - this.searchDatasets(); - } else if(this.fetchDatasets.searchUtils.totalResults == 0) { - //this.statsClicked=true; - //this.activeTab = "Statistics"; - } + if (this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) { + this.searchDatasets(); + } else if (this.fetchDatasets.searchUtils.totalResults == 0) { + //this.statsClicked=true; + //this.activeTab = "Statistics"; + } } public searchSoftwareInit() { - if(this.reloadSoftware && this.fetchSoftware.searchUtils.totalResults > 0) { - this.searchSoftware(); - } + if (this.reloadSoftware && this.fetchSoftware.searchUtils.totalResults > 0) { + this.searchSoftware(); + } } public searchOrpsInit() { - if(this.reloadOrps && this.fetchOrps.searchUtils.totalResults > 0) { - this.searchOrps(); - } + if (this.reloadOrps && this.fetchOrps.searchUtils.totalResults > 0) { + this.searchOrps(); + } } - private getProjectInfo (id:string) { - this.warningMessage = ''; - this.errorMessage="" + private getProjectInfo(id: string) { + this.warningMessage = ''; + this.errorMessage = "" this.showLoading = true; this.projectInfo = null; this.infoSub = this._projectService.getProjectInfo(id, this.properties).subscribe( data => { - this.projectInfo = data; + this.projectInfo = data; - this.actionsAfterGettingProjectInfo(); + this.actionsAfterGettingProjectInfo(); }, err => { - //console.log(err); - this.handleError("Error getting project for id: "+this.projectId, err); + //console.log(err); + this.handleError("Error getting project for id: " + this.projectId, err); this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects); - this.errorMessage = 'No project found'; - this.showLoading = false; - } + this.errorMessage = 'No project found'; + this.showLoading = false; + } ); - } - private getProjectInfoByGrantId (grantId:string, funder:string) { - this.warningMessage = ''; - this.errorMessage="" - this.showLoading = true; + } - this.projectInfo = null; + private getProjectInfoByGrantId(grantId: string, funder: string) { + this.warningMessage = ''; + this.errorMessage = "" + this.showLoading = true; - this._projectService.getProjectInfoByGrantId(grantId,funder,this.properties).subscribe( - data =>{ + this.projectInfo = null; - this.projectInfo = data; + this._projectService.getProjectInfoByGrantId(grantId, funder, this.properties).subscribe( + data => { - this.actionsAfterGettingProjectInfo(); - this.projectId = this.projectInfo.id; - this.actionsAfterLoadId(); - }, - err => { - //console.log(err); - this.handleError("Error getting project for grant id: "+grantId+" and funder: "+funder, err); - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects); - this.errorMessage = 'No project found'; - this.showLoading = false; - } - ); - } -actionsAfterGettingProjectInfo(){ - this.projectName = this.projectInfo.acronym; - if(this.projectName == undefined || this.projectName == '') { + this.projectInfo = data; + + this.actionsAfterGettingProjectInfo(); + this.projectId = this.projectInfo.id; + this.actionsAfterLoadId(); + }, + err => { + //console.log(err); + this.handleError("Error getting project for grant id: " + grantId + " and funder: " + funder, err); + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects); + this.errorMessage = 'No project found'; + this.showLoading = false; + } + ); + } + + actionsAfterGettingProjectInfo() { + this.projectName = this.projectInfo.acronym; + if (this.projectName == undefined || this.projectName == '') { this.projectName = this.projectInfo.title; - } - this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url); - this.updateTitle(this.projectName); - this.updateDescription("project, "+this.projectName+ ","+this.projectInfo.funder+","+this.projectInfo.acronym); - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe(); + } + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url); + this.updateTitle(this.projectName); + this.updateDescription("project, " + this.projectName + "," + this.projectInfo.funder + "," + this.projectInfo.acronym); + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe(); + } + + this.project = { + funderId: "", + funderName: this.projectInfo.funder, + projectId: this.projectId, + projectName: this.projectInfo.title, + projectAcronym: this.projectInfo.acronym, + startDate: this.projectInfo.startDate, + endDate: this.projectInfo.endDate + }; + + this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"' + this.projectId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + + this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"projRepoDownloads","projTitle":"' + this.projectId + '","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + + //stats tab charts + this.chartScientificResultsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + this.chartAccessModeUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + this.chartDatasourcesUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projPubsRepos","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + + this.showLoading = false; } - this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate }; + public downloadfile(url: string, filename: string) { + this.openLoading(); + this.setMessageLoading("Downloading CSV file"); - this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this._reportsService.downloadCSVFile(url).subscribe( + data => { + this.closeLoading(); - this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"projRepoDownloads","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + var url = window.URL.createObjectURL(data); + var a = window.document.createElement('a'); + window.document.body.appendChild(a); + a.setAttribute('style', 'display: none'); + a.href = url; + a.download = filename + ".csv"; + a.click(); + window.URL.revokeObjectURL(url); + a.remove(); // remove the element - //stats tab charts - this.chartScientificResultsUrl=this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; - this.chartAccessModeUrl=this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; - this.chartDatasourcesUrl= this.properties.statisticsFrameAPIURL+'chart.php?com=query&persistent=false&data={"query":"projPubsRepos","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250'; + //window.open(window.URL.createObjectURL(data)); + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe(); + } + }, + error => { + //console.log("Error downloading the file."); + this.handleError("Error downloading file: " + filename, error); - this.showLoading = false; -} - public downloadfile(url:string, filename: string){ - this.openLoading(); - this.setMessageLoading("Downloading CSV file"); - - this._reportsService.downloadCSVFile(url).subscribe( - data => { - this.closeLoading(); - - var url = window.URL.createObjectURL(data); - var a = window.document.createElement('a'); - window.document.body.appendChild(a); - a.setAttribute('style', 'display: none'); - a.href = url; - a.download = filename+".csv"; - a.click(); - window.URL.revokeObjectURL(url); - a.remove(); // remove the element - - //window.open(window.URL.createObjectURL(data)); - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe(); - } - }, - error => { - //console.log("Error downloading the file."); - this.handleError("Error downloading file: "+filename, error); - - this.closeLoading(); - this.confirmOpenCsvError(); - }/*, + this.closeLoading(); + this.confirmOpenCsvError(); + }/*, () => console.log('Completed file download.')*/ - ); - } + ); + } -/* - showHTML(){ - let info:string = "

    Publications of Project "; + /* + showHTML(){ + let info:string = "

    Publications of Project "; - if(this.projectInfo.title != undefined && this.projectInfo.title != "") { - info += this.projectInfo.title; - } - if((this.projectInfo.title != undefined && this.projectInfo.title != "") && - ((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") || - (this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) { - info += "("; - } - if(this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") { - info += this.projectInfo.acronym + " - "; - } - if(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != "") { - info += this.projectInfo.callIdentifier; - } - if((this.projectInfo.title != undefined && this.projectInfo.title != "") && - ((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") || - (this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) { - info += ")"; - } - info +="

    "; - info += "

    "+this.fetchPublications.searchUtils.totalResults+" publications

    "; + if(this.projectInfo.title != undefined && this.projectInfo.title != "") { + info += this.projectInfo.title; + } + if((this.projectInfo.title != undefined && this.projectInfo.title != "") && + ((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") || + (this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) { + info += "("; + } + if(this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") { + info += this.projectInfo.acronym + " - "; + } + if(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != "") { + info += this.projectInfo.callIdentifier; + } + if((this.projectInfo.title != undefined && this.projectInfo.title != "") && + ((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") || + (this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) { + info += ")"; + } + info +=""; + info += "

    "+this.fetchPublications.searchUtils.totalResults+" publications

    "; - let htmlParams = 'resources?format=html&page=0&size='+this.fetchPublications.searchUtils.totalResults+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "'+this.projectId+'"))'; - this._reportsService.downloadHTMLFile(this.downloadURLAPI+htmlParams, info) - .subscribe(data => this.funct(data), - error => console.log("Error downloading the file."), - () => console.log('Completed file download.')); - } + let htmlParams = 'resources?format=html&page=0&size='+this.fetchPublications.searchUtils.totalResults+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "'+this.projectId+'"))'; + this._reportsService.downloadHTMLFile(this.downloadURLAPI+htmlParams, info) + .subscribe(data => this.funct(data), + error => console.log("Error downloading the file."), + () => console.log('Completed file download.')); + } - funct(data) { - var win = window.open(window.URL.createObjectURL(data)); - } -*/ - public metricsResults($event) { - this.totalViews = $event.totalViews; - this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; - } + funct(data) { + var win = window.open(window.URL.createObjectURL(data)); + } + */ + public metricsResults($event) { + this.totalViews = $event.totalViews; + this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; + } - private updateDescription(description:string) { - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string) { - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(_title); - this._meta.updateTag({content:_title},"property='og:title'"); - } - private updateUrl(url:string) { - this._meta.updateTag({content:url},"property='og:url'"); - } + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } - private openLoading(){ - if(this.loading){ - this.loading.open(); - } - } - private closeLoading(){ - if(this.loading){ - this.loading.close(); - } - } - private setMessageLoading(message: string){ - if(this.loading){ - this.loading.message = message; - } - } + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } - public confirmOpenCsvError(){ - this.alertCsvError.cancelButton = false; - this.alertCsvError.okButton = true; - this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE"; - this.alertCsvError.message = "There was an error in csv downloading. Please try again later."; - this.alertCsvError.okButtonText = "OK"; - this.alertCsvError.open(); - } + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } - private handleError(message: string, error) { - console.error("Project Landing Page: "+message, error); + private openLoading() { + if (this.loading) { + this.loading.open(); } - isRouteAvailable(routeToCheck:string){ + } + + private closeLoading() { + if (this.loading) { + this.loading.close(); + } + } + + private setMessageLoading(message: string) { + if (this.loading) { + this.loading.message = message; + } + } + + public confirmOpenCsvError() { + this.alertCsvError.cancelButton = false; + this.alertCsvError.okButton = true; + this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE"; + this.alertCsvError.message = "There was an error in csv downloading. Please try again later."; + this.alertCsvError.okButtonText = "OK"; + this.alertCsvError.open(); + } + + private handleError(message: string, error) { + console.error("Project Landing Page: " + message, error); + } + + isRouteAvailable(routeToCheck: string) { for (let i = 0; i < this.router.config.length; i++) { - let routePath:string = this.router.config[i].path; - if(routePath == routeToCheck){ + let routePath: string = this.router.config[i].path; + if (routePath == routeToCheck) { return true; } } diff --git a/landingPages/project/project.module.ts b/landingPages/project/project.module.ts index 044f0cf6..68b40f67 100644 --- a/landingPages/project/project.module.ts +++ b/landingPages/project/project.module.ts @@ -5,13 +5,11 @@ import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { ProjectServiceModule} from './projectService.module'; -// import {HtmlProgressReportService} from './htmlProgressReport.service'; -import{LoadingModalModule} from '../../utils/modal/loadingModal.module'; +import {LoadingModalModule} from '../../utils/modal/loadingModal.module'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {ErrorMessagesModule} from '../../utils/errorMessages.module'; import { ProjectComponent } from './project.component'; -// import { ProjectRoutingModule } from './project-routing.module'; import {IFrameModule} from '../../utils/iframe.module'; import {MetricsModule} from '../landing-utils/metrics.module'; import {ReportsServiceModule} from '../../services/reportsService.module'; @@ -25,22 +23,21 @@ import {FreeGuard} from'../../login/freeGuard.guard'; import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; +import {HelperModule} from "../../utils/helper/helper.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, LandingModule, - LoadingModalModule, AlertModalModule, ErrorMessagesModule, + LoadingModalModule, AlertModalModule, ErrorMessagesModule, TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule, PublicationsServiceModule, DatasetsServiceModule, SoftwareServiceModule, OrpsServiceModule, ProjectServiceModule, - Schema2jsonldModule, SEOServiceModule + Schema2jsonldModule, SEOServiceModule, HelperModule ], declarations: [ ProjectComponent ], providers:[ - // ProjectService, - // HtmlProgressReportService FreeGuard, IsRouteEnabled ], exports: [ diff --git a/landingPages/project/projectService.module.ts b/landingPages/project/projectService.module.ts index 1dbae019..9eda7c04 100644 --- a/landingPages/project/projectService.module.ts +++ b/landingPages/project/projectService.module.ts @@ -1,6 +1,6 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; import {ProjectService} from './project.service'; @@ -9,12 +9,11 @@ import {ProjectService} from './project.service'; imports: [ CommonModule, FormsModule ], - declarations: [ + declarations: [], + providers: [ + ProjectService ], - providers:[ - ProjectService -], - exports: [ - ] + exports: [] }) -export class ProjectServiceModule { } +export class ProjectServiceModule { +} diff --git a/landingPages/publication/publication.component.html b/landingPages/publication/publication.component.html index f2a64ee4..8fd3cf5a 100644 --- a/landingPages/publication/publication.component.html +++ b/landingPages/publication/publication.component.html @@ -1,419 +1,474 @@ -
    +
    -
    +
    -
    - - - +
    + + + -
    -
    - - - {{publicationInfo.types.join(", ")}}{{" "}} - {{publicationInfo.languages.join(", ")}}{{" "}} - {{publicationInfo.countries.join(", ")}}{{" "}} +
    + +
    + + + {{publicationInfo.types.join(", ")}}{{" "}} + {{publicationInfo.languages.join(", ")}}{{" "}} + {{publicationInfo.countries.join(", ")}}{{" "}} - {{publicationInfo.accessMode}}{{" "}} + {{publicationInfo.accessMode}}{{" "}} - + + title="{{buildCurationTooltip()}}"> Record in preview {{" "}} - -
    - - ({{publicationInfo.date}}) +
    + + ({{publicationInfo.date}})
      -
    • Embargo end date: {{publicationInfo.embargoEndDate}}
    • -
    • - -
    • -
    • - +
    • Embargo end date: {{publicationInfo.embargoEndDate}}
    • +
    • + +
    • +
    • + -
    • -
    -
    -
    + + +
    +
    {{publicationInfo.description.substring(0, showNumDescription)}}... + -->... View more -
    - + + + +
    +
    + +
    +
    + {{publicationInfo.references.length | number}} + references, page {{referencesPage | number}} + of {{totalPages(publicationInfo.references.length) | number}} + +
    - - - -
    +
  • - - Related Research Results - - - ({{relatedResearchResultsNum | number}}) - - -
    - -
    -
    -
    {{provenanceaction}}
    + + Related Research Results + + + ({{relatedResearchResultsNum | number}}) + + +
    + +
    +
    +
    {{provenanceaction}}
    - -
    +
    -
  • +
    + -
  • - - Similar Research Results - - - ({{publicationInfo.similarResearchResults.length | number}}) - - -
    - + + ({{publicationInfo.similarResearchResults.length | number}}) + + +
    + -
    - -
    -
    -
  • +
    --> +
    + +
    +
    + -
  • - - Related Organizations - - - ({{publicationInfo.organizations.length | number}}) - - -
    - -
    -
    - {{publicationInfo.organizations.length | number}} organizations, page {{organizationsPage | number}} of {{totalPages(publicationInfo.organizations.length) | number}} - -
    - - - - - - - - -
    - - {{organization['name']}} - ( - {{organization.shortname}} - ) - -

    - {{organization['name']}} - ( - {{organization.shortname}} - ) -

    -
    {{organization.country}}
    -
    Website url: - {{organization.websiteUrl}} -
    -
    -
    -
    {{organization['trust']}}%
    - -
    -
    -

    no trust available

    -
    -
    - -
    +
  • + + Related Organizations + + + ({{publicationInfo.organizations.length | number}}) + + +
    + +
    +
    + {{publicationInfo.organizations.length | number}} + organizations, page {{organizationsPage | number}} + of {{totalPages(publicationInfo.organizations.length) | number}} +
    -
  • -
  • - - Bioentities - - - ({{bioentitiesNum | number}}) - - -
    -
    - {{bioentitiesNum | number}} bioentities, page {{bioentitiesPage | number}} of {{totalPages(bioentitiesNum) | number}} - -
    + + + + + + + +
    + + {{organization['name']}} + ( + {{organization.shortname}} + ) + +

    + {{organization['name']}} + ( + {{organization.shortname}} + ) +

    +
    {{organization.country}}
    +
    Website url: + {{organization.websiteUrl}} +
    +
    +
    +
    {{organization['trust']}}%
    + +
    +
    +

    no trust available

    +
    +
    - - - - - + + + + +
    + + + + +
  • + + Bioentities + + + ({{bioentitiesNum | number}}) + + +
    +
    + {{bioentitiesNum | number}} + bioentities, page {{bioentitiesPage | number}} of {{totalPages(bioentitiesNum) | number}} + +
    + + + + + + - - - - -
    + target="_blank"> {{keyIn}} - - {{key}} -
    -
    -
  • +
    + {{key}} +
    +
    +
  • -
  • - - Software - - - ({{publicationInfo.software.length | number}}) - - -
    -
    - {{publicationInfo.software.length | number}} software results, page {{softwarePage | number}} of {{totalPages(publicationInfo.software.length) | number}} - -
    +
  • + + Software + + + ({{publicationInfo.software.length | number}}) + + +
    +
    + {{publicationInfo.software.length | number}} + software results, page {{softwarePage | number}} + of {{totalPages(publicationInfo.software.length) | number}} + +
    - - - - + + +
    + + + + - - -
    {{item.name}} -
    - - +
    +
    +
  • -
  • - - Open Citations - ({{publicationInfo.openCitations.length | number}}) - -
    -
    - {{publicationInfo.openCitations.length | number}} open citations, page {{openCitationsPage | number}} of {{totalPages(publicationInfo.openCitations.length) | number}} - -
    +
  • + + Open Citations + ({{publicationInfo.openCitations.length | number}}) + +
    +
    + {{publicationInfo.openCitations.length | number}} + open citations, page {{openCitationsPage | number}} + of {{totalPages(publicationInfo.openCitations.length) | number}} + +
    -
    -
  • +
    + Identifier: doi: {{result.doi}} + + +
    + -
  • - - Metrics - -
    - - - - - - - -
    -
  • +
  • + + Metrics + +
    + + + + + + + +
    +
  • -
  • - - Other Versions - ({{publicationInfo.deletedByInferenceIds.length | number}}) - -
    - -
    -
  • +
  • + + Other Versions + ({{publicationInfo.deletedByInferenceIds.length | number}}) + +
    + +
    +
  • -
    - -
    -
    -
    -
    Share - Bookmark
    -
    - - -
      + +
      +
      +
      +
      Share - Bookmark
      + +
      + + +
      • - +
      • -
      • - +
      • +
      • -
        -
        Related to
        -
        - +
        +
        Related to
        +
        + {{item['labelContext']}} -> {{item['labelCategory']}} : {{item['labelConcept']}} - - {{item['labelContext']}} - -> {{item['labelCategory']}} - : {{item['labelConcept']}} - -
        -
        + + {{item['labelContext']}} + -> {{item['labelCategory']}} + : {{item['labelConcept']}} + +
        +
      • @@ -424,51 +479,81 @@
      • -
        - Cite this publication -
        -
        - -
        +
        + Cite this publication +
        +
        + +
      • -
      - - - -
      - -
      + + + +
      + +
      +
      +
      - +
    -
    -
    -
    -
    +
    +
    +
    diff --git a/landingPages/publication/publication.component.ts b/landingPages/publication/publication.component.ts index acbfbbf9..ad68d0f8 100644 --- a/landingPages/publication/publication.component.ts +++ b/landingPages/publication/publication.component.ts @@ -1,28 +1,27 @@ -import {Component, ViewChild} from '@angular/core'; -import {Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; -import {Observable} from 'rxjs'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {PublicationInfo} from '../../utils/entities/publicationInfo'; +import {RouterHelper} from '../../utils/routerHelper.class'; -import {EnvProperties} from '../../utils/properties/env-properties'; -import {PublicationInfo} from '../../utils/entities/publicationInfo'; -import {RouterHelper} from '../../utils/routerHelper.class'; - -import {PiwikService} from '../../utils/piwik/piwik.service'; -import {PublicationService} from './publication.service'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {PublicationService} from './publication.service'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ - selector: 'publication', - templateUrl: 'publication.component.html', + selector: 'publication', + templateUrl: 'publication.component.html', }) export class PublicationComponent { @Input() piwikSiteId = null; + @Input() communityId = null; public publicationInfo: PublicationInfo; public articleId: string; @@ -65,307 +64,339 @@ export class PublicationComponent { public errorMessage = ""; public showLoading: boolean = true; - public routerHelper:RouterHelper = new RouterHelper(); + public routerHelper: RouterHelper = new RouterHelper(); private doi: string; public doiURL: string; private result; - sub: any; piwiksub: any; infoSub: any; - properties:EnvProperties; + sub: any; + piwiksub: any; + infoSub: any; + properties: EnvProperties; + public pageContents = null; + public divContents = null; - constructor ( private _publicationService: PublicationService, - private _piwikService:PiwikService, - private route: ActivatedRoute, - private router: Router, - private _meta: Meta, - private _title: Title, - private _router: Router, + constructor(private _publicationService: PublicationService, + private _piwikService: PiwikService, + private route: ActivatedRoute, + private router: Router, + private _meta: Meta, + private _title: Title, + private _router: Router, + private helper: HelperService, private seoService: SEOService) { } ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.doiURL = this.properties.doiURL; - this.updateUrl(data.envSpecific.baseLink+this._router.url); + this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); + this.doiURL = this.properties.doiURL; + this.updateUrl(data.envSpecific.baseLink + this._router.url); }); - this.sub = this.route.queryParams.subscribe(data => { - this.publicationInfo = null; - this.updateTitle("Publication"); - this.updateDescription(""); - this.articleId = data['articleId']; + this.sub = this.route.queryParams.subscribe(data => { + this.publicationInfo = null; + this.updateTitle("Publication"); + this.updateDescription(""); + this.articleId = data['articleId']; - this.metricsClicked = false; + this.metricsClicked = false; - if(this.articleId){ + if (this.articleId) { - this.getPublicationInfo(this.articleId); - // if (typeof document !== 'undefined') { - // switcher(UIkit); - // } - }else{ - this.showLoading = false; - this.warningMessage="No valid publication id"; - } + this.getPublicationInfo(this.articleId); + // if (typeof document !== 'undefined') { + // switcher(UIkit); + // } + } else { + this.showLoading = false; + this.warningMessage = "No valid publication id"; + } - this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.articleId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - this.downloadsFrameUrl =this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.articleId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.articleId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - this.scroll(); + this.scroll(); }); } + + private getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } - ngOnDestroy() { - if(this.sub){ - this.sub.unsubscribe(); - } - if(this.piwiksub){ - this.piwiksub.unsubscribe(); - } - if(this.infoSub) { - this.infoSub.unsubscribe(); - } + private getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + + ngOnDestroy() { + if (this.sub) { + this.sub.unsubscribe(); } - - private getOpenCitations(id: string) { - this._publicationService.getOpenCitations(this.articleId, this.properties).subscribe( - data => { - this.publicationInfo.openCitations = data[1]; - }, - err => { - //console.log(err); - this.handleError("Error getting open citation for publication with id: "+this.articleId, err); - } - ); + if (this.piwiksub) { + this.piwiksub.unsubscribe(); } - - private getPublicationInfo(id:string) { - this.warningMessage = ''; - this.errorMessage="" - this.showLoading = true; - - this.publicationInfo = null; - - this.infoSub = this._publicationService.getPublicationInfo(this.articleId, this.properties).subscribe( - data => { - this.publicationInfo = data; - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublication + this.publicationInfo.record["result"]["header"]["dri:objIdentifier"]); - if((this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { - this.getOpenCitations(this.articleId); - } - - // this.result = [] - // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestaccessright, embargoEndDate: ''}; - /*if(this.publicationInfo.title.name != undefined && this.publicationInfo.title.name!= ''){ - this.updateTitle(this.publicationInfo.title.name); - this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name); - }*/ - if(this.publicationInfo.title){ - this.updateTitle(this.publicationInfo.title); - this.updateDescription((this.publicationInfo.description?(this.publicationInfo.description):(","+this.publicationInfo.title))); - } - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, this.publicationInfo.title/*.name*/, this.piwikSiteId).subscribe(); - } - - let bioentitiesNum = 0; - if(this.publicationInfo.bioentities != undefined) { - this.publicationInfo.bioentities.forEach(function (value, key, map) { - bioentitiesNum += value.size; - }); - } - this.bioentitiesNum = bioentitiesNum; - - let relatedResearchResultsNum = 0; - if(this.publicationInfo.relatedResearchResults != undefined) { - this.publicationInfo.relatedResearchResults.forEach(function (value, key, map) { - relatedResearchResultsNum += value.length; - }); - } - this.relatedResearchResultsNum = relatedResearchResultsNum; - - this.result = {id: this.articleId, type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: /*this.publicationInfo.title.accessMode*/this.publicationInfo.accessMode, embargoEndDate: ''}; - // this.result.push(result_); - - if(this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) { - this.doi = this.publicationInfo.identifiers.get('doi')[0]; - } - - this.showLoading = false; - - if(this.publicationInfo.references) { - this.activeTab = "References"; - } else if(this.publicationInfo.relatedResearchResults) { - this.activeTab = "Related Research Results"; - } else if(this.publicationInfo.similarResearchResults) { - this.activeTab = "Similar Research Results"; - } else if(this.publicationInfo.organizations) { - this.activeTab = "Related Organizations"; - } else if(this.publicationInfo.bioentities) { - this.activeTab = "bioentities"; - } else if(this.publicationInfo.software) { - this.activeTab = "Software"; - } else { - this.activeTab = "Metrics"; - this.metricsClicked = true; - } - }, - err => { - //console.log(err); - this.handleError("Error getting publication for id: "+this.articleId, err); - - this.errorMessage = 'No publication found'; - this.showLoading = false; - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublications); - } - ); + if (this.infoSub) { + this.infoSub.unsubscribe(); } + } - public metricsResults($event) { - this.totalViews = $event.totalViews; - this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; - } - - public buildCurationTooltip() { - let tooltipContent: string = "
    "; - - tooltipContent += "

    Record in preview

    "; - tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; - - return tooltipContent+= "
    "; - } - - private updateDescription(description:string){ - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string){ - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(title); - this._meta.updateTag({content:title},"property='og:title'"); - } - - private updateUrl(url:string){ - this._meta.updateTag({content:url},"property='og:url'"); - } - - public totalPages(totalResults: number): number { - let totalPages:any = totalResults/this.pageSize; - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, this.pageSize) + 1); + private getOpenCitations(id: string) { + this._publicationService.getOpenCitations(this.articleId, this.properties).subscribe( + data => { + this.publicationInfo.openCitations = data[1]; + }, + err => { + //console.log(err); + this.handleError("Error getting open citation for publication with id: " + this.articleId, err); } - return totalPages; - } + ); + } - public updateReferencesPage($event) { - this.referencesPage = $event.value; - } + private getPublicationInfo(id: string) { + this.warningMessage = ''; + this.errorMessage = "" + this.showLoading = true; - public updateOrganizationsPage($event) { - this.organizationsPage = $event.value; - } + this.publicationInfo = null; - public updateSoftwarePage($event) { - this.softwarePage = $event.value; - } + this.infoSub = this._publicationService.getPublicationInfo(this.articleId, this.properties).subscribe( + data => { + this.publicationInfo = data; + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublication + this.publicationInfo.record["result"]["header"]["dri:objIdentifier"]); + if ((this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { + this.getOpenCitations(this.articleId); + } - public updateBioentitiesPage($event) { - this.bioentitiesPage = $event.value; - } + // this.result = [] + // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestaccessright, embargoEndDate: ''}; + /*if(this.publicationInfo.title.name != undefined && this.publicationInfo.title.name!= ''){ + this.updateTitle(this.publicationInfo.title.name); + this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name); + }*/ + if (this.publicationInfo.title) { + this.updateTitle(this.publicationInfo.title); + this.updateDescription((this.publicationInfo.description ? (this.publicationInfo.description) : ("," + this.publicationInfo.title))); + } + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, this.publicationInfo.title/*.name*/, this.piwikSiteId).subscribe(); + } - public updateOpenCitationsPage($event) { - this.openCitationsPage = $event.value; - } + let bioentitiesNum = 0; + if (this.publicationInfo.bioentities != undefined) { + this.publicationInfo.bioentities.forEach(function (value, key, map) { + bioentitiesNum += value.size; + }); + } + this.bioentitiesNum = bioentitiesNum; - public keysToArray(bioentities: Map) : string[] { - let keys: string[] = []; - bioentities.forEach(function (value, key, map) { - keys.push(key); - }); - return keys; - } - public getKeys( map) { - return Array.from(map.keys()); - } + let relatedResearchResultsNum = 0; + if (this.publicationInfo.relatedResearchResults != undefined) { + this.publicationInfo.relatedResearchResults.forEach(function (value, key, map) { + relatedResearchResultsNum += value.length; + }); + } + this.relatedResearchResultsNum = relatedResearchResultsNum; - public scroll() { - HelperFunctions.scroll(); - } -/* - start(i: number, bioentitiesPage: number) { - let sum = 0; - let index=0; - let retValue = 0; - let valuesToPage = this.pageSize*bioentitiesPage; - let valuesToPreviousPage = valuesToPage - this.pageSize; + this.result = { + id: this.articleId, + type: "publication", + source: "openaire", + title: this.publicationInfo.title, + url: '', + result: '', + accessRights: /*this.publicationInfo.title.accessMode*/this.publicationInfo.accessMode, + embargoEndDate: '' + }; + // this.result.push(result_); - if(bioentitiesPage == 1) { - return 0; + if (this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) { + this.doi = this.publicationInfo.identifiers.get('doi')[0]; + } + + this.showLoading = false; + + if (this.publicationInfo.references) { + this.activeTab = "References"; + } else if (this.publicationInfo.relatedResearchResults) { + this.activeTab = "Related Research Results"; + } else if (this.publicationInfo.similarResearchResults) { + this.activeTab = "Similar Research Results"; + } else if (this.publicationInfo.organizations) { + this.activeTab = "Related Organizations"; + } else if (this.publicationInfo.bioentities) { + this.activeTab = "bioentities"; + } else if (this.publicationInfo.software) { + this.activeTab = "Software"; + } else { + this.activeTab = "Metrics"; + this.metricsClicked = true; + } + }, + err => { + //console.log(err); + this.handleError("Error getting publication for id: " + this.articleId, err); + + this.errorMessage = 'No publication found'; + this.showLoading = false; + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublications); } + ); + } - this.publicationInfo.bioentities.forEach(function (value, key, map) { - sum += map.get(key).size; + public metricsResults($event) { + this.totalViews = $event.totalViews; + this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; + } - if(index == i) { - if(sum <= valuesToPreviousPage) { - retValue = 0; - } else if((sum-map.get(key).size) >= valuesToPage){ - retValue = 0; - } else { - if(map.get(key).size < (sum - valuesToPreviousPage)) { + public buildCurationTooltip() { + let tooltipContent: string = "
    "; + + tooltipContent += "

    Record in preview

    "; + tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; + + return tooltipContent += "
    "; + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(title); + this._meta.updateTag({content: title}, "property='og:title'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } + + public totalPages(totalResults: number): number { + let totalPages: any = totalResults / this.pageSize; + if (!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, this.pageSize) + 1); + } + return totalPages; + } + + public updateReferencesPage($event) { + this.referencesPage = $event.value; + } + + public updateOrganizationsPage($event) { + this.organizationsPage = $event.value; + } + + public updateSoftwarePage($event) { + this.softwarePage = $event.value; + } + + public updateBioentitiesPage($event) { + this.bioentitiesPage = $event.value; + } + + public updateOpenCitationsPage($event) { + this.openCitationsPage = $event.value; + } + + public keysToArray(bioentities: Map): string[] { + let keys: string[] = []; + bioentities.forEach(function (value, key, map) { + keys.push(key); + }); + return keys; + } + + public getKeys(map) { + return Array.from(map.keys()); + } + + public scroll() { + HelperFunctions.scroll(); + } + + /* + start(i: number, bioentitiesPage: number) { + let sum = 0; + let index=0; + let retValue = 0; + let valuesToPage = this.pageSize*bioentitiesPage; + let valuesToPreviousPage = valuesToPage - this.pageSize; + + if(bioentitiesPage == 1) { + return 0; + } + + this.publicationInfo.bioentities.forEach(function (value, key, map) { + sum += map.get(key).size; + + if(index == i) { + if(sum <= valuesToPreviousPage) { + retValue = 0; + } else if((sum-map.get(key).size) >= valuesToPage){ retValue = 0; } else { - retValue = map.get(key).size - (sum - valuesToPreviousPage); + if(map.get(key).size < (sum - valuesToPreviousPage)) { + retValue = 0; + } else { + retValue = map.get(key).size - (sum - valuesToPreviousPage); + } } } - } - index++; - }); - this.startt = retValue; - return retValue; - } + index++; + }); + this.startt = retValue; + return retValue; + } - stop(i: number, bioentitiesPage: number) { - let sum = 0; - let index=0; - let retValue = 0; - let valuesToPage = this.pageSize*bioentitiesPage; - let valuesToPreviousPage = valuesToPage - this.pageSize; + stop(i: number, bioentitiesPage: number) { + let sum = 0; + let index=0; + let retValue = 0; + let valuesToPage = this.pageSize*bioentitiesPage; + let valuesToPreviousPage = valuesToPage - this.pageSize; - this.publicationInfo.bioentities.forEach(function (value, key, map) { - sum += map.get(key).size; - if(index == i) { - if(sum <= valuesToPreviousPage) { - retValue = 0; - } else if((sum - map.get(key).size) >= valuesToPage){ - retValue = 0; - } else { - if(sum < valuesToPage) { - retValue = map.get(key).size; + this.publicationInfo.bioentities.forEach(function (value, key, map) { + sum += map.get(key).size; + if(index == i) { + if(sum <= valuesToPreviousPage) { + retValue = 0; + } else if((sum - map.get(key).size) >= valuesToPage){ + retValue = 0; } else { - retValue = map.get(key).size - (sum - valuesToPage); + if(sum < valuesToPage) { + retValue = map.get(key).size; + } else { + retValue = map.get(key).size - (sum - valuesToPage); + } } } - } - index++; - }); - this.stopp = retValue; - return retValue; - } -*/ + index++; + }); + this.stopp = retValue; + return retValue; + } + */ private handleError(message: string, error) { - console.error("Publication Landing Page: "+message, error); + console.error("Publication Landing Page: " + message, error); } - isRouteAvailable(routeToCheck:string){ + + isRouteAvailable(routeToCheck: string) { for (let i = 0; i < this.router.config.length; i++) { - let routePath:string = this.router.config[i].path; - if(routePath == routeToCheck){ + let routePath: string = this.router.config[i].path; + if (routePath == routeToCheck) { return true; } } diff --git a/landingPages/publication/publication.module.ts b/landingPages/publication/publication.module.ts index 78d1fcd0..415ae5e9 100644 --- a/landingPages/publication/publication.module.ts +++ b/landingPages/publication/publication.module.ts @@ -24,13 +24,14 @@ import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import {DeletedByInferenceModule} from '../landing-utils/deletedByInference/deletedByInference.module'; import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; +import {HelperModule} from "../../utils/helper/helper.module"; @NgModule({ imports: [ CommonModule, FormsModule, LandingModule, SharedModule, RouterModule, CiteThisModule, PagingModule, ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, - DeletedByInferenceModule, ShowAuthorsModule + DeletedByInferenceModule, ShowAuthorsModule, HelperModule ], declarations: [ PublicationComponent diff --git a/landingPages/software/software.component.html b/landingPages/software/software.component.html index b389b38c..e2b6e1d7 100644 --- a/landingPages/software/software.component.html +++ b/landingPages/software/software.component.html @@ -1,26 +1,42 @@ -
    +
    -
    +
    -
    +
    - - - + + + -
    -
    - - - {{softwareInfo.types.join(", ")}}{{" "}} - {{softwareInfo.programmingLanguages.join(", ")}}{{" "}} - {{softwareInfo.languages.join(", ")}}{{" "}} - {{softwareInfo.countries.join(", ")}}{{" "}} +
    + +
    + + + {{softwareInfo.types.join(", ")}}{{" "}} + {{softwareInfo.programmingLanguages.join(", ")}}{{" "}} + {{softwareInfo.languages.join(", ")}}{{" "}} + {{softwareInfo.countries.join(", ")}}{{" "}} - {{softwareInfo.accessMode}}{{" "}} - + {{softwareInfo.accessMode}}{{" "}} + + title="{{buildCurationTooltip()}}"> Record in preview {{" "}} @@ -32,37 +48,43 @@ -
    - - ({{softwareInfo.date}}) +
    + + ({{softwareInfo.date}})
      -
    • Embargo end date: {{softwareInfo.embargoEndDate}}
    • -
    • - -
    • -
    • - +
    • Embargo end date: {{softwareInfo.embargoEndDate}}
    • +
    • + +
    • +
    • + -
    • +
    -
    - + -
  • - - Other Versions - ({{softwareInfo.deletedByInferenceIds.length | number}}) - -
    - -
    -
  • +
  • + + Other Versions + ({{softwareInfo.deletedByInferenceIds.length | number}}) + +
    + +
    +
  • -
    - -
    -
    -
    -
    Share - Bookmark
    -
    - - -
      + +
      +
      +
      +
      Share - Bookmark
      + +
      + + +
      • - +
      • -
      • -
        -
        Related to
        -
        - +
      • +
        +
        Related to
        +
        + {{item['labelContext']}} -> {{item['labelCategory']}} : {{item['labelConcept']}} - - {{item['labelContext']}} - -> {{item['labelCategory']}} - : {{item['labelConcept']}} - -
        + + {{item['labelContext']}} + -> {{item['labelCategory']}} + : {{item['labelConcept']}} + +
      • -
        +
      • @@ -222,12 +249,12 @@
      • -
        - Cite this software -
        -
        - -
        +
        + Cite this software +
        +
        + +
      • -
      -
    + + +
    + +
    +
    +
    + +
    + +
    +
    + + +
    -
    +
    -
    - -
    -
    - - -
    - -
    -
    -
    -
    +
    +
    diff --git a/landingPages/software/software.component.ts b/landingPages/software/software.component.ts index 4eafa620..2be94d1c 100644 --- a/landingPages/software/software.component.ts +++ b/landingPages/software/software.component.ts @@ -1,212 +1,243 @@ -import {Component, ViewChild} from '@angular/core'; -import {Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Title, Meta} from '@angular/platform-browser'; +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; -import {Observable} from 'rxjs'; +import {SoftwareService} from './software.service'; +import {SoftwareInfo} from '../../utils/entities/softwareInfo'; -import {SoftwareService} from './software.service'; -import {SoftwareInfo} from '../../utils/entities/softwareInfo'; - -import {RouterHelper} from '../../utils/routerHelper.class'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import {EnvProperties} from '../../utils/properties/env-properties'; -import { SEOService } from '../../sharedComponents/SEO/SEO.service'; +import {RouterHelper} from '../../utils/routerHelper.class'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ - selector: 'software', - templateUrl: 'software.component.html', + selector: 'software', + templateUrl: 'software.component.html', }) export class SoftwareComponent { @Input() piwikSiteId = null; - public softwareInfo: SoftwareInfo; - public softwareId : string ; + @Input() communityId = null; + public softwareInfo: SoftwareInfo; + public softwareId: string; - // APP BOX variables - public showAllCollectedFrom: boolean = false; - public showAllDownloadFrom: boolean = false; - public showAllPublishedIn: boolean = false; + // APP BOX variables + public showAllCollectedFrom: boolean = false; + public showAllDownloadFrom: boolean = false; + public showAllPublishedIn: boolean = false; - public thresholdDescription: number = 270; - public showNumDescription: number = 270; + public thresholdDescription: number = 270; + public showNumDescription: number = 270; - // Metrics tab variables - public metricsClicked: boolean; - public viewsFrameUrl: string; - public downloadsFrameUrl: string; - public totalViews: number; - public totalDownloads: number; - public pageViews: number; + // Metrics tab variables + public metricsClicked: boolean; + public viewsFrameUrl: string; + public downloadsFrameUrl: string; + public totalViews: number; + public totalDownloads: number; + public pageViews: number; - // Active tab variable for responsiveness - public activeTab: string = "Related Research Results"; + // Active tab variable for responsiveness + public activeTab: string = "Related Research Results"; - // Map counting variable - public relatedResearchResultsNum: number = 0; + // Map counting variable + public relatedResearchResultsNum: number = 0; - // Message variables - public warningMessage = ""; - public errorMessage = ""; - public showLoading: boolean = true; + // Message variables + public warningMessage = ""; + public errorMessage = ""; + public showLoading: boolean = true; - public routerHelper:RouterHelper = new RouterHelper(); + public routerHelper: RouterHelper = new RouterHelper(); - private result ; - sub: any; piwiksub: any; infoSub: any; - properties:EnvProperties; + private result; + sub: any; + piwiksub: any; + infoSub: any; + properties: EnvProperties; + public pageContents = null; + public divContents = null; - constructor (private _softwareService: SoftwareService, - private _piwikService:PiwikService, - private route: ActivatedRoute, - private router: Router, - private _meta: Meta, - private _title: Title, - private _router: Router, - private seoService: SEOService) { - } + constructor(private _softwareService: SoftwareService, + private _piwikService: PiwikService, + private route: ActivatedRoute, + private router: Router, + private _meta: Meta, + private _title: Title, + private _router: Router, + private helper: HelperService, + private seoService: SEOService) { + } - ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.updateUrl(data.envSpecific.baseLink+this._router.url); + ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); + this.updateUrl(data.envSpecific.baseLink + this._router.url); - }); - this.sub = this.route.queryParams.subscribe(params => { - this.softwareInfo = null; - this.updateTitle("Software"); - this.updateDescription("Software, search, open access"); + }); + this.sub = this.route.queryParams.subscribe(params => { + this.softwareInfo = null; + this.updateTitle("Software"); + this.updateDescription("Software, search, open access"); - this.softwareId = params['softwareId']; + this.softwareId = params['softwareId']; - if(this.softwareId){ - this.getSoftwareInfo(this.softwareId); - }else{ - this.showLoading = false; - this.warningMessage="No valid software id"; - } - - this.metricsClicked = false; - - this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.softwareId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.softwareId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - */ - - this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.softwareId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.softwareId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; - */ - this.scroll(); - }); - - } - - ngOnDestroy() { - if(this.sub){ - this.sub.unsubscribe(); + if (this.softwareId) { + this.getSoftwareInfo(this.softwareId); + } else { + this.showLoading = false; + this.warningMessage = "No valid software id"; } - if(this.piwiksub){ - this.piwiksub.unsubscribe(); + + this.metricsClicked = false; + + this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.softwareId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.softwareId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + */ + + this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.softwareId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.softwareId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; + */ + this.scroll(); + }); + + } + + private getPageContents() { + this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.pageContents = contents; + }) + } + + private getDivContents() { + this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { + this.divContents = contents; + }) + } + + ngOnDestroy() { + if (this.sub) { + this.sub.unsubscribe(); + } + if (this.piwiksub) { + this.piwiksub.unsubscribe(); + } + if (this.infoSub) { + this.infoSub.unsubscribe(); + } + } + + private getSoftwareInfo(id: string) { + this.warningMessage = ''; + this.errorMessage = "" + this.showLoading = true; + + this.softwareInfo = null; + + this.infoSub = this._softwareService.getSoftwareInfo(id, this.properties).subscribe( + data => { + this.softwareInfo = data; + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftwareLanding + this.softwareInfo.record["result"]["header"]["dri:objIdentifier"]); + /*if(this.softwareInfo.title.name != undefined && this.softwareInfo.title.name!= ''){ + this.updateTitle(this.softwareInfo.title.name); + this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name); + }*/ + if (this.softwareInfo.title) { + this.updateTitle(this.softwareInfo.title); + this.updateDescription("Software, " + this.softwareInfo.title); + } + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, this.softwareInfo.title/*.name*/, this.piwikSiteId).subscribe(); + } + + this.result = [] + this.result = { + id: id, + type: "software", + source: "openaire", + title: this.softwareInfo.title, + url: '', + result: '', + accessRights: /*this.softwareInfo.title.accessMode*/this.softwareInfo.accessMode, + embargoEndDate: '' + }; + + let relatedResearchResultsNum = 0; + if (this.softwareInfo.relatedResearchResults != undefined) { + this.softwareInfo.relatedResearchResults.forEach(function (value, key, map) { + relatedResearchResultsNum += value.length; + }); + } + this.relatedResearchResultsNum = relatedResearchResultsNum; + + this.showLoading = false; + }, + err => { + //console.log(err) + this.handleError("Error getting software for id: " + this.softwareId, err); + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftware); + this.errorMessage = 'No software found'; + this.showLoading = false; } - if(this.infoSub) { - this.infoSub.unsubscribe(); - } - } + ); + } - private getSoftwareInfo(id:string) { - this.warningMessage = ''; - this.errorMessage="" - this.showLoading = true; + // showChange($event) { + // this.showAllReferences=$event.value; + // } - this.softwareInfo = null; + public metricsResults($event) { + this.totalViews = $event.totalViews; + this.totalDownloads = $event.totalDownloads; + this.pageViews = $event.pageViews; + } - this.infoSub = this._softwareService.getSoftwareInfo(id, this.properties).subscribe( - data => { - this.softwareInfo = data; - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftwareLanding + this.softwareInfo.record["result"]["header"]["dri:objIdentifier"]); - /*if(this.softwareInfo.title.name != undefined && this.softwareInfo.title.name!= ''){ - this.updateTitle(this.softwareInfo.title.name); - this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name); - }*/ - if(this.softwareInfo.title){ - this.updateTitle(this.softwareInfo.title); - this.updateDescription("Software, "+this.softwareInfo.title); - } - if( this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.properties, this.softwareInfo.title/*.name*/, this.piwikSiteId).subscribe(); - } + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } - this.result = [] - this.result = {id: id, type :"software", source : "openaire", title: this.softwareInfo.title,url: '', result: '', accessRights: /*this.softwareInfo.title.accessMode*/this.softwareInfo.accessMode, embargoEndDate: ''}; + private updateTitle(title: string) { + var _prefix = "OpenAIRE | "; + var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } - let relatedResearchResultsNum = 0; - if(this.softwareInfo.relatedResearchResults != undefined) { - this.softwareInfo.relatedResearchResults.forEach(function (value, key, map) { - relatedResearchResultsNum += value.length; - }); - } - this.relatedResearchResultsNum = relatedResearchResultsNum; + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } - this.showLoading = false; - }, - err => { - //console.log(err) - this.handleError("Error getting software for id: "+this.softwareId, err); - this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToSoftware); - this.errorMessage = 'No software found'; - this.showLoading = false; - } - ); - } + public buildCurationTooltip() { + let tooltipContent: string = "
    "; - // showChange($event) { - // this.showAllReferences=$event.value; - // } + tooltipContent += "

    Record in preview

    "; + tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; - public metricsResults($event) { - this.totalViews = $event.totalViews; - this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; - } + return tooltipContent; + } - private updateDescription(description:string) { - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - } - private updateTitle(title:string) { - var _prefix ="OpenAIRE | "; - var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._title.setTitle(_title); - this._meta.updateTag({content:_title},"property='og:title'"); - } - private updateUrl(url:string) { - this._meta.updateTag({content:url},"property='og:url'"); - } + public getKeys(map) { + return Array.from(map.keys()); + } - public buildCurationTooltip() { - let tooltipContent: string = "
    "; + public scroll() { + HelperFunctions.scroll(); + } - tooltipContent += "

    Record in preview

    "; - tooltipContent += "

    Bibliographic record accepted by the system, but not yet processed by
    OpenAIRE tools for information quality improvement and de-duplication

    "; + private handleError(message: string, error) { + console.error("Software Landing Page: " + message, error); + } - return tooltipContent; - } - public getKeys( map) { - return Array.from(map.keys()); - } - - public scroll() { - HelperFunctions.scroll(); - } - - private handleError(message: string, error) { - console.error("Software Landing Page: "+message, error); - } - isRouteAvailable(routeToCheck:string){ + isRouteAvailable(routeToCheck: string) { for (let i = 0; i < this.router.config.length; i++) { - let routePath:string = this.router.config[i].path; - if(routePath == routeToCheck){ + let routePath: string = this.router.config[i].path; + if (routePath == routeToCheck) { return true; } } diff --git a/landingPages/software/software.module.ts b/landingPages/software/software.module.ts index 82182047..88862795 100644 --- a/landingPages/software/software.module.ts +++ b/landingPages/software/software.module.ts @@ -1,32 +1,33 @@ //import {MaterialModule} from '@angular/material'; -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; -import { RouterModule } from '@angular/router'; +import {RouterModule} from '@angular/router'; -import { SoftwareService } from './software.service'; -import { SoftwareComponent } from './software.component'; +import {SoftwareService} from './software.service'; +import {SoftwareComponent} from './software.component'; // import { SoftwareRoutingModule } from './software-routing.module'; -import { MetricsModule } from '../landing-utils/metrics.module'; -import { IFrameModule } from '../../utils/iframe.module'; -import { AltMetricsModule } from '../../utils/altmetrics.module'; -import { CiteThisModule } from '../landing-utils/citeThis/citeThis.module'; -import { PagingModule } from '../../utils/paging.module'; +import {MetricsModule} from '../landing-utils/metrics.module'; +import {IFrameModule} from '../../utils/iframe.module'; +import {AltMetricsModule} from '../../utils/altmetrics.module'; +import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; +import {PagingModule} from '../../utils/paging.module'; -import { ResultLandingModule } from '../landing-utils/resultLanding.module'; -import { LandingModule } from '../landing-utils/landing.module'; -import { FreeGuard } from'../../login/freeGuard.guard'; +import {ResultLandingModule} from '../landing-utils/resultLanding.module'; +import {LandingModule} from '../landing-utils/landing.module'; +import {FreeGuard} from '../../login/freeGuard.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; -import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; -import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; +import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module'; +import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/deletedByInference.module"; +import {HelperModule} from "../../utils/helper/helper.module"; @NgModule({ imports: [ CommonModule, FormsModule, LandingModule, RouterModule, CiteThisModule, PagingModule, ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule, - ShowAuthorsModule, DeletedByInferenceModule + ShowAuthorsModule, DeletedByInferenceModule, HelperModule ], declarations: [ SoftwareComponent diff --git a/searchPages/searchUtils/searchPage.component.html b/searchPages/searchUtils/searchPage.component.html index 65ecc7b4..5276ac74 100644 --- a/searchPages/searchUtils/searchPage.component.html +++ b/searchPages/searchUtils/searchPage.component.html @@ -45,8 +45,8 @@
    - -
    + +
    @@ -111,14 +111,10 @@
    - - - - -
    @@ -228,32 +221,12 @@ [href]="properties.lastIndexInformationLink" target="_blank"> Last index information - - -
    -
    - - -
    - -
    -
    - -
    +
    diff --git a/searchPages/searchUtils/searchPage.component.ts b/searchPages/searchUtils/searchPage.component.ts index fc149063..37fc6f27 100644 --- a/searchPages/searchUtils/searchPage.component.ts +++ b/searchPages/searchUtils/searchPage.component.ts @@ -17,6 +17,7 @@ import {EnvProperties} from '../../utils/properties/env-propertie import { SEOService } from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {ZenodoInformationClass} from "../../deposit/utils/zenodoInformation.class"; +import {HelperService} from "../../utils/helper/helper.service"; @Component({ selector: 'search-page', @@ -77,6 +78,8 @@ export class SearchPageComponent { public pagingLimit: number = 0; public resultsPerPage: number = 10; public isPiwikEnabled; + public pageContents = null; + public divContents = null; properties:EnvProperties; public routerHelper:RouterHelper = new RouterHelper(); public errorCodes:ErrorCodes = new ErrorCodes(); @@ -87,7 +90,8 @@ export class SearchPageComponent { private _title: Title, private _piwikService:PiwikService, private router: Router, - private seoService: SEOService) { + private seoService: SEOService, + private helper: HelperService) { } ngOnInit() { @@ -95,7 +99,10 @@ export class SearchPageComponent { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; + //this.getDivContents(); + this.getPageContents(); this.pagingLimit = data.envSpecific.pagingLimit; + HelperFunctions.scroll(); this.csvLimit = data.envSpecific.csvLimit; this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; if(typeof window !== 'undefined') { @@ -105,7 +112,6 @@ export class SearchPageComponent { this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe(); } }); - HelperFunctions.scroll(); // this.updateBaseUrlWithParameters(this.filters); this.updateTitle(this.pageTitle); @@ -114,6 +120,19 @@ export class SearchPageComponent { this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this.router.url,false); } + public getPageContents() { + this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => { + + this.pageContents = contents; + }) + } + + public getDivContents() { + this.helper.getDivHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => { + this.divContents = contents; + }) + } + ngOnDestroy() { if(this.piwiksub){ this.piwiksub.unsubscribe(); diff --git a/utils/helper/helper.service.ts b/utils/helper/helper.service.ts index 7d9d5432..77433b68 100644 --- a/utils/helper/helper.service.ts +++ b/utils/helper/helper.service.ts @@ -28,12 +28,20 @@ export class HelperService { } getPageHelpContents(router: string, properties:EnvProperties, communityId:string ):any { + if(!communityId) { + communityId = 'openaire'; + } + router = router.split('?')[0].substring(0); let url = properties.adminToolsAPIURL; url += '/community/' + communityId + '/pagehelpcontent?active=true&page='+router; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url); } getDivHelpContents(router: string, properties:EnvProperties, communityId:string ):any { + if(!communityId) { + communityId = 'openaire'; + } + router = router.split('?')[0].substring(0); let url = properties.adminToolsAPIURL; url += '/community/' + communityId + '/divhelpcontent?active=true&page='+router; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);