From 276e467b4fcc1f0a3e0155e8d72974b0f5f7e00f Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 16 Mar 2020 13:09:46 +0000 Subject: [PATCH] [Library | Trunk]: 1. Merge from landing redesign. 2. Close modal on show Authors. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58275 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../annotation/annotation.component.ts | 2 +- .../dataProvider/dataProvider.component.html | 819 +++++++---- .../dataProvider/dataProvider.component.ts | 300 +++-- .../dataProvider/dataProvider.module.ts | 8 +- .../dataProvider/dataProvider.service.ts | 19 +- .../relatedDatasourcesTab.component.ts | 264 ++-- .../dataProvider/statisticsTab.component.ts | 35 +- landingPages/feedback/feedback.component.html | 78 ++ landingPages/feedback/feedback.component.ts | 108 ++ landingPages/feedback/feedback.module.ts | 16 + .../htmlProjectReport.component.ts | 2 +- .../htmlProjectReport.service.ts | 25 +- .../landing-utils/addThis.component.ts | 80 +- .../landing-utils/availableOn.component.ts | 145 +- .../citeThis/citeThis.component.ts | 21 +- .../landing-utils/fundedBy.component.ts | 111 +- .../landing-header.component.ts | 101 ++ .../landing-header/landing-header.module.ts | 12 + .../landing-utils/parsingFunctions.class.ts | 681 +++++----- .../projects-in-modal.component.ts | 120 ++ ....module.ts => projects-in-modal.module.ts} | 18 +- .../landing-utils/relatedTo.component.ts | 69 +- .../searchingProjectsInTab.component.ts | 116 -- .../showIdentifiers.component.ts | 174 +-- .../landing-utils/showPublisher.component.ts | 139 +- .../landing-utils/showSubjects.component.ts | 98 +- .../landing-utils/showTitle.component.ts | 7 +- .../deletedByInference.component.ts | 66 +- .../deletedByInference.module.ts | 4 +- .../organization/organization.component.html | 380 +++--- .../organization/organization.component.ts | 394 +++--- .../organization/organization.module.ts | 9 +- landingPages/project/project.component.html | 1200 +++++++++-------- landingPages/project/project.component.ts | 397 ++++-- landingPages/project/project.module.ts | 42 +- landingPages/project/project.service.ts | 85 +- .../deletedByInference.component.ts | 194 +-- .../deletedByInference.module.ts | 5 +- .../result/resultLanding.component.html | 632 ++++++--- .../result/resultLanding.component.ts | 177 ++- landingPages/result/resultLanding.module.ts | 16 +- landingPages/result/resultLanding.service.ts | 41 +- searchPages/find/search.component.ts | 4 +- services/metrics.service.ts | 7 +- services/searchDataproviders.service.ts | 2 +- services/searchProjects.service.ts | 7 +- .../schema2jsonld/schema2jsonld.component.ts | 76 +- .../open-aire-jsonld-converter.service.ts | 13 +- utils/authors/showAuthors.component.ts | 100 +- utils/authors/showAuthors.module.ts | 11 +- utils/email/composer.ts | 7 +- utils/entities/dataProviderInfo.ts | 5 +- utils/entities/organizationInfo.ts | 42 +- utils/entities/projectInfo.ts | 15 +- utils/entities/resultLandingInfo.ts | 65 +- .../fetchDataproviders.class.ts | 711 +++++----- .../fetchProjects.class.ts | 5 +- .../fetchResearchResults.class.ts | 15 +- .../result-preview.component.html | 4 +- .../result-preview.component.ts | 2 +- 60 files changed, 4799 insertions(+), 3502 deletions(-) create mode 100644 landingPages/feedback/feedback.component.html create mode 100644 landingPages/feedback/feedback.component.ts create mode 100644 landingPages/feedback/feedback.module.ts create mode 100644 landingPages/landing-utils/landing-header/landing-header.component.ts create mode 100644 landingPages/landing-utils/landing-header/landing-header.module.ts create mode 100644 landingPages/landing-utils/projects-in-modal.component.ts rename landingPages/landing-utils/{searchingProjectsInTab.module.ts => projects-in-modal.module.ts} (56%) delete mode 100644 landingPages/landing-utils/searchingProjectsInTab.component.ts diff --git a/landingPages/annotation/annotation.component.ts b/landingPages/annotation/annotation.component.ts index d3663c92..b2d7c1db 100644 --- a/landingPages/annotation/annotation.component.ts +++ b/landingPages/annotation/annotation.component.ts @@ -30,7 +30,7 @@ import {ResultLandingInfo} from "../../utils/entities/resultLandingInfo"; Annotate -
+
+ Report issue for another field + +
+
+ +
+
+ + +
+
+ +
+ +
+
+
+ \ No newline at end of file diff --git a/landingPages/feedback/feedback.component.ts b/landingPages/feedback/feedback.component.ts new file mode 100644 index 00000000..88f0e143 --- /dev/null +++ b/landingPages/feedback/feedback.component.ts @@ -0,0 +1,108 @@ +import { + Component, + ElementRef, + EventEmitter, + Input, + OnChanges, + OnInit, + Output, + SimpleChanges, + ViewChild +} from "@angular/core"; +import {ResultLandingInfo} from "../../utils/entities/resultLandingInfo"; +import {EnvProperties} from "../../utils/properties/env-properties"; +import {FormArray, FormBuilder, FormGroup, Validators} from "@angular/forms"; +import {AlertModal} from "../../utils/modal/alert"; +import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {OrganizationInfo} from "../../utils/entities/organizationInfo"; +import {ProjectInfo} from "../../utils/entities/projectInfo"; +import {DataProviderInfo} from "../../utils/entities/dataProviderInfo"; +import {EmailService} from "../../utils/email/email.service"; + +@Component({ + selector: 'feedback', + templateUrl: 'feedback.component.html' +}) +export class FeedbackComponent implements OnInit, OnChanges { + @ViewChild('feedback') feedback: ElementRef; + @ViewChild('backModal') backModal: AlertModal; + @Input() showForm: boolean = false; + @Input() resultLandingInfo: ResultLandingInfo = null; + @Input() organizationInfo: OrganizationInfo = null; + @Input() projectInfo: ProjectInfo = null; + @Input() dataProviderInfo: DataProviderInfo = null; + @Input() title: string = null; + @Input() properties: EnvProperties = null; + @Input() entityType: string = null; + @Input() fields: string[] = []; + @Output() show: EventEmitter = new EventEmitter(); + + public sent: boolean = false; + public form: FormGroup; + public url: string = null; + + constructor(private fb: FormBuilder, + private emailService: EmailService) { + } + + ngOnInit(): void { + this.init(); + if(typeof window !== "undefined") { + this.url = window.location.href; + } + if(this.resultLandingInfo) { + this.title = this.resultLandingInfo.title; + } else if(this.organizationInfo) { + this.title = this.organizationInfo.title.name; + } else if(this.dataProviderInfo) { + this.title = this.dataProviderInfo.title.name; + } + } + + ngOnChanges(changes: SimpleChanges): void { + if(changes.showForm) { + this.init(); + } + } + + init() { + this.sent = false; + this.form = this.fb.group({ + issues: this.fb.array([], Validators.required) + }); + this.addIssue(); + } + + public addIssue() { + let issue: FormGroup = this.fb.group({ + field: this.fb.control('', Validators.required), + report: this.fb.control('', Validators.required) + }); + this.issues.push(issue); + } + + public removeIssue(index: number) { + this.issues.removeAt(index); + } + + public get issues(): FormArray { + return this.form.get('issues'); + } + + changeShowForm(value: boolean) { + this.show.emit(value); + HelperFunctions.scroll(); + } + + public openBackModal() { + this.backModal.alertTitle = 'Go back to ' + this.entityType + '\'s page'; + this.backModal.message = 'All changes will be deleted. Are you sure you want to proceed?'; + this.backModal.okButtonText = 'Yes'; + this.backModal.cancelButtonText = 'No'; + this.backModal.open(); + } + + public sendReport() { + this.sent = true; + } +} \ No newline at end of file diff --git a/landingPages/feedback/feedback.module.ts b/landingPages/feedback/feedback.module.ts new file mode 100644 index 00000000..3ccb376f --- /dev/null +++ b/landingPages/feedback/feedback.module.ts @@ -0,0 +1,16 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {FeedbackComponent} from "./feedback.component"; +import {LandingHeaderModule} from "../landing-utils/landing-header/landing-header.module"; +import {ReactiveFormsModule} from "@angular/forms"; +import {MatSelectModule} from "@angular/material/select"; +import {AlertModalModule} from "../../utils/modal/alertModal.module"; +import {EmailService} from "../../utils/email/email.service"; + +@NgModule({ + imports: [CommonModule, LandingHeaderModule, ReactiveFormsModule, MatSelectModule, AlertModalModule], + declarations: [FeedbackComponent], + providers: [EmailService], + exports: [FeedbackComponent] +}) +export class FeedbackModule {} \ No newline at end of file diff --git a/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/landingPages/htmlProjectReport/htmlProjectReport.component.ts index 3e787950..dbd7bed2 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -203,7 +203,7 @@ export class HtmlProjectReportComponent { intro += ''; if (typeof window !== 'undefined') { - this.subHTML = this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType, this.properties.csvAPIURL).subscribe( + this.subHTML = this.htmlService.getHTML(this.projectId, this.resultsType, this.properties.csvAPIURL).subscribe( data => { //let body: string = intro+'

'+this.header1+'

'+this.header2+'

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

' + this.header1 + '

' + this.header2 + '

'; diff --git a/landingPages/htmlProjectReport/htmlProjectReport.service.ts b/landingPages/htmlProjectReport/htmlProjectReport.service.ts index 6bd05749..8a4db598 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.service.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.service.ts @@ -6,28 +6,11 @@ export class HtmlProjectReportService { constructor(private http: HttpClient ) {} - getHTML(id: string, size: number, type:string, csvAPIURL: string ):any { - - let resultTypeId: string; - let requestType: string; - if(type == "publication") { - resultTypeId = 'publication'; - requestType = 'publications'; - } else if(type == "research data") { - resultTypeId = 'dataset'; - requestType = 'datasets'; - } else if(type == "software") { - resultTypeId = 'software'; - requestType = 'software' - } else if(type == 'other research product') { - resultTypeId = 'other'; - requestType = 'other'; - } - + getHTML(id: string, requestType:string, csvAPIURL: string ):any { let url = csvAPIURL; - url += '?format=html&type='+requestType+'&fq=(((oaftype exact result) and (resulttypeid exact "'+resultTypeId+'")) and (relprojectid exact "'+id+'"))'; - - let key = url; + url += '?format=html&type='+requestType+'&fq=(' + + //'((oaftype exact result) and (resulttypeid exact "'+resultTypeId+'")) and + '(relprojectid exact "'+id+'"))'; return this.http.get(url,{responseType: 'text'}); } diff --git a/landingPages/landing-utils/addThis.component.ts b/landingPages/landing-utils/addThis.component.ts index b729d1c1..4bfeaad0 100644 --- a/landingPages/landing-utils/addThis.component.ts +++ b/landingPages/landing-utils/addThis.component.ts @@ -1,60 +1,50 @@ -import {Component, ElementRef, Input} from '@angular/core'; +import { + AfterContentInit, + AfterViewInit, + Component, + ElementRef, + EventEmitter, + Input, + OnInit, + Output, + ViewChild +} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; - interface addthis { - layers: refresh; - init: Function; - toolbox: Function; - } - interface refresh { - refresh: Function; - } - declare var addthis: addthis; - // declare var loadAddThis: any; +interface addthis { + layers: Refresh; + init: Function; + toolbox: Function; +} + +interface Refresh { + refresh: Function; +} + +declare var addthis: addthis; -// @Component({ selector: 'addThis', template: ` -

+

` }) -export class AddThisComponent { - private sub:any; - - - constructor(private route: ActivatedRoute) { - - } +export class AddThisComponent implements OnInit { + @Output() event: EventEmitter = new EventEmitter(); + + constructor(private route: ActivatedRoute) {} + ngOnInit() { - this.sub = this.route.queryParams.subscribe(data => { - + this.route.queryParams.subscribe(data => { if (typeof document !== 'undefined' && typeof addthis !== 'undefined') { - try{ - //console.log("AddThis: try load"); - // addthis.toolbox(); - // addthis.init(); + if(addthis.layers && addthis.layers.refresh) { addthis.layers.refresh(); - }catch (e) { - // console.log("AddThis may didn't load properly"); - // try{ - // addthis.init(); - // addthis.layers.refresh(); - // console.log("AddThis: one more"); - // }catch (e) { - // console.log("AddThis error again"); - // } + } else { + this.event.emit(false); } + } else { + this.event.emit(false); } - // if (typeof document !== 'undefined' ) { - // console.log("AddThis: try load"); - // loadAddThis(); - // - // - // } - }); - + }); } - - } diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 1df0ba68..5d2e7098 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -1,75 +1,106 @@ import {Component, Input} from '@angular/core'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {EnvProperties} from "../../utils/properties/env-properties"; @Component({ - selector: 'availableOn', - template: ` -
-
Download from
-
-
- -
- - {{available.downloadName}} - - - [{{(i+1) | number}}] - - - - - {{available.downloadName}} - - via - - {{available.collectedName}} - - ({{available.type}}, {{available.year}}) -
-
-
-
- + selector: 'availableOn', + template: ` +
Download from
+
+
+ + + +
+ + {{available.downloadName}} + + [href]="url" target="_blank"> + [{{(i + 1) | number}}] + + + + {{available.downloadName}} + + +
+ {{available.type}} + . + {{available.year}} +
+
+ Provider: + + {{available.collectedName}} + + + {{available.collectedName}} + +
+
+
+
- + - ` - }) + ` +}) export class AvailableOnComponent { - @Input() availableOn: { "downloadName": string, "downloadUrl": string[], - "collectedName": string, "collectedId": string, - "accessMode": string[], "bestAccessMode": string, - "type": string, "year":string }[]; - - public threshold: number = 5; - public showNum: number = 5; - - constructor () {} - - ngOnInit() {} - - public scroll() { - HelperFunctions.scroll(); + @Input() availableOn: { + "downloadName": string, "downloadUrl": string[], + "collectedName": string, "collectedId": string, + "accessMode": string[], "bestAccessMode": string, + "type": string, "year": string, icon: string + }[]; + @Input() properties: EnvProperties; + public open = 'assets/common-assets/unlock.svg'; + public closed = 'assets/common-assets/lock.svg'; + public unknown = 'assets/common-assets/question.svg'; + public threshold: number = 4; + public showNum: number = 4; + + constructor() { + } + + ngOnInit() { + this.availableOn.forEach(available => { + if (available.bestAccessMode) { + if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) { + available.icon = this.open; + } else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) { + available.icon = this.unknown; + } else { + available.icon = this.closed; + } + } else { + available.icon = this.unknown; + } + } + ); + } + + public removeUnknown(value: string): string { + if(this.properties.environment === 'production') { + if (value.toLowerCase() === 'unknown') { + return null; + } } + return value; + } + + public scroll() { + HelperFunctions.scroll(); + } } diff --git a/landingPages/landing-utils/citeThis/citeThis.component.ts b/landingPages/landing-utils/citeThis/citeThis.component.ts index 203205a5..d082ea1f 100644 --- a/landingPages/landing-utils/citeThis/citeThis.component.ts +++ b/landingPages/landing-utils/citeThis/citeThis.component.ts @@ -9,19 +9,14 @@ declare var Sys:any; selector: 'citeThis', template: ` -
-
- -
- - select a citation style - {{style}} - -
-
-
+
+ + select a citation style + {{style}} + +
` }) diff --git a/landingPages/landing-utils/fundedBy.component.ts b/landingPages/landing-utils/fundedBy.component.ts index f5e78cff..f204aece 100644 --- a/landingPages/landing-utils/fundedBy.component.ts +++ b/landingPages/landing-utils/fundedBy.component.ts @@ -4,62 +4,65 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class"; @Component({ selector: 'fundedBy', template: ` -
-
Funded by
-
-
- - - - {{item['funderShortname']?item['funderShortname']:item['funderName']}} - [no funder available] - | {{ item['acronym']?item['acronym']:item['title']}} - - - - - {{item['funderShortname']?item['funderShortname']:item['funderName']}} - [no funder available] - | {{ item['acronym']?item['acronym']:item['title']}} - - - - - {{item['funderShortname']?item['funderShortname']:item['funderName']}} - [no funder available] - | {{ item['acronym']?item['acronym']:item['title']}} - - - - - {{item['funderShortname']?item['funderShortname']:item['funderName']}} - [no funder available] - | {{ item['acronym']?item['acronym']:item['title']}} - - - - {{" "}} - - +
  • + Funded by: + + + + {{item['funderShortname']?item['funderShortname']:item['funderName']}} + [no funder available] + | {{ item['acronym']?item['acronym']:item['title']}} + + + {{item['funderShortname']?item['funderShortname']:item['funderName']}} + [no funder available] + | {{ item['acronym']?item['acronym']:item['title']}} + +
    + Project +
    + + {{item['acronym']?item['acronym']:item['title']}} + + + {{item['acronym']?item['acronym']:item['title']}} + +
    +
      +
    • + Funder: + {{item.funderName?item.funderName:item.funderShortname}} + + ({{item.funderShortname}}) + +
    • +
    • + Project Code: {{item.code}} +
    • +
    • + Funding stream: {{item.funding}} +
    • +
    +
    + {{item.provenanceAction}} +
    -
  • -
    - - - + , + + + + ` }) diff --git a/landingPages/landing-utils/landing-header/landing-header.component.ts b/landingPages/landing-utils/landing-header/landing-header.component.ts new file mode 100644 index 00000000..fc31ac42 --- /dev/null +++ b/landingPages/landing-utils/landing-header/landing-header.component.ts @@ -0,0 +1,101 @@ +import {Component, Input} from "@angular/core"; +import {EnvProperties} from "../../../utils/properties/env-properties"; +import {Author} from "../../../utils/result-preview/result-preview"; +import {AlertModal} from "../../../utils/modal/alert"; + +@Component({ + selector: 'landing-header', + template: ` +
    + + +
    + + {{entityType}} + + + {{' . ' + removeDuplicates(types).join(' . ')}} + + + {{' . ' + removeUnknown(types, true).join(' . ')}} + + + + {{' . '}} + + + {{'from '}} + + + {{'until '}} + + + {{startDate | date: 'yyyy'}} + + + {{' - '}} + + + {{endDate | date: 'yyyy'}} + + + + {{' . ' + status}} + + + {{' . ' + year}} + + + . Embargo end date: {{embargoEndDate | date: 'dd MMM yyyy'}} + +
    + +
    + +
    +
    + +
    +
    ` +}) +export class LandingHeaderComponent { + @Input() entityType: string; + @Input() properties: EnvProperties; + @Input() types: string[]; + @Input() startDate: number; // project landing + @Input() endDate: number; // project landing + @Input() status: string; // project landing + @Input() year: string; + @Input() embargoEndDate: Date; + @Input() title: string; + @Input() subTitle: string; + @Input() authors: Author[]; + @Input() authorLimit: number = 30; + @Input() showAllAuthors: boolean = true; + @Input() underCuration: boolean = false; + @Input() modal: AlertModal; + + public removeUnknown(array: string[], type: boolean = false): string[] { + if (type) { + return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown'); + } else { + return array.filter(value => value.toLowerCase() !== 'unknown'); + } + } + + public removeDuplicates(array: string[]): string[] { + return array.filter(value => value.toLowerCase() !== this.entityType); + } + + public buildCurationTooltip(): string { + let tooltipContent: string = "
    "; + + tooltipContent += "

    Record in preview

    "; + tooltipContent += "

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

    "; + + tooltipContent += "
    "; + return tooltipContent; + } +} diff --git a/landingPages/landing-utils/landing-header/landing-header.module.ts b/landingPages/landing-utils/landing-header/landing-header.module.ts new file mode 100644 index 00000000..d607e391 --- /dev/null +++ b/landingPages/landing-utils/landing-header/landing-header.module.ts @@ -0,0 +1,12 @@ +import {NgModule} from "@angular/core"; +import {LandingHeaderComponent} from "./landing-header.component"; +import {CommonModule} from "@angular/common"; +import {LandingModule} from "../landing.module"; +import {ShowAuthorsModule} from "../../../utils/authors/showAuthors.module"; + +@NgModule({ + imports: [CommonModule, LandingModule, ShowAuthorsModule], + declarations: [LandingHeaderComponent], + exports: [LandingHeaderComponent] +}) +export class LandingHeaderModule {} \ No newline at end of file diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 3309514b..c01cfc6c 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -1,45 +1,32 @@ +import {HostedByCollectedFrom, Journal, Project, RelationResult} from "../../utils/result-preview/result-preview"; export class ParsingFunctions { - - constructor () {} - - public ngOnDestroy() {} - - public parseFundingByProjects(fundedByProjects: { "id": string, "acronym": string, "title": string, - "funderShortname": string, "funderName": string, - "funding": string, "code": string, - "provenanceAction": string, "inline": boolean - }[], - relation: any, provenanceActionVocabulary: any): - { "id": string, "acronym": string, "title": string, - "funderShortname": string, "funderName": string, - "funding": string, "code": string, - "provenanceAction": string, "inline": boolean - }[] { - if(fundedByProjects == undefined) { - fundedByProjects = new Array<{"id": string, "acronym": string, "title": string, - "funderShortname": string, "funderName": string, - "funding": string, "code": string, - "provenanceAction": string, "inline": boolean - }>(); + + constructor() { + } + + public ngOnDestroy() { + } + + public parseFundingByProjects(fundedByProjects: Project[], relation: any, + provenanceActionVocabulary: any): Project[] { + if (fundedByProjects == undefined) { + fundedByProjects = []; } - - let fundedByProject: { "id": string, "acronym": string, "title": string, - "funderShortname": string, "funderName": string, - "funding": string, "code": string, - "provenanceAction": string, "inline": boolean - } = { "id": "", "acronym": "", "title": "", - "funderShortname": "", "funderName": "", - "funding": "", "code": "", "provenanceAction": "", "inline": false - }; - - if(relation.title != 'unidentified') { + + let fundedByProject: Project = { + "id": "", "acronym": "", "title": "", + "funderShortname": "", "funderName": "", + "funding": "", "code": "", "provenanceAction": "", "inline": false + }; + + if (relation.title != 'unidentified') { fundedByProject['id'] = relation['to'].content; fundedByProject['acronym'] = relation.acronym; fundedByProject['title'] = relation.title; fundedByProject['code'] = relation.code; - - if(provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) { + + if (provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) { fundedByProject['provenanceAction'] = provenanceActionVocabulary[relation.provenanceaction]; } } else { @@ -49,425 +36,429 @@ export class ParsingFunctions { fundedByProject['code'] = ""; fundedByProject['provenanceAction'] = ""; } - - if(relation.hasOwnProperty("funding")) { - let funding: {"funderName": string, "funderShortname": string, "stream": string}; + + if (relation.hasOwnProperty("funding")) { + let funding: { "funderName": string, "funderShortname": string, "stream": string }; funding = this.parseFundingTrees(relation.funding); - - if(funding.funderName) { + + if (funding.funderName) { fundedByProject['funderName'] = funding.funderName; } - if(funding.funderShortname) { + if (funding.funderShortname) { fundedByProject['funderShortname'] = funding.funderShortname; } - if(funding.stream) { + if (funding.stream) { fundedByProject['funding'] = funding.stream; } } fundedByProjects.push(fundedByProject); return fundedByProjects; } - + // publication & research data : for fundedByProjects | project landing : for funding - public parseFundingTrees(fundingTree: any): {"funderName": string, "funderShortname": string, "stream": string} { - let funding: {"funderName": string, "funderShortname": string, "stream": string} = {"funderName": "", "funderShortname": "", "stream": ""}; + public parseFundingTrees(fundingTree: any): { "funderName": string, "funderShortname": string, "stream": string } { + let funding: { "funderName": string, "funderShortname": string, "stream": string } = { + "funderName": "", + "funderShortname": "", + "stream": "" + }; let length = Array.isArray(fundingTree) ? fundingTree.length : 1; - - for(let i=0; i/*, title: { "name": string, "url": string, "accessMode": string}*/) { - if( publisher && identifiers != null && identifiers.has('doi')) { - if( hostedBy_collectedFrom == null) { - hostedBy_collectedFrom = new Array<{"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}>(); + addPublisherToHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[], + publisher: string, journal: Journal, + identifiers: Map/*, title: { "name": string, "url": string, "accessMode": string}*/) { + if (publisher && identifiers != null && identifiers.has('doi')) { + if (hostedBy_collectedFrom == null) { + hostedBy_collectedFrom = []; } - let available: {"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}; - available = {"downloadName": "", "downloadUrl": null, "collectedName": "", "collectedId": "", "accessMode": null, "bestAccessMode": null, "type": "", "year": ""}; - - if(journal && journal.journal) { - available.downloadName = publisher + "/ "+journal['journal']; + let available: HostedByCollectedFrom = { + downloadName: "", + downloadUrl: null, + collectedName: "", + collectedId: "", + accessMode: null, + bestAccessMode: null, + type: "", + year: "" + }; + + if (journal && journal.journal) { + available.downloadName = publisher + "/ " + journal['journal']; } else { available.downloadName = publisher; } - - let url = "https://dx.doi.org/"+identifiers.get("doi")[0]; - + + let url = "https://dx.doi.org/" + identifiers.get("doi")[0]; + available.downloadUrl = new Array(); available.accessMode = new Array(); - + available.downloadUrl.push(url); -/* - if(title != undefined && title['url'] == "") { - title['url'] = url; - } -*/ + /* + if(title != undefined && title['url'] == "") { + title['url'] = url; + } + */ hostedBy_collectedFrom.push(available); } return hostedBy_collectedFrom; } - + // publication & dataset landing : for downloadFrom - parseDownloadFrom(downloadFrom: Map, instance: any, url: string) - { + parseDownloadFrom(downloadFrom: Map, instance: any, url: string) { let key: string = instance['hostedby'].name; - - if(key) { + + if (key) { this.addUrlAndAccessMode(downloadFrom, instance, key, url); } } - + // publication & dataset landing : for publishedIn - parsePublishedIn(publishedIn: Map, instance: any, result: any, url: string, counter: number): number { - if(result != null && result.hasOwnProperty("source")) { + parsePublishedIn(publishedIn: Map, instance: any, result: any, url: string, counter: number): number { + if (result != null && result.hasOwnProperty("source")) { let key: string; - if(Array.isArray(result.source)) { - if(counter==result.source.length) { + if (Array.isArray(result.source)) { + if (counter == result.source.length) { counter--; } key = result['source'][counter]; } else { key = result['source']; } - - if(key) { + + if (key) { this.addUrlAndAccessMode(publishedIn, instance, key, url); counter++; } } return counter; } - + // publication & dataset landing : for downloadFrom and publishedIn - addUrlAndAccessMode(mapStructure: Map, instance: any, key: string, url: string) { - if(!mapStructure.has(key)) { + addUrlAndAccessMode(mapStructure: Map, instance: any, key: string, url: string) { + if (!mapStructure.has(key)) { mapStructure.set(key, {"url": null, "accessMode": null, "bestAccessMode": null}); } - - if(mapStructure.get(key)['url'] == null) { + + if (mapStructure.get(key)['url'] == null) { mapStructure.get(key)['url'] = new Array(); } - - if(url) { + + if (url) { mapStructure.get(key)['url'].push(url); } - - if(mapStructure.get(key)['accessMode'] == null) { + + if (mapStructure.get(key)['accessMode'] == null) { mapStructure.get(key)['accessMode'] = new Array(); } - - if(instance.hasOwnProperty("accessright")) { - if(url) { - mapStructure.get(key)['accessMode'].push(instance['accessright'].classid); + + if (instance.hasOwnProperty("accessright")) { + if (url) { + mapStructure.get(key)['accessMode'].push(instance['accessright'].classname); } - - if(this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) { - mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classid; + + if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) { + mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classname; } - } else if(url) { + } else if (url) { mapStructure.get(key)['accessMode'].push(""); } } - - - parseHostedBy_collectedFrom(hostedBy_collectedFrom: { "downloadName": string, "downloadUrl": string[], - "collectedName": string, "collectedId": string, - "accessMode": string[], "bestAccessMode": string, - "type": string, "year":string }[], + + + parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[], instance: any, data: any, url: string, counter: number/*, title: { "name": string, "url": string, "accessMode": string}*/, accessMode: string): number { - let available: {"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}; - available = {"downloadName": "", "downloadUrl": null, "collectedName": "", "collectedId": "", "accessMode": null, "bestAccessMode": null, "type": "", "year": ""}; - - if(instance['hostedby'].name && instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") { - available.downloadName = instance['hostedby'].name; - } else { - if(data != null && data.hasOwnProperty("source")) { - let downloadName: string; - if(Array.isArray(data.source)) { - - if(counter==data.source.length) { - counter--; - } - downloadName = data['source'][counter]; - } else { - downloadName = data['source']; - } - if(downloadName) { - counter++; - available.downloadName = downloadName; - } - } - - } - - if(available.downloadName) { - if(instance.hasOwnProperty("collectedfrom")) { - available.collectedId = instance['collectedfrom'].id; - available.collectedName = instance['collectedfrom'].name; - } - - if(instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { - available.type = instance['instancetype'].classname; - } - - if(instance.hasOwnProperty("dateofacceptance")) { - var date:string = (instance.dateofacceptance)+""; // transform to string in case it is an integer - available.year = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date; - } - - available.accessMode = new Array(); - available.downloadUrl = new Array(); - available['downloadUrl'].push(url); - if(instance.hasOwnProperty("accessright")) { - if(url) { - available['accessMode'].push(instance['accessright'].classid); - } - - if(this.changeBestAccessMode(available.bestAccessMode, instance['accessright'])) { - available.bestAccessMode = instance['accessright'].classid; -/* - if(title != undefined) { - if(this.changeBestAccessMode(title['accessMode'], instance['accessright'])) { - title['accessMode'] = instance['accessright'].classid; - title['url'] = url; - } - } -*/ - if(this.changeBestAccessMode(accessMode, instance['accessright'])) { - accessMode = instance['accessright'].classid; + let available: HostedByCollectedFrom = { + "downloadName": "", + "downloadUrl": null, + "collectedName": "", + "collectedId": "", + "accessMode": null, + "bestAccessMode": null, + "type": "", + "year": "" + }; + + if (instance['hostedby'].name && instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") { + available.downloadName = instance['hostedby'].name; + } else { + if (data != null && data.hasOwnProperty("source")) { + let downloadName: string; + if (Array.isArray(data.source)) { + + if (counter == data.source.length) { + counter--; } - } -/* - if(title != undefined) { - if(!title['url']) { - title['url'] = url; - } - } -*/ - } else if(url) { - available['accessMode'].push(""); - } - - hostedBy_collectedFrom.push(available); - } - - return counter; + downloadName = data['source'][counter]; + } else { + downloadName = data['source']; + } + if (downloadName) { + counter++; + available.downloadName = downloadName; + } + } + + } + + if (available.downloadName) { + if (instance.hasOwnProperty("collectedfrom")) { + available.collectedId = instance['collectedfrom'].id; + available.collectedName = instance['collectedfrom'].name; + } + + if (instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { + available.type = instance['instancetype'].classname; + } + + if (instance.hasOwnProperty("dateofacceptance")) { + var date: string = (instance.dateofacceptance) + ""; // transform to string in case it is an integer + available.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; + } + + available.accessMode = new Array(); + available.downloadUrl = new Array(); + available['downloadUrl'].push(url); + if (instance.hasOwnProperty("accessright")) { + if (url) { + available['accessMode'].push(instance['accessright'].classname); + } + + if (this.changeBestAccessMode(available.bestAccessMode, instance['accessright'])) { + available.bestAccessMode = instance['accessright'].classname; + /* + if(title != undefined) { + if(this.changeBestAccessMode(title['accessMode'], instance['accessright'])) { + title['accessMode'] = instance['accessright'].classid; + title['url'] = url; + } + } + */ + if (this.changeBestAccessMode(accessMode, instance['accessright'])) { + accessMode = instance['accessright'].classname; + } + } + /* + if(title != undefined) { + if(!title['url']) { + title['url'] = url; + } + } + */ + } else if (url) { + available['accessMode'].push(""); + } + + hostedBy_collectedFrom.push(available); + } + + return counter; } - + // publication & dataset landing : for downloadFrom and publishedIn changeBestAccessMode(currentAccessMode: string, accessMode: any): boolean { - if(!accessMode) { + if (!accessMode) { return false; } accessMode = accessMode.classid; - + switch (currentAccessMode) { case null: - if(accessMode != "UNKNOWN") { + if (accessMode != "UNKNOWN") { return true; } return false; case "CLOSED": - if( accessMode == "OPEN" || - accessMode == "OPEN SOURCE" || - accessMode == "EMBARGO" || - accessMode == "RESTRICTED") { - return true; + if (accessMode == "OPEN" || + accessMode == "OPEN SOURCE" || + accessMode == "EMBARGO" || + accessMode == "RESTRICTED") { + return true; } return false; case "RESTRICTED": - if( accessMode == "OPEN" || - accessMode == "OPEN SOURCE" || - accessMode == "EMBARGO") { - return true; + if (accessMode == "OPEN" || + accessMode == "OPEN SOURCE" || + accessMode == "EMBARGO") { + return true; } return false; case "EMBARGO": - if( accessMode == "OPEN" || - accessMode == "OPEN SOURCE") { + if (accessMode == "OPEN" || + accessMode == "OPEN SOURCE") { return true; } return false; case "OPEN SOURCE": - if( accessMode == "OPEN") { + if (accessMode == "OPEN") { return true; } return false; } return false; } - + // publication & dataset & software & orp landing : for relatedResearchResults - parseRelatedResearchResults(relatedResearchResults: Map, relation: any, provenanceAction: string) : - Map { - if(relatedResearchResults == undefined) { - relatedResearchResults = new Map(); + parseRelatedResearchResults(relatedResearchResults: RelationResult[], relation: any, provenanceAction: string): + RelationResult[] { + if (relatedResearchResults == undefined) { + relatedResearchResults = [] } - - if(!relatedResearchResults.has(provenanceAction)) { - relatedResearchResults.set(provenanceAction, - new Array<{ "name": string, "id": string, "date": string, - "percentage": number, "class": string }>()); - } - relatedResearchResults.get(provenanceAction).push(this.parseRelatedOrSimilarResearchResult(relation, "trust")); - + relatedResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation, "trust", provenanceAction)); return relatedResearchResults; } - + // publication & dataset & software & orp landing : for supplementaryResearchResults - parseSupplementaryResearchResults(supplementaryResearchResults: { "name": string, "id": string, "date": string, - "percentage": number, "class": string}[], relation: any) : - { "name": string, "id": string, "date": string, "percentage": number, "class": string }[] { - if(supplementaryResearchResults == undefined) { - supplementaryResearchResults = new Array<{"name": string, "id": string, "date": string, - "percentage": number, "class": string}>(); + parseSupplementaryResearchResults(supplementaryResearchResults: RelationResult[], relation: any): RelationResult[] { + if (supplementaryResearchResults == undefined) { + supplementaryResearchResults = []; } supplementaryResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation, "trust")); return supplementaryResearchResults; } - + // publication & dataset & software & orp landing : for supplementedByResearchResults - parseSupplementedByResearchResults(supplementedByResearchResults: { "name": string, "id": string, "date": string, - "percentage": number, "class": string}[], relation: any) : - { "name": string, "id": string, "date": string, "percentage": number, "class": string }[] { - if(supplementedByResearchResults == undefined) { - supplementedByResearchResults = new Array<{"name": string, "id": string, "date": string, - "percentage": number, "class": string}>(); + parseSupplementedByResearchResults(supplementedByResearchResults: RelationResult[], relation: any): RelationResult[] { + if (supplementedByResearchResults == undefined) { + supplementedByResearchResults = []; } supplementedByResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation, "trust")); return supplementedByResearchResults; } - + // publication & dataset & software & orp landing : for similarResearchResults - parseSimilarResearchResults(similarResearchResults: { "name": string, "id": string, "date": string, - "percentage": number, "class": string}[], relation: any) : - { "name": string, "id": string, "date": string, "percentage": number, "class": string }[] { - if(similarResearchResults == undefined) { - similarResearchResults = new Array<{"name": string, "id": string, "date": string, - "percentage": number, "class": string}>(); + parseSimilarResearchResults(similarResearchResults: RelationResult[], relation: any): RelationResult[] { + if (similarResearchResults == undefined) { + similarResearchResults = []; } similarResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation, "similarity")); return similarResearchResults; } - + // publication & dataset & software & orp landing : for relatedResearchResults and similarResearchResults - parseRelatedOrSimilarResearchResult(relation: any, percentageName: string): {"name": string, "id": string, "date": string, "percentage": number, "class": string} { - let researchResult: {"name": string, "id": string, "date": string, "percentage": number, "class": string} - = {"name": "", "id": "", "date": "", "percentage": null, "class": ""} - if(relation['resulttype'].classname == "publication") { + parseRelatedOrSimilarResearchResult(relation: any, percentageName: string, provenanceAction: string = null): RelationResult { + let researchResult: RelationResult = { + name: "", + id: "", + date: "", + percentage: null, + class: "", + provenanceAction: provenanceAction + }; + if (relation['resulttype'].classname == "publication") { researchResult['class'] = "publication"; - } else if(relation['resulttype'].classname == "dataset") { + } else if (relation['resulttype'].classname == "dataset") { researchResult['class'] = "dataset"; - } else if(relation['resulttype'].classname == "software") { + } else if (relation['resulttype'].classname == "software") { researchResult['class'] = "software"; - } else if(relation['resulttype'].classname == "other") { + } else if (relation['resulttype'].classname == "other") { researchResult['class'] = "other"; } - researchResult['id'] = relation['to'].content; let titleName = Array.isArray(relation['title']) ? relation['title'][0].content : relation['title'].content; researchResult['name'] = titleName; - if(relation.hasOwnProperty("dateofacceptance")) { - var date:string = ((Array.isArray(relation.dateofacceptance))?(relation.dateofacceptance[0]):(relation.dateofacceptance))+""; // transform to string in case it is an integer - researchResult['date'] = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date; + if (relation.hasOwnProperty("dateofacceptance")) { + var date: string = ((Array.isArray(relation.dateofacceptance)) ? (relation.dateofacceptance[0]) : (relation.dateofacceptance)) + ""; // transform to string in case it is an integer + researchResult['date'] = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; } //researchResult['date'] = relation.dateofacceptance.substring(0,4);; - researchResult['percentage'] = Math.round(relation[percentageName]*100); + researchResult['percentage'] = Math.round(relation[percentageName] * 100); return researchResult; } - - sortByPercentage(results: { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]) : { "name": string, "id": string, "date": string, "percentage": number, "class": string}[] { - if(results) { - return results.sort(function(a, b){return b["percentage"] - a["percentage"]}); + + sortByPercentage(results: RelationResult[]): RelationResult[] { + if (results) { + return results.sort(function (a, b) { + return b["percentage"] - a["percentage"] + }); } return results; } - + // publication & dataset landing : for identifiers parseIdentifiers(pid: any): Map { let identifiers = new Map(); - - if(pid.hasOwnProperty("classname") && pid['classname'] != "") { - if(pid.classname == "doi" || pid.classname == "pmc" || pid.classname == "handle") { - if(!identifiers.has(pid.classname)) { + + if (pid.hasOwnProperty("classname") && pid['classname'] != "") { + if (pid.classname == "doi" || pid.classname == "pmc" || pid.classname == "handle" || pid == "pmid") { + if (!identifiers.has(pid.classname)) { identifiers.set(pid.classname, new Array()); } - + identifiers.get(pid.classname).push(pid.content); } } else { - for(let i=0; i()); } identifiers.get(pid[i].classname).push(pid[i].content); @@ -476,42 +467,42 @@ export class ParsingFunctions { } return identifiers; } - + // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects parseAllSubjects(_subjects: any): [string[], Map, Map] { let subjects: string[]; let otherSubjects: Map; let classifiedSubjects: Map; - + let subject; let length = Array.isArray(_subjects) ? _subjects.length : 1; - - for(let i=0; i(); } - - if(!classifiedSubjects.has(subject.classname)) { + + if (!classifiedSubjects.has(subject.classname)) { classifiedSubjects.set(subject.classname, new Array()); } - + classifiedSubjects.get(subject.classname).push(subject.content); } else { - if(subject.classid == "keyword") { - if(subjects == undefined) { + if (subject.classid == "keyword") { + if (subjects == undefined) { subjects = new Array(); } - + subjects.push(subject.content); } else { - if(otherSubjects == undefined) { + if (otherSubjects == undefined) { otherSubjects = new Map(); } - - if(!otherSubjects.has(subject.classname)) { + + if (!otherSubjects.has(subject.classname)) { otherSubjects.set(subject.classname, new Array()); } otherSubjects.get(subject.classname).push(subject.content); @@ -521,21 +512,25 @@ export class ParsingFunctions { } return [subjects, otherSubjects, classifiedSubjects]; } - - parseContexts(_contexts: any): {"labelContext": string, "labelCategory": string, - "labelConcept": string, inline:boolean}[] { - let contexts = new Array<{"labelContext": string, "labelCategory": string, - "labelConcept": string, inline:boolean}>(); - + + parseContexts(_contexts: any): { + "labelContext": string, "labelCategory": string, + "labelConcept": string, inline: boolean + }[] { + let contexts = new Array<{ + "labelContext": string, "labelCategory": string, + "labelConcept": string, inline: boolean + }>(); + let position = 0; let labels = ""; let context; let length = Array.isArray(_contexts) ? _contexts.length : 1; - for(let i=0; i, instance: any) { - if(instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { - if(!uniqueTypes.has(instance['instancetype'].classname)) { + if (instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) { + if (!uniqueTypes.has(instance['instancetype'].classname)) { types.push(instance['instancetype'].classname); uniqueTypes.add(instance['instancetype'].classname); } } } - + parseLanguages(_languages: any) { var languages = new Array(); - - if(!Array.isArray(_languages)) { - if(_languages.classname != "Undetermined" && _languages.classname) { + + if (!Array.isArray(_languages)) { + if (_languages.classname != "Undetermined" && _languages.classname) { languages.push(_languages.classname); } } else { - for(let i=0; i<_languages.length; i++) { - if(_languages[i].classname != "Undetermined" && _languages[i].classname) { + for (let i = 0; i < _languages.length; i++) { + if (_languages[i].classname != "Undetermined" && _languages[i].classname) { languages.push(_languages[i].classname); } } } return languages; } - + parseCountries(_countries: any) { var countries = new Array(); - - if(!Array.isArray(_countries)) { - if(_countries.classname != "Undetermined" && _countries.classname) { + + if (!Array.isArray(_countries)) { + if (_countries.classname != "Undetermined" && _countries.classname) { countries.push(_countries.classname); } } else { - for(let i=0; i(); - - if(!Array.isArray(_pLanguages)) { - if(_pLanguages.classname != "Undetermined" && _pLanguages.classname) { + + if (!Array.isArray(_pLanguages)) { + if (_pLanguages.classname != "Undetermined" && _pLanguages.classname) { pLanguages.push(_pLanguages.classname); } } else { - for(let i=0; i<_pLanguages.length; i++) { - if(_pLanguages[i].classname != "Undetermined" && _pLanguages[i].classname) { + for (let i = 0; i < _pLanguages.length; i++) { + if (_pLanguages[i].classname != "Undetermined" && _pLanguages[i].classname) { pLanguages.push(_pLanguages[i].classname); } } } return pLanguages; } - - parseReferences(citations: any): {"name": string, "url": string}[] { - let references = new Array<{"name": string, "url": string}>(); - + + parseReferences(citations: any): { "name": string, "url": string }[] { + let references = new Array<{ "name": string, "url": string }>(); + let citation; let length = Array.isArray(citations) ? citations.length : 1; - for(let i=0; i + +
    +
      +
    • + + + + {{value.name}} + +
    • +
    + + +
      +
    • + +
    • +
    + + +
    + ` +}) + +export class ProjectsInModalComponent { + @Input() fetchProjects: FetchProjects; + @Input() organizationId: string = ""; + @Input() properties: EnvProperties; + @Input() modal: AlertModal; + public page: number = 1; + public size: number = 10; + public linkToSearchProjects: string; + + public routerHelper: RouterHelper = new RouterHelper(); + public errorCodes: ErrorCodes = new ErrorCodes(); + + private filterQuery: string = ""; + + constructor(private route: ActivatedRoute, + private _searchProjectsService: SearchProjectsService) { + } + + + ngOnInit() { + if (this.organizationId) { + this.linkToSearchProjects = this.properties.searchLinkToAdvancedProjects;//+"?organization="+this.organizationId+"or=and";; + if (this.fetchProjects.searchUtils.totalResults > 0) { + this.search(false, ""); + } + } + } + + public getResultPreview(result: SearchResult): ResultPreview { + return ResultPreview.searchResultConvert(result, 'project'); + } + + private search(refine: boolean, filterQuery: string) { + var refineFields: string [] = ["funder"]; + this.fetchProjects.getResultsForOrganizations(this.organizationId, filterQuery, this.page, this.size, (refine) ? refineFields : [], this.properties); + } + + public pageChange($event) { + this.page = $event.value; + this.search(false, this.filterQuery); + } + + public filterChange($event) { + this.updateFilters(); + //this.search(true, this.filterQuery); + this.search(false, this.filterQuery); + } + + private updateFilters() { + this.filterQuery = ""; + for (let filter of this.fetchProjects.filters) { + var filterLimits = ""; + for (let value of filter.values) { + if (value.selected == true) { + //filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"'; + filterLimits += ((filterLimits.length == 0) ? '' : ' or ') + filter.filterId + ' exact '; + filterLimits += '"' + StringUtils.URIEncode(value.id) + '"'; + } + } + if (filterLimits.length > 0) { + //this.filterQuery+=' and '+filter.filterId + ' exact '+ filterLimits + ' '; + this.filterQuery += ' and ( ' + filterLimits + ' ) '; + } + + } + //console.log("Filter Changed"+this.filterQuery); + + } +} diff --git a/landingPages/landing-utils/searchingProjectsInTab.module.ts b/landingPages/landing-utils/projects-in-modal.module.ts similarity index 56% rename from landingPages/landing-utils/searchingProjectsInTab.module.ts rename to landingPages/landing-utils/projects-in-modal.module.ts index e3d7a061..672dd5c5 100644 --- a/landingPages/landing-utils/searchingProjectsInTab.module.ts +++ b/landingPages/landing-utils/projects-in-modal.module.ts @@ -7,25 +7,27 @@ import { RouterModule } from '@angular/router'; import { ProjectsServiceModule} from '../../services/projectsService.module'; import { TabResultModule } from '../../searchPages/searchUtils/tabResult.module'; -import { SearchingProjectsTabComponent} from './searchingProjectsInTab.component'; +import { ProjectsInModalComponent} from './projects-in-modal.component'; import {PagingModule } from '../../utils/paging.module'; import {ErrorMessagesModule} from '../../utils/errorMessages.module'; +import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module"; +import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module"; @NgModule({ imports: [ - RouterModule, CommonModule, FormsModule, - ProjectsServiceModule, TabResultModule, - PagingModule, ErrorMessagesModule - ], + RouterModule, CommonModule, FormsModule, + ProjectsServiceModule, TabResultModule, + PagingModule, ErrorMessagesModule, NoLoadPaging, ResultPreviewModule + ], declarations: [ - SearchingProjectsTabComponent + ProjectsInModalComponent ], providers:[ ], exports: [ - SearchingProjectsTabComponent + ProjectsInModalComponent ] }) -export class SearchingProjectsTabModule { } +export class ProjectsInModalModule { } diff --git a/landingPages/landing-utils/relatedTo.component.ts b/landingPages/landing-utils/relatedTo.component.ts index 1324d9a9..571986de 100644 --- a/landingPages/landing-utils/relatedTo.component.ts +++ b/landingPages/landing-utils/relatedTo.component.ts @@ -4,44 +4,51 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class"; @Component({ selector: 'relatedTo', template: ` -
    -
    Related to
    -
    - - {{item['labelContext']}} - {{item['labelCategory']}} - : {{item['labelConcept']}} - - - {{item['labelContext']}} - {{item['labelCategory']}} - : {{item['labelConcept']}} - -
    -
    - -
    - - View more - +
    +
    +
    + Communities: +
    +
    + + {{item['labelContext']}} + {{item['labelCategory']}} + : {{item['labelConcept']}} + + + {{item['labelContext']}} + {{item['labelCategory']}} + : {{item['labelConcept']}} + +
    +
    + +
    ` }) export class RelatedToComponent { - @Input() contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[]; - + @Input() contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean }[]; + public threshold: number = 5; public showNum: number = 5; - - constructor () {} - - ngOnInit() {} - + + constructor() { + } + + ngOnInit() { + } + public scroll() { HelperFunctions.scroll(); } diff --git a/landingPages/landing-utils/searchingProjectsInTab.component.ts b/landingPages/landing-utils/searchingProjectsInTab.component.ts deleted file mode 100644 index 88704b94..00000000 --- a/landingPages/landing-utils/searchingProjectsInTab.component.ts +++ /dev/null @@ -1,116 +0,0 @@ -import {Component, Input} from '@angular/core'; -import {ActivatedRoute} from '@angular/router'; - -import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import { SearchProjectsService } from '../../services/searchProjects.service'; - -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {StringUtils} from '../../utils/string-utils.class'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import{EnvProperties} from '../../utils/properties/env-properties'; - -@Component({ - selector: 'searchingProjectsTab', - template: ` - - -
    - -
    -
    -
    - -
    -
    -
      -
    • - - - - {{value.name}} ({{value.number | number}}) - -
    • - -
    • Filtered {{fetchProjects.searchUtils.totalResults | number}} results of {{fetchProjects.searchUtils.totalResultsNoFilters | number}} total results
    • -
    • -
    - - - -
    -
    - ` -}) - -export class SearchingProjectsTabComponent { - @Input() fetchProjects : FetchProjects; - @Input() organizationId:string = ""; - @Input() properties:EnvProperties; - public page :number = 1; - public size :number = 10; - public linkToSearchProjects: string; - - public routerHelper:RouterHelper = new RouterHelper(); - public errorCodes:ErrorCodes = new ErrorCodes(); - - private filterQuery:string = ""; - - constructor (private route: ActivatedRoute, - private _searchProjectsService: SearchProjectsService) { - } - - - ngOnInit() { - - if(this.organizationId) { - this.linkToSearchProjects = this.properties.searchLinkToAdvancedProjects;//+"?organization="+this.organizationId+"or=and";; - if(this.fetchProjects.searchUtils.totalResults > 0) { - this.search(false,""); - } - } - } - - - private search(refine:boolean, filterQuery:string){ - var refineFields:string [] = ["funder"]; - this.fetchProjects.getResultsForOrganizations(this.organizationId, filterQuery, this.page, this.size,(refine)?refineFields:[], this.properties); - } - - public pageChange($event) { - this.page=$event.value; - this.search(false, this.filterQuery); - } - - public filterChange($event) { - this.updateFilters(); - //this.search(true, this.filterQuery); - this.search(false, this.filterQuery); - } - - private updateFilters (){ - this.filterQuery = ""; - for (let filter of this.fetchProjects.filters){ - var filterLimits=""; - for (let value of filter.values){ - if(value.selected == true){ - //filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"'; - filterLimits+=((filterLimits.length == 0)?'':' or ')+filter.filterId+' exact '; - filterLimits+='"'+ StringUtils.URIEncode(value.id)+'"'; - } - } - if(filterLimits.length > 0){ - //this.filterQuery+=' and '+filter.filterId + ' exact '+ filterLimits + ' '; - this.filterQuery+=' and ( ' + filterLimits + ' ) '; - } - - } - //console.log("Filter Changed"+this.filterQuery); - - } -} diff --git a/landingPages/landing-utils/showIdentifiers.component.ts b/landingPages/landing-utils/showIdentifiers.component.ts index e8a3cef9..b8a1bcb7 100644 --- a/landingPages/landing-utils/showIdentifiers.component.ts +++ b/landingPages/landing-utils/showIdentifiers.component.ts @@ -2,92 +2,106 @@ import {Component, Input} from '@angular/core'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; @Component({ - selector: 'showIdentifiers', - template: ` - - Identifiers: - - - View less identifiers + selector: 'showIdentifiers', + template: ` + +
  • + + {{key}}: + + + + + {{item}} + + + {{item}} + + + {{item}} + + + {{item}} + - - - - - - {{key}}: {{item}}{{key}}: {{item}}{{key}}: {{item}}{{", "}} - ... - - - - - - - view all {{countIdentifiers() | number}} identifiers - - - - View less identifiers - - - - ` - }) + , + + + +
  • +
    + + + ` +}) export class ShowIdentifiersComponent { - @Input() identifiers: Map; - public doiURL: string; - public pmcURL: string; - public handleURL: string; - public showAll: boolean = false; - public sizeOfIdentifiers: number = -1; - public sizeOfPreviousIdentifiers: number = -1; - public pageSize: number = 10; - - constructor () { - this.doiURL = "https://dx.doi.org/"; - this.pmcURL = "http://europepmc.org/articles/"; - this.handleURL = "http://hdl.handle.net/"; - } - - ngOnInit() {} - - public countIdentifiers(): number { - if(this.sizeOfIdentifiers < 0) { - let num: number = 0; - if(this.identifiers != undefined) { - this.identifiers.forEach(function (value, key, map) { - num += value.length; - }); - } - this.sizeOfIdentifiers = num; - } - return this.sizeOfIdentifiers; - } - - public countSizeOfPreviousIdentifiers(index: number): number { + @Input() identifiers: Map; + public doiURL: string; + public pmcURL: string; + public pmidURL: string; + public handleURL: string; + public showAll: boolean = false; + public sizeOfIdentifiers: number = -1; + public sizeOfPreviousIdentifiers: number = -1; + public pageSize: number = 3; + + constructor() { + this.doiURL = "https://dx.doi.org/"; + this.pmcURL = "http://europepmc.org/articles/"; + this.handleURL = "http://hdl.handle.net/"; + this.pmidURL = "https://www.ncbi.nlm.nih.gov/pubmed/"; + } + + ngOnInit() {} + + public countIdentifiers(): number { + if (this.sizeOfIdentifiers < 0) { let num: number = 0; - let i: number = 0; - if(this.identifiers != undefined) { - this.identifiers.forEach(function (value, key, map) { - if(i < index) { - num += value.length; - } - i++; + if (this.identifiers != undefined) { + this.identifiers.forEach((value, key, map) => { + num += value.length; }); } - this.sizeOfPreviousIdentifiers= num; - return num; + this.sizeOfIdentifiers = num; } - - public scroll() { - HelperFunctions.scroll(); - } - public getKeys( map) { - return Array.from(map.keys()); + return this.sizeOfIdentifiers; + } + + public countSizeOfPreviousIdentifiers(index: number): number { + let num: number = 0; + let i: number = 0; + if (this.identifiers != undefined) { + this.identifiers.forEach(function (value, key, map) { + if (i < index) { + num += value.length; + } + i++; + }); } + this.sizeOfPreviousIdentifiers = num; + return num; + } + + public scroll() { + HelperFunctions.scroll(); + } + + public getKeys(map) { + return Array.from(map.keys()).sort((a: string, b: string) => { + if(a === 'doi') { + return -1; + } else if(b === 'doi') { + return 1; + } else { + return 0; + } + }); + } } diff --git a/landingPages/landing-utils/showPublisher.component.ts b/landingPages/landing-utils/showPublisher.component.ts index fb9b7abf..03c23e07 100644 --- a/landingPages/landing-utils/showPublisher.component.ts +++ b/landingPages/landing-utils/showPublisher.component.ts @@ -4,74 +4,95 @@ import {EnvProperties} from "../../utils/properties/env-properties"; @Component({ selector: 'showPublisher', template: ` -
  • Publisher: {{publisher}}
  • -
  • - Journal: - {{journal['journal']}}, - volume - {{journal['volume'] | number}}{{journal['volume']}}, - - issue - {{journal['issue'] | number}}{{journal['issue']}}, - - pages - page - {{journal['start_page'] | number}}{{journal['start_page']}}-{{journal['end_page'] | number}}{{journal['end_page']}} - (issn: {{journal['issn']}}, eissn: {{journal['eissn']}}, lissn: {{journal['lissn']}} - >) +
  • + + Published: + {{publishDate | date: 'dd MMM yyyy'}} + + + Journal: + {{journal['journal']}} + , + + + volume + {{journal['volume'] | number}} + {{journal['volume']}} + + , + + + + issue + {{journal['issue'] | number}} + {{journal['issue']}} + + , + + + {{(journal['start_page'] && journal['end_page']) ? 'pages' : 'page'}} + + {{journal['start_page'] | number}} + {{journal['start_page']}} + + - + + {{journal['end_page'] | number}} + {{journal['end_page']}} + + + ( + + issn: {{journal['issn']}} + , + + + eissn: {{journal['eissn']}} + , + + + lissn: {{journal['lissn']}} + , + + + + + Copyright policy + + + ) +
  • -
  • - - - Publisher copyright policies & self-archiving - +
  • + Publisher: {{publisher}} + + ( + + Copyright policy + )
  • - ` }) - export class ShowPublisherComponent { + @Input() publishDate: Date; @Input() publisher; @Input() journal; - @Input() sherpaUrl = 'http://www.sherpa.ac.uk/romeo/search.php?issn='; - @Input() properties:EnvProperties; - - + //@Input() sherpaUrl = 'http://www.sherpa.ac.uk/romeo/search.php?issn='; + @Input() properties: EnvProperties; + + constructor() { - + } - + ngOnInit() { } - + } diff --git a/landingPages/landing-utils/showSubjects.component.ts b/landingPages/landing-utils/showSubjects.component.ts index 8278c570..31c2448a 100644 --- a/landingPages/landing-utils/showSubjects.component.ts +++ b/landingPages/landing-utils/showSubjects.component.ts @@ -1,57 +1,53 @@ import {Component, Input} from '@angular/core'; @Component({ - selector: 'showSubjects', - template: ` -
    - -
    - Subject: - - {{subjects.join(" | ")}} -
      -
    • -
      - {{key}}: {{otherSubjects.get(key).join(" | ")}} -
      -
    • - -
    -
    - -
    -
    -
    - - - - {{key}}: {{classifiedSubjects.get(key).join(" | ")}} - -
    -
    -
    - ` - - }) + selector: 'showSubjects', + template: ` +
    +
    + Subjects by Vocabulary: +
    +
    +
    + + {{key}}: + + {{subject}} + +
    +
    +
    +
    + Subjects: + {{subjects.join(', ')}} + , + + + + {{otherSubjects.get(key).join(', ')}} + , + + + +
    + ` +}) export class ShowSubjectsComponent { - @Input() subjects: string[]; - @Input() otherSubjects: Map; - @Input() classifiedSubjects: Map; - // private showClassifiedSbj: boolean = false; - - constructor () { - } - - ngOnInit() { - } - public getKeys( map) { - return Array.from(map.keys()); - } + @Input() subjects: string[]; + @Input() otherSubjects: Map; + @Input() classifiedSubjects: Map; + + // private showClassifiedSbj: boolean = false; + + constructor() { + } + + ngOnInit() { + } + + public getKeys(map) { + return Array.from(map.keys()); + } } diff --git a/landingPages/landing-utils/showTitle.component.ts b/landingPages/landing-utils/showTitle.component.ts index 3c0f73d9..7f3ec016 100644 --- a/landingPages/landing-utils/showTitle.component.ts +++ b/landingPages/landing-utils/showTitle.component.ts @@ -4,11 +4,10 @@ import {ActivatedRoute} from '@angular/router'; @Component({ selector: 'showTitle', template: ` -

    +

    + ` }) diff --git a/landingPages/organization/deletedByInference/deletedByInference.component.ts b/landingPages/organization/deletedByInference/deletedByInference.component.ts index eac73dd3..cab2a84a 100644 --- a/landingPages/organization/deletedByInference/deletedByInference.component.ts +++ b/landingPages/organization/deletedByInference/deletedByInference.component.ts @@ -8,59 +8,37 @@ import {RouterHelper} from '../../../utils/routerHelper.class'; import {ErrorCodes} from '../../../utils/properties/errorCodes'; import {OrganizationsDeletedByInferenceService} from './deletedByInference.service'; +import {ResultLandingInfo} from "../../../utils/entities/resultLandingInfo"; +import {ResultPreview} from "../../../utils/result-preview/result-preview"; +import {AlertModal} from "../../../utils/modal/alert"; @Component({ - selector: 'deletedByInference', + selector: 'organizationsDeletedByInference', template: ` - -
    -
    - {{results.length | number}} {{type}}, page {{page | number}} of {{totalPages(results.length) | number}} - -
    - -
    -
    + + +
      +
    • + +
    • +
    + + ` }) - export class OrganizationsDeletedByInferenceComponent { public results: OrganizationInfo[] = []; @Input() id: string; @Input() ids: string[] = []; @Input() type: string; + @Input() modal: AlertModal; // Custom tab paging variables public page: number = 1; @@ -115,6 +93,10 @@ export class OrganizationsDeletedByInferenceComponent { } ); } + + public getResultPreview(result: OrganizationInfo): ResultPreview { + return ResultPreview.organizationInfoConvert(result); + } public totalPages(totalResults: number): number { let totalPages:any = totalResults/this.pageSize; diff --git a/landingPages/organization/deletedByInference/deletedByInference.module.ts b/landingPages/organization/deletedByInference/deletedByInference.module.ts index b792d420..c327c902 100644 --- a/landingPages/organization/deletedByInference/deletedByInference.module.ts +++ b/landingPages/organization/deletedByInference/deletedByInference.module.ts @@ -12,11 +12,13 @@ import {ResultLandingUtilsModule} from '../../landing-utils/resultLandingUtils.m import {ErrorMessagesModule} from '../../../utils/errorMessages.module'; import {ShowAuthorsModule} from "../../../utils/authors/showAuthors.module"; import {LandingModule} from "../../landing-utils/landing.module"; +import {NoLoadPaging} from "../../../searchPages/searchUtils/no-load-paging.module"; +import {ResultPreviewModule} from "../../../utils/result-preview/result-preview.module"; @NgModule({ imports: [ CommonModule, FormsModule, ResultLandingUtilsModule, - PagingModule, ErrorMessagesModule, ShowAuthorsModule, LandingModule + PagingModule, ErrorMessagesModule, ShowAuthorsModule, LandingModule, NoLoadPaging, ResultPreviewModule ], declarations: [ OrganizationsDeletedByInferenceComponent diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index 3f295bc0..39292fac 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -1,217 +1,237 @@ -
    -
    +
    +
    - -
    +
    + class="loading-gif uk-align-center">
    -
    - +
    - - - - - -
    Share - Bookmark
    -
    -
    - Application Box +
    +
    + Download report - based on the affiliation information
    - +
    +
    + Funder report +
    +
    +
    +
    + + Specify by Funder + {{element.name}} + + +
    + +
    - +
    + Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}} +
    - - - -
    - - -
    +
    + + + +
    + + +
    +
    + + + + +
    + + +
    +
    + + + \ No newline at end of file diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index e20170ba..68ff5885 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -1,20 +1,15 @@ import {Component, ElementRef, Input, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Meta, Title} from '@angular/platform-browser'; - import {OrganizationService} from '../../services/organization.service'; import {OrganizationInfo} from '../../utils/entities/organizationInfo'; import {ReportsService} from '../../services/reports.service'; -import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class'; -// import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; import {SearchResearchResultsService} from '../../services/searchResearchResults.service'; -// import {SearchDatasetsService} from '../../services/searchDatasets.service'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchProjectsService} from '../../services/searchProjects.service'; import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {SearchingProjectsTabComponent} from '../landing-utils/searchingProjectsInTab.component'; +import {ProjectsInModalComponent} from '../landing-utils/projects-in-modal.component'; import {RouterHelper} from '../../utils/routerHelper.class'; import {ModalLoading} from '../../utils/modal/loading.component'; @@ -26,71 +21,76 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {HelperService} from "../../utils/helper/helper.service"; import {Location} from "@angular/common"; +interface Total { + publications: number; + datasets: number; + software: number; + other: number; + results: number; + dataproviders: number; +} + @Component({ selector: 'organization', templateUrl: 'organization.component.html', }) - export class OrganizationComponent { @Input() piwikSiteId = null; @Input() communityId = null; - + public organizationInfo: OrganizationInfo; public organizationId: string; - + // Message variables public warningMessage = ""; public errorMessage = ""; public showLoading: boolean = true; - + // CSV variables public downloadURLAPI: string; public csvProjectParamsHead: string; public csvPublicationParamsHead: string; public csvParamsTail: string; - public csvAffiliatedPublications: string; - + // Active tab variable for responsiveness public activeTab: string = "Publications"; - + // Variables for publications, research data, projects, dataproviders tabs - public fetchPublications: FetchResearchResults; - public linkToSearchPublications: string = ""; - // public fetchDatasets: FetchDatasets; - // public linkToSearchDatasets: string = ""; + public total: Total = { + publications: 0, + datasets: 0, + software: 0, + other: 0, + results: 0, + dataproviders: 0 + }; public fetchProjects: FetchProjects; - public fetchDataproviders: FetchDataproviders; - public linkToSearchDataproviders: string = ""; - //public projectFunders:string[] = []; - // Variables for projects query (query results only if projects tab is clicked) - public projectsClicked: boolean = false; - @ViewChild(SearchingProjectsTabComponent) searchingProjectsTabComponent: SearchingProjectsTabComponent; - + @ViewChild(ProjectsInModalComponent) projectsInModalComponent: ProjectsInModalComponent; + @ViewChild(ModalLoading) loading: ModalLoading; // Alert box when CSV: Project Publications for a funder is requested @ViewChild('AlertModalApplyAll') alertApplyAll; // Alert box when something is wrong with CSV requests @ViewChild('AlertModalCsvError') alertCsvError; - + public routerHelper: RouterHelper = new RouterHelper(); public errorCodes: ErrorCodes = new ErrorCodes(); public pageContents = null; public divContents = null; - - //private projectsNum: number = 0; - //private fundersSet: Set; - //private emptyFundersSet: boolean = true; - - // Request results for publications, research data and content providers only the one time (first time tab is clicked) - private reloadPublications: boolean = true; - // private reloadDatasets: boolean = true; - private reloadDataproviders: boolean = true; - + // Helper variables to specify funder in downloadPublicationsFile function - private funder: string; + public contentTypes: [string,string][] =[ + ['results', 'all research outcomes'], + ['publications', 'publications'], + ['datasets', 'research data'], + ['software', 'software'], + ['other', 'other research products'], + ]; + public funderContentType: string = ''; + public funder: any = ""; private funderId: string; - private funderCountPublications: number; + private funderCount: number; sub: any; infoSub: any; piwiksub: any; @@ -100,12 +100,16 @@ export class OrganizationComponent { countPublSub: any; downloadProjectPublSub: any; properties: EnvProperties; - + public indexUpdateDate: Date; + public showFeedback: boolean = false; + public feedbackFields: string [] = ['Name', 'Country', 'Other']; + @ViewChild('AlertModalDeletedByInference') alertModalDeletedByInference; + @ViewChild('projectsModal') projectsModal; public deleteByInferenceOpened: boolean = false; - + //private ngUnsubscribe: Subject = new Subject(); - + constructor(private element: ElementRef, private _organizationService: OrganizationService, private _piwikService: PiwikService, @@ -121,17 +125,16 @@ export class OrganizationComponent { private helper: HelperService, private seoService: SEOService, private _location: Location) { - - this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService); - // this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); this.fetchProjects = new FetchProjects(this._searchProjectsService); - this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); } - + ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; + if(this.properties.lastIndexUpdate) { + this.indexUpdateDate = new Date(this.properties.lastIndexUpdate); + } //this.getDivContents(); this.getPageContents(); this.updateUrl(data.envSpecific.baseLink + this._router.url); @@ -140,43 +143,47 @@ export class OrganizationComponent { this.organizationInfo = null; this.updateTitle("Organization"); this.updateDescription(""); - this.projectsClicked = false; - + this.organizationId = params['organizationId']; - + if (this.organizationId) { this.getOrganizationInfo(); } else { this.showLoading = false; - this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "organization"}}); + this._router.navigate(['/error'], { + queryParams: { + "page": this._location.path(true), + "page_type": "organization" + } + }); //this.warningMessage = "No valid organization id"; } - + HelperFunctions.scroll(); - + this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))'; - + }); - + this.downloadURLAPI = this.properties.csvAPIURL; - this.csvAffiliatedPublications = this.downloadURLAPI + "?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact \"" + this.organizationId + "\"))"; - this.csvProjectParamsHead = 'format=csv&type=projects&fq=( (oaftype exact project)and (funder exact "'; + //this.csvAffiliatedPublications = this.downloadURLAPI + "?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact \"" + this.organizationId + "\"))"; + this.csvProjectParamsHead = 'format=csv&type=projects&fq=((funder exact "'; //this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact '; } - + private getPageContents() { this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { this.pageContents = contents; }) } - + private getDivContents() { this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { this.divContents = contents; }) } - - + + ngOnDestroy() { if (this.sub) { this.sub.unsubscribe(); @@ -202,26 +209,62 @@ export class OrganizationComponent { if (this.downloadProjectPublSub) { this.downloadProjectPublSub.unsubscribe(); } - + /* this.ngUnsubscribe.next(); this.ngUnsubscribe.complete(); */ } - + + private getTotalResearchResults() { + this._searchResearchResultsService.numOfEntityResults('publication', + this.organizationInfo.objIdentifier, 'organization', this.properties).subscribe(total => { + this.total.publications = total; + this.total.results += total; + }); + this._searchResearchResultsService.numOfEntityResults('dataset', + this.organizationInfo.objIdentifier, 'organization', this.properties).subscribe(total => { + this.total.datasets = total; + this.total.results += total; + }); + this._searchResearchResultsService.numOfEntityResults('software', + this.organizationInfo.objIdentifier, 'organization', this.properties).subscribe(total => { + this.total.software = total; + this.total.results += total; + }); + this._searchResearchResultsService.numOfEntityResults('other', + this.organizationInfo.objIdentifier, 'organization', this.properties).subscribe(total => { + this.total.other = total; + this.total.results += total; + }); + } + + private getTotalDataproviders() { + this._searchDataprovidersService.numOfEntityDataproviders( + this.organizationInfo.objIdentifier,'organization', this.properties).subscribe( + total => { + this.total.dataproviders = total; + }); + } + private getOrganizationInfo() { - + this.warningMessage = ''; this.errorMessage = "" this.showLoading = true; - + this.organizationInfo = null; - + this.infoSub = this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe( data => { if (data == null) { this.showLoading = false; - this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "organization"}}); + this._router.navigate(['/error'], { + queryParams: { + "page": this._location.path(true), + "page_type": "organization" + } + }); this.errorMessage = 'No organization found'; } else { this.organizationInfo = data; @@ -231,35 +274,24 @@ export class OrganizationComponent { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.piwiksub = this._piwikService.trackView(this.properties, this.organizationInfo.title.name, this.piwikSiteId).subscribe(); } + console.log(this.organizationInfo); var refineFields: string [] = ["funder"]; - - //this.searchPublications(); - this.fetchPublications.getNumForEntity("publication", "organization", this.organizationId, this.properties); - // this.fetchDatasets.getNumForEntity("organization", this.organizationId, this.properties); + this.getTotalResearchResults(); + this.getTotalDataproviders(); this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0, refineFields, this.properties); - - this.fetchDataproviders.getNumForEntity("organization", this.organizationId, this.properties); - this.showLoading = false; - - /*let projectsNum = 0; - - if(this.organizationInfo.projects != undefined) { - this.fundersSet = new Set(); - this.organizationInfo.projects.forEach(function (value, key, map) { - projectsNum += value.length; - this.fundersSet.add(key); - }.bind(this)); - } - - this.projectsNum = projectsNum;*/ } }, err => { //console.log(err) this.handleError("Error getting organization for id: " + this.organizationId, err); - if(err.status == 404) { - this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "organization"}}); + if (err.status == 404) { + this._router.navigate(['/error'], { + queryParams: { + "page": this._location.path(true), + "page_type": "organization" + } + }); } this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrganizations); //this.errorMessage = 'No organization found'; @@ -267,90 +299,20 @@ export class OrganizationComponent { } ); } - - /* - private handleClick(funder: string) { - if(this.emptyFundersSet) { - this.fundersSet.clear(); - this.emptyFundersSet = false; - } - - if(this.fundersSet.has(funder)) { - this.fundersSet.delete(funder); - - if(this.fundersSet.size == 0) { - this.organizationInfo.projects.forEach(function (value, key, map) { - this.fundersSet.add(key); - }.bind(this)); - this.emptyFundersSet = true; - } - console.info(funder+" funder deleted"); - } else { - this.fundersSet.add(funder); - console.info(funder+" funder added"); - } - } - */ - //private getProjectsData(key: string): any { - //return this.projectsData; - //} - - private searchPublications() { - this.fetchPublications.getResultsForEntity("publication", "organization", this.organizationId, 1, 10, this.properties); - this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications; - //if(this.fetchPublications.searchUtils.totalResults > 0) { - this.reloadPublications = false; - //this.activeTab = "Publications"; - //} else { - //this.projectsClicked = true; - //} - } - - // private searchDatasets() { - // this.fetchDatasets.getResultsForEntity("organization", this.organizationId, 1, 10,this.properties); - // this.linkToSearchPublications = this.properties.searchLinkToAdvancedDatasets; - // this.reloadDatasets = false; - // } - - private searchDataproviders() { - this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10, this.properties); - this.linkToSearchDataproviders = this.properties.searchLinkToAdvancedDataProviders; - - //if(this.fetchDataproviders.searchUtils.totalResults > 0) { - this.reloadDataproviders = false; - //this.activeTab = "Content Providers"; - //} else { - - //} - } - - public searchPublicationsInit() { - if (this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) { - this.searchPublications(); - } - } - - // public searchDatasetsInit() { - // if(this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) { - // this.searchDatasets(); - // } - // } - - public searchDataprovidersInit() { - if (this.reloadDataproviders && this.fetchDataproviders.searchUtils.totalResults > 0) { - this.searchDataproviders(); - } - } - + + + /*public searchDataproviders(page: number = 1) { + this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, page, 1, this.properties); + }*/ + public downloadFile(url: string, filename: string) { - this.openLoading(); this.setMessageLoading("Downloading CSV file"); - + this.downloadFileSub = this._reportsService.downloadCSVFile(url).subscribe( data => { this.closeLoading(); - + var url = window.URL.createObjectURL(data); var a = window.document.createElement('a'); window.document.body.appendChild(a); @@ -360,7 +322,7 @@ export class OrganizationComponent { a.click(); window.URL.revokeObjectURL(url); a.remove(); // remove the element - + //window.open(window.URL.createObjectURL(data)); if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe(); @@ -369,40 +331,40 @@ export class OrganizationComponent { err => { //console.log("Error downloading the file."); this.handleError("Error downloading file: " + filename + ".csv", err); - + this.closeLoading(); this.confirmOpenCsvError(); }/*, () => console.log('Completed file download.')*/ ); } - - private downloadPublicationsFile(funder: string, funderId: string, count: number) { - + + private downloadFileByFunder() { + this.openLoading(); this.setMessageLoading("Downloading CSV file"); - + let response: string[] = []; let totalResponse: string = ""; let projects = []; - let counter: number = count; + let counter: number = this.funderCount; let title: boolean = false; let title_index: number = 0; - - let filename: string = 'funder-project-publications-report'; - - this.countProjectsSub = this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + funderId + '" ) ', 1, count, [], this.properties).subscribe( + + let filename: string = 'funder-project-' + this.funderContentType + '-report'; + + this.countProjectsSub = this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe( data => { projects = data[1]; for (let index = 0; index < projects.length; index++) { - this.countPublSub = this._searchResearchResultsService.numOfEntityResults("publication", projects[index].id, "project", this.properties).subscribe( + this.countPublSub = this._searchResearchResultsService.numOfEntityResults(this.funderContentType, projects[index].id, "project", this.properties).subscribe( data => { //if(data == 0 && title) { // if no publications for this project if (data == 0 && (counter > 1 || title)) { // if no publications for this project counter--; response[index] = ""; //console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]); - + if (counter == 0) { //for(let i=count-1; i>=0; i--) { for (let i = 0; i < projects.length; i++) { @@ -415,7 +377,7 @@ export class OrganizationComponent { } } this.closeLoading(); - + var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'})); var a = window.document.createElement('a'); window.document.body.appendChild(a); @@ -431,18 +393,18 @@ export class OrganizationComponent { if (!title) { title_index = index; //console.info(title_index); - url = this.downloadURLAPI + "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \"" + projects[index].id + "\"))" + url = this.downloadURLAPI + '?format=csv-special&' + this.getTypeParam(this.funderContentType)+ '&fq=((relprojectid exact "' + projects[index].id + '"))'; } else { - url = this.downloadURLAPI + "?format=csv-special-notitle&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \"" + projects[index].id + "\"))" + url = this.downloadURLAPI + '?format=csv-special-notitle&' + this.getTypeParam(this.funderContentType)+ '&fq=((relprojectid exact "' + projects[index].id + '"))'; } title = true; - + this.downloadProjectPublSub = this._reportsService.getCSVResponse(url).subscribe( data => { counter--; response[index] = data; //console.info("index: "+index, "counter: "+counter, "id:"+projects[index].id, response[index]); - + if (counter == 0) { //for(let i=count-1; i>=0; i--) { for (let i = 0; i < projects.length; i++) { @@ -455,7 +417,7 @@ export class OrganizationComponent { } } this.closeLoading(); - + var csvurl = window.URL.createObjectURL(new Blob([totalResponse], {type: 'text/csv'})); var a = window.document.createElement('a'); window.document.body.appendChild(a); @@ -469,7 +431,7 @@ export class OrganizationComponent { }, err => { this.handleError("Error downloading file: " + filename, err); - + this.closeLoading(); this.confirmOpenCsvError(); }/*, @@ -484,18 +446,18 @@ export class OrganizationComponent { }, err => { this.handleError("Error getting projects for organization with id: " + this.organizationId, err); - + this.closeLoading(); this.confirmOpenCsvError(); } ); } - + private updateDescription(description: string) { this._meta.updateTag({content: description.substring(0, 160)}, "name='description'"); this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'"); } - + private updateTitle(title: string) { var _prefix = ""; // if(!this.communityId) { @@ -505,30 +467,30 @@ export class OrganizationComponent { this._title.setTitle(title); this._meta.updateTag({content: title}, "property='og:title'"); } - + private updateUrl(url: string) { this._meta.updateTag({content: url}, "property='og:url'"); } - + private openLoading() { if (this.loading) { this.loading.open(); } } - + private closeLoading() { if (this.loading) { this.loading.close(); } } - + private setMessageLoading(message: string) { if (this.loading) { this.loading.message = message; } } - - public confirmOpenApplyAll(funder: string, funderId: string, funderCountPublications: number) { + + public confirmOpenApplyAll(contentType: string) { this.alertApplyAll.cancelButton = true; this.alertApplyAll.okButton = true; this.alertApplyAll.alertTitle = "CSV FILE"; @@ -536,16 +498,15 @@ export class OrganizationComponent { this.alertApplyAll.okButtonText = "Yes"; this.alertApplyAll.cancelButtonText = "No"; this.alertApplyAll.open(); - - this.funder = funder; - this.funderId = funderId; - this.funderCountPublications = funderCountPublications; + this.funderId = this.funder.id; + this.funderCount = this.funder.number; + this.funderContentType = contentType; } - - public confirmCloseApplyAll(data) { - this.downloadPublicationsFile(this.funder, this.funderId, this.funderCountPublications); + + public confirmCloseApplyAll() { + this.downloadFileByFunder(); } - + public confirmOpenCsvError() { this.alertCsvError.cancelButton = false; this.alertCsvError.okButton = true; @@ -554,20 +515,43 @@ export class OrganizationComponent { this.alertCsvError.okButtonText = "OK"; this.alertCsvError.open(); } - + encodeURI(input: string): string { return StringUtils.URIEncode(input); } - + private handleError(message: string, error) { console.error("Organizaton Landing Page: " + message, error); } - + openDeletedByInference() { this.deleteByInferenceOpened = true; this.alertModalDeletedByInference.cancelButton = false; this.alertModalDeletedByInference.okButton = false; - this.alertModalDeletedByInference.alertTitle = "Other versions"; + this.alertModalDeletedByInference.alertTitle = "Other versions of"; this.alertModalDeletedByInference.open(); } + + openProjectsModal() { + this.projectsInModalComponent.pageChange({value: 1}); + this.projectsModal.cancelButton = false; + this.projectsModal.okButton = false; + this.projectsModal.alertTitle = "Projects of"; + this.projectsModal.open(); + } + + public getTypeParam(type: string): string { + if(type == 'results') { + type = 'publications&type=datasets&type=software&type=other'; + } + return 'type='+type; + } + + getCSVAffiliated(contentType: string): string { + return this.downloadURLAPI + '?format=csv&' + this.getTypeParam(contentType) + '&fq=(relorganizationid exact "' + this.organizationId + '")'; + } + + getFunderProjects(): string { + return this.downloadURLAPI + '?'+this.csvProjectParamsHead+encodeURI(this.funder.id)+this.csvParamsTail; + } } diff --git a/landingPages/organization/organization.module.ts b/landingPages/organization/organization.module.ts index 30d6e501..ffe5407e 100644 --- a/landingPages/organization/organization.module.ts +++ b/landingPages/organization/organization.module.ts @@ -16,13 +16,16 @@ import {ReportsServiceModule} from '../../services/reportsService.module'; import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module'; import {ProjectsServiceModule} from '../../services/projectsService.module'; -import {SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module'; +import {ProjectsInModalModule} from '../landing-utils/projects-in-modal.module'; import {FreeGuard} from '../../login/freeGuard.guard'; import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module'; import {HelperModule} from "../../utils/helper/helper.module"; import {OrganizationsDeletedByInferenceModule} from "./deletedByInference/deletedByInference.module"; +import {LandingHeaderModule} from "../landing-utils/landing-header/landing-header.module"; +import {FeedbackModule} from "../feedback/feedback.module"; +import {MatSelectModule} from "@angular/material/select"; @NgModule({ @@ -34,12 +37,12 @@ import {OrganizationsDeletedByInferenceModule} from "./deletedByInference/delete DataProvidersServiceModule, ReportsServiceModule, OrganizationServiceModule, - SearchingProjectsTabModule, + ProjectsInModalModule, OrganizationServiceModule, SearchResearchResultsServiceModule, ProjectsServiceModule, Schema2jsonldModule, SEOServiceModule, HelperModule, - OrganizationsDeletedByInferenceModule + OrganizationsDeletedByInferenceModule, LandingHeaderModule, FeedbackModule, MatSelectModule ], declarations: [ OrganizationComponent, diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 4f640c15..51975bf9 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -1,8 +1,7 @@ + let-dynamic_content="dynamic_content"> + + + + + + -
    -
    +
    +
    -
    +
    - -

    - - - {{projectName}} - ({{projectInfo.contractNum}}) -

    -
    {{projectInfo.title}} - ({{projectInfo.contractNum}}) -
    -
    - Project{{" "}} - {{projectInfo.funder}}{{" "}} - - - Open Access mandate for Publications and Research Data Open Access mandate for ... + + + +
    + + Open Access mandate for Publications and Research Data + Open Access mandate for ... + {{" "}} + + Open Access mandate for Publications + {{" "}} + + Open Access mandate for Research Data + {{" "}} + + {{projectInfo.funding.funderName}} + {{" "}} + + Special Clause 39 {{" "}} - Open Access mandate for Publications{{" "}} - Special Clause 39{{" "}} - Open Access mandate for Research Data{{" "}}
    -
    -
    -
    - + + + + + + + + + + - -
    -
    - + + + + + + + + + + -
    + -
    -

    Research Results

    - -

    Access Mode of Research Results

    - -

    By Datasource of Research Results

    - -
    -
    -
    -
    + + + + + + + + + + + + + + - - - - - - -
    -
    --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -
    -
    + - + + + + + + + + + + + + -
    + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    + - -
    -
    Share - Bookmark
    - -
    -
    -
    Share project's research results
    -
    - - - - -
    - Publications -
    -
    - Research data -
    -
    - Software -
    -
    - Other -
    - - -
    -
    - - - - - -
    -
    - - - - -
    -
    - - - - -
    -
    - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    -
    + +
    +
    Share - Bookmark
    +
    +
    +
    +
    Share project's content
    +
    + + + + + + + + + +
    + + Select content type + All research outcomes + Publications + Research data + Software + Other research products + +
    + + +
    +
    +
    +
    +
    Download report
    +
    + + + + + + + + + +
    + + Select content type + All research outcomes + + Publications + + + Research data + + + Software + + + Other research products + + +
    + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
    + + +
    +
    - - - - -
    + + + + + +
    + + +
    +
    + Produced research results per year + +
    +
    + Access mode of research results + +
    +
    + Research results per datasource + +
    +
    +
    +
    + +
    \ No newline at end of file diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 764d3fe3..590846d6 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -20,6 +20,7 @@ import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {HelperService} from "../../utils/helper/helper.service"; import {Location} from "@angular/common"; +import {HtmlProjectReportService} from "../htmlProjectReport/htmlProjectReport.service"; @Component({ selector: 'project', @@ -47,20 +48,19 @@ export class ProjectComponent { public chartAccessModeUrl: string; public chartDatasourcesUrl: string; - // HTML variables in APP BOX - public publications_dynamic: string; - public datasets_dynamic: string; - public software_dynamic: string; - public orps_dynamic: string; + // Clipboard variable for HTML dynamic content + public clipboard; public project; // CSV variables public downloadURLAPI: string; public csvParams: string; - public csvParamsDatasets: string; - public csvParamsSoftware: string; - public csvParamsOrps: string; + + // HTML (download) variables + public header1: string = ""; + public header2: string = ""; + public htmlResultDownload: string = ""; // Message variables public warningMessage = ""; @@ -70,12 +70,18 @@ export class ProjectComponent { // Active tab variable for responsiveness public activeTab: string = "Publications"; + @ViewChild('statisticsModal') statisticsModal; + // Request results for publications, research data and software only the one time (first time tab is clicked) private reloadPublications: boolean = true; private reloadDatasets: boolean = true; private reloadSoftware: boolean = true; private reloadOrps: boolean = true; + // Variables for entity selections on the right column + public share_research_results_type: string = ""; + public download_research_results_type: string = ""; + // Variables for publications, research data, software tabs public fetchPublications: FetchResearchResults; public linkToSearchPublications = ""; @@ -91,36 +97,53 @@ export class ProjectComponent { public pageContents = null; public divContents = null; - public share_research_results_type: string = ""; + public indexUpdateDate: Date; + public showFeedback: boolean; + public feedbackFields: string [] = [ + 'Title', 'Funding Information', 'Duration', + 'Organizations', 'Other']; @ViewChild(ModalLoading) loading: ModalLoading; // Alert box when something is wrong with CSV requests @ViewChild('AlertModalCsvError') alertCsvError; + // Description variables for view more/less functionality + public thresholdDescription: number = 670; + public showNumDescription: number = 670; + + // Organizations variables for view more/less functionality + public thresholdOrganizations: number = 20; + public showNumOrganizations: number = 20; + sub: any; piwiksub: any; infoSub: any; downloadFilePiwikSub: any; + downloadHtmlFilePiwikSub: any; properties: EnvProperties; - constructor(private _projectService: ProjectService, - private _piwikService: PiwikService, - private route: ActivatedRoute, - private router: Router, - private _searchResearchResultsService: SearchResearchResultsService, - private _reportsService: ReportsService, + public subHTML: any; + + constructor(private route: ActivatedRoute, + private _router: Router, + private _location: Location, private _meta: Meta, private _title: Title, - private _router: Router, - private helper: HelperService, private seoService: SEOService, - private _location: Location) { - } + private _piwikService: PiwikService, + private helper: HelperService, + private _projectService: ProjectService, + private _searchResearchResultsService: SearchResearchResultsService, + private _reportsService: ReportsService, + private htmlService: HtmlProjectReportService) {} ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; + if(this.properties.lastIndexUpdate) { + this.indexUpdateDate = new Date(this.properties.lastIndexUpdate); + } //this.getDivContents(); this.getPageContents(); this.updateUrl(data.envSpecific.baseLink + this._router.url); @@ -137,6 +160,8 @@ export class ProjectComponent { var title = "Project"; var description = ""; + this.header1 = ""; + this.updateTitle(title); this.updateDescription(description); this.projectId = params['projectId']; @@ -159,15 +184,32 @@ export class ProjectComponent { this.downloadURLAPI = this.properties.csvAPIURL; this.createClipboard(); - this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \"" + this.projectId + "\"))"; - this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact \"" + this.projectId + "\"))"; - this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact \"" + this.projectId + "\"))"; - this.csvParamsOrps = "?format=csv-special&type=other&fq=(((oaftype exact result) and (resulttypeid exact other)) and (relprojectid exact \"" + this.projectId + "\"))"; - HelperFunctions.scroll(); }); } + public getFileNameType(type: string) { + if(type == "results") { + return "research-outcomes"; + } else if(type == "publications") { + return "publications"; + } else if(type == "datasets") { + return "research-data"; + } else if(type == "software") { + return "software"; + } else if(type == "other") { + return "other-research-products"; + } + return "results"; + } + + public getCsvParams(type: string) { + // if(type == "results") { + // type = "publications&type=datasets&type=software&type=other"; + // } + return "?format=csv-special&type="+type+"&fq=(relprojectid exact \"" + this.projectId + "\")"; + } + private getPageContents() { this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { this.pageContents = contents; @@ -180,47 +222,20 @@ export class ProjectComponent { }) } + getDynamicContent(type: string) { + return ""; + } + actionsAfterLoadId() { - this.publications_dynamic = - ""; - - this.datasets_dynamic = - ""; - - this.software_dynamic = - ""; - - this.orps_dynamic = - ""; - this.getProjectInfo(this.projectId); //this.searchPublications(); this.fetchPublications.getNumForEntity("publication", "project", this.projectId, this.properties); @@ -242,29 +257,23 @@ export class ProjectComponent { if (this.downloadFilePiwikSub) { this.downloadFilePiwikSub.unsubscribe(); } + if(this.downloadHtmlFilePiwikSub) { + this.downloadHtmlFilePiwikSub.unsubscribe(); + } } private createClipboard() { if (typeof window !== 'undefined') { - - let publications_clipboard, datasets_clipboard, software_clipboard, other_clipboard; + delete this.clipboard; let Clipboard; Clipboard = require('clipboard'); - publications_clipboard = new Clipboard('.publications_clipboard_btn'); - datasets_clipboard = new Clipboard('.datasets_clipboard_btn'); - software_clipboard = new Clipboard('.software_clipboard_btn'); - other_clipboard = new Clipboard('.other_clipboard_btn'); + this.clipboard = new Clipboard('.clipboard_btn'); } } private searchPublications() { this.fetchPublications.getResultsForEntity("publication", "project", this.projectId, 1, 10, this.properties); this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications;// + "?project=" + this.projectId+"&pr=and"; - //if(this.fetchPublications.searchUtils.totalResults > 0) { - //this.activeTab = "Publications"; - //} else { - //this.searchDatasetsInit(); - //} this.reloadPublications = false; } @@ -377,14 +386,14 @@ export class ProjectComponent { } this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url); this.updateTitle(this.projectName); - this.updateDescription("project, " + this.projectName + "," + this.projectInfo.funder + "," + this.projectInfo.acronym); + this.updateDescription("project, " + this.projectName + "," + this.projectInfo.funding.funderShortName + "," + this.projectInfo.acronym); if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe(); } this.project = { funderId: "", - funderName: this.projectInfo.funder, + funderName: ((this.projectInfo.funding) ? this.projectInfo.funding.funderShortName: ''), projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, @@ -404,7 +413,7 @@ export class ProjectComponent { this.showLoading = false; } - public downloadfile(url: string, filename: string) { + public downloadCsvFile(url: string, filename: string) { this.openLoading(); this.setMessageLoading("Downloading CSV file"); @@ -412,17 +421,9 @@ export class ProjectComponent { data => { this.closeLoading(); - var url = window.URL.createObjectURL(data); - var a = window.document.createElement('a'); - window.document.body.appendChild(a); - a.setAttribute('style', 'display: none'); - a.href = url; - a.download = filename + ".csv"; - a.click(); - window.URL.revokeObjectURL(url); - a.remove(); // remove the element + let url = window.URL.createObjectURL(data); + this.download(url, filename+".csv"); - //window.open(window.URL.createObjectURL(data)); if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe(); } @@ -432,55 +433,191 @@ export class ProjectComponent { this.handleError("Error downloading file: " + filename, error); this.closeLoading(); - this.confirmOpenCsvError(); + this.confirmOpenFileDownloadError("CSV"); }/*, () => console.log('Completed file download.')*/ ); } - /* - showHTML(){ - let info:string = "

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

    "; - info += "

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

    "; - - let htmlParams = 'resources?format=html&page=0&size='+this.fetchPublications.searchUtils.totalResults+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "'+this.projectId+'"))'; - this._reportsService.downloadHTMLFile(this.downloadURLAPI+htmlParams, info) - .subscribe(data => this.funct(data), - error => console.log("Error downloading the file."), - () => console.log('Completed file download.')); - } - - funct(data) { - var win = window.open(window.URL.createObjectURL(data)); - } - */ public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; this.pageViews = $event.pageViews; } + public openStatistics() { + this.statsClicked = true; + this.statisticsModal.cancelButton = false; + this.statisticsModal.okButton = false; + this.statisticsModal.alertTitle = "Statistics of"; + this.statisticsModal.open(); + } + + private createHeaders(type: string) { + this.openLoading(); + this.setMessageLoading("Downloading HTML file"); + + if(!this.header1) { + this.createHeader1(); + } + + if (type == "publications") { + this.header2 = this.fetchPublications.searchUtils.totalResults.toLocaleString('en-US') + " publications"; + } else if (type == "datasets") { + this.header2 = this.fetchDatasets.searchUtils.totalResults.toLocaleString('en-US') + " research data"; + } else if (type == "software") { + this.header2 = this.fetchSoftware.searchUtils.totalResults.toLocaleString('en-US') + " software"; + } else if (type == "other") { + this.header2 = this.fetchOrps.searchUtils.totalResults.toLocaleString('en-US') + " other research products"; + } else if (type == "results") { + let totalResults: number = (+this.fetchPublications.searchUtils.totalResults) + + (+this.fetchDatasets.searchUtils.totalResults) + + (+this.fetchSoftware.searchUtils.totalResults) + + (+this.fetchOrps.searchUtils.totalResults); + + this.header2 = totalResults.toLocaleString('en-US') + " research outcomes"; + } + } + + private createHtmlFile(type: string, filename: string) { + let intro: string = ''; + intro += ''; + intro += ''; + intro += '' + this.header1 + ''; + intro += ''; + + if (typeof window !== 'undefined') { + this.subHTML = this.htmlService.getHTML(this.projectId, type, this.properties.csvAPIURL).subscribe( + data => { + //console.info(data); + this.htmlResultDownload = intro + '
    ' + this.header1 + '

    ' + this.header2 + '

    '; + this.htmlResultDownload += "" + data + "
    TypeTitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
    "; + this.htmlResultDownload += ''; + + //console.info(this.htmlResultDownload); + this.closeLoading(); + + let url = window.URL.createObjectURL(new Blob([this.htmlResultDownload], { type: 'text/html' })); + this.download(url, filename+".html"); + + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.downloadHtmlFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe(); + } + }, + err => { + this.handleError("Error getting html for id: " + this.projectId, err); + //this.errorMessage = 'Service not available'; + this.closeLoading(); + this.confirmOpenFileDownloadError("HTML"); + } + ); + } else { + this.closeLoading(); + this.confirmOpenFileDownloadError("HTML"); + } + } + + downloadHtmlFile(type: string, filename: string) { + this.createHeaders(type); + this.createHtmlFile(type, filename); + } + + createHeader1() { + // if (title != undefined && title != "") { + // this.header1 += title; + // } + // if ((title != undefined && title != "") && + // ((acronym != undefined && acronym != "") || + // (code != undefined && code != ""))) { + // this.header1 += "("; + // } + // if (acronym != undefined && acronym != "") { + // this.header1 += acronym + " - "; + // } + // if (code != undefined && code != "") { + // this.header1 += code; + // } + // if ((title != undefined && title != "") && + // ((acronym != undefined && acronym != "") || + // (code != undefined && code != ""))) { + // this.header1 += ")"; + // } + + this.header1 = "
    Project"; + + if(this.projectInfo.startDate || this.projectInfo.endDate) { + this.header1 += " . " + } + if(this.projectInfo.startDate && !this.projectInfo.endDate) { + this.header1 += "from "; + } + if(!this.projectInfo.startDate && this.projectInfo.endDate) { + this.header1 += "until "; + } + if(this.projectInfo.startDate) { + let startYear = (new Date(this.projectInfo.startDate)).getFullYear(); + this.header1 += startYear; + } + if(this.projectInfo.startDate && this.projectInfo.endDate) { + this.header1 += " - "; + } + if(this.projectInfo.endDate) { + let endYear = (new Date(this.projectInfo.endDate)).getFullYear(); + this.header1 += endYear; + } + if(this.projectInfo.startDate || this.projectInfo.endDate) { + this.header1 += "" + } + + if(this.projectInfo.status) { + this.header1 += " . "+this.projectInfo.status+""; + } + + if(this.projectInfo.funding && this.projectInfo.funding.code) { + this.header1 += " . "+this.projectInfo.funding.code+""; + } + this.header1 += "
    "; + + this.header1 += "

    "; + // + if(this.projectInfo.title) { + this.header1 += "
    "+this.projectInfo.title+"
    "; + } + } + + public download(url, filename) { + //var url = window.URL.createObjectURL(new Blob([this.htmlResultDownload], { type: 'text/html' })); + var a = window.document.createElement('a'); + window.document.body.appendChild(a); + a.setAttribute('style', 'display: none'); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + a.remove(); // remove the element + } + + // copyToClipboard(element: HTMLElement) { + // if (typeof document !== 'undefined') { + // if (window.getSelection) { + // const selection = window.getSelection(); + // const range = document.createRange(); + // range.selectNodeContents(element); + // selection.removeAllRanges(); + // selection.addRange(range); + // document.execCommand('copy'); + // } else { + // console.warn("Could not select text in node: Unsupported browser."); + // } + // } + // } + private updateDescription(description: string) { this._meta.updateTag({content: description.substring(0, 160)}, "name='description'"); this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'"); @@ -518,10 +655,10 @@ export class ProjectComponent { } } - public confirmOpenCsvError() { + public confirmOpenFileDownloadError(fileType: string) { this.alertCsvError.cancelButton = false; this.alertCsvError.okButton = true; - this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE"; + this.alertCsvError.alertTitle = "ERROR DOWNLOADING "+fileType+" FILE"; this.alertCsvError.message = "There was an error in csv downloading. Please try again later."; this.alertCsvError.okButtonText = "OK"; this.alertCsvError.open(); @@ -532,8 +669,8 @@ export class ProjectComponent { } isRouteAvailable(routeToCheck: string) { - for (let i = 0; i < this.router.config.length; i++) { - let routePath: string = this.router.config[i].path; + for (let i = 0; i < this._router.config.length; i++) { + let routePath: string = this._router.config[i].path; if (routePath == routeToCheck) { return true; } diff --git a/landingPages/project/project.module.ts b/landingPages/project/project.module.ts index 3b442204..cd6d792a 100644 --- a/landingPages/project/project.module.ts +++ b/landingPages/project/project.module.ts @@ -1,41 +1,47 @@ //import {MaterialModule} from '@angular/material'; -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; +import {MatSelectModule} from "@angular/material"; + +import { ProjectComponent } from './project.component'; +import {ProjectServiceModule} from './projectService.module'; +import {HtmlProjectReportService} from "../htmlProjectReport/htmlProjectReport.service"; +import {ReportsServiceModule} from '../../services/reportsService.module'; +import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module'; + +import {MetricsModule} from '../landing-utils/metrics.module'; +import {LandingModule } from '../landing-utils/landing.module'; +import {LandingHeaderModule} from "../landing-utils/landing-header/landing-header.module"; -import { ProjectServiceModule} from './projectService.module'; import {LoadingModalModule} from '../../utils/modal/loadingModal.module'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {ErrorMessagesModule} from '../../utils/errorMessages.module'; - -import { ProjectComponent } from './project.component'; +import {HelperModule} from "../../utils/helper/helper.module"; import {IFrameModule} from '../../utils/iframe.module'; -import {MetricsModule} from '../landing-utils/metrics.module'; -import {ReportsServiceModule} from '../../services/reportsService.module'; -import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module'; -import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module'; -import { LandingModule } from '../landing-utils/landing.module'; + import {FreeGuard} from'../../login/freeGuard.guard'; import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; -import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; -import {HelperModule} from "../../utils/helper/helper.module"; +import {SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; +import {FeedbackModule} from "../feedback/feedback.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, LandingModule, LoadingModalModule, AlertModalModule, ErrorMessagesModule, - TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule, + IFrameModule, MetricsModule, ReportsServiceModule, SearchResearchResultsServiceModule, ProjectServiceModule, - Schema2jsonldModule, SEOServiceModule, HelperModule - + Schema2jsonldModule, SEOServiceModule, HelperModule, + LandingHeaderModule, MatSelectModule, FeedbackModule + ], declarations: [ ProjectComponent ], providers:[ - FreeGuard, IsRouteEnabled + FreeGuard, IsRouteEnabled, HtmlProjectReportService ], exports: [ ProjectComponent diff --git a/landingPages/project/project.service.ts b/landingPages/project/project.service.ts index 32ebcaa5..72700177 100644 --- a/landingPages/project/project.service.ts +++ b/landingPages/project/project.service.ts @@ -98,32 +98,79 @@ export class ProjectService { parseProjectInfo (data: any, properties:EnvProperties):any { this.projectInfo = new ProjectInfo(); + this.projectInfo.funding = {funderName: "", funderShortName: "", code: "", fundingStream: "", + budget: "", contribution: "", currency: ""}; + + // ['result']['header']['dri:objIdentifier'] if(data[3] != null) { this.projectInfo.id = data[3]; } - if(data[0] != null) { - this.projectInfo.acronym = data[0].acronym; - this.projectInfo.title = Array.isArray(data[0]['title']) ? data[0].title[0] : data[0].title; - this.projectInfo.callIdentifier = data[0].callidentifier; - this.projectInfo.contractNum = data[0].code; - this.projectInfo.startDate = data[0].startdate; - this.projectInfo.endDate = data[0].enddate; + + // ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree'] + if(data[1] != null) { + let funding: {"funderName": string, "funderShortname": string, "stream": string}; + funding = this.parsingFunctions.parseFundingTrees(data[1]); + if(funding.funderName) { + this.projectInfo.funding.funderName = funding.funderName; + } + if(funding.funderShortname) { + this.projectInfo.funding.funderShortName = funding.funderShortname; + } + if(funding.stream) { + this.projectInfo.funding.fundingStream = funding.stream; + } + } + + // ['result']['metadata']['oaf:entity']['oaf:project'] + if(data[0] != null) { + this.projectInfo.acronym = data[0].acronym; + this.projectInfo.title = Array.isArray(data[0]['title']) ? data[0].title[0] : data[0].title; + this.projectInfo.funding.code = data[0].code; + if(data[0].startdate) { + let date: number = Date.parse(data[0].startdate); + this.projectInfo.startDate = (date ? date : null); + } + if(data[0].enddate) { + let date: number = Date.parse(data[0].enddate); + this.projectInfo.endDate = (date ? date : null); + } + if(this.projectInfo.endDate || this.projectInfo.startDate) { + let todayDate = Date.parse(new Date().toString()); + this.projectInfo.currentDate = todayDate; + if(this.projectInfo.startDate) { + let startDate = +(this.projectInfo.startDate); + if (todayDate < startDate) { + this.projectInfo.status = "Not started"; + } + } + if(this.projectInfo.endDate && !this.projectInfo.status) { + let endDate = +(this.projectInfo.endDate); + if (todayDate <= endDate) { + this.projectInfo.status = "On going"; + } else { + this.projectInfo.status = "Closed"; + } + } + } + if(this.projectInfo.funding) { + if(this.projectInfo.funding.funderShortName == "EC") { this.projectInfo.openAccessMandatePublications = data[0].oamandatepublications; this.projectInfo.specialClause39 = data[0].ecsc39; this.projectInfo.openAccessMandateDatasets = data[0].ecarticle29_3; + } + this.projectInfo.funding.budget = data[0].totalcost;//"10000"; + this.projectInfo.funding.contribution = data[0].fundedamount;//"200100"; + this.projectInfo.funding.currency = data[0].currency;//"EUR"; } - if(data[1] != null) { - let funding: {"funderName": string, "funderShortname": string, "stream": string}; - funding = this.parsingFunctions.parseFundingTrees(data[1]); - if(funding.funderShortname) { - this.projectInfo.funder = funding.funderShortname; - } - if(funding.stream) { - this.projectInfo['funding'] = funding.stream; - } + if(!Array.isArray(data[0]['summary'])) { + this.projectInfo.description = (data[0]['summary']) ? String(data[0]['summary']) : ""; + } else { + this.projectInfo.description = (data[0]['summary'][0]) ? String(data[0]['summary'][0]) : ""; } + } - if(data[2] != null) { + // ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel'] + if(data[2] != null) { this.projectInfo.organizations = [];//new Map(); let acronym: string = ""; @@ -170,8 +217,8 @@ export class ProjectService { } } - if(this.projectInfo.funder == "EC") { - this.projectInfo.url = properties.cordisURL+this.projectInfo.contractNum; + if(this.projectInfo.funding && this.projectInfo.funding.funderShortName == "EC") { + this.projectInfo.url = properties.cordisURL+this.projectInfo.funding.code; this.projectInfo.urlInfo = "Detailed project information (CORDIS)"; } diff --git a/landingPages/result/deletedByInference/deletedByInference.component.ts b/landingPages/result/deletedByInference/deletedByInference.component.ts index 23e3e6cc..f09dfb41 100644 --- a/landingPages/result/deletedByInference/deletedByInference.component.ts +++ b/landingPages/result/deletedByInference/deletedByInference.component.ts @@ -1,160 +1,92 @@ -import {Component, ViewChild} from '@angular/core'; -import {ElementRef, Input} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; +import {Component, ViewChild} from '@angular/core'; +import {ElementRef, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; -import {EnvProperties} from '../../../utils/properties/env-properties'; -import {ResultLandingInfo} from '../../../utils/entities/resultLandingInfo'; -import {RouterHelper} from '../../../utils/routerHelper.class'; -import {ErrorCodes} from '../../../utils/properties/errorCodes'; +import {EnvProperties} from '../../../utils/properties/env-properties'; +import {ResultLandingInfo} from '../../../utils/entities/resultLandingInfo'; +import {RouterHelper} from '../../../utils/routerHelper.class'; +import {ErrorCodes} from '../../../utils/properties/errorCodes'; -import {DeletedByInferenceService} from './deletedByInference.service'; +import {DeletedByInferenceService} from './deletedByInference.service'; +import {SearchResult} from "../../../utils/entities/searchResult"; +import {ResultPreview} from "../../../utils/result-preview/result-preview"; +import {AlertModal} from "../../../utils/modal/alert"; @Component({ - selector: 'deletedByInference', - template: ` + selector: 'deletedByInference', + template: ` - -
    -
    - {{results.length | number}} {{type}}, page {{page | number}} of {{totalPages(results.length) | number}} - -
    - -
      -
    • -
      - -
      -
      - [no title available] -
      - - {{result.types.join(", ")}}{{" "}} - {{result.languages.join(", ")}}{{" "}} - {{result.countries.join(", ")}}{{" "}} - {{result.accessMode}}{{" "}} - -
      - - ({{result.date}}) -
      - -
      - -
      - -
      - Download From: - - - {{available.downloadName}} - - - [{{(i+1) | number}}] - - - - {{available.downloadName}}, - - ... -
      - -
      - {{result.description}} -
      - - - -
    • -
    -
    - ` + + +
      +
    • + +
    • +
    + + + ` }) - export class DeletedByInferenceComponent { public results: ResultLandingInfo[] = []; @Input() id: string; @Input() ids: string[] = []; @Input() type: string; - + @Input() resultType: string; + @Input() modal: AlertModal; + // Custom tab paging variables public page: number = 1; public pageSize: number = 5; - + public status: number; - public routerHelper:RouterHelper = new RouterHelper(); - public errorCodes:ErrorCodes = new ErrorCodes(); - + public routerHelper: RouterHelper = new RouterHelper(); + public errorCodes: ErrorCodes = new ErrorCodes(); + sub: any; - properties:EnvProperties; - - constructor ( private element: ElementRef, - private _deletedByInferenceService: DeletedByInferenceService, - private route: ActivatedRoute, - private _router: Router) { + properties: EnvProperties; + + constructor(private element: ElementRef, + private _deletedByInferenceService: DeletedByInferenceService, + private route: ActivatedRoute, + private _router: Router) { } - + ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - + this.properties = data.envSpecific; + }); - this.sub = this.route.queryParams.subscribe(data => { - this.errorCodes = new ErrorCodes(); - this.status = this.errorCodes.LOADING; - - this.getDeletedByInference(); + this.sub = this.route.queryParams.subscribe(data => { + this.errorCodes = new ErrorCodes(); + this.status = this.errorCodes.LOADING; + + this.getDeletedByInference(); }); } - - ngOnDestroy() {} - + + ngOnDestroy() { + } + getDeletedByInference() { this.results = []; this.status = this.errorCodes.LOADING; -/* - if(this.ids) { - var allRequests = []; - for(let id of this.ids) { - allRequests.push(this._deletedByInferenceService.getDeletedByInferencePublications(id, this.properties)); - } - - zip.apply(null, allRequests).subscribe( - // this._deletedByInferenceService.getDeletedByInferencePublications(id, this.properties).subscribe( - data => { - this.results = data; - this.status = this.errorCodes.DONE; - }, - error => { - if(error.status == '404') { - this.status = this.errorCodes.NOT_FOUND; - } else if(error.status == '500') { - this.status = this.errorCodes.ERROR; - } else { - this.status = this.errorCodes.NOT_AVAILABLE; - } - } - ); - } - */ this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe( data => { this.results = data; this.status = this.errorCodes.DONE; }, error => { - if(error.status == '404') { + if (error.status == '404') { this.status = this.errorCodes.NOT_FOUND; - } else if(error.status == '500') { + } else if (error.status == '500') { this.status = this.errorCodes.ERROR; } else { this.status = this.errorCodes.NOT_AVAILABLE; @@ -162,15 +94,19 @@ export class DeletedByInferenceComponent { } ); } - + + public getResultPreview(result: ResultLandingInfo): ResultPreview { + return ResultPreview.resultLandingInfoConvert(result, this.resultType); + } + public totalPages(totalResults: number): number { - let totalPages:any = totalResults/this.pageSize; - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, this.pageSize) + 1); + let totalPages: any = totalResults / this.pageSize; + if (!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, this.pageSize) + 1); } return totalPages; } - + public updatePage($event) { this.page = $event.value; } diff --git a/landingPages/result/deletedByInference/deletedByInference.module.ts b/landingPages/result/deletedByInference/deletedByInference.module.ts index 4779ca00..9756a7ab 100644 --- a/landingPages/result/deletedByInference/deletedByInference.module.ts +++ b/landingPages/result/deletedByInference/deletedByInference.module.ts @@ -11,11 +11,14 @@ import {ResultLandingUtilsModule} from '../../landing-utils/resultLandingUtils.m import {ErrorMessagesModule} from '../../../utils/errorMessages.module'; import {ShowAuthorsModule} from "../../../utils/authors/showAuthors.module"; +import {SearchResultsModule} from "../../../searchPages/searchUtils/searchResults.module"; +import {NoLoadPaging} from "../../../searchPages/searchUtils/no-load-paging.module"; +import {ResultPreviewModule} from "../../../utils/result-preview/result-preview.module"; @NgModule({ imports: [ CommonModule, FormsModule, ResultLandingUtilsModule, - PagingModule, ErrorMessagesModule, ShowAuthorsModule + PagingModule, ErrorMessagesModule, ShowAuthorsModule, SearchResultsModule, NoLoadPaging, ResultPreviewModule ], declarations: [ DeletedByInferenceComponent diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index e73c3d29..7a25b826 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -1,109 +1,194 @@ -
    -
    +
    +
    -
    +
    + class="loading-gif uk-align-center">
    -
    - -
    +
    +
    + - - - - - - - - - -
    - The following information is the result of merging - {{resultLandingInfo.deletedByInferenceIds.length}} other versions + + + -

    - -

    - {{resultLandingInfo.types.join(", ")}}{{" "}} - {{resultLandingInfo.programmingLanguages.join(", ")}}{{" "}} - {{resultLandingInfo.languages.join(", ")}}{{" "}} - {{resultLandingInfo.countries.join(", ")}}{{" "}} - - {{resultLandingInfo.accessMode}}{{" "}} - - - - Record in preview - - {{" "}} - - -
    - - ({{resultLandingInfo.date}}) +
    + +
    + +
    + {{resultLandingInfo.accessMode}} + {{" "}} + {{resultLandingInfo.accessMode}} + {{" "}} + + + {{language}} + {{' '}} + + + + + {{language}} + {{' '}} + + + + + {{programmingLanguage}} + {{' '}} + +
    -
      + -
    • Embargo end date: {{resultLandingInfo.embargoEndDate}}
    • + +
    • + + {{(resultLandingInfo.countries.length === 1) ? 'Country: ' : 'Countries: '}} + + {{resultLandingInfo.countries.join(", ")}} +
    • + +
    • + +
    • +
    • -
    • - - -
    -
    -
    - {{resultLandingInfo.description.substring(0, showNumDescription)}}... - - View more - - + +
    +
    + Abstract: + {{resultLandingInfo.description.substring(0, showNumDescription)}} + ... +
    + +
    -
    - - - View less - + +
    +
    - - -
      - + +
      + + +
      +
      +
      +
      + {{resultLandingInfo.references.length | number}} References +
      +
      + {{bioentitiesNum | number}} Bioentities +
      +
      +
      +
      +
      +
      Related Research Results
      + +
      +
      +
      +
      +
      Similar Research Results
      + +
      +
      +
      +
      +
      Supplementary Research Results
      + +
      +
      +
      +
      +
      Research Results supplemented by + this {{getTypeName()}}
      + +
      +
      +
      +
      +
      Related Organizations
      + +
      +
      +
      +
      +
      + + Powered by OpenAIRE Open Research Graph +
      +
    -
    - -
    - - -
    -
    -
    Share - Bookmark
    - -
    - - -
      - - - - - - - - -
    • - -
    • -
    • - -
    • - -
    • - -
    • - - - - - - -
    • -
      - Cite this {{title.toLowerCase()}}research product + +
      +
      Share - Bookmark
      + +
      + +
      + +
      + +
      +
      Metrics
      +
      +
      +
      + + +
      +
      -
      - +
      +
      +
      + Cite this {{getTypeName()}}
      -
    • -
    + +
    +
    +
    + Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}} +
    - - - - - -
    -
    + + + + + +
    + + + + +
    +
    + + + + +
    + + +
    +

    + {{item['name']}} + + [PubMed] + +

    +
    + + +
    +
    + + + + +
    + + +
    + + +
    +
    + {{keyIn}} +
    + + {{keyIn}} + + +
    +
    +
    +
    + + +
    +
    + + + + +
    + + +
      +
    • + +
    • +
    + + +
    +
    + + + + +
    + + +
      +
    • + +
    • +
    + + +
    +
    diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index e770a3a1..cf7da581 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -1,4 +1,4 @@ -import {Component, ElementRef, Input, ViewChild} from '@angular/core'; +import {ChangeDetectorRef, Component, Input, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Meta, Title} from '@angular/platform-browser'; @@ -12,14 +12,14 @@ import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {HelperFunctions} from '../../utils/HelperFunctions.class'; import {HelperService} from '../../utils/helper/helper.service'; import {Location} from "@angular/common"; +import {MetricsService} from "../../services/metrics.service"; +import {Organization, RelationResult, ResultPreview} from "../../utils/result-preview/result-preview"; @Component({ selector: 'result-landing', templateUrl: 'resultLanding.component.html', - }) - export class ResultLandingComponent { @Input() type: string = "publication"; @Input() piwikSiteId = null; @@ -29,9 +29,15 @@ export class ResultLandingComponent { @Input() activeTab: string = "References"; @ViewChild('AlertModalDeletedByInference') alertModalDeletedByInference; + @ViewChild('referencesModal') referencesModal; + @ViewChild('bioentitiesModal') bioentitiesModal; + @ViewChild('relationModal') relationModal; + @ViewChild('organizationModal') organizationModal; public deleteByInferenceOpened: boolean = false; public resultLandingInfo: ResultLandingInfo; + public relationResults: RelationResult[]; + public relation: string = 'trust'; public id: string; public title: string; @@ -39,15 +45,12 @@ export class ResultLandingComponent { public linkToLandingPage: string = null; public linkToSearchPage: string = null; - // APP BOX variables - public showAllCollectedFrom: boolean = false; - public showAllDownloadFrom: boolean = false; - - public thresholdDescription: number = 270; - public showNumDescription: number = 270; + public thresholdDescription: number = 670; + public showNumDescription: number = 670; // Metrics tab variables public metricsClicked: boolean; + public hasAltMetrics: boolean = false; public viewsFrameUrl: string; public downloadsFrameUrl: string; public totalViews: number; @@ -56,15 +59,15 @@ export class ResultLandingComponent { // Custom tab paging variables public referencesPage: number = 1; + public bioentitiesPage: number = 1; + public relationPage: number = 1; public organizationsPage: number = 1; public softwarePage: number = 1; - public bioentitiesPage: number = 1; public openCitationsPage: number = 1; public pageSize: number = 10; // Map counting variables public bioentitiesNum: number = 0; - public relatedResearchResultsNum: number = 0; // Message variables public warningMessage = ""; @@ -75,17 +78,20 @@ export class ResultLandingComponent { private doi: string; public doiURL: string; - private result; sub: any; piwiksub: any; infoSub: any; properties: EnvProperties; + public indexUpdateDate: Date; public pageContents = null; public divContents = null; - - @ViewChild('accordions') - accordions: ElementRef; - testBrowser: boolean = false; + + public addThis: boolean = true; + public showFeedback: boolean = false; + public feedbackFields: string [] = [ + 'Title', 'Authors', 'Access rights', + 'Publisher information', 'Funding Information', + 'Persistent identifiers','Other']; constructor(private _resultLaningService: ResultLandingService, private _piwikService: PiwikService, @@ -96,6 +102,8 @@ export class ResultLandingComponent { private _router: Router, private helper: HelperService, private seoService: SEOService, + private metricsService: MetricsService, + private cdr: ChangeDetectorRef, private _location: Location) { } @@ -103,11 +111,13 @@ export class ResultLandingComponent { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; + if(this.properties.lastIndexUpdate) { + this.indexUpdateDate = new Date(this.properties.lastIndexUpdate); + } //this.getDivContents(); this.getPageContents(); this.doiURL = this.properties.doiURL; this.updateUrl(data.envSpecific.baseLink + this._router.url); - this.sub = this.route.queryParams.subscribe(data => { this.resultLandingInfo = null; if(this.type == "publication") { @@ -195,8 +205,31 @@ export class ResultLandingComponent { this.infoSub.unsubscribe(); } } + + public getTypeName(): string { + if (this.type === "dataset") { + return "research data"; + } else if (this.type === "orp" || this.type === "other") { + return "other research product"; + } else { + return this.type; + } + } + + public removeUnknown(array: string[], type: boolean = false): string[] { + if (type) { + return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown'); + } else { + return array.filter(value => value.toLowerCase() !== 'unknown'); + } + } + + public removeDuplicates(array: string[]): string[] { + let type = this.getTypeName(); + return array.filter(value => value.toLowerCase() !== type); + } - private getOpenCitations(id: string) { + private getOpenCitations() { this._resultLaningService.getOpenCitations(this.id, this.properties).subscribe( data => { this.resultLandingInfo.openCitations = data[1]; @@ -234,7 +267,7 @@ export class ResultLandingComponent { } this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.record["result"]["header"]["dri:objIdentifier"]); if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { - this.getOpenCitations(this.id); + this.getOpenCitations(); } if (this.resultLandingInfo.title) { @@ -252,32 +285,15 @@ export class ResultLandingComponent { }); } this.bioentitiesNum = bioentitiesNum; - - let relatedResearchResultsNum = 0; - if (this.resultLandingInfo.relatedResearchResults != undefined) { - this.resultLandingInfo.relatedResearchResults.forEach(function (value, key, map) { - relatedResearchResultsNum += value.length; - }); - } - this.relatedResearchResultsNum = relatedResearchResultsNum; - - this.result = { - id: this.id, - type: this.type, - source: "openaire", - title: this.resultLandingInfo.title, - url: '', - result: '', - accessRights: this.resultLandingInfo.accessMode, - embargoEndDate: '' - }; - if (this.resultLandingInfo.identifiers != undefined && this.resultLandingInfo.identifiers.has('doi')) { this.doi = this.resultLandingInfo.identifiers.get('doi')[0]; + this.metricsService.hasAltMetrics(this.properties.altMetricsAPIURL, this.doi).subscribe(hasAltMetrics => { + this.hasAltMetrics = hasAltMetrics; + }, error => { + this.hasAltMetrics = false; + }); } - this.showLoading = false; - if (this.resultLandingInfo.references) { this.activeTab = "References"; } else if (this.resultLandingInfo.relatedResearchResults) { @@ -359,6 +375,14 @@ export class ResultLandingComponent { public updateReferencesPage($event) { this.referencesPage = $event.value; } + + public updateBioentitiesPage($event) { + this.bioentitiesPage = $event.value; + } + + public updateRelationPage($event) { + this.relationPage = $event.value; + } public updateOrganizationsPage($event) { this.organizationsPage = $event.value; @@ -368,10 +392,6 @@ export class ResultLandingComponent { this.softwarePage = $event.value; } - public updateBioentitiesPage($event) { - this.bioentitiesPage = $event.value; - } - public updateOpenCitationsPage($event) { this.openCitationsPage = $event.value; } @@ -430,27 +450,58 @@ export class ResultLandingComponent { this.deleteByInferenceOpened = true; this.alertModalDeletedByInference.cancelButton = false; this.alertModalDeletedByInference.okButton = false; - this.alertModalDeletedByInference.alertTitle = "Other versions"; - //this.alertModalDeletedByInference.message = "There was an error in csv downloading. Please try again later."; - //this.alertModalDeletedByInference.okButtonText = "OK"; + this.alertModalDeletedByInference.alertTitle = "Other versions of"; this.alertModalDeletedByInference.open(); } - - gotoAccordions() { - //this.accordions.nativeElement.scrollIntoView(); - - let offsetHeight = document.getElementById('stickyNavbar').offsetHeight; - - // scroll to your element - this.accordions.nativeElement.scrollIntoView(true); - - // now account for fixed header - var scrolledY = window.scrollY; - - if(scrolledY){ - window.scroll(0, scrolledY - offsetHeight - 50); - } + + openReferences() { + this.referencesModal.cancelButton = false; + this.referencesModal.okButton = false; + this.referencesModal.alertTitle = "References of"; + this.referencesPage = 1; + this.referencesModal.open(); } + + openBioentities() { + this.bioentitiesModal.cancelButton = false; + this.bioentitiesModal.okButton = false; + this.bioentitiesModal.alertTitle = "Bioentities of"; + this.bioentitiesPage = 1; + this.bioentitiesModal.open(); + } + + openRelationResults(title: string, relationResults: RelationResult[], relation: string = 'trust') { + this.relationResults = relationResults; + this.relation = relation; + this.relationModal.cancelButton = false; + this.relationModal.okButton = false; + this.relationModal.alertTitle = title; + this.relationPage = 1; + this.relationModal.open(); + } + + openOrganizations() { + this.relation = 'trust'; + this.organizationModal.cancelButton = false; + this.organizationModal.okButton = false; + this.organizationModal.alertTitle = 'Related organizations of'; + this.organizationsPage = 1; + this.organizationModal.open(); + } + + public getResultPreview(result: RelationResult): ResultPreview { + return ResultPreview.relationResultConvert(result, this.relation); + } + + public getResultPreviewFromOrg(result: Organization): ResultPreview { + return ResultPreview.organizationConvert(result, this.relation); + } + + public hideAddThis(value: boolean) { + this.addThis = value; + this.cdr.detectChanges(); + } + updateUrlWithType(){ this.type = this.resultLandingInfo.resultType; if(this.type == "publication") { diff --git a/landingPages/result/resultLanding.module.ts b/landingPages/result/resultLanding.module.ts index cddc99f1..e6bcc4e7 100644 --- a/landingPages/result/resultLanding.module.ts +++ b/landingPages/result/resultLanding.module.ts @@ -25,14 +25,18 @@ import {HelperModule} from "../../utils/helper/helper.module"; import {ResultLandingUtilsModule} from "../landing-utils/resultLandingUtils.module"; import {AlertModalModule} from "../../utils/modal/alertModal.module"; import {AnnotationModule} from "../annotation/annotation.module"; +import {LandingHeaderModule} from "../landing-utils/landing-header/landing-header.module"; +import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module"; +import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module"; +import {FeedbackModule} from "../feedback/feedback.module"; @NgModule({ - imports: [ - CommonModule, FormsModule, LandingModule, SharedModule, RouterModule, - CiteThisModule, PagingModule, IFrameModule, - MetricsModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, - DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, AnnotationModule - ], + imports: [ + CommonModule, FormsModule, LandingModule, SharedModule, RouterModule, + CiteThisModule, PagingModule, IFrameModule, + MetricsModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, + DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule + ], declarations: [ ResultLandingComponent ], diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index c4052ae4..2090bfd0 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -5,6 +5,7 @@ import {ResultLandingInfo} from '../../utils/entities/resultLandingInfo'; import {EnvProperties} from '../../utils/properties/env-properties'; import {ParsingFunctions} from '../landing-utils/parsingFunctions.class'; import {map, tap} from "rxjs/operators"; +import {Organization} from "../../utils/result-preview/result-preview"; @Injectable() export class ResultLandingService { @@ -89,7 +90,7 @@ export class ResultLandingService { if (data[0] != null) { let date: string = (data[0].dateofacceptance) + ''; // transform to string in case it is an integer this.resultLandingInfo.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; - this.resultLandingInfo.dateofacceptance = data[0].dateofacceptance; + this.resultLandingInfo.dateofacceptance = data[0].dateofacceptance?new Date(data[0].dateofacceptance):null; this.resultLandingInfo.publisher = data[0].publisher; if(!Array.isArray(data[0].description)) { //this.resultLandingInfo.description = String(data[0].description); @@ -98,7 +99,7 @@ export class ResultLandingService { //this.resultLandingInfo.description = String(data[0].description[0]); this.resultLandingInfo.description = (data[0] && data[0].description[0]) ? String(data[0].description[0]) : ""; } - this.resultLandingInfo.embargoEndDate = data[0].embargoenddate; + this.resultLandingInfo.embargoEndDate = data[0].embargoenddate?new Date(data[0].embargoenddate):null; } if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classname")) { @@ -191,6 +192,20 @@ export class ResultLandingService { /**********************************************************/ } } + /* Order Download from via openness*/ + this.resultLandingInfo.hostedBy_collectedFrom.sort((a, b) => { + if(a.bestAccessMode && a.bestAccessMode.toLowerCase() === 'open access') { + return -1; + } else if(b.bestAccessMode && b.bestAccessMode.toLowerCase() === 'open access') { + return 1; + } else if(!a.bestAccessMode || a.bestAccessMode.toLowerCase() !== 'not available') { + return 1; + } else if(!b.bestAccessMode || b.bestAccessMode.toLowerCase() !== 'not available') { + return -1; + } else { + return 0; + } + }); } if(data[3].hasOwnProperty("externalreference")) { @@ -281,13 +296,7 @@ export class ResultLandingService { return (item != undefined && item.fullName != undefined); }); } - - if(this.resultLandingInfo.relatedResearchResults) { - let self = this; - this.resultLandingInfo.relatedResearchResults.forEach(function (value, key, map) { - self.resultLandingInfo.relatedResearchResults.set(key, self.parsingFunctions.sortByPercentage(value)); - }); - } + this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResearchResults); this.resultLandingInfo.similarResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.similarResearchResults); this.resultLandingInfo.supplementaryResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.supplementaryResearchResults); this.resultLandingInfo.supplementedByResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.supplementedByResearchResults); @@ -295,22 +304,18 @@ export class ResultLandingService { return this.resultLandingInfo; } - parseRelatedOrganizations(organizations: {"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[], relation: any): - {"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[] { + parseRelatedOrganizations(organizations: Organization[], relation: any): Organization[] { if(organizations == undefined) { - organizations = new Array<{ - "name": string, "shortname": string, - "id": string, "websiteUrl": string, - "country": string, "trust": number}>(); + organizations = [] } let organization: { "name": string, "shortname": string, "id": string, "websiteUrl": string, "country": string, "trust": number } = { - "name": "", "shortname": "", - "id": "", "websiteUrl": "", - "country": "", "trust": null + name: "", shortname: "", + id: "", websiteUrl: "", + country: "", trust: null }; organization.id = relation['to'].content; diff --git a/searchPages/find/search.component.ts b/searchPages/find/search.component.ts index 596ccb71..f0dba4f6 100644 --- a/searchPages/find/search.component.ts +++ b/searchPages/find/search.component.ts @@ -25,7 +25,7 @@ import {EnvProperties} from '../../utils/properties/env-properties'; import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {StringUtils} from '../../utils/string-utils.class'; import {SearchCustomFilter} from "../searchUtils/searchUtils.class"; -import {Observable} from "rxjs"; +import {Observable, Subscription} from "rxjs"; @Component({ changeDetection: ChangeDetectionStrategy.Default, @@ -452,7 +452,7 @@ export class SearchComponent { } - private numOfSearchResults(resultType: string, fetchClass: FetchResearchResults, refineParams): Observable { + private numOfSearchResults(resultType: string, fetchClass: FetchResearchResults, refineParams) { return this._searchResearchResultsService.numOfSearchResults(resultType, this.keyword, this.properties, refineParams).subscribe( data => { fetchClass.searchUtils.totalResults = data; diff --git a/services/metrics.service.ts b/services/metrics.service.ts index 0760b579..32353e4b 100644 --- a/services/metrics.service.ts +++ b/services/metrics.service.ts @@ -5,7 +5,7 @@ import {Observable} from 'rxjs'; import {Metrics} from '../utils/entities/metrics'; import{EnvProperties} from '../utils/properties/env-properties'; -import {map} from "rxjs/operators"; +import {catchError, map} from "rxjs/operators"; @Injectable() export class MetricsService { @@ -13,12 +13,15 @@ export class MetricsService { constructor(private http: HttpClient ) {} + hasAltMetrics(url: string, doi: string): Observable { + return this.http.get(url + doi).pipe(map(res => !!(res))); + } + getMetrics (id: string, entityType: string, properties:EnvProperties):any { let url = properties.metricsAPIURL+entityType+"/"+id+"/clicks"; let key = url; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) - //.map(res => res.json()) .pipe(map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"], res["total_openaire_views"], res["total_openaire_downloads"], res["pageviews"], properties))); } diff --git a/services/searchDataproviders.service.ts b/services/searchDataproviders.service.ts index ba25a1e3..dfded792 100644 --- a/services/searchDataproviders.service.ts +++ b/services/searchDataproviders.service.ts @@ -203,7 +203,7 @@ export class SearchDataprovidersService { var basicQuery = "(oaftype exact datasource) " url += "?query="; if(datasourceId!= null && datasourceId != '' ) { - url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\")"; + url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\" or resulthostingdatasourceid exact \""+ datasourceId + "\")"; }else{ url +=" ( "+basicQuery+ " ) "; } diff --git a/services/searchProjects.service.ts b/services/searchProjects.service.ts index 54d95247..223f4fce 100644 --- a/services/searchProjects.service.ts +++ b/services/searchProjects.service.ts @@ -39,7 +39,7 @@ export class SearchProjectsService { var basicQuery = "(oaftype exact project) " url += "?query="; if(datasourceId!= null && datasourceId != '' ) { - url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\")"; + url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\" or resulthostingdatasourceid exact \""+ datasourceId + "\")"; }else{ url +=" ( "+basicQuery+ " ) "; } @@ -74,6 +74,7 @@ export class SearchProjectsService { //.map(res => res.json()) .pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "project")])); } + getProjectsForOrganizations (organizationId: string, filterquery: string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any { let url = properties.searchResourcesAPIURL; var basicQuery = "(oaftype exact project) " @@ -149,6 +150,10 @@ export class SearchProjectsService { result.acronym = resData['acronym']; result.code = resData['code']; + result.budget = resData.totalcost;//"10000"; + result.contribution = resData.fundedamount;//"200100"; + result.currency = resData.currency;//"EUR"; + result.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; if(!Array.isArray(resData['summary'])) { diff --git a/sharedComponents/schema2jsonld/schema2jsonld.component.ts b/sharedComponents/schema2jsonld/schema2jsonld.component.ts index e78547b3..0c96eee5 100644 --- a/sharedComponents/schema2jsonld/schema2jsonld.component.ts +++ b/sharedComponents/schema2jsonld/schema2jsonld.component.ts @@ -1,50 +1,48 @@ import {Component, ElementRef, Input} from '@angular/core'; -import { OpenAireJsonldConverterService } from './service/open-aire-jsonld-converter.service'; -import { JsonldDocumentSerializerService } from './service/jsonld-document-serializer.service'; +import {OpenAireJsonldConverterService} from './service/open-aire-jsonld-converter.service'; +import {JsonldDocumentSerializerService} from './service/jsonld-document-serializer.service'; + @Component({ selector: 'schema2jsonld', template: ` - + ` }) export class Schema2jsonldComponent { -@Input() data; // for project, organization, datasource -@Input() URL; -@Input() logoURL; // for home, search -@Input() otherURL; //for project, datasource -@Input() name; -@Input() searchAction = true; -@Input() type="result"; - -json; - constructor( private documentParser: OpenAireJsonldConverterService, - private documentSerializer: JsonldDocumentSerializerService) { - + @Input() data; // for project, organization, datasource + @Input() URL; + @Input() logoURL; // for home, search + @Input() otherURL; //for project, datasource + @Input() name; + @Input() searchAction = true; + @Input() type = "result"; + public json; + + constructor(private documentParser: OpenAireJsonldConverterService, + private documentSerializer: JsonldDocumentSerializerService) { + } - + ngOnInit() { - var docOvject; - if(this.type == 'project'){ - docOvject = this.documentParser.convertProject(this.data, this.URL, this.otherURL); - this.json = this.documentSerializer.serializeOrganization(docOvject); - }else if(this.type == 'organization'){ - docOvject = this.documentParser.convertOrganization(this.data, this.URL); - this.json = this.documentSerializer.serializeOrganization(docOvject); - }else if(this.type == 'datasource'){ - docOvject = this.documentParser.convertDatasource(this.data, this.URL, this.otherURL); - this.json = this.documentSerializer.serializeOrganization(docOvject); - }else if(this.type == 'home'){ - this.json = this.documentParser.createHome(this.name, this.URL, this.logoURL); - }else if(this.type == 'search'){ - this.json = this.documentParser.createSearchPage(this.name, this.URL, this.logoURL, this.searchAction); - }else if(this.type == 'result'){ - docOvject = this.documentParser.convertResult(this.data, this.URL); - this.json = this.documentSerializer.serializeDataset(docOvject); - }else{ - this.json = this.documentParser.createSimplePage(this.name, this.URL); - } - + var docOvject; + if (this.type == 'project') { + docOvject = this.documentParser.convertProject(this.data, this.URL, this.otherURL); + this.json = this.documentSerializer.serializeOrganization(docOvject); + } else if (this.type == 'organization') { + docOvject = this.documentParser.convertOrganization(this.data, this.URL); + this.json = this.documentSerializer.serializeOrganization(docOvject); + } else if (this.type == 'datasource') { + docOvject = this.documentParser.convertDatasource(this.data, this.URL, this.otherURL); + this.json = this.documentSerializer.serializeOrganization(docOvject); + } else if (this.type == 'home') { + this.json = this.documentParser.createHome(this.name, this.URL, this.logoURL); + } else if (this.type == 'search') { + this.json = this.documentParser.createSearchPage(this.name, this.URL, this.logoURL, this.searchAction); + } else if (this.type == 'result') { + docOvject = this.documentParser.convertResult(this.data, this.URL); + this.json = this.documentSerializer.serializeDataset(docOvject); + } else { + this.json = this.documentParser.createSimplePage(this.name, this.URL); + } } - - } diff --git a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts index 2870ff27..35c9f067 100644 --- a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts +++ b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts @@ -77,15 +77,14 @@ export class OpenAireJsonldConverterService { convertProject(project: any, URL, otherUrl): Organization { const doc = new Organization(); - - doc.title = (project.name)?project.title:project.acronym; + doc.title = (project.title)?project.title:project.acronym; doc.identifier = new Array(); - doc.identifier.push({id:project.contractNum, schema: "grantid"}); + doc.identifier.push({id:project.funding.code, schema: "grantid"}); var funder = new Organization(); - funder.title = project.funder; + funder.title = project.funding.funderShortName; doc.funder = funder; doc.url = URL; - doc.sameAs =[project.url] + doc.sameAs =[project.url]; return doc; } @@ -103,8 +102,8 @@ convertOrganization(organization: any, URL): Organization { convertDatasource(datasource: any, URL, otherUrl): Organization { const doc = new Organization(); - doc.title = datasource.title.name - doc.identifier = datasource.contractNum; + doc.title = datasource.title.name; + //doc.identifier = datasource.contractNum; doc.legalName = datasource.officialName; if(datasource.countries && datasource.countries.length > 0){ doc.areaServed = datasource.countries[0]; diff --git a/utils/authors/showAuthors.component.ts b/utils/authors/showAuthors.component.ts index 555ec0b6..be0925a3 100644 --- a/utils/authors/showAuthors.component.ts +++ b/utils/authors/showAuthors.component.ts @@ -4,22 +4,22 @@ import {HelperFunctions} from '../HelperFunctions.class'; import {RouterHelper} from "../routerHelper.class"; import {EnvProperties} from '../properties/env-properties'; import {isPlatformBrowser} from "@angular/common"; -import {Keyword} from "../../searchPages/searchUtils/highlight/highlight.component"; import {Author} from "../result-preview/result-preview"; +import {AlertModal} from "../modal/alert"; @Component({ selector: 'showAuthors', template: ` - -
    + + ` @@ -97,7 +112,8 @@ export class ShowAuthorsComponent { @Input() authors: Author[]; @Input() authorsLimit: number = 30; @Input() showAll: boolean = true; - @Input() keywords: Keyword[]; + @Input() small: boolean = true; + @Input() modal: AlertModal; public numberOfAuthors: number; public properties: EnvProperties; @@ -130,4 +146,10 @@ export class ShowAuthorsComponent { public scroll() { HelperFunctions.scroll(); } + + public onClick() { + if(this.modal) { + this.modal.cancel(); + } + } } diff --git a/utils/authors/showAuthors.module.ts b/utils/authors/showAuthors.module.ts index b5b711a1..0c7f72d3 100644 --- a/utils/authors/showAuthors.module.ts +++ b/utils/authors/showAuthors.module.ts @@ -1,14 +1,13 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {RouterModule} from '@angular/router'; import {ShowAuthorsComponent} from './showAuthors.component'; -import {HighlightModule} from "../../searchPages/searchUtils/highlight/highlight.module"; @NgModule({ imports: [ - CommonModule, FormsModule, RouterModule, HighlightModule + CommonModule, FormsModule, RouterModule ], declarations: [ ShowAuthorsComponent diff --git a/utils/email/composer.ts b/utils/email/composer.ts index 5b6bd840..6440f930 100644 --- a/utils/email/composer.ts +++ b/utils/email/composer.ts @@ -1,5 +1,6 @@ import {Email} from "./email"; import {Body} from "./body"; +import {FormArray} from "@angular/forms"; export class Composer { private static noteBodySize = "14px"; @@ -63,7 +64,11 @@ export class Composer { email.recipients = admins; return email; } - + + /*public static composeEmailForFeedback(issues: any[], recipients: string[]): Email { + + }*/ + public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string, firstVersionOfManagers: any, managers: any) : Email { let email: Email = new Email(); diff --git a/utils/entities/dataProviderInfo.ts b/utils/entities/dataProviderInfo.ts index 37201974..91b947b0 100644 --- a/utils/entities/dataProviderInfo.ts +++ b/utils/entities/dataProviderInfo.ts @@ -10,6 +10,8 @@ export class DataProviderInfo { originalId: string; countries: string[]; journal: {"journal": "", "issn": string, "lissn": string, "eissn": string}; + description: string; + subjects: string[]; //collected from datasource api aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string}; @@ -168,5 +170,6 @@ export class DataProviderInfo { //projects: any; datasources: any; - relatedDatasources: Map; + //relatedDatasources: Map; + relatedDatasources: {"id": string, "name": string, "count": number}[] = []; } diff --git a/utils/entities/organizationInfo.ts b/utils/entities/organizationInfo.ts index 5a6d3854..fbe3f95f 100644 --- a/utils/entities/organizationInfo.ts +++ b/utils/entities/organizationInfo.ts @@ -1,16 +1,28 @@ -export class OrganizationInfo { - title: { "name": string, "url": string }; - name: string; - country: string; - objIdentifier: string; - - - projects: Map; - //dataProviders: { "name": string, "url": string, "type": string, "websiteUrl": string, - // "organizations": {"name": string, "url": string}[]}[]; - - deletedByInferenceIds: string[]; +export interface OrganizationProject { + name: string; + id: string; + code: string; + acronym: string; + funder: string; + funderId: string; + fundingStream: string; + fundingLevel1: string; + fundingLevel2: string; + sc39: string; + startDate: string; + endDate: string; +} + +export class OrganizationInfo { + title: { name: string; url: string; }; + name: string; + country: string; + objIdentifier: string; + + + projects: Map; + //dataProviders: { name: string; url: string; type: string; websiteUrl: string; + // organizations: {name: string; url: string}[]}[]; + + deletedByInferenceIds: string[]; } diff --git a/utils/entities/projectInfo.ts b/utils/entities/projectInfo.ts index 0b601f69..56130e97 100644 --- a/utils/entities/projectInfo.ts +++ b/utils/entities/projectInfo.ts @@ -2,22 +2,21 @@ export class ProjectInfo { id:string; acronym: string; title: string; - callIdentifier: string; - funder: string; - funding: string; - contractNum: string; - startDate: string; - endDate: string; + + funding: {funderName: string, funderShortName: string, code: string, fundingStream: string, budget: string, contribution: string, currency: string}; + startDate: number; + endDate: number; + currentDate: number; + status: string; openAccessMandatePublications: string; openAccessMandateDatasets: string; specialClause39: string; organizations: { "acronym": string, "name": string, "id": string }[];//Map; url: string; urlInfo: string; - + description: string; //publications: any; researchData: any; - statistics: any; totalPublications: number; totalDatasets: number; diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 5f5cf815..c290b29a 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -1,3 +1,12 @@ +import { + Author, + HostedByCollectedFrom, + Journal, + Organization, + Project, + RelationResult +} from "../result-preview/result-preview"; + export class ResultLandingInfo { // PUBLICATION, DATASET, SOFTWARE, ORP record; @@ -5,59 +14,53 @@ export class ResultLandingInfo { // PUBLICATION, DATASET, SOFTWARE, ORP, DELETED_BY_INFERENCE title: string; accessMode: string; - authors: {"fullName": string, "orcid": string}[]; + authors: Author[]; date: string; - dateofacceptance: string; - embargoEndDate: string; + dateofacceptance: Date; + embargoEndDate: Date; types: string[]; identifiers: Map; //key is the classname languages: string[]; countries: string[]; description: string; - - hostedBy_collectedFrom: {"downloadName": string, "downloadUrl": string[], - "collectedName": string, "collectedId": string, - "accessMode": string[], "bestAccessMode": string, - "type": string, "year":string}[]; - + + hostedBy_collectedFrom: HostedByCollectedFrom[]; + // PUBLICATION, DATASET, SOFTWARE, ORP - fundedByProjects: { "id": string, "acronym": string, "title": string, - "funderShortname": string, "funderName": string, - "funding": string, "code": string, "provenanceAction": string, "inline": boolean}[]; - + fundedByProjects: Project[]; + underCurationMessage: boolean; publisher: string; - journal: {"journal": string, "issn": string, "lissn": string, "eissn": string, - "issue": string, "volume": string, "start_page": string, "end_page": string}; - + journal: Journal; + subjects: string[]; otherSubjects: Map; classifiedSubjects: Map; // - + // percentage is for trust - relatedResearchResults: Map; + relatedResearchResults: RelationResult[]; // percentage is for similarity - similarResearchResults: { "name": string, "id": string, "date": string, "percentage": number, "class": string}[]; + similarResearchResults: RelationResult[]; //isSupplementedBy - supplementaryResearchResults; + supplementaryResearchResults: RelationResult[]; //isSupplementTo - supplementedByResearchResults; - - contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[]; - + supplementedByResearchResults: RelationResult[]; + + contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean }[]; + deletedByInferenceIds: string[]; - + // PUBLICATION, DATASET, ORP - references: { "name": string, "url": string}[]; - + references: { "name": string, "url": string }[]; + // PUBLICATION bioentities: Map>; //> - organizations: {"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[]; - openCitations: {"url": string, "title": string, "year": string, "doi": string, "authors": string[]}[]; - + organizations: Organization[]; + openCitations: { "url": string, "title": string, "year": string, "doi": string, "authors": string[] }[]; + // DATASET subtitle: string; - + // SOFTWARE programmingLanguages: string[]; } diff --git a/utils/fetchEntitiesClasses/fetchDataproviders.class.ts b/utils/fetchEntitiesClasses/fetchDataproviders.class.ts index ab1f82c9..ec28c638 100644 --- a/utils/fetchEntitiesClasses/fetchDataproviders.class.ts +++ b/utils/fetchEntitiesClasses/fetchDataproviders.class.ts @@ -1,392 +1,397 @@ import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; -import { ErrorCodes} from '../../utils/properties/errorCodes'; -import {ErrorMessagesComponent} from '../../utils/errorMessages.component'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {ErrorMessagesComponent} from '../../utils/errorMessages.component'; import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {EnvProperties} from '../../utils/properties/env-properties'; import {StringUtils} from '../../utils/string-utils.class'; + export class FetchDataproviders { private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - - public results =[]; - public searchUtils:SearchUtilsClass = new SearchUtilsClass(); - public sub: any; public subResults: any; - public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], - "export":[] - }; + + public results = []; + public searchUtils: SearchUtilsClass = new SearchUtilsClass(); + public sub: any; + public subResults: any; + public CSV: any = { + "columnNames": ["Title", "Type", "Coutries", "Compatibility"], + "export": [] + }; public CSVDownloaded = false; public csvParams: string; public loadPaging: boolean = true; public oldTotalResults: number = 0; - - constructor ( private _searchDataprovidersService: SearchDataprovidersService ) { + + constructor(private _searchDataprovidersService: SearchDataprovidersService) { this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); this.searchUtils.status = this.errorCodes.LOADING; - } - - + } + + public ngOnDestroy() { - if(this.sub){ + if (this.sub) { this.sub.unsubscribe(); } - if(this.subResults){ + if (this.subResults) { this.subResults.unsubscribe(); } } - - public getResultsByKeyword(keyword:string, page: number, size: number, properties:EnvProperties, customFilter:SearchCustomFilter=null){ + + public getResultsByKeyword(keyword: string, page: number, size: number, properties: EnvProperties, customFilter: SearchCustomFilter = null) { var parameters = ""; - if(keyword.length > 0){ + if (keyword.length > 0) { parameters = "q=" + StringUtils.URIEncode(keyword); } - + //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - + var refineParams = null; - if(customFilter){ - refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId ))); + if (customFilter) { + refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId))); } - this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,refineParams, page, size,[], properties).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - //console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); - this.results = data[1]; - - //ar errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.ERROR; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - } - */ - this.handleError("Error getting content providers for keyword: "+keyword, err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + this.subResults = this._searchDataprovidersService.searchDataproviders(parameters, refineParams, page, size, [], properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + //console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + //ar errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; } + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.ERROR; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + */ + this.handleError("Error getting content providers for keyword: " + keyword, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + } ); } - - public getResultsForHome(size: number, properties:EnvProperties){ + + public getResultsForHome(size: number, properties: EnvProperties) { let page = 1; var parameters = "&sortBy=resultdateofacceptance,descending";//"orderby=date"; - + this.searchUtils.status = this.errorCodes.LOADING; - - this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,null, page, size,[], properties).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - //console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); - this.results = data[1]; - - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - this.handleError("Error getting content providers with parameters: "+parameters + " for Home", err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + + this.subResults = this._searchDataprovidersService.searchDataproviders(parameters, null, page, size, [], properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + //console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; } - ); - } - - public getNumForEntity(entity: string, id:string, properties:EnvProperties) { - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - - if(id != "" && entity != "") { - - this._searchDataprovidersService.numOfEntityDataproviders(id, entity, properties).subscribe( - data => { - this.searchUtils.totalResults = data; - - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.ERROR; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - this.handleError("Error getting content providers for "+entity+" with id: "+id, err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - } - ); + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + this.handleError("Error getting content providers with parameters: " + parameters + " for Home", err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); } - } - - public getNumForSearch(keyword: string, properties:EnvProperties, refineParams:string=null) { - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - - this._searchDataprovidersService.numOfSearchDataproviders(keyword, properties, refineParams).subscribe( - data => { - this.searchUtils.totalResults = data; - this.searchUtils.status = this.errorCodes.DONE; - - if(this.searchUtils.totalResults == 0) { - this.searchUtils.status = this.errorCodes.NONE; - } - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.ERROR; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - this.handleError("Error getting number of content providers for keyword: "+keyword, err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - } - ); - } - -public getResultsForDeposit(id:string, type:string, page: number, size: number, properties:EnvProperties){ - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - this.results = []; - this.searchUtils.totalResults = 0; - this.loadPaging = false; - - if(id != "") { - - this._searchDataprovidersService.searchDataprovidersForDeposit(id,type, page, size, properties).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - //console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]"); - this.results = data[1]; - - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - - if(this.searchUtils.status == this.errorCodes.DONE) { - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; - } - } - this.loadPaging = true; - this.oldTotalResults = this.searchUtils.totalResults; - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.ERROR; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - this.handleError("Error getting content providers in share "+type+" for organization with id: "+id, err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - - this.loadPaging = true; - this.oldTotalResults = 0; - } - ); - } -} -public getResultsBySubjectsForDeposit(subject:string, type:string, page: number, size: number, properties:EnvProperties){ - //var errorCodes:ErrorCodes = new ErrorCodes(); - - this.searchUtils.status = this.errorCodes.LOADING; - this.results = []; - this.searchUtils.totalResults = 0; - this.loadPaging = false; - - this._searchDataprovidersService.searchDataProvidersBySubjects(subject,type, page, size, properties).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - //console.info("search Dataproviders forDeposit: [subject:"+subject+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]"); - this.results = data[1]; - - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - if(this.searchUtils.status == this.errorCodes.DONE) { - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; - } - } - this.loadPaging = true; - this.oldTotalResults = this.searchUtils.totalResults; - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.ERROR; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - this.handleError("Error getting content providers in share "+type+" by subject: "+subject, err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - - this.loadPaging = true; - this.oldTotalResults = 0; - } - ); - -} - public getResultsForEntity(entity:string, id:string, page: number, size: number, properties:EnvProperties){ - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - - var parameters = ""; - - if(entity == "organization") { - parameters = "organizations/"+id; - } - - if(parameters != "") { - - this._searchDataprovidersService.searchDataprovidersForEntity(parameters, page, size, properties).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - //console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); - this.results = data[1]; - - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.ERROR; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - this.handleError("Error getting content providers for "+entity+" with id: "+id, err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - } - ); - } - } - - public getResultsForDataproviders(id:string, page: number, size: number, properties:EnvProperties){ - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - - this._searchDataprovidersService.getDataProvidersforEntityRegistry(id, page, size, properties).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - //console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]"); - this.results = data[1]; - - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - }, - err => { - /*console.log(err); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.ERROR; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - this.handleError("Error getting content providers for entity registry with id: "+id, err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - } ); } - + + public getNumForEntity(entity: string, id: string, properties: EnvProperties) { + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + + if (id != "" && entity != "") { + + this._searchDataprovidersService.numOfEntityDataproviders(id, entity, properties).subscribe( + data => { + this.searchUtils.totalResults = data; + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.ERROR; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + this.handleError("Error getting content providers for " + entity + " with id: " + id, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + } + ); + } + } + + public getNumForSearch(keyword: string, properties: EnvProperties, refineParams: string = null) { + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + + this._searchDataprovidersService.numOfSearchDataproviders(keyword, properties, refineParams).subscribe( + data => { + this.searchUtils.totalResults = data; + this.searchUtils.status = this.errorCodes.DONE; + + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.ERROR; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + this.handleError("Error getting number of content providers for keyword: " + keyword, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + } + ); + } + + public getResultsForDeposit(id: string, type: string, page: number, size: number, properties: EnvProperties) { + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + this.results = []; + this.searchUtils.totalResults = 0; + this.loadPaging = false; + + if (id != "") { + + this._searchDataprovidersService.searchDataprovidersForDeposit(id, type, page, size, properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + //console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; + } + + if (this.searchUtils.status == this.errorCodes.DONE) { + // Page out of limit!!! + let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size); + if (!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if (totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + } + } + this.loadPaging = true; + this.oldTotalResults = this.searchUtils.totalResults; + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.ERROR; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + this.handleError("Error getting content providers in share " + type + " for organization with id: " + id, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + + this.loadPaging = true; + this.oldTotalResults = 0; + } + ); + } + } + + public getResultsBySubjectsForDeposit(subject: string, type: string, page: number, size: number, properties: EnvProperties) { + //var errorCodes:ErrorCodes = new ErrorCodes(); + + this.searchUtils.status = this.errorCodes.LOADING; + this.results = []; + this.searchUtils.totalResults = 0; + this.loadPaging = false; + + this._searchDataprovidersService.searchDataProvidersBySubjects(subject, type, page, size, properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + //console.info("search Dataproviders forDeposit: [subject:"+subject+", type:"+type+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; + } + if (this.searchUtils.status == this.errorCodes.DONE) { + // Page out of limit!!! + let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size); + if (!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if (totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + } + } + this.loadPaging = true; + this.oldTotalResults = this.searchUtils.totalResults; + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.ERROR; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + this.handleError("Error getting content providers in share " + type + " by subject: " + subject, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + + this.loadPaging = true; + this.oldTotalResults = 0; + } + ); + + } + + public getResultsForEntity(entity: string, id: string, page: number, size: number, properties: EnvProperties) { + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + + var parameters = ""; + + if (entity == "organization") { + parameters = "organizations/" + id; + } + + if (parameters != "") { + + this._searchDataprovidersService.searchDataprovidersForEntity(parameters, page, size, properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + //console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.ERROR; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + this.handleError("Error getting content providers for " + entity + " with id: " + id, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + } + ); + } + } + + public getResultsForDataproviders(id: string, page: number, size: number, properties: EnvProperties) { + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + + this._searchDataprovidersService.getDataProvidersforEntityRegistry(id, page, size, properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + //console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]"); + this.results = data[1]; + + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + /*console.log(err); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.ERROR; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + this.handleError("Error getting content providers for entity registry with id: " + id, err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + } + ); + } + private handleError(message: string, error) { - console.error("Fetch Content Providers (class): "+message, error); + console.error("Fetch Content Providers (class): " + message, error); } } diff --git a/utils/fetchEntitiesClasses/fetchProjects.class.ts b/utils/fetchEntitiesClasses/fetchProjects.class.ts index d0d87cf9..a197251c 100644 --- a/utils/fetchEntitiesClasses/fetchProjects.class.ts +++ b/utils/fetchEntitiesClasses/fetchProjects.class.ts @@ -4,11 +4,12 @@ import {ErrorMessagesComponent} from '../../utils/errorMessages.component'; import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class'; import{EnvProperties} from '../../utils/properties/env-properties'; import {StringUtils} from '../../utils/string-utils.class'; +import {SearchResult} from "../entities/searchResult"; export class FetchProjects{ private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - public results =[]; + public results: SearchResult[] =[]; public filters; // for getResultsForOrganizations public funders:any = []; // for getResultsForOrganizations // this is filled with the initial query - before filtering @@ -179,7 +180,6 @@ export class FetchProjects{ } } } - if(filterquery == ""){ this.searchUtils.totalResultsNoFilters = this.searchUtils.totalResults; this.funders = []; @@ -187,7 +187,6 @@ export class FetchProjects{ //console.log("this.filters[i].filterId:"+this.filters[i].filterId); if(this.filters[i].filterId == "funder"){ this.funders = (this.filters[i].values); - } } //console.log(" this.funders:"+ this.funders); diff --git a/utils/fetchEntitiesClasses/fetchResearchResults.class.ts b/utils/fetchEntitiesClasses/fetchResearchResults.class.ts index 457e86d1..3f9acd55 100644 --- a/utils/fetchEntitiesClasses/fetchResearchResults.class.ts +++ b/utils/fetchEntitiesClasses/fetchResearchResults.class.ts @@ -183,11 +183,13 @@ export class FetchResearchResults { this.searchUtils.status = this.errorCodes.LOADING; var parameters; - if(resultsFrom == "collectedFrom") { - parameters = this.getEntityName(resultType,true)+"?fq=collectedfromdatasourceid exact "+'"'+id+'"'; - } else if(resultsFrom == "hostedBy") { - parameters = this.getEntityName(resultType,true)+"?fq=resulthostingdatasourceid exact "+'"'+id+'"'; - } + // if(resultsFrom == "collectedFrom") { + // parameters = this.getEntityName(resultType,true)+"?fq=collectedfromdatasourceid exact "+'"'+id+'"'; + // } else if(resultsFrom == "hostedBy") { + // parameters = this.getEntityName(resultType,true)+"?fq=resulthostingdatasourceid exact "+'"'+id+'"'; + // } + + parameters = this.getEntityName(resultType,true)+"?fq=collectedfromdatasourceid exact "+'"'+id+'"' + "or resulthostingdatasourceid exact "+'"'+id+'"'; if(parameters != "") { @@ -226,7 +228,8 @@ export class FetchResearchResults { public getAggregatorResults(resultType: string, id:string, page: number, size: number, properties:EnvProperties){ this.searchUtils.status = this.errorCodes.LOADING; - this.subResults = this._searchResearchResultsService.searchAggregators(this.getEntityName(resultType,false), id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe( + // this.getEntityName(resultType,false) + this.subResults = this._searchResearchResultsService.searchAggregators(resultType, id, '&fq=(collectedfromdatasourceid exact "'+id+'" or resulthostingdatasourceid exact "'+id+'")',"&refine=true&fields=resulthostingdatasource&type="+resultType , page, size, properties).subscribe( data => { this.results = data; this.searchUtils.totalResults = this.results.length; diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 74260d5a..a6b7bba7 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -32,7 +32,7 @@ diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index e2ffabc6..178c7c33 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -66,7 +66,7 @@ export class ResultPreviewComponent implements OnInit{ } } - public onTitleClick() { + public onClick() { if(this.modal) { this.modal.cancel(); }