[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
This commit is contained in:
konstantina.galouni 2019-05-29 12:24:43 +00:00
parent bb4d406a8f
commit adfd6b568d
35 changed files with 305 additions and 110 deletions

View File

@ -688,7 +688,7 @@ openaireORPPageChange($event) {
result.result = item; result.result = item;
if(item.authors){ if(item.authors){
for(var j=0; j<item.authors.length; j++){ for(var j=0; j<item.authors.length; j++){
result.authors.push(item.authors[j]); result.authors.push(item.authors[j]['fullName']);
} }
} }

View File

@ -47,7 +47,7 @@
<span *ngIf="!displayedResult.url" > {{((displayedResult.title == undefined || displayedResult.title == '')?'[no title available]':displayedResult.title)}}</span> <span *ngIf="!displayedResult.url" > {{((displayedResult.title == undefined || displayedResult.title == '')?'[no title available]':displayedResult.title)}}</span>
</div> </div>
<div *ngIf="displayedResult.result.authors && displayedResult.result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of displayedResult.result.authors.slice(0,10) let i = index">{{author}}{{(i < (displayedResult.result.authors.slice(0,10).length-1))?"; ":""}}{{(i == displayedResult.result.authors.slice(0,10).length-1 && displayedResult.result.authors.length > 10)?"...":""}}</span></div> <div *ngIf="displayedResult.result.authors && displayedResult.result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of displayedResult.result.authors.slice(0,10) let i = index">{{author.fullName}}{{(i < (displayedResult.result.authors.slice(0,10).length-1))?"; ":""}}{{(i == displayedResult.result.authors.slice(0,10).length-1 && displayedResult.result.authors.length > 10)?"...":""}}</span></div>
</div> </div>

View File

@ -36,7 +36,7 @@
</div--> </div-->
<div class= " uk-margin-top"> <div class= " uk-margin-top">
<showAuthors [authors]="datasetInfo.authors" searchPage="datasets"></showAuthors> <showAuthors [authors]="datasetInfo.authors"></showAuthors>
<span *ngIf="datasetInfo.date != ''">({{datasetInfo.date}})</span> <span *ngIf="datasetInfo.date != ''">({{datasetInfo.date}})</span>
</div> </div>

View File

@ -25,13 +25,15 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; 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";
@NgModule({ @NgModule({
imports: [ imports: [
//MaterialModule.forRoot(), //MaterialModule.forRoot(),
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule,
AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule,
ShowAuthorsModule
], ],
declarations: [ declarations: [
DatasetComponent DatasetComponent

View File

@ -45,7 +45,7 @@ export class DatasetService {
res[2], //13 res[2], //13
(res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null, //14 (res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null, //14
res[1]['journal'] //15 res[1]['journal'] //15
]).map(res => this.parseDatasetInfo(res)); ]).map(res => this.parseDatasetInfo(res, properties));
} }
private handleError (error: Response) { private handleError (error: Response) {
@ -55,7 +55,7 @@ export class DatasetService {
return Observable.throw(error || 'Server error'); return Observable.throw(error || 'Server error');
} }
parseDatasetInfo (data: any):any { parseDatasetInfo (data: any, properties: EnvProperties):any {
this.datasetInfo = new DatasetInfo(); this.datasetInfo = new DatasetInfo();
this.datasetInfo.record = data[13]; this.datasetInfo.record = data[13];
// ['result']['metadata']['oaf:entity']['oaf:result'] // ['result']['metadata']['oaf:entity']['oaf:result']
@ -199,19 +199,23 @@ export class DatasetService {
// ['result']['metadata']['oaf:entity']['oaf:result']['creator'] // ['result']['metadata']['oaf:entity']['oaf:result']['creator']
if(data[10] != null) { if(data[10] != null) {
if(this.datasetInfo.authors == undefined) { if(this.datasetInfo.authors == undefined) {
this.datasetInfo.authors = new Array<string>(); this.datasetInfo.authors = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = data[10]; let authors = data[10];
let length = Array.isArray(authors) ? authors.length : 1; let length = Array.isArray(authors) ? authors.length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
this.datasetInfo.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
this.datasetInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) { this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -81,10 +81,10 @@ export class CiteThisComponent {
citationData.author = []; citationData.author = [];
var max_length = (this.result.authors.length > 10)?10:this.result.authors.length; var max_length = (this.result.authors.length > 10)?10:this.result.authors.length;
for (var i =0 ;i < max_length; i++){ for (var i =0 ;i < max_length; i++){
if(this.result.authors[i] && this.result.authors[i].indexOf(", ") !== -1){ 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].split(", ")[0], family:this.result.authors[i].split(", ")[1], 'parse-names':true}); citationData.author.push({given:this.result.authors[i].fullName.split(", ")[0], family:this.result.authors[i].fullName.split(", ")[1], 'parse-names':true});
}else{ }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]); // citationData.authors.push(this.result.authors[i]);
} }

View File

@ -12,11 +12,12 @@ import { FormsModule } from '@angular/forms';
import {PagingModule} from '../../../utils/paging.module'; import {PagingModule} from '../../../utils/paging.module';
import {ErrorMessagesModule} from '../../../utils/errorMessages.module'; import {ErrorMessagesModule} from '../../../utils/errorMessages.module';
import {ShowAuthorsModule} from "../../../utils/authors/showAuthors.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, ResultLandingModule, CommonModule, FormsModule, ResultLandingModule,
PagingModule, ErrorMessagesModule PagingModule, ErrorMessagesModule, ShowAuthorsModule
], ],
declarations: [ declarations: [
DeletedByInferenceComponent DeletedByInferenceComponent

View File

@ -28,10 +28,10 @@ export class DeletedByInferenceService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
.map(res => res['result']['metadata']['oaf:entity']) .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, /*title, authors, abstract, List of projects, PIDs,
collectedfrom (link pointing to the download url), access rights*/ 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(result['oaf:result'] && result['oaf:result']['creator']) {
if(publication.authors == undefined) { if(publication.authors == undefined) {
publication.authors = new Array<string>(); publication.authors = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = result['oaf:result']['creator']; let authors = result['oaf:result']['creator'];
@ -148,10 +148,15 @@ export class DeletedByInferenceService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
publication.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
publication['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
publication.authors = publication.authors.filter(function (item) { publication.authors = publication.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {PagingModule} from '../../utils/paging.module'; import {PagingModule} from '../../utils/paging.module';
import {ShowAuthorsComponent} from './showAuthors.component'; //import {ShowAuthorsComponent} from './showAuthors.component';
import {ShowIdentifiersComponent} from './showIdentifiers.component'; import {ShowIdentifiersComponent} from './showIdentifiers.component';
import {ShowSubjectsComponent} from './showSubjects.component'; import {ShowSubjectsComponent} from './showSubjects.component';
import {FundedByComponent} from './fundedBy.component'; import {FundedByComponent} from './fundedBy.component';
@ -21,13 +21,13 @@ import {ShowPublisherModule} from "./showPublisher.module";
CommonModule, FormsModule, RouterModule, PagingModule, ShowPublisherModule CommonModule, FormsModule, RouterModule, PagingModule, ShowPublisherModule
], ],
declarations: [ declarations: [
ShowAuthorsComponent,ShowIdentifiersComponent,ShowSubjectsComponent, ShowIdentifiersComponent,ShowSubjectsComponent,
FundedByComponent,PublishedInComponent,AvailableOnComponent,TabTableComponent FundedByComponent,PublishedInComponent,AvailableOnComponent,TabTableComponent
], ],
providers:[ providers:[
], ],
exports: [ exports: [
ShowAuthorsComponent, ShowIdentifiersComponent, ShowSubjectsComponent, ShowIdentifiersComponent, ShowSubjectsComponent,
FundedByComponent, PublishedInComponent, AvailableOnComponent, TabTableComponent, ShowPublisherComponent FundedByComponent, PublishedInComponent, AvailableOnComponent, TabTableComponent, ShowPublisherComponent
] ]
}) })

View File

@ -3,7 +3,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {HelperFunctions} from "../../utils/HelperFunctions.class";
@Component({ @Component({
selector: 'showAuthors', selector: 'showAuthors1',
template: ` template: `
<span *ngIf="authors != undefined"> <span *ngIf="authors != undefined">
<div *ngIf="showAll"> <div *ngIf="showAll">
@ -40,7 +40,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
}) })
export class ShowAuthorsComponent { export class ShowAuthorsComponent1 {
@Input() authors: { [key: string]: string }[]; @Input() authors: { [key: string]: string }[];
@Input() searchPage:string ="publications" @Input() searchPage:string ="publications"

View File

@ -23,7 +23,7 @@
</span> </span>
<div class= " uk-margin-top"> <div class= " uk-margin-top">
<showAuthors [authors]="orpInfo.authors" searchPage="orps"></showAuthors> <showAuthors [authors]="orpInfo.authors"></showAuthors>
<span *ngIf="orpInfo.date != ''">({{orpInfo.date}})</span> <span *ngIf="orpInfo.date != ''">({{orpInfo.date}})</span>
</div> </div>

View File

@ -22,13 +22,15 @@ import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; 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";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule,
AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule,
ShowAuthorsModule
], ],
declarations: [ declarations: [
OrpComponent OrpComponent

View File

@ -43,7 +43,7 @@ export class OrpService {
res[2], //13 res[2], //13
(res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null, //14 (res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null, //14
res[1]['oaf:result']['journal'] //15 res[1]['oaf:result']['journal'] //15
]).map(res => this.parseOrpInfo(res)); ]).map(res => this.parseOrpInfo(res, properties));
} }
private handleError (error: Response) { private handleError (error: Response) {
@ -53,7 +53,7 @@ export class OrpService {
return Observable.throw(error || 'Server error'); return Observable.throw(error || 'Server error');
} }
parseOrpInfo (data: any):any { parseOrpInfo (data: any, properties: EnvProperties):any {
this.orpInfo = new OrpInfo(); this.orpInfo = new OrpInfo();
this.orpInfo.record = data[13]; this.orpInfo.record = data[13];
if(data[0] != null) { if(data[0] != null) {
@ -169,19 +169,23 @@ export class OrpService {
if(data[10] != null) { if(data[10] != null) {
if(this.orpInfo.authors == undefined) { if(this.orpInfo.authors == undefined) {
this.orpInfo.authors = new Array<string>(); this.orpInfo.authors = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = data[10]; let authors = data[10];
let length = Array.isArray(authors) ? authors.length : 1; let length = Array.isArray(authors) ? authors.length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
this.orpInfo.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
this.orpInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
this.orpInfo.authors = this.orpInfo.authors.filter(function (item) { this.orpInfo.authors = this.orpInfo.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -27,7 +27,7 @@
<div class= " uk-margin-top"> <div class= " uk-margin-top">
<showAuthors [authors]="publicationInfo.authors" searchPage="publications"></showAuthors> <showAuthors [authors]="publicationInfo.authors"></showAuthors>
<span *ngIf="publicationInfo.date != ''">({{publicationInfo.date}})</span> <span *ngIf="publicationInfo.date != ''">({{publicationInfo.date}})</span>
</div> </div>

View File

@ -23,13 +23,14 @@ import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2j
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {DeletedByInferenceModule} from '../landing-utils/deletedByInference/deletedByInference.module'; import {DeletedByInferenceModule} from '../landing-utils/deletedByInference/deletedByInference.module';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, LandingModule, SharedModule, RouterModule, CommonModule, FormsModule, LandingModule, SharedModule, RouterModule,
CiteThisModule, PagingModule, ResultLandingModule, IFrameModule, CiteThisModule, PagingModule, ResultLandingModule, IFrameModule,
MetricsModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, MetricsModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule,
DeletedByInferenceModule DeletedByInferenceModule, ShowAuthorsModule
], ],
declarations: [ declarations: [
PublicationComponent PublicationComponent

View File

@ -47,7 +47,7 @@ export class PublicationService {
res[2], //14 res[2], //14
res[1]['oaf:result']['country'] //15 res[1]['oaf:result']['country'] //15
]) ])
.map(res => this.parsePublicationInfo(res)); .map(res => this.parsePublicationInfo(res, properties));
} }
private handleError (error: Response) { private handleError (error: Response) {
@ -57,7 +57,7 @@ export class PublicationService {
return Observable.throw(error || 'Server error'); return Observable.throw(error || 'Server error');
} }
parsePublicationInfo (data: any):any { parsePublicationInfo (data: any, properties: EnvProperties):any {
this.publicationInfo = new PublicationInfo(); this.publicationInfo = new PublicationInfo();
this.publicationInfo.record = data[14]; this.publicationInfo.record = data[14];
if(data[0] != null) { if(data[0] != null) {
@ -243,7 +243,7 @@ export class PublicationService {
if(data[13] != null) { if(data[13] != null) {
if(this.publicationInfo.authors == undefined) { if(this.publicationInfo.authors == undefined) {
this.publicationInfo.authors = new Array<string>(); this.publicationInfo.authors = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = data[13]; let authors = data[13];
@ -251,10 +251,15 @@ export class PublicationService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
this.publicationInfo.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
this.publicationInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) { this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -33,7 +33,7 @@
</div--> </div-->
<div class= " uk-margin-top"> <div class= " uk-margin-top">
<showAuthors [authors]="softwareInfo.authors" searchPage="software"></showAuthors> <showAuthors [authors]="softwareInfo.authors"></showAuthors>
<span *ngIf="softwareInfo.date != ''">({{softwareInfo.date}})</span> <span *ngIf="softwareInfo.date != ''">({{softwareInfo.date}})</span>
</div> </div>

View File

@ -19,11 +19,13 @@ import { LandingModule } from '../landing-utils/landing.module';
import { FreeGuard } from'../../login/freeGuard.guard'; import { FreeGuard } from'../../login/freeGuard.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; 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";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, LandingModule, RouterModule, CiteThisModule, PagingModule, CommonModule, FormsModule, LandingModule, RouterModule, CiteThisModule, PagingModule,
ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule,
ShowAuthorsModule
], ],
declarations: [ declarations: [
SoftwareComponent SoftwareComponent

View File

@ -45,7 +45,7 @@ export class SoftwareService {
res[1]['programmingLanguage'], res[1]['programmingLanguage'],
res[2], res[2],
res[1]['journal'] //15 res[1]['journal'] //15
]).map(res => this.parseSoftwareInfo(res)); ]).map(res => this.parseSoftwareInfo(res, properties));
} }
private handleError (error: Response) { private handleError (error: Response) {
@ -55,7 +55,7 @@ export class SoftwareService {
return Observable.throw(error || 'Server error'); return Observable.throw(error || 'Server error');
} }
parseSoftwareInfo (data: any):any { parseSoftwareInfo (data: any, properties: EnvProperties):any {
this.softwareInfo = new SoftwareInfo(); this.softwareInfo = new SoftwareInfo();
this.softwareInfo.record = data[14]; this.softwareInfo.record = data[14];
if(data[0] != null) { if(data[0] != null) {
@ -190,7 +190,7 @@ export class SoftwareService {
if(data[10] != null) { if(data[10] != null) {
if(this.softwareInfo.authors == undefined) { if(this.softwareInfo.authors == undefined) {
this.softwareInfo.authors = new Array<string>(); this.softwareInfo.authors = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = data[10]; let authors = data[10];
@ -198,11 +198,15 @@ export class SoftwareService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
this.softwareInfo.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
this.softwareInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
this.softwareInfo.authors = this.softwareInfo.authors.filter(function (item) { this.softwareInfo.authors = this.softwareInfo.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -24,12 +24,13 @@
<span *ngIf="result.title && result.title.sc39" class="uk-label custom-label label-sc39 " title="Special Clause 39">Special Clause 39</span> <span *ngIf="result.title && result.title.sc39" class="uk-label custom-label label-sc39 " title="Special Clause 39">Special Clause 39</span>
<div class="uk-margin-small"> <div class="uk-margin-small">
<span *ngIf="result['authors'] != undefined" class="resultsAuthors uk-margin-small-top" style="font-style: italic;"> <!-- <span *ngIf="result['authors'] != undefined" class="resultsAuthors uk-margin-small-top" style="font-style: italic;">-->
<span *ngFor="let author of result['authors'].slice(0,15)"> <!-- <span *ngFor="let author of result['authors'].slice(0,15)">-->
{{author}}; <!-- {{author}};-->
</span> <!-- </span>-->
<span *ngIf="result['authors'].length > 15">...</span> <!-- <span *ngIf="result['authors'].length > 15">...</span>-->
</span> <!-- </span>-->
<showAuthors [authors]="result['authors']" [authorsLimit]=15 [showAll]=false></showAuthors>
<span *ngIf="result.year != undefined && result.year != ''"> <span *ngIf="result.year != undefined && result.year != ''">
({{result.year}}) ({{result.year}})
</span> </span>

View File

@ -8,12 +8,14 @@ import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {SearchResult} from '../../utils/entities/searchResult'; import {SearchResult} from '../../utils/entities/searchResult';
import {SearchResultComponent} from './searchResult.component'; import {SearchResultComponent} from './searchResult.component';
import {ApprovedByCommunityModule} from '../../connect/approvedByCommunity/approved.module'; import {ApprovedByCommunityModule} from '../../connect/approvedByCommunity/approved.module';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
RouterModule, ErrorMessagesModule, RouterModule, ErrorMessagesModule,
ApprovedByCommunityModule ApprovedByCommunityModule,
ShowAuthorsModule
], ],
declarations: [ declarations: [
SearchResultComponent SearchResultComponent

View File

@ -46,12 +46,13 @@
<span *ngIf="result.country != undefined && result.country != ''" class="uk-label custom-label label-country" title="Country"> {{result.country}}</span> <span *ngIf="result.country != undefined && result.country != ''" class="uk-label custom-label label-country" title="Country"> {{result.country}}</span>
<div class="uk-margin-small"> <div class="uk-margin-small">
<span *ngIf="result['authors'] != undefined" class="resultsAuthors uk-margin-small-top" style="font-style: italic;"> <!-- <span *ngIf="result['authors'] != undefined" class="resultsAuthors uk-margin-small-top" style="font-style: italic;">-->
<span *ngFor="let author of result['authors'].slice(0,15)"> <!-- <span *ngFor="let author of result['authors'].slice(0,15)">-->
{{author}}; <!-- {{author}};-->
</span> <!-- </span>-->
<span *ngIf="result['authors'].length > 15">...</span> <!-- <span *ngIf="result['authors'].length > 15">...</span>-->
</span> <!-- </span>-->
<showAuthors [authors]="result['authors']" [authorsLimit]=15 [showAll]=false></showAuthors>
<span *ngIf="result.year != undefined && result.year != ''"> <span *ngIf="result.year != undefined && result.year != ''">
({{result.year}}) ({{result.year}})
</span> </span>

View File

@ -5,11 +5,12 @@ import { FormsModule } from '@angular/forms';
import {SearchResult} from '../../utils/entities/searchResult'; import {SearchResult} from '../../utils/entities/searchResult';
import {TabResultComponent} from './tabResult.component'; import {TabResultComponent} from './tabResult.component';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
RouterModule RouterModule, ShowAuthorsModule
], ],
declarations: [ declarations: [
TabResultComponent, TabResultComponent,

View File

@ -37,14 +37,14 @@ export class SearchDatasetsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { searchDatasetById (id: string , properties:EnvProperties):any {
let url = properties.searchAPIURLLAst+"datasets/"+id+"?format=json"; let url = properties.searchAPIURLLAst+"datasets/"+id+"?format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any {
@ -89,7 +89,7 @@ export class SearchDatasetsService {
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { advancedSearchDatasets (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any {
let url = properties.searchResourcesAPIURL; let url = properties.searchResourcesAPIURL;
@ -112,7 +112,7 @@ export class SearchDatasetsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { searchDatasetsForEntity (params: string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchAPIURLLAst; let link = properties.searchAPIURLLAst;
@ -120,7 +120,7 @@ export class SearchDatasetsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { 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"; let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
@ -220,7 +220,7 @@ export class SearchDatasetsService {
if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
if(result['authors'] == undefined) { if(result['authors'] == undefined) {
result['authors'] = new Array<string>(); result['authors'] = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = resData['creator']; let authors = resData['creator'];
@ -228,10 +228,15 @@ export class SearchDatasetsService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
result.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
result.authors = result.authors.filter(function (item) { result.authors = result.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -37,7 +37,7 @@ export class SearchOrpsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { searchOrpById (id: string , properties:EnvProperties):any {
@ -45,7 +45,7 @@ export class SearchOrpsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any {
@ -91,7 +91,7 @@ export class SearchOrpsService {
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { advancedSearchOrps (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any {
let url = properties.searchResourcesAPIURL; let url = properties.searchResourcesAPIURL;
@ -115,7 +115,7 @@ export class SearchOrpsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { searchOrpsForEntity (params: string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchAPIURLLAst; let link = properties.searchAPIURLLAst;
@ -124,7 +124,7 @@ export class SearchOrpsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { 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"; let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
@ -225,7 +225,7 @@ export class SearchOrpsService {
if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
if(result['authors'] == undefined) { if(result['authors'] == undefined) {
result['authors'] = new Array<string>(); result['authors'] = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = resData['creator']; let authors = resData['creator'];
@ -233,10 +233,14 @@ export class SearchOrpsService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
result.authors[author.rank] = author.content; if(author) {
} if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
} }
result.authors = result.authors.filter(function (item) { result.authors = result.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -38,7 +38,7 @@ export class SearchPublicationsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
// .do(res => console.info(res)) // .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 { searchPublicationById (id: string, properties:EnvProperties ):any {
@ -46,7 +46,7 @@ export class SearchPublicationsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { 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) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { advancedSearchPublications (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any {
@ -116,7 +116,7 @@ export class SearchPublicationsService {
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { searchPublicationsForEntity (params: string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchAPIURLLAst; let link = properties.searchAPIURLLAst;
@ -127,7 +127,7 @@ export class SearchPublicationsService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { 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"; let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { 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 results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
@ -256,7 +256,7 @@ export class SearchPublicationsService {
if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
if(result['authors'] == undefined) { if(result['authors'] == undefined) {
result['authors'] = new Array<string>(); result['authors'] = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = resData['creator']; let authors = resData['creator'];
@ -264,10 +264,15 @@ export class SearchPublicationsService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
result.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
result.authors = result.authors.filter(function (item) { result.authors = result.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -36,7 +36,7 @@ export class SearchSoftwareService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { searchSoftwareById (id: string, properties:EnvProperties ):any {
@ -45,7 +45,7 @@ export class SearchSoftwareService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { 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) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { advancedSearchSoftware (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any {
let url = properties.searchResourcesAPIURL; let url = properties.searchResourcesAPIURL;
@ -111,7 +111,7 @@ export class SearchSoftwareService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> res.json())
//.do(res => console.info(res)) //.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 { searchSoftwareForEntity (params: string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchAPIURLLAst; let link = properties.searchAPIURLLAst;
@ -119,7 +119,7 @@ export class SearchSoftwareService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 { 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) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json()) .map(res => <any> 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 results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1; let length = Array.isArray(data) ? data.length : 1;
@ -237,7 +237,7 @@ export class SearchSoftwareService {
if(resData.hasOwnProperty("creator") && resData['creator'] != null) { if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
if(result['authors'] == undefined) { if(result['authors'] == undefined) {
result['authors'] = new Array<string>(); result['authors'] = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = resData['creator']; let authors = resData['creator'];
@ -245,10 +245,15 @@ export class SearchSoftwareService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors; let author = Array.isArray(authors) ? authors[i] : authors;
result.authors[author.rank] = author.content; if(author) {
if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
} }
result.authors = result.authors.filter(function (item) { result.authors = result.authors.filter(function (item) {
return (item != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }

View File

@ -0,0 +1,120 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
import {HelperFunctions} from '../HelperFunctions.class';
import {RouterHelper} from "../routerHelper.class";
import {EnvProperties} from '../properties/env-properties';
@Component({
selector: 'showAuthors',
template: `
<span *ngIf="authors != undefined">
<div *ngIf="showAll && numberOfAuthors > authorsLimit">
<a (click)="numberOfAuthors = authorsLimit;">View less authors</a>
</div>
<span *ngFor="let author of authors.slice(0,numberOfAuthors) let i=index">
<i *ngIf="!author.orcid || (properties.environment != 'beta' && properties.environment != 'development')">{{author.fullName}}</i
><a *ngIf="author.orcid && (properties.environment == 'beta' || properties.environment == 'development')"><i>{{author.fullName}}</i></a
><div *ngIf="author.orcid && (properties.environment == 'beta' || properties.environment == 'development')" class=" default-dropdown uk-margin-remove-top uk-padding-medium"
uk-dropdown="pos: bottom-left; mode:hover" style="min-width: 70px !important;">
<b class="uk-margin-top">{{author.fullName}}</b>
<div>
<div class="uk-text-muted">ORCID</div>
<span><code class="uk-padding-small" [id]="'orcid_clipboard_auhtor_'+i">{{author.orcid}}</code></span>
<span>
<button [class]="'uk-icon-clipboard uk-button uk-button-primary uk-button-small orcid_clipboard_btn_auhtor_'+i"
[attr.data-clipboard-target]="'#orcid_clipboard_auhtor_'+i" title="Copy to clipboard">
Copy
</button>
<a class="uk-button uk-button-primary uk-button-small" title="Visit author in Orcid"
[href]="properties.orcidURL+author.orcid" target="_blank">
Visit
</a>
</span>
</div>
<hr>
<div class="uk-margin-top">
Search <b>{{author.fullName}}</b> by <b>ORCID</b> in OpenAIRE's
</div>
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/publications">
Publications
</a>
</div>
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/datasets">
Research Data
</a>
</div>
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/software">
Software
</a>
</div>
<div class="uk-text-center uk-margin-small uk-margin-large-left uk-margin-large-right">
<a class="uk-button uk-button-small portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-width-1-1"
[queryParams]="routerHelper.createQueryParams(['orcid','oc'],[quote(author['orcid']),'and'])" routerLinkActive="router-link-active" routerLink="/search/advanced/other">
Other Research Products
</a>
</div>
</div
><span>;</span>
</span>
<span *ngIf="numberOfAuthors == authorsLimit && authors.length > authorsLimit"> ... </span>
<span *ngIf="showAll && numberOfAuthors == authorsLimit && authors.length > authorsLimit">
<a (click)="numberOfAuthors = authors.length;">
view all {{authors.length | number}} authors
</a>
</span>
<span *ngIf="showAll && numberOfAuthors > authorsLimit">
<a (click)="numberOfAuthors = authorsLimit; scroll()">View less authors</a>
</span>
</span>
`
})
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();
}
}

View File

@ -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 { }

View File

@ -4,7 +4,7 @@ export class DatasetInfo {
title: string; title: string;
subtitle: string; subtitle: string;
accessMode: string; accessMode: string;
authors: string[]; authors: {"fullName": string, "orcid": string}[];
date: string; date: string;
dateofacceptance: string; dateofacceptance: string;
embargoEndDate: string; embargoEndDate: string;

View File

@ -4,7 +4,7 @@
export class DeletedByInferenceResult { export class DeletedByInferenceResult {
title: string; title: string;
accessMode: string; accessMode: string;
authors: string[]; authors: {"fullName": string, "orcid": string}[];
date: string; date: string;
dateofacceptance: string; dateofacceptance: string;

View File

@ -2,7 +2,7 @@ export class OrpInfo {
underCurationMessage: boolean; underCurationMessage: boolean;
title: string; title: string;
accessMode: string; accessMode: string;
authors: string[]; authors: {"fullName": string, "orcid": string}[];
date: string; date: string;
dateofacceptance: string; dateofacceptance: string;
embargoEndDate: string; embargoEndDate: string;

View File

@ -3,7 +3,7 @@ export class PublicationInfo {
//title: { "name": string, "url": string, "accessMode": string}; //title: { "name": string, "url": string, "accessMode": string};
title: string; title: string;
accessMode: string; accessMode: string;
authors: string[]; authors: {"fullName": string, "orcid": string}[];
date: string; date: string;
dateofacceptance: string; dateofacceptance: string;
embargoEndDate: string; embargoEndDate: string;

View File

@ -11,7 +11,7 @@ export class SearchResult {
description: string; description: string;
year: string; year: string;
embargoEndDate: string; embargoEndDate: string;
authors: string[]; authors: {"fullName": string, "orcid": string}[];
//datasets & orp: //datasets & orp:
publisher: string; publisher: string;

View File

@ -3,7 +3,7 @@ export class SoftwareInfo {
//title: { "name": string, "url": string, "accessMode": string}; //title: { "name": string, "url": string, "accessMode": string};
title: string; title: string;
accessMode: string; accessMode: string;
authors: string[]; authors: {"fullName": string, "orcid": string}[];
date: string; date: string;
dateofacceptance: string; dateofacceptance: string;
embargoEndDate: string; embargoEndDate: string;