[Library | Trunk]: Result Landing add bioentities and references. Result-Preview fix a bug with before title section

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58745 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-05-21 14:18:52 +00:00
parent 0f7349ce6f
commit 22a9f9aad1
7 changed files with 230 additions and 248 deletions

View File

@ -18,7 +18,7 @@ declare var UIkit: any;
</mat-select>
<div *ngIf="selectedStyle!='0'">
<div id="citation" class="box-content uk-margin-small-top uk-overflow-auto" [innerHTML]=citationText></div>
<button class="clipboard_btn uk-button uk-button-small uk-button-secondary square-button uk-icon uk-float-right" data-clipboard-target="#citation" title="Copy to clipboard">
<button class="clipboard_btn uk-button uk-button-small uk-button-secondary uk-margin-small-top uk-icon uk-float-right" data-clipboard-target="#citation" title="Copy to clipboard">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="copy" ratio="1">
<rect fill="none" stroke="#000" x="3.5" y="2.5" width="12" height="16"></rect>
<polyline fill="none" stroke="#000" points="5 0.5 17.5 0.5 17.5 17"></polyline>

View File

@ -46,7 +46,10 @@ import {EnvProperties} from "../../utils/properties/env-properties";
</span>
<span *ngIf=" journal['journal'] && (journal['issn'] || journal['eissn'] || journal['lissn'])"> (</span>
<ng-container *ngIf="journal['issn']">
<span class="uk-display-inline-block">issn: {{journal['issn']}}</span>
<a target="_blank" class="uk-display-inline-block" [href]="properties.sherpaURL+journal['issn'] + properties.sherpaURLSuffix">
<img src="assets/common-assets/common/SHERPA-RoMEO-short-logo.gif" width=16 height=16 alt="">
issn: {{journal['issn']}}<span class="custom-external custom-icon space"></span>
</a>
<span *ngIf="journal['eissn'] || journal['lissn'] || !publisher">, </span>
</ng-container>
<ng-container *ngIf="journal['eissn']">
@ -57,26 +60,11 @@ import {EnvProperties} from "../../utils/properties/env-properties";
<span class="uk-display-inline-block">lissn: {{journal['lissn']}}</span>
<span *ngIf="!publisher">, </span>
</span>
<span *ngIf="journal && (journal['issn'] ||journal['lissn'] || journal['eissn'] ) && !publisher">
<a target="_blank"
[href]="properties.sherpaURL+(journal['issn']?journal['issn']:(journal['eissn']?journal['eissn']:journal['lissn'] ))+properties.sherpaURLSuffix"
uk-tooltip="title: View information on Sherpa/RoMEO ">
<img src="assets/common-assets/common/SHERPA-RoMEO-short-logo.gif" width=16 height=16 alt="">
Copyright policy<span class="custom-external custom-icon space"></span>
</a>
</span>
<span *ngIf=" journal['journal'] && (journal['issn'] || journal['eissn'] || journal['lissn'])">)</span>
</span>
</li>
<li *ngIf="publisher">
<span class="uk-text-muted">Publisher: </span> {{publisher}}
<span *ngIf="journal && (journal['issn'] ||journal['lissn'] || journal['eissn'] )">
(<a target="_blank"
[href]="properties.sherpaURL+(journal['issn']?journal['issn']:(journal['eissn']?journal['eissn']:journal['lissn'] ))+properties.sherpaURLSuffix"
uk-tooltip="title: View information on Sherpa/RoMEO ">
<img src="assets/common-assets/common/SHERPA-RoMEO-short-logo.gif" width=16 height=16 alt="">
Copyright policy<span class="custom-external custom-icon space"></span>
</a>)</span>
</li>
`
})

View File

@ -5,7 +5,7 @@ import {Component, Input} from '@angular/core';
template: `
<div *ngIf="classifiedSubjects && classifiedSubjects.size > 0" class="uk-text-small">
<div class="uk-text-muted">
Subjects by Vocabulary:
Subjects
</div>
<div class="uk-margin-small-top">
<div *ngFor="let key of getKeys(classifiedSubjects)" style="line-height: 20px">
@ -17,9 +17,8 @@ import {Component, Input} from '@angular/core';
</div>
</div>
</div>
<div *ngIf="(subjects && subjects.length > 0) || (otherSubjects && otherSubjects.size > 0)" class="uk-text-small uk-margin-medium-top"
<div *ngIf="(subjects && subjects.length > 0) || (otherSubjects && otherSubjects.size > 0)" class="uk-text-small uk-margin-small-top"
[class.uk-margin-top]="classifiedSubjects && classifiedSubjects.size > 0">
<div class="uk-text-muted">Subjects</div>
<span *ngIf="subjects && subjects.length > 0">{{subjects.join(', ')}}</span>
<span *ngIf="(subjects && subjects.length > 0) && (otherSubjects && otherSubjects.size > 0)">, </span>
<span *ngIf="otherSubjects && otherSubjects.size > 0">

View File

@ -59,16 +59,7 @@
{{resultLandingInfo.countries.join(", ")}}
</li>
</ul>
<div class="uk-margin-medium-top">
<div *ngIf="resultLandingInfo.references || resultLandingInfo.bioentities"
class="uk-margin-top simple-buttons uk-flex uk-flex-middle">
<div *ngIf="resultLandingInfo.references" (click)="openReferences()" class="clickable uk-margin-right">
<span class="uk-text-bold">{{resultLandingInfo.references.length | number}}</span> References
</div>
<div *ngIf="resultLandingInfo.bioentities" (click)="openBioentities()" class="clickable">
<span class="uk-text-bold">{{bioentitiesNum | number}}</span> Bioentities
</div>
</div>
<div>
<div *ngIf="resultLandingInfo.relatedResearchResults || resultLandingInfo.similarResearchResults ||
resultLandingInfo.supplementaryResearchResults || resultLandingInfo.supplementedByResearchResults ||
resultLandingInfo.organizations"
@ -150,29 +141,29 @@
</li>
<!-- Metrics -->
<li *ngIf="hasAltMetrics || hasMetrics" class="uk-margin-medium-top">
<div uk-grid class="uk-child-width-1-3 uk-text-center uk-flex uk-flex-middle">
<div>
<metrics [pageViews]="pageViews" *ngIf="hasMetrics"
<div uk-grid class="uk-child-width-1-3 uk-text-center uk-flex uk-flex-middle uk-flex-center uk-padding-remove-left">
<div *ngIf="hasMetrics">
<metrics [pageViews]="pageViews"
[id]="id" [entityType]="'results'" [entity]="title"
[viewsFrameUrl]="viewsFrameUrl" [downloadsFrameUrl]="downloadsFrameUrl"
(metricsResults)="metricsResults($event)" [properties]=properties>
</metrics>
</div>
<div>
<div *ngIf="hasAltMetrics">
<altmetrics *ngIf="hasAltMetrics" id="{{resultLandingInfo.identifiers.get('doi')[0]}}" type="doi">
</altmetrics>
</div>
<div></div><!-- Open Citations-->
</div>
</li>
</ul>
</div>
<div class="uk-padding-remove-left">
<div class="uk-padding-remove-left uk-width-1-1 uk-margin-large-top">
<div class="main-tabs-div">
<my-tabs (selectedActiveTab)="onSelectActiveTab($event)">
<my-tab [tabTitle]="getTypeName() + ' Summary'" [tabId]="'summary'">
<my-tabs>
<my-tab *ngIf="hasPrimaryInfo || hasSecondaryInfo" [tabTitle]="getTypeName() + ' Summary'"
[tabId]="'summary'">
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<div *ngIf="hasPrimaryInfo" class="uk-width-expand uk-padding">
<!-- Description -->
<div *ngIf="resultLandingInfo.description" class="uk-margin-medium-bottom">
<div class="uk-text-justify uk-text-small uk-height-max-medium uk-overflow-auto">
@ -210,10 +201,8 @@
</showSubjects>
</div>
</div>
<div *ngIf="resultLandingInfo.fundedByProjects && resultLandingInfo.fundedByProjects.length > 0 ||
resultLandingInfo.contexts && resultLandingInfo.contexts.length >0 ||
resultLandingInfo.hostedBy_collectedFrom && resultLandingInfo.hostedBy_collectedFrom.length > 0"
class="uk-width-1-3 right-column uk-padding-remove">
<div *ngIf="hasSecondaryInfo"
[class]="hasPrimaryInfo?'uk-width-1-3 right-column uk-padding-remove':'uk-padding-remove uk-width-expand'">
<div *ngIf="resultLandingInfo.fundedByProjects && resultLandingInfo.fundedByProjects.length > 0 ||
resultLandingInfo.contexts && resultLandingInfo.contexts.length >0"
class="uk-padding uk-padding-remove-bottom">
@ -229,11 +218,15 @@
</div>
</div>
<!-- Download From -->
<div *ngIf="resultLandingInfo.hostedBy_collectedFrom && resultLandingInfo.hostedBy_collectedFrom.length > 0" class="uk-margin-medium-bottom">
<div
*ngIf="resultLandingInfo.hostedBy_collectedFrom && resultLandingInfo.hostedBy_collectedFrom.length > 0"
class="uk-margin-medium-bottom">
<div class="sideInfoTitle uk-margin-small-bottom uk-flex">
<span class="uk-width-1-2">Download from</span>
<span *ngIf="resultLandingInfo.deletedByInferenceIds" class="uk-width-1-2 uk-text-small uk-text-right">
<a (click)="openDeletedByInference()">View all {{resultLandingInfo.deletedByInferenceIds.length}} versions</a>
<span *ngIf="resultLandingInfo.deletedByInferenceIds"
class="uk-width-1-2 uk-text-small uk-text-right">
<a (click)="openDeletedByInference()">View all {{resultLandingInfo.deletedByInferenceIds.length}}
versions</a>
</span>
</div>
<availableOn [properties]="properties"
@ -242,7 +235,79 @@
</div>
</div>
</my-tab>
<my-tab [tabTitle]="'references'" [tabId]="'references'" [tabNumber]="resultLandingInfo.references.length"></my-tab>
<my-tab *ngIf="resultLandingInfo.references && resultLandingInfo.references.length > 0"
[tabTitle]="'references'" [tabId]="'references'"
[tabNumber]="resultLandingInfo.references.length">
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<div>
<no-load-paging *ngIf="resultLandingInfo.references.length > 1.5*pageSize" [type]="'references'"
(pageChange)="updateReferencesPage($event)"
[page]="referencesPage" [pageSize]="1.5*pageSize"
[totalResults]="resultLandingInfo.references.length">
</no-load-paging>
<div
*ngFor="let item of resultLandingInfo.references.slice((referencesPage-1)*1.5*pageSize, referencesPage*1.5*pageSize)">
<p *ngIf="item">
{{item.name}}
<ng-container *ngIf="item.ids && item.ids.length > 0">
<span *ngFor="let id of item.ids">
[<a *ngIf="id.type !== 'openaire'" href="{{getReferenceUrl(id)}}"
target="_blank">{{getReferenceIdName(id)}}</a>
<a *ngIf="id.type === 'openaire'" [routerLink]="'/search/result'"
[queryParams]="{id: id.value}"
target="_blank">OpenAIRE</a>]
</span>
</ng-container>
</p>
</div>
<no-load-paging *ngIf="resultLandingInfo.references.length > 1.5*pageSize" [type]="'references'"
(pageChange)="updateReferencesPage($event)"
[page]="referencesPage" [pageSize]="1.5*pageSize"
[totalResults]="resultLandingInfo.references.length">
</no-load-paging>
</div>
</div>
<div class="uk-width-1-3 right-column uk-padding-remove"></div>
</div>
</my-tab>
<my-tab *ngIf="resultLandingInfo.bioentities && bioentitiesNum> 0"
[tabTitle]="'External Databases'" [tabId]="'bioentities'" [tabNumber]="bioentitiesNum">
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<div>
<no-load-paging *ngIf="bioentitiesNum > 2*pageSize" [type]="'bioentities'"
(pageChange)="updateBioentitiesPage($event)"
[page]="bioentitiesPage" [pageSize]="2*pageSize"
[totalResults]="bioentitiesNum">
</no-load-paging>
<div class="uk-child-width-1-4@s uk-child-width-1-2 bioentities-buttons" uk-grid>
<ng-container *ngFor="let key of getKeys(resultLandingInfo.bioentities) let i=index">
<ng-container
*ngFor="let keyIn of keysToArray(resultLandingInfo.bioentities.get(key)).slice((bioentitiesPage-1)*2*pageSize, bioentitiesPage*2*pageSize)">
<div>
<div [title]="key" *ngIf="keyIn && !resultLandingInfo.bioentities.get(key).get(keyIn)">
{{keyIn}}
</div>
<a [href]="resultLandingInfo.bioentities.get(key).get(keyIn)" target="_blank"
[title]="key" *ngIf="keyIn && resultLandingInfo.bioentities.get(key).get(keyIn)">
{{keyIn}}
<span class="custom-external custom-icon space"></span>
</a>
</div>
</ng-container>
</ng-container>
</div>
<no-load-paging *ngIf="bioentitiesNum > 2*pageSize" [type]="'bioentities'"
(pageChange)="updateBioentitiesPage($event)"
[page]="bioentitiesPage" [pageSize]="2*pageSize"
[totalResults]="bioentitiesNum">
</no-load-paging>
</div>
</div>
<div class="uk-width-1-3 right-column uk-padding-remove"></div>
</div>
</my-tab>
</my-tabs>
</div>
<div class="uk-margin-small-top uk-flex">
@ -308,80 +373,6 @@
[resultType]="'other'" [type]="'other research products'"></deletedByInference>
</div>
</modal-alert>
<!-- References -->
<modal-alert *ngIf="resultLandingInfo && resultLandingInfo.references"
classBody="uk-width-xxlarge uk-padding-remove-right" #referencesModal>
<landing-header [properties]="properties" [title]="resultLandingInfo.title"
[subTitle]="resultLandingInfo.subtitle" [authorLimit]="10" [showAllAuthors]="false"
[modal]="referencesModal"
[entityType]="getTypeName()" [authors]="resultLandingInfo.authors" [types]="resultLandingInfo.types"
[year]="resultLandingInfo.date" [embargoEndDate]="resultLandingInfo.embargoEndDate">
</landing-header>
<div class="uk-margin-medium-top uk-margin-medium-right">
<no-load-paging *ngIf="resultLandingInfo.references.length > 1.5*pageSize" [type]="'references'"
(pageChange)="updateReferencesPage($event)"
[page]="referencesPage" [pageSize]="1.5*pageSize"
[totalResults]="resultLandingInfo.references.length">
</no-load-paging>
<div
*ngFor="let item of resultLandingInfo.references.slice((referencesPage-1)*1.5*pageSize, referencesPage*1.5*pageSize)">
<p *ngIf="item">
{{item.name}}
<ng-container *ngIf="item.ids && item.ids.length > 0">
<span *ngFor="let id of item.ids">
[<a *ngIf="id.type !== 'openaire'" href="{{getReferenceUrl(id)}}"
target="_blank">{{getReferenceIdName(id)}}</a>
<a *ngIf="id.type === 'openaire'" [routerLink]="'/search/result'" [queryParams]="{id: id.value}"
target="_blank">OpenAIRE</a>]
</span>
</ng-container>
</p>
</div>
<no-load-paging *ngIf="resultLandingInfo.references.length > 1.5*pageSize" [type]="'references'"
(pageChange)="updateReferencesPage($event)"
[page]="referencesPage" [pageSize]="1.5*pageSize"
[totalResults]="resultLandingInfo.references.length">
</no-load-paging>
</div>
</modal-alert>
<!-- Bioentities -->
<modal-alert *ngIf="resultLandingInfo && resultLandingInfo.bioentities"
classBody="uk-width-xxlarge uk-padding-remove-right" #bioentitiesModal>
<landing-header [properties]="properties" [title]="resultLandingInfo.title" [modal]="bioentitiesModal"
[subTitle]="resultLandingInfo.subtitle" [authorLimit]="10" [showAllAuthors]="false"
[entityType]="getTypeName()" [authors]="resultLandingInfo.authors" [types]="resultLandingInfo.types"
[year]="resultLandingInfo.date" [embargoEndDate]="resultLandingInfo.embargoEndDate">
</landing-header>
<div class="uk-margin-medium-top uk-margin-medium-right">
<no-load-paging *ngIf="bioentitiesNum > 2*pageSize" [type]="'bioentities'"
(pageChange)="updateBioentitiesPage($event)"
[page]="bioentitiesPage" [pageSize]="2*pageSize"
[totalResults]="bioentitiesNum">
</no-load-paging>
<div class="uk-child-width-1-4@s uk-child-width-1-2 bioentities-buttons" uk-grid>
<ng-container *ngFor="let key of getKeys(resultLandingInfo.bioentities) let i=index">
<ng-container
*ngFor="let keyIn of keysToArray(resultLandingInfo.bioentities.get(key)).slice((bioentitiesPage-1)*2*pageSize, bioentitiesPage*2*pageSize)">
<div>
<div [title]="key" *ngIf="keyIn && !resultLandingInfo.bioentities.get(key).get(keyIn)">
{{keyIn}}
</div>
<a [href]="resultLandingInfo.bioentities.get(key).get(keyIn)" target="_blank"
[title]="key" *ngIf="keyIn && resultLandingInfo.bioentities.get(key).get(keyIn)">
{{keyIn}}
<span class="custom-external custom-icon space"></span>
</a>
</div>
</ng-container>
</ng-container>
</div>
<no-load-paging *ngIf="bioentitiesNum > 2*pageSize" [type]="'bioentities'"
(pageChange)="updateBioentitiesPage($event)"
[page]="bioentitiesPage" [pageSize]="2*pageSize"
[totalResults]="bioentitiesNum">
</no-load-paging>
</div>
</modal-alert>
<!-- Relation Results-->
<modal-alert *ngIf="resultLandingInfo" classBody="uk-width-xxlarge uk-padding-remove-right" #relationModal>
<landing-header [properties]="properties" [title]="resultLandingInfo.title" [modal]="relationModal"
@ -436,7 +427,8 @@
</div>
</modal-alert>
</div>
<modal-alert #linkModal [classTitle]="'landing-modal-header uk-padding-small'" [classBody]="'uk-padding-remove landing-modal'">
<modal-alert #linkModal [classTitle]="'landing-modal-header uk-padding-small'"
[classBody]="'uk-padding-remove landing-modal'">
<div class="uk-grid uk-child-width-1-3 uk-flex uk-flex-middle">
<div class="uk-text-center">
<a [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[id,type,'project'])"
@ -484,7 +476,8 @@
</a></div>
</div>
</modal-alert>
<modal-alert #citeModal [classTitle]="'landing-modal-header uk-padding-small'" [classBody]="'uk-padding-remove landing-modal'">
<modal-alert #citeModal [classTitle]="'landing-modal-header uk-padding-small'"
[classBody]="'uk-padding-remove landing-modal'">
<citeThis *ngIf="resultLandingInfo" [result]="resultLandingInfo" [id]="id" [type]="title.toLowerCase()"></citeThis>
</modal-alert>

View File

@ -25,31 +25,29 @@ export class ResultLandingComponent {
@Input() type: string = "publication";
@Input() piwikSiteId = null;
@Input() communityId = null;
// Active tab variable for responsiveness
@Input() activeTab: string = "References";
@ViewChild('linkModal') linkModal;
@ViewChild('citeModal') citeModal;
@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;
// Links for SEO
public linkToLandingPage: string = null;
public linkToSearchPage: string = null;
public thresholdDescription: number = 670;
public showNumDescription: number = 670;
// Metrics tab variables
public metricsClicked: boolean;
public hasAltMetrics: boolean = false;
@ -58,7 +56,7 @@ export class ResultLandingComponent {
public totalViews: number;
public totalDownloads: number;
public pageViews: number;
// Custom tab paging variables
public referencesPage: number = 1;
public bioentitiesPage: number = 1;
@ -67,17 +65,17 @@ export class ResultLandingComponent {
public softwarePage: number = 1;
public openCitationsPage: number = 1;
public pageSize: number = 10;
// Map counting variables
public bioentitiesNum: number = 0;
// Message variables
public warningMessage = "";
public errorMessage = "";
public showLoading: boolean = true;
public routerHelper: RouterHelper = new RouterHelper();
private doi: string;
public doiURL: string;
sub: any;
@ -91,8 +89,8 @@ export class ResultLandingComponent {
public feedbackFields: string [] = [
'Title', 'Authors', 'Access rights',
'Publisher information', 'Funding Information',
'Persistent identifiers','Other'];
'Persistent identifiers', 'Other'];
constructor(private _resultLaningService: ResultLandingService,
private _piwikService: PiwikService,
private route: ActivatedRoute,
@ -107,15 +105,15 @@ export class ResultLandingComponent {
private _location: Location,
private indexInfoService: IndexInfoService) {
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if(lastIndexUpdate) {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if(this.properties.lastIndexUpdate) {
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
@ -125,31 +123,31 @@ export class ResultLandingComponent {
this.updateUrl(data.envSpecific.baseLink + this._router.url);
this.sub = this.route.queryParams.subscribe(data => {
this.resultLandingInfo = null;
if(this.type == "publication") {
if (this.type == "publication") {
this.updateTitle("Publication");
this.linkToLandingPage = this.properties.searchLinkToPublication;
this.linkToSearchPage = this.properties.searchLinkToPublications;
this.id = data['articleId'];
this.title = "Publication";
} else if(this.type == "dataset") {
} else if (this.type == "dataset") {
this.updateTitle("Dataset");
this.linkToLandingPage = this.properties.searchLinkToDataset;
this.linkToSearchPage = this.properties.searchLinkToDatasets;
this.id = data['datasetId'];
this.title = "Research Data";
} else if(this.type == "software") {
} else if (this.type == "software") {
this.updateTitle("Software");
this.linkToLandingPage = this.properties.searchLinkToSoftware;
this.linkToSearchPage = this.properties.searchLinkToSoftwareLanding;
this.id = data['softwareId'];
this.title = "Software";
} else if(this.type == "orp") {
} else if (this.type == "orp") {
this.updateTitle("Other Research Product");
this.linkToLandingPage = this.properties.searchLinkToOrp;
this.linkToSearchPage = this.properties.searchLinkToOrps;
this.id = data['orpId'];
this.title = "Other Research Product";
}else if(this.type == "result"){
} else if (this.type == "result") {
this.id = data["id"];
this.updateTitle("Research Result");
this.linkToLandingPage = this.properties.searchLinkToOrp;
@ -157,15 +155,20 @@ export class ResultLandingComponent {
this.title = "Research Result";
}
this.updateDescription("");
this.metricsClicked = false;
if (this.id) {
this.getProvenanceVocabularyAndResultLandingInfo();
} else {
this.showLoading = false;
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
this._router.navigate(['/error'], {
queryParams: {
"page": this._location.path(true),
"page_type": this.type
}
});
/*
this.warningMessage = "No valid ";
if(this.type == "publication" || this.type == "software") {
@ -178,27 +181,27 @@ export class ResultLandingComponent {
this.warningMessage += "id";
*/
}
this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":80,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":80,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
this.scroll();
});
});
}
private getPageContents() {
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
});
}
private getDivContents() {
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
});
}
ngOnDestroy() {
if (this.sub) {
this.sub.unsubscribe();
@ -233,48 +236,48 @@ export class ResultLandingComponent {
let type = this.getTypeName();
return array.filter(value => value.toLowerCase() !== type);
}
private getOpenCitations() {
this._resultLaningService.getOpenCitations(this.id, this.properties).subscribe(
data => {
this.resultLandingInfo.openCitations = data[1];
},
err => {
this.handleError("Error getting open citation for "+this.type+" with id: " + this.id, err);
this.handleError("Error getting open citation for " + this.type + " with id: " + this.id, err);
}
);
}
private getProvenanceVocabularyAndResultLandingInfo() {
this.warningMessage = '';
this.errorMessage = '';
this.showLoading = true;
this.resultLandingInfo = null;
this._resultLaningService.getProvenanceActionVocabulary(this.properties).subscribe(
provenanceActionVocabulary => {
this.getResultLandingInfo(provenanceActionVocabulary);
}, err => {
this.getResultLandingInfo(null);
this.handleError("Error getting provenance action vocabulary for "+this.type+" with id: " + this.id, err);
this.handleError("Error getting provenance action vocabulary for " + this.type + " with id: " + this.id, err);
}
);
}
private getResultLandingInfo(provenanceActionVocabulary: any) {
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, provenanceActionVocabulary, this.properties).subscribe(
data => {
this.resultLandingInfo = data;
if(this.type == "result"){ // no type was specified - update URL based this.resultLandingInfo.resultType
if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType
this.updateUrlWithType();
}
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();
}
if (this.resultLandingInfo.title) {
this.updateTitle(this.resultLandingInfo.title);
this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description) : ("," + this.resultLandingInfo.title)));
@ -282,7 +285,7 @@ export class ResultLandingComponent {
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties, this.resultLandingInfo.title/*.name*/, this.piwikSiteId).subscribe();
}
let bioentitiesNum = 0;
if (this.resultLandingInfo.bioentities != undefined) {
this.resultLandingInfo.bioentities.forEach(function (value, key, map) {
@ -315,17 +318,17 @@ export class ResultLandingComponent {
}
},
err => {
this.handleError("Error getting "+this.type+" for id: " + this.id, err);
if(err.status == 404) {
this.handleError("Error getting " + this.type + " for id: " + this.id, err);
if (err.status == 404) {
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
}
if(this.type == "publication" || this.type == "software") {
this.errorMessage = 'No '+this.type+' found';
} else if(this.type == "dataset") {
if (this.type == "publication" || this.type == "software") {
this.errorMessage = 'No ' + this.type + ' found';
} else if (this.type == "dataset") {
this.errorMessage += "No research data found";
} else if(this.type == "orp") {
} else if (this.type == "orp") {
this.errorMessage += "No research product found";
}
this.showLoading = false;
@ -333,32 +336,42 @@ export class ResultLandingComponent {
}
);
}
public metricsResults($event) {
this.totalViews = $event.totalViews;
this.totalDownloads = $event.totalDownloads;
this.pageViews = $event.pageViews;
}
public get hasMetrics(): boolean {
return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0||this.pageViews > 0;
public get hasPrimaryInfo(): boolean {
return !!this.resultLandingInfo && (!!this.resultLandingInfo.description || !!this.resultLandingInfo.identifiers || !!this.resultLandingInfo.subjects);
}
public get hasSecondaryInfo(): boolean {
return (this.resultLandingInfo.fundedByProjects && this.resultLandingInfo.fundedByProjects.length > 0) ||
(this.resultLandingInfo.contexts && this.resultLandingInfo.contexts.length > 0) ||
(this.resultLandingInfo.hostedBy_collectedFrom && this.resultLandingInfo.hostedBy_collectedFrom.length > 0);
}
public get hasMetrics(): boolean {
return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0;
}
public buildCurationTooltip(): string {
let tooltipContent: string = "<div class='uk-margin uk-padding-small'>";
tooltipContent += "<h4>Record in preview</h4>";
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p>";
tooltipContent += "</div>";
return tooltipContent;
}
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) {
@ -368,11 +381,11 @@ export class ResultLandingComponent {
this._title.setTitle(title);
this._meta.updateTag({content: title}, "property='og:title'");
}
private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'");
}
public totalPages(totalResults: number): number {
let totalPages: any = totalResults / this.pageSize;
if (!(Number.isInteger(totalPages))) {
@ -380,7 +393,7 @@ export class ResultLandingComponent {
}
return totalPages;
}
public updateReferencesPage($event) {
this.referencesPage = $event.value;
}
@ -392,29 +405,29 @@ export class ResultLandingComponent {
public updateRelationPage($event) {
this.relationPage = $event.value;
}
public updateOrganizationsPage($event) {
this.organizationsPage = $event.value;
}
public updateSoftwarePage($event) {
this.softwarePage = $event.value;
}
public updateOpenCitationsPage($event) {
this.openCitationsPage = $event.value;
}
public accessClass(accessMode: string): string {
if(accessMode.toLowerCase().indexOf('open') !== -1) {
if (accessMode.toLowerCase().indexOf('open') !== -1) {
return 'open';
} else if(accessMode.toLowerCase() === 'not available') {
} else if (accessMode.toLowerCase() === 'not available') {
return 'unknown';
} else {
return 'closed';
}
}
public keysToArray(bioentities: Map<string, string>): string[] {
let keys: string[] = [];
bioentities.forEach(function (value, key, map) {
@ -422,29 +435,29 @@ export class ResultLandingComponent {
});
return keys;
}
public getKeys(map) {
return Array.from(map.keys());
}
public scroll() {
HelperFunctions.scroll();
}
private handleError(message: string, error) {
if(this.type == "publication") {
if (this.type == "publication") {
console.error("Publication Landing Page: " + message, error);
} else if(this.type == "dataset") {
} else if (this.type == "dataset") {
console.error("Research Data Landing Page: " + message, error);
} else if(this.type == "software") {
} else if (this.type == "software") {
console.error("Software Landing Page: " + message, error);
} else if(this.type == "orp") {
} else if (this.type == "orp") {
console.error("Other Research Product Landing Page: " + message, error);
} else {
console.error("Landing Page: " + message, error);
}
}
isRouteAvailable(routeToCheck: string) {
for (let i = 0; i < this.router.config.length; i++) {
let routePath: string = this.router.config[i].path;
@ -454,7 +467,7 @@ export class ResultLandingComponent {
}
return false;
}
openDeletedByInference() {
this.deleteByInferenceOpened = true;
this.alertModalDeletedByInference.cancelButton = false;
@ -462,23 +475,7 @@ export class ResultLandingComponent {
this.alertModalDeletedByInference.alertTitle = "Other versions of";
this.alertModalDeletedByInference.open();
}
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;
@ -506,20 +503,20 @@ export class ResultLandingComponent {
return ResultPreview.organizationConvert(result, this.relation);
}
updateUrlWithType(){
updateUrlWithType() {
this.type = this.resultLandingInfo.resultType;
if(this.type == "publication") {
if (this.type == "publication") {
this._location.go("test");
this.linkToLandingPage = this.properties.searchLinkToPublication;
this.linkToSearchPage = this.properties.searchLinkToPublications;
} else if(this.type == "dataset") {
} else if (this.type == "dataset") {
this.linkToLandingPage = this.properties.searchLinkToDataset;
this.linkToSearchPage = this.properties.searchLinkToDatasets;
} else if(this.type == "software") {
} else if (this.type == "software") {
this.linkToLandingPage = this.properties.searchLinkToSoftwareLanding;
this.linkToSearchPage = this.properties.searchLinkToSoftware;
} else if(this.type == "other") {
this.type="orp";
} else if (this.type == "other") {
this.type = "orp";
this.linkToLandingPage = this.properties.searchLinkToOrp;
this.linkToSearchPage = this.properties.searchLinkToOrps;
}
@ -527,30 +524,30 @@ export class ResultLandingComponent {
}
public getReferenceUrl(id: Id): string {
if(id.type === "doi") {
if (id.type === "doi") {
return this.properties.doiURL + id.value;
} else if(id.type === "pmc") {
} else if (id.type === "pmc") {
return this.properties.pmcURL + id.value;
} else if(id.type === "pmid") {
} else if (id.type === "pmid") {
return this.properties.pmidURL + id.value;
} else if(id.type === "handle") {
} else if (id.type === "handle") {
return this.properties.handleURL + id.value;
} else {
return null;
return null;
}
}
public getReferenceIdName(id: Id): string {
if(id.type === "doi") {
if (id.type === "doi") {
return 'DOI'
} else if(id.type === "pmc") {
} else if (id.type === "pmc") {
return 'Europe PMC'
} else if(id.type === "pmid") {
} else if (id.type === "pmid") {
return 'PubMed';
} else if(id.type === "handle") {
} else if (id.type === "handle") {
return 'Handle.NET';
} else {
return null;
return null;
}
}
@ -567,12 +564,4 @@ export class ResultLandingComponent {
this.citeModal.alertTitle = "Cite this " + this.getTypeName() + " to";
this.citeModal.open();
}
public onSelectActiveTab(activeTabId) {
if(this.activeTab != activeTabId) { // tab really changed
if (activeTabId == 'summary') {
this.activeTab = 'summary';
}
}
}
}

View File

@ -11,16 +11,10 @@
</span>
<div class="uk-text-small">
<span class="uk-text-capitalize">
{{getTypeName(result.resultType)}}
{{beforeTitle.join(' . ')}}
</span>
<span *ngIf="result.types &&
removeUnknown(removeDuplicates(result.types)).length > 0">
{{' . ' + removeUnknown(removeDuplicates(result.types)).join(' . ')}}
</span>
<span *ngIf="result.year">{{' . ' + result.year.toString()}}</span>
<span *ngIf="result.startYear && result.endYear"> . {{result.startYear}} - {{result.endYear}}</span>
<span *ngIf="result.embargoEndDate && result.embargoEndDate != ''">
. Embargo End Date: {{result.embargoEndDate | date: 'dd MMM yyyy'}}
<span *ngIf="beforeTitle.length > 0"> . </span> Embargo End Date: {{result.embargoEndDate | date: 'dd MMM yyyy'}}
</span>
</div>
<!-- Title -->

View File

@ -17,6 +17,7 @@ export class ResultPreviewComponent implements OnInit{
@Input() promoteWebsiteURL: boolean = false;
public routerHelper: RouterHelper = new RouterHelper();
public urlParam: string;
public beforeTitle: string[] = [];
ngOnInit(): void {
if (this.result.resultType === "publication") {
@ -34,6 +35,24 @@ export class ResultPreviewComponent implements OnInit{
} else if (this.result.resultType == "dataprovider") {
this.urlParam = "datasourceId";
}
this.initBeforeTitle();
}
public initBeforeTitle() {
if(this.result.resultType) {
this.beforeTitle.push(this.getTypeName(this.result.resultType));
}
if(this.result.types) {
this.removeUnknown(this.removeDuplicates(this.result.types)).forEach(type => {
this.beforeTitle.push(type);
});
}
if(this.result.year) {
this.beforeTitle.push(this.result.year.toString());
}
if(this.result.startYear && this.result.endYear) {
this.beforeTitle.push(this.result.startYear.toString() + ' - ' + this.result.endYear.toString());
}
}
public getTypeName(type: string): string {