From adfd6b568d5d89702e332f40a2b16b3cdd1ebbf8 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 29 May 2019 12:24:43 +0000 Subject: [PATCH] [Trunk | Library]: 1. Create 'authors' folder in 'utils' to show authors, including dropdown with their ORCID information if available (used by landing & search pages). 2. Landing & Search Pages (services): Parse ORCID information of authors (creators) & cut it, if prefix is included. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@55899 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../claimResultSearchForm.component.ts | 2 +- .../directLinking.component.html | 2 +- landingPages/dataset/dataset.component.html | 2 +- landingPages/dataset/dataset.module.ts | 4 +- landingPages/dataset/dataset.service.ts | 18 ++- .../citeThis/citeThis.component.ts | 6 +- .../deletedByInference.module.ts | 3 +- .../deletedByInference.service.ts | 15 ++- .../landing-utils/resultLanding.module.ts | 6 +- .../landing-utils/showAuthors.component.ts | 4 +- landingPages/orp/orp.component.html | 2 +- landingPages/orp/orp.module.ts | 4 +- landingPages/orp/orp.service.ts | 18 ++- .../publication/publication.component.html | 2 +- .../publication/publication.module.ts | 3 +- .../publication/publication.service.ts | 15 ++- landingPages/software/software.component.html | 2 +- landingPages/software/software.module.ts | 4 +- landingPages/software/software.service.ts | 16 ++- .../searchUtils/searchResult.component.html | 13 +- .../searchUtils/searchResults.module.ts | 4 +- .../searchUtils/tabResult.component.html | 13 +- searchPages/searchUtils/tabResult.module.ts | 3 +- services/searchDatasets.service.ts | 25 ++-- services/searchOrps.service.ts | 26 ++-- services/searchPublications.service.ts | 25 ++-- services/searchSoftware.service.ts | 25 ++-- utils/authors/showAuthors.component.ts | 120 ++++++++++++++++++ utils/authors/showAuthors.module.ts | 21 +++ utils/entities/datasetInfo.ts | 2 +- utils/entities/deletedByInferenceResult.ts | 2 +- utils/entities/orpInfo.ts | 2 +- utils/entities/publicationInfo.ts | 2 +- utils/entities/searchResult.ts | 2 +- utils/entities/softwareInfo.ts | 2 +- 35 files changed, 305 insertions(+), 110 deletions(-) create mode 100644 utils/authors/showAuthors.component.ts create mode 100644 utils/authors/showAuthors.module.ts diff --git a/claims/claim-utils/claimResultSearchForm.component.ts b/claims/claim-utils/claimResultSearchForm.component.ts index c9032d9d..089aebd2 100644 --- a/claims/claim-utils/claimResultSearchForm.component.ts +++ b/claims/claim-utils/claimResultSearchForm.component.ts @@ -688,7 +688,7 @@ openaireORPPageChange($event) { result.result = item; if(item.authors){ for(var j=0; j {{((displayedResult.title == undefined || displayedResult.title == '')?'[no title available]':displayedResult.title)}} - + diff --git a/landingPages/dataset/dataset.component.html b/landingPages/dataset/dataset.component.html index aba66f89..1fb2c41c 100644 --- a/landingPages/dataset/dataset.component.html +++ b/landingPages/dataset/dataset.component.html @@ -36,7 +36,7 @@
- + ({{datasetInfo.date}})
diff --git a/landingPages/dataset/dataset.module.ts b/landingPages/dataset/dataset.module.ts index 8e4cc84b..447fbcc2 100644 --- a/landingPages/dataset/dataset.module.ts +++ b/landingPages/dataset/dataset.module.ts @@ -25,13 +25,15 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; +import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; @NgModule({ imports: [ //MaterialModule.forRoot(), CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, - AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule + AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, + ShowAuthorsModule ], declarations: [ DatasetComponent diff --git a/landingPages/dataset/dataset.service.ts b/landingPages/dataset/dataset.service.ts index e0562057..9ae82062 100644 --- a/landingPages/dataset/dataset.service.ts +++ b/landingPages/dataset/dataset.service.ts @@ -45,7 +45,7 @@ export class DatasetService { res[2], //13 (res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null, //14 res[1]['journal'] //15 - ]).map(res => this.parseDatasetInfo(res)); + ]).map(res => this.parseDatasetInfo(res, properties)); } private handleError (error: Response) { @@ -55,7 +55,7 @@ export class DatasetService { return Observable.throw(error || 'Server error'); } - parseDatasetInfo (data: any):any { + parseDatasetInfo (data: any, properties: EnvProperties):any { this.datasetInfo = new DatasetInfo(); this.datasetInfo.record = data[13]; // ['result']['metadata']['oaf:entity']['oaf:result'] @@ -199,19 +199,23 @@ export class DatasetService { // ['result']['metadata']['oaf:entity']['oaf:result']['creator'] if(data[10] != null) { if(this.datasetInfo.authors == undefined) { - this.datasetInfo.authors = new Array(); + this.datasetInfo.authors = new Array<{"fullName": string, "orcid": string}>(); } let authors = data[10]; let length = Array.isArray(authors) ? authors.length : 1; + for(let i=0; i 10)?10:this.result.authors.length; for (var i =0 ;i < max_length; i++){ - if(this.result.authors[i] && this.result.authors[i].indexOf(", ") !== -1){ - citationData.author.push({given:this.result.authors[i].split(", ")[0], family:this.result.authors[i].split(", ")[1], 'parse-names':true}); + if(this.result.authors[i] && this.result.authors[i].fullName && this.result.authors[i].fullName.indexOf(", ") !== -1){ + citationData.author.push({given:this.result.authors[i].fullName.split(", ")[0], family:this.result.authors[i].fullName.split(", ")[1], 'parse-names':true}); }else{ - citationData.author.push({given:"", family:this.result.authors[i], 'parse-names':true}); + citationData.author.push({given:"", family:this.result.authors[i].fullName, 'parse-names':true}); } // citationData.authors.push(this.result.authors[i]); } diff --git a/landingPages/landing-utils/deletedByInference/deletedByInference.module.ts b/landingPages/landing-utils/deletedByInference/deletedByInference.module.ts index cdbd7917..0e877587 100644 --- a/landingPages/landing-utils/deletedByInference/deletedByInference.module.ts +++ b/landingPages/landing-utils/deletedByInference/deletedByInference.module.ts @@ -12,11 +12,12 @@ import { FormsModule } from '@angular/forms'; import {PagingModule} from '../../../utils/paging.module'; import {ErrorMessagesModule} from '../../../utils/errorMessages.module'; +import {ShowAuthorsModule} from "../../../utils/authors/showAuthors.module"; @NgModule({ imports: [ CommonModule, FormsModule, ResultLandingModule, - PagingModule, ErrorMessagesModule + PagingModule, ErrorMessagesModule, ShowAuthorsModule ], declarations: [ DeletedByInferenceComponent diff --git a/landingPages/landing-utils/deletedByInference/deletedByInference.service.ts b/landingPages/landing-utils/deletedByInference/deletedByInference.service.ts index a1466284..d7daad43 100644 --- a/landingPages/landing-utils/deletedByInference/deletedByInference.service.ts +++ b/landingPages/landing-utils/deletedByInference/deletedByInference.service.ts @@ -28,10 +28,10 @@ export class DeletedByInferenceService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .map(res => res['result']['metadata']['oaf:entity']) - .map(res => this.parseDeletedByInferencePublications(res)); + .map(res => this.parseDeletedByInferencePublications(res, properties)); } - parseDeletedByInferencePublications (result: any): DeletedByInferenceResult { + parseDeletedByInferencePublications (result: any, properties: EnvProperties): DeletedByInferenceResult { /*title, authors, abstract, List of projects, PIDs, collectedfrom (link pointing to the download url), access rights*/ @@ -140,7 +140,7 @@ export class DeletedByInferenceService { if(result['oaf:result'] && result['oaf:result']['creator']) { if(publication.authors == undefined) { - publication.authors = new Array(); + publication.authors = new Array<{"fullName": string, "orcid": string}>(); } let authors = result['oaf:result']['creator']; @@ -148,10 +148,15 @@ export class DeletedByInferenceService { for(let i=0; i
@@ -40,7 +40,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class"; }) -export class ShowAuthorsComponent { +export class ShowAuthorsComponent1 { @Input() authors: { [key: string]: string }[]; @Input() searchPage:string ="publications" diff --git a/landingPages/orp/orp.component.html b/landingPages/orp/orp.component.html index 056fe84e..cc89fb9d 100644 --- a/landingPages/orp/orp.component.html +++ b/landingPages/orp/orp.component.html @@ -23,7 +23,7 @@
- + ({{orpInfo.date}})
diff --git a/landingPages/orp/orp.module.ts b/landingPages/orp/orp.module.ts index 9a025c6b..19002449 100644 --- a/landingPages/orp/orp.module.ts +++ b/landingPages/orp/orp.module.ts @@ -22,13 +22,15 @@ 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 {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; @NgModule({ imports: [ CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, - AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule + AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, + ShowAuthorsModule ], declarations: [ OrpComponent diff --git a/landingPages/orp/orp.service.ts b/landingPages/orp/orp.service.ts index 06da7655..568f8a81 100644 --- a/landingPages/orp/orp.service.ts +++ b/landingPages/orp/orp.service.ts @@ -43,7 +43,7 @@ export class OrpService { res[2], //13 (res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null, //14 res[1]['oaf:result']['journal'] //15 - ]).map(res => this.parseOrpInfo(res)); + ]).map(res => this.parseOrpInfo(res, properties)); } private handleError (error: Response) { @@ -53,7 +53,7 @@ export class OrpService { return Observable.throw(error || 'Server error'); } - parseOrpInfo (data: any):any { + parseOrpInfo (data: any, properties: EnvProperties):any { this.orpInfo = new OrpInfo(); this.orpInfo.record = data[13]; if(data[0] != null) { @@ -169,19 +169,23 @@ export class OrpService { if(data[10] != null) { if(this.orpInfo.authors == undefined) { - this.orpInfo.authors = new Array(); + this.orpInfo.authors = new Array<{"fullName": string, "orcid": string}>(); } let authors = data[10]; let length = Array.isArray(authors) ? authors.length : 1; + for(let i=0; i - + ({{publicationInfo.date}})
diff --git a/landingPages/publication/publication.module.ts b/landingPages/publication/publication.module.ts index c4462202..78d1fcd0 100644 --- a/landingPages/publication/publication.module.ts +++ b/landingPages/publication/publication.module.ts @@ -23,13 +23,14 @@ import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2j import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import {DeletedByInferenceModule} from '../landing-utils/deletedByInference/deletedByInference.module'; +import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; @NgModule({ imports: [ CommonModule, FormsModule, LandingModule, SharedModule, RouterModule, CiteThisModule, PagingModule, ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, - DeletedByInferenceModule + DeletedByInferenceModule, ShowAuthorsModule ], declarations: [ PublicationComponent diff --git a/landingPages/publication/publication.service.ts b/landingPages/publication/publication.service.ts index 5809056f..7c7f18ac 100644 --- a/landingPages/publication/publication.service.ts +++ b/landingPages/publication/publication.service.ts @@ -47,7 +47,7 @@ export class PublicationService { res[2], //14 res[1]['oaf:result']['country'] //15 ]) - .map(res => this.parsePublicationInfo(res)); + .map(res => this.parsePublicationInfo(res, properties)); } private handleError (error: Response) { @@ -57,7 +57,7 @@ export class PublicationService { return Observable.throw(error || 'Server error'); } - parsePublicationInfo (data: any):any { + parsePublicationInfo (data: any, properties: EnvProperties):any { this.publicationInfo = new PublicationInfo(); this.publicationInfo.record = data[14]; if(data[0] != null) { @@ -243,7 +243,7 @@ export class PublicationService { if(data[13] != null) { if(this.publicationInfo.authors == undefined) { - this.publicationInfo.authors = new Array(); + this.publicationInfo.authors = new Array<{"fullName": string, "orcid": string}>(); } let authors = data[13]; @@ -251,10 +251,15 @@ export class PublicationService { for(let i=0; i
- + ({{softwareInfo.date}})
diff --git a/landingPages/software/software.module.ts b/landingPages/software/software.module.ts index 689ac343..1885a1ac 100644 --- a/landingPages/software/software.module.ts +++ b/landingPages/software/software.module.ts @@ -19,11 +19,13 @@ 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"; @NgModule({ imports: [ CommonModule, FormsModule, LandingModule, RouterModule, CiteThisModule, PagingModule, - ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule + ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule, + ShowAuthorsModule ], declarations: [ SoftwareComponent diff --git a/landingPages/software/software.service.ts b/landingPages/software/software.service.ts index 052250a1..7f93a8d8 100644 --- a/landingPages/software/software.service.ts +++ b/landingPages/software/software.service.ts @@ -45,7 +45,7 @@ export class SoftwareService { res[1]['programmingLanguage'], res[2], res[1]['journal'] //15 - ]).map(res => this.parseSoftwareInfo(res)); + ]).map(res => this.parseSoftwareInfo(res, properties)); } private handleError (error: Response) { @@ -55,7 +55,7 @@ export class SoftwareService { return Observable.throw(error || 'Server error'); } - parseSoftwareInfo (data: any):any { + parseSoftwareInfo (data: any, properties: EnvProperties):any { this.softwareInfo = new SoftwareInfo(); this.softwareInfo.record = data[14]; if(data[0] != null) { @@ -190,7 +190,7 @@ export class SoftwareService { if(data[10] != null) { if(this.softwareInfo.authors == undefined) { - this.softwareInfo.authors = new Array(); + this.softwareInfo.authors = new Array<{"fullName": string, "orcid": string}>(); } let authors = data[10]; @@ -198,11 +198,15 @@ export class SoftwareService { for(let i=0; iSpecial Clause 39
- - - {{author}}; - - ... - + + + + + + + ({{result.year}}) diff --git a/searchPages/searchUtils/searchResults.module.ts b/searchPages/searchUtils/searchResults.module.ts index 5e9e5388..ea2a46c8 100644 --- a/searchPages/searchUtils/searchResults.module.ts +++ b/searchPages/searchUtils/searchResults.module.ts @@ -8,12 +8,14 @@ import {ErrorMessagesModule} from '../../utils/errorMessages.module'; import {SearchResult} from '../../utils/entities/searchResult'; import {SearchResultComponent} from './searchResult.component'; import {ApprovedByCommunityModule} from '../../connect/approvedByCommunity/approved.module'; +import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, ErrorMessagesModule, - ApprovedByCommunityModule + ApprovedByCommunityModule, + ShowAuthorsModule ], declarations: [ SearchResultComponent diff --git a/searchPages/searchUtils/tabResult.component.html b/searchPages/searchUtils/tabResult.component.html index 259815f1..372aeac0 100644 --- a/searchPages/searchUtils/tabResult.component.html +++ b/searchPages/searchUtils/tabResult.component.html @@ -46,12 +46,13 @@ {{result.country}}
- - - {{author}}; - - ... - + + + + + + + ({{result.year}}) diff --git a/searchPages/searchUtils/tabResult.module.ts b/searchPages/searchUtils/tabResult.module.ts index 589b5623..e0231542 100644 --- a/searchPages/searchUtils/tabResult.module.ts +++ b/searchPages/searchUtils/tabResult.module.ts @@ -5,11 +5,12 @@ import { FormsModule } from '@angular/forms'; import {SearchResult} from '../../utils/entities/searchResult'; import {TabResultComponent} from './tabResult.component'; import {RouterModule} from '@angular/router'; +import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; @NgModule({ imports: [ CommonModule, FormsModule, - RouterModule + RouterModule, ShowAuthorsModule ], declarations: [ TabResultComponent, diff --git a/services/searchDatasets.service.ts b/services/searchDatasets.service.ts index ea398032..085a78d9 100644 --- a/services/searchDatasets.service.ts +++ b/services/searchDatasets.service.ts @@ -37,14 +37,14 @@ export class SearchDatasetsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]); } searchDatasetById (id: string , properties:EnvProperties):any { let url = properties.searchAPIURLLAst+"datasets/"+id+"?format=json"; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => this.parseResults(res)); + .map(res => this.parseResults(res, properties)); } searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any { @@ -89,7 +89,7 @@ export class SearchDatasetsService { .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]); } advancedSearchDatasets (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any { let url = properties.searchResourcesAPIURL; @@ -112,7 +112,7 @@ export class SearchDatasetsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchDatasetsForEntity (params: string, page: number, size: number, properties:EnvProperties):any { let link = properties.searchAPIURLLAst; @@ -120,7 +120,7 @@ export class SearchDatasetsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchDatasetsForDataproviders(params: string, page: number, size: number, properties:EnvProperties):any { @@ -128,10 +128,10 @@ export class SearchDatasetsService { let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json"; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } - parseResults(data: any): SearchResult[] { + parseResults(data: any, properties: EnvProperties): SearchResult[] { let results: SearchResult[] = []; let length = Array.isArray(data) ? data.length : 1; @@ -220,7 +220,7 @@ export class SearchDatasetsService { if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(result['authors'] == undefined) { - result['authors'] = new Array(); + result['authors'] = new Array<{"fullName": string, "orcid": string}>(); } let authors = resData['creator']; @@ -228,10 +228,15 @@ export class SearchDatasetsService { for(let i=0; i res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "other")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "other")]); } searchOrpById (id: string , properties:EnvProperties):any { @@ -45,7 +45,7 @@ export class SearchOrpsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => this.parseResults(res)); + .map(res => this.parseResults(res, properties)); } searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any { @@ -91,7 +91,7 @@ export class SearchOrpsService { .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "other")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "other")]); } advancedSearchOrps (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any { let url = properties.searchResourcesAPIURL; @@ -115,7 +115,7 @@ export class SearchOrpsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchOrpsForEntity (params: string, page: number, size: number, properties:EnvProperties):any { let link = properties.searchAPIURLLAst; @@ -124,7 +124,7 @@ export class SearchOrpsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchOrpsForDataproviders(params: string, page: number, size: number, properties:EnvProperties):any { @@ -133,10 +133,10 @@ export class SearchOrpsService { let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json"; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } - parseResults(data: any): SearchResult[] { + parseResults(data: any, properties: EnvProperties): SearchResult[] { let results: SearchResult[] = []; let length = Array.isArray(data) ? data.length : 1; @@ -225,7 +225,7 @@ export class SearchOrpsService { if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(result['authors'] == undefined) { - result['authors'] = new Array(); + result['authors'] = new Array<{"fullName": string, "orcid": string}>(); } let authors = resData['creator']; @@ -233,10 +233,14 @@ export class SearchOrpsService { for(let i=0; i res.json()) // .do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]); } searchPublicationById (id: string, properties:EnvProperties ):any { @@ -46,7 +46,7 @@ export class SearchPublicationsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => this.parseResults(res)); + .map(res => this.parseResults(res, properties)); } searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any { @@ -91,7 +91,7 @@ export class SearchPublicationsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]); } advancedSearchPublications (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any { @@ -116,7 +116,7 @@ export class SearchPublicationsService { .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchPublicationsForEntity (params: string, page: number, size: number, properties:EnvProperties):any { let link = properties.searchAPIURLLAst; @@ -127,7 +127,7 @@ export class SearchPublicationsService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchPublicationsForDataproviders(params: string, page: number, size: number, properties:EnvProperties):any { @@ -135,7 +135,7 @@ export class SearchPublicationsService { let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json"; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } /* searchPublicationsCSV (params: string, refineParams:string, page: number, size: number):any { @@ -161,7 +161,7 @@ export class SearchPublicationsService { } */ - parseResults(data: any): SearchResult[] { + parseResults(data: any, properties: EnvProperties): SearchResult[] { let results: SearchResult[] = []; let length = Array.isArray(data) ? data.length : 1; @@ -256,7 +256,7 @@ export class SearchPublicationsService { if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(result['authors'] == undefined) { - result['authors'] = new Array(); + result['authors'] = new Array<{"fullName": string, "orcid": string}>(); } let authors = resData['creator']; @@ -264,10 +264,15 @@ export class SearchPublicationsService { for(let i=0; i res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); } searchSoftwareById (id: string, properties:EnvProperties ):any { @@ -45,7 +45,7 @@ export class SearchSoftwareService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => this.parseResults(res)); + .map(res => this.parseResults(res, properties)); } searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any { @@ -88,7 +88,7 @@ export class SearchSoftwareService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); } advancedSearchSoftware (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any { let url = properties.searchResourcesAPIURL; @@ -111,7 +111,7 @@ export class SearchSoftwareService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) //.do(res => console.info(res)) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchSoftwareForEntity (params: string, page: number, size: number, properties:EnvProperties):any { let link = properties.searchAPIURLLAst; @@ -119,7 +119,7 @@ export class SearchSoftwareService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } searchSoftwareForDataproviders(params: string, page: number, size: number, properties:EnvProperties):any { @@ -128,10 +128,10 @@ export class SearchSoftwareService { return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) - .map(res => [res['meta'].total, this.parseResults(res['results'])]); + .map(res => [res['meta'].total, this.parseResults(res['results'], properties)]); } - parseResults(data: any): SearchResult[] { + parseResults(data: any, properties: EnvProperties): SearchResult[] { let results: SearchResult[] = []; let length = Array.isArray(data) ? data.length : 1; @@ -237,7 +237,7 @@ export class SearchSoftwareService { if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(result['authors'] == undefined) { - result['authors'] = new Array(); + result['authors'] = new Array<{"fullName": string, "orcid": string}>(); } let authors = resData['creator']; @@ -245,10 +245,15 @@ export class SearchSoftwareService { for(let i=0; i + + + + {{author.fullName}}{{author.fullName}}
+ {{author.fullName}} + +
+
ORCID
+ {{author.orcid}} + + + + Visit + + +
+ +
+
+ Search {{author.fullName}} by ORCID in OpenAIRE's +
+ + + + +
; +
+ ... + + + view all {{authors.length | number}} authors + + + + View less authors + + + ` + +}) + +export class ShowAuthorsComponent { + @Input() authors: {"fullName": string, "orcid": string}[]; + @Input() authorsLimit: number = 30; + @Input() showAll: boolean = true; + + public numberOfAuthors: number; + public properties:EnvProperties; + public routerHelper:RouterHelper = new RouterHelper(); + + constructor (private route: ActivatedRoute) {} + + ngOnInit() { + this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + }); + this.numberOfAuthors = this.authorsLimit; + + if(typeof window !== 'undefined') { + let orcid_clipboard; + let Clipboard; + Clipboard = require('clipboard'); + if(this.authors) { + this.authors.forEach((author, index) => { + if (author && author.orcid) { + orcid_clipboard = new Clipboard('.orcid_clipboard_btn_auhtor_' + index); + } + }); + } + } + } + + public quote(params: string):string { + return '"'+params+'"'; + } + + public scroll() { + HelperFunctions.scroll(); + } +} diff --git a/utils/authors/showAuthors.module.ts b/utils/authors/showAuthors.module.ts new file mode 100644 index 00000000..36df12d5 --- /dev/null +++ b/utils/authors/showAuthors.module.ts @@ -0,0 +1,21 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + +import {ShowAuthorsComponent} from './showAuthors.component'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule + ], + declarations: [ + ShowAuthorsComponent + ], + providers:[ + ], + exports: [ + ShowAuthorsComponent + ] +}) +export class ShowAuthorsModule { } \ No newline at end of file diff --git a/utils/entities/datasetInfo.ts b/utils/entities/datasetInfo.ts index f51a7735..98ebdbf5 100644 --- a/utils/entities/datasetInfo.ts +++ b/utils/entities/datasetInfo.ts @@ -4,7 +4,7 @@ export class DatasetInfo { title: string; subtitle: string; accessMode: string; - authors: string[]; + authors: {"fullName": string, "orcid": string}[]; date: string; dateofacceptance: string; embargoEndDate: string; diff --git a/utils/entities/deletedByInferenceResult.ts b/utils/entities/deletedByInferenceResult.ts index 526e721c..fc91f611 100644 --- a/utils/entities/deletedByInferenceResult.ts +++ b/utils/entities/deletedByInferenceResult.ts @@ -4,7 +4,7 @@ export class DeletedByInferenceResult { title: string; accessMode: string; - authors: string[]; + authors: {"fullName": string, "orcid": string}[]; date: string; dateofacceptance: string; diff --git a/utils/entities/orpInfo.ts b/utils/entities/orpInfo.ts index 9c473a8e..6b0c1be2 100644 --- a/utils/entities/orpInfo.ts +++ b/utils/entities/orpInfo.ts @@ -2,7 +2,7 @@ export class OrpInfo { underCurationMessage: boolean; title: string; accessMode: string; - authors: string[]; + authors: {"fullName": string, "orcid": string}[]; date: string; dateofacceptance: string; embargoEndDate: string; diff --git a/utils/entities/publicationInfo.ts b/utils/entities/publicationInfo.ts index 2f5972d1..d23938c0 100644 --- a/utils/entities/publicationInfo.ts +++ b/utils/entities/publicationInfo.ts @@ -3,7 +3,7 @@ export class PublicationInfo { //title: { "name": string, "url": string, "accessMode": string}; title: string; accessMode: string; - authors: string[]; + authors: {"fullName": string, "orcid": string}[]; date: string; dateofacceptance: string; embargoEndDate: string; diff --git a/utils/entities/searchResult.ts b/utils/entities/searchResult.ts index cafcd843..d7032a25 100644 --- a/utils/entities/searchResult.ts +++ b/utils/entities/searchResult.ts @@ -11,7 +11,7 @@ export class SearchResult { description: string; year: string; embargoEndDate: string; - authors: string[]; + authors: {"fullName": string, "orcid": string}[]; //datasets & orp: publisher: string; diff --git a/utils/entities/softwareInfo.ts b/utils/entities/softwareInfo.ts index f1304af3..18e35a31 100644 --- a/utils/entities/softwareInfo.ts +++ b/utils/entities/softwareInfo.ts @@ -3,7 +3,7 @@ export class SoftwareInfo { //title: { "name": string, "url": string, "accessMode": string}; title: string; accessMode: string; - authors: string[]; + authors: {"fullName": string, "orcid": string}[]; date: string; dateofacceptance: string; embargoEndDate: string;