1 |
58275
|
k.triantaf
|
import {ChangeDetectorRef, Component, Input, ViewChild} from '@angular/core';
|
2 |
56958
|
konstantin
|
import {ActivatedRoute, Router} from '@angular/router';
|
3 |
|
|
import {Meta, Title} from '@angular/platform-browser';
|
4 |
|
|
|
5 |
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
6 |
58310
|
k.triantaf
|
import {Id, ResultLandingInfo} from '../../utils/entities/resultLandingInfo';
|
7 |
56958
|
konstantin
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
8 |
|
|
|
9 |
|
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
10 |
|
|
import {ResultLandingService} from './resultLanding.service';
|
11 |
|
|
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
|
12 |
|
|
import {HelperFunctions} from '../../utils/HelperFunctions.class';
|
13 |
|
|
import {HelperService} from '../../utils/helper/helper.service';
|
14 |
57536
|
konstantin
|
import {Location} from "@angular/common";
|
15 |
58275
|
k.triantaf
|
import {MetricsService} from "../../services/metrics.service";
|
16 |
59180
|
konstantin
|
import {RelationResult, ResultPreview} from "../../utils/result-preview/result-preview";
|
17 |
|
|
import {IndexInfoService} from "../../utils/indexInfo.service";
|
18 |
|
|
import {FormBuilder} from "@angular/forms";
|
19 |
|
|
import {StringUtils} from "../../utils/string-utils.class";
|
20 |
|
|
import {properties} from "../../../../environments/environment";
|
21 |
|
|
import {ISVocabulariesService} from "../../utils/staticAutoComplete/ISVocabularies.service";
|
22 |
56958
|
konstantin
|
|
23 |
|
|
|
24 |
|
|
@Component({
|
25 |
|
|
selector: 'result-landing',
|
26 |
|
|
templateUrl: 'resultLanding.component.html',
|
27 |
|
|
})
|
28 |
|
|
export class ResultLandingComponent {
|
29 |
|
|
@Input() type: string = "publication";
|
30 |
59180
|
konstantin
|
@Input() piwikSiteId = properties.piwikSiteId;
|
31 |
56958
|
konstantin
|
@Input() communityId = null;
|
32 |
59180
|
konstantin
|
@ViewChild('linkModal') linkModal;
|
33 |
|
|
@ViewChild('citeModal') citeModal;
|
34 |
56958
|
konstantin
|
@ViewChild('AlertModalDeletedByInference') alertModalDeletedByInference;
|
35 |
58275
|
k.triantaf
|
@ViewChild('relationModal') relationModal;
|
36 |
|
|
@ViewChild('organizationModal') organizationModal;
|
37 |
57201
|
konstantin
|
public deleteByInferenceOpened: boolean = false;
|
38 |
59180
|
konstantin
|
|
39 |
56958
|
konstantin
|
public resultLandingInfo: ResultLandingInfo;
|
40 |
59180
|
konstantin
|
public relatedResults: RelationResult[];
|
41 |
|
|
public supplementaryResults: RelationResult[];
|
42 |
58275
|
k.triantaf
|
public relation: string = 'trust';
|
43 |
56958
|
konstantin
|
public id: string;
|
44 |
|
|
public title: string;
|
45 |
59180
|
konstantin
|
|
46 |
|
|
/*Show all organizations*/
|
47 |
|
|
public showAll: boolean = false;
|
48 |
|
|
|
49 |
56958
|
konstantin
|
// Links for SEO
|
50 |
|
|
public linkToLandingPage: string = null;
|
51 |
|
|
public linkToSearchPage: string = null;
|
52 |
59180
|
konstantin
|
|
53 |
58275
|
k.triantaf
|
public thresholdDescription: number = 670;
|
54 |
|
|
public showNumDescription: number = 670;
|
55 |
59180
|
konstantin
|
|
56 |
|
|
public citeThisClicked: boolean;
|
57 |
|
|
|
58 |
56958
|
konstantin
|
// Metrics tab variables
|
59 |
|
|
public metricsClicked: boolean;
|
60 |
58275
|
k.triantaf
|
public hasAltMetrics: boolean = false;
|
61 |
56958
|
konstantin
|
public viewsFrameUrl: string;
|
62 |
|
|
public downloadsFrameUrl: string;
|
63 |
|
|
public totalViews: number;
|
64 |
|
|
public totalDownloads: number;
|
65 |
|
|
public pageViews: number;
|
66 |
59180
|
konstantin
|
|
67 |
56958
|
konstantin
|
// Custom tab paging variables
|
68 |
|
|
public referencesPage: number = 1;
|
69 |
58275
|
k.triantaf
|
public bioentitiesPage: number = 1;
|
70 |
59180
|
konstantin
|
public relatedPage: number = 1;
|
71 |
|
|
public similarPage: number = 1;
|
72 |
|
|
public supplementaryPage: number = 1;
|
73 |
|
|
public supplementedByPage: number = 1;
|
74 |
56958
|
konstantin
|
public organizationsPage: number = 1;
|
75 |
|
|
public openCitationsPage: number = 1;
|
76 |
|
|
public pageSize: number = 10;
|
77 |
59180
|
konstantin
|
|
78 |
56958
|
konstantin
|
// Map counting variables
|
79 |
|
|
public bioentitiesNum: number = 0;
|
80 |
59180
|
konstantin
|
public relatedResultsNum: number = 0;
|
81 |
|
|
public supplementaryResultsNum: number = 0;
|
82 |
|
|
|
83 |
56958
|
konstantin
|
// Message variables
|
84 |
|
|
public warningMessage = "";
|
85 |
|
|
public errorMessage = "";
|
86 |
|
|
public showLoading: boolean = true;
|
87 |
59180
|
konstantin
|
public dashboard = properties.isDashboard;
|
88 |
|
|
|
89 |
56958
|
konstantin
|
public routerHelper: RouterHelper = new RouterHelper();
|
90 |
59180
|
konstantin
|
public activeTab: string = null;
|
91 |
56958
|
konstantin
|
private doi: string;
|
92 |
|
|
sub: any;
|
93 |
|
|
piwiksub: any;
|
94 |
|
|
infoSub: any;
|
95 |
59180
|
konstantin
|
properties: EnvProperties = properties;
|
96 |
58275
|
k.triantaf
|
public indexUpdateDate: Date;
|
97 |
56958
|
konstantin
|
public pageContents = null;
|
98 |
|
|
public divContents = null;
|
99 |
58275
|
k.triantaf
|
public showFeedback: boolean = false;
|
100 |
|
|
public feedbackFields: string [] = [
|
101 |
|
|
'Title', 'Authors', 'Access rights',
|
102 |
|
|
'Publisher information', 'Funding Information',
|
103 |
59180
|
konstantin
|
'Persistent identifiers', 'Other'];
|
104 |
|
|
|
105 |
56958
|
konstantin
|
constructor(private _resultLaningService: ResultLandingService,
|
106 |
59180
|
konstantin
|
private _vocabulariesService: ISVocabulariesService,
|
107 |
56958
|
konstantin
|
private _piwikService: PiwikService,
|
108 |
|
|
private route: ActivatedRoute,
|
109 |
|
|
private router: Router,
|
110 |
|
|
private _meta: Meta,
|
111 |
|
|
private _title: Title,
|
112 |
|
|
private _router: Router,
|
113 |
|
|
private helper: HelperService,
|
114 |
57404
|
konstantin
|
private seoService: SEOService,
|
115 |
58275
|
k.triantaf
|
private metricsService: MetricsService,
|
116 |
|
|
private cdr: ChangeDetectorRef,
|
117 |
59180
|
konstantin
|
private _location: Location,
|
118 |
|
|
private indexInfoService: IndexInfoService,
|
119 |
|
|
private fb: FormBuilder) {
|
120 |
56958
|
konstantin
|
}
|
121 |
59180
|
konstantin
|
|
122 |
56958
|
konstantin
|
ngOnInit() {
|
123 |
59180
|
konstantin
|
if (typeof document !== 'undefined') {
|
124 |
|
|
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
|
125 |
|
|
if (lastIndexUpdate) {
|
126 |
|
|
this.indexUpdateDate = new Date(lastIndexUpdate);
|
127 |
58275
|
k.triantaf
|
}
|
128 |
59180
|
konstantin
|
});
|
129 |
|
|
}
|
130 |
|
|
//this.getDivContents();
|
131 |
|
|
this.getPageContents();
|
132 |
59452
|
konstantin
|
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
|
133 |
59180
|
konstantin
|
this.sub = this.route.queryParams.subscribe(data => {
|
134 |
|
|
this.resultLandingInfo = null;
|
135 |
|
|
if (data['articleId']) {
|
136 |
|
|
this.type = "publication";
|
137 |
|
|
this.updateTitle("Publication");
|
138 |
|
|
this.linkToLandingPage = this.properties.searchLinkToPublication;
|
139 |
|
|
this.linkToSearchPage = this.properties.searchLinkToPublications;
|
140 |
|
|
this.id = data['articleId'];
|
141 |
|
|
this.title = "Publication";
|
142 |
|
|
} else if (data['datasetId']) {
|
143 |
|
|
this.updateTitle("Dataset");
|
144 |
|
|
this.type = "dataset";
|
145 |
|
|
this.linkToLandingPage = this.properties.searchLinkToDataset;
|
146 |
|
|
this.linkToSearchPage = this.properties.searchLinkToDatasets;
|
147 |
|
|
this.id = data['datasetId'];
|
148 |
|
|
this.title = "Research Data";
|
149 |
|
|
} else if (data['softwareId']) {
|
150 |
|
|
this.updateTitle("Software");
|
151 |
|
|
this.type = "software";
|
152 |
59378
|
konstantin
|
this.linkToLandingPage = this.properties.searchLinkToSoftwareLanding;
|
153 |
|
|
this.linkToSearchPage = this.properties.searchLinkToSoftware;
|
154 |
59180
|
konstantin
|
this.id = data['softwareId'];
|
155 |
|
|
this.title = "Software";
|
156 |
|
|
} else if (data['orpId']) {
|
157 |
|
|
this.type = "orp";
|
158 |
|
|
this.updateTitle("Other Research Product");
|
159 |
|
|
this.linkToLandingPage = this.properties.searchLinkToOrp;
|
160 |
|
|
this.linkToSearchPage = this.properties.searchLinkToOrps;
|
161 |
|
|
this.id = data['orpId'];
|
162 |
|
|
this.title = "Other Research Product";
|
163 |
|
|
} else if (data["id"]){
|
164 |
|
|
this.type = "result";
|
165 |
|
|
this.id = data["id"];
|
166 |
|
|
this.updateTitle("Research Result");
|
167 |
59378
|
konstantin
|
this.linkToLandingPage = this.properties.searchLinkToResult;
|
168 |
59180
|
konstantin
|
this.linkToSearchPage = this.properties.searchLinkToResults;
|
169 |
|
|
this.title = "Research Result";
|
170 |
|
|
}
|
171 |
|
|
this.updateDescription("");
|
172 |
|
|
|
173 |
|
|
this.metricsClicked = false;
|
174 |
56958
|
konstantin
|
|
175 |
59180
|
konstantin
|
if (this.id && StringUtils.isOpenAIREID(this.id)) {
|
176 |
|
|
this.getProvenanceVocabularyAndResultLandingInfo();
|
177 |
|
|
} else {
|
178 |
|
|
this.showLoading = false;
|
179 |
|
|
|
180 |
|
|
this._router.navigate(['/error'], {
|
181 |
|
|
queryParams: {
|
182 |
|
|
"page": this._location.path(true),
|
183 |
|
|
"page_type": this.type
|
184 |
56958
|
konstantin
|
}
|
185 |
|
|
});
|
186 |
59180
|
konstantin
|
}
|
187 |
|
|
|
188 |
|
|
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":200,"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';
|
189 |
|
|
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":200,"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';
|
190 |
|
|
|
191 |
|
|
this.scroll();
|
192 |
|
|
});
|
193 |
56958
|
konstantin
|
}
|
194 |
59180
|
konstantin
|
|
195 |
56958
|
konstantin
|
private getPageContents() {
|
196 |
59180
|
konstantin
|
if (this.communityId) {
|
197 |
|
|
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
198 |
|
|
this.pageContents = contents;
|
199 |
|
|
});
|
200 |
|
|
}
|
201 |
56958
|
konstantin
|
}
|
202 |
59180
|
konstantin
|
|
203 |
56958
|
konstantin
|
private getDivContents() {
|
204 |
59180
|
konstantin
|
if (this.communityId) {
|
205 |
|
|
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
206 |
|
|
this.divContents = contents;
|
207 |
|
|
});
|
208 |
|
|
}
|
209 |
56958
|
konstantin
|
}
|
210 |
59180
|
konstantin
|
|
211 |
56958
|
konstantin
|
ngOnDestroy() {
|
212 |
|
|
if (this.sub) {
|
213 |
|
|
this.sub.unsubscribe();
|
214 |
|
|
}
|
215 |
|
|
if (this.piwiksub) {
|
216 |
|
|
this.piwiksub.unsubscribe();
|
217 |
|
|
}
|
218 |
|
|
if (this.infoSub) {
|
219 |
|
|
this.infoSub.unsubscribe();
|
220 |
|
|
}
|
221 |
|
|
}
|
222 |
58275
|
k.triantaf
|
|
223 |
|
|
public getTypeName(): string {
|
224 |
|
|
if (this.type === "dataset") {
|
225 |
|
|
return "research data";
|
226 |
|
|
} else if (this.type === "orp" || this.type === "other") {
|
227 |
59180
|
konstantin
|
return "research product";
|
228 |
58275
|
k.triantaf
|
} else {
|
229 |
|
|
return this.type;
|
230 |
|
|
}
|
231 |
|
|
}
|
232 |
|
|
|
233 |
|
|
public removeUnknown(array: string[], type: boolean = false): string[] {
|
234 |
|
|
if (type) {
|
235 |
|
|
return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown');
|
236 |
|
|
} else {
|
237 |
|
|
return array.filter(value => value.toLowerCase() !== 'unknown');
|
238 |
|
|
}
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
public removeDuplicates(array: string[]): string[] {
|
242 |
|
|
let type = this.getTypeName();
|
243 |
|
|
return array.filter(value => value.toLowerCase() !== type);
|
244 |
|
|
}
|
245 |
59180
|
konstantin
|
|
246 |
58275
|
k.triantaf
|
private getOpenCitations() {
|
247 |
56958
|
konstantin
|
this._resultLaningService.getOpenCitations(this.id, this.properties).subscribe(
|
248 |
|
|
data => {
|
249 |
|
|
this.resultLandingInfo.openCitations = data[1];
|
250 |
|
|
},
|
251 |
|
|
err => {
|
252 |
59180
|
konstantin
|
this.handleError("Error getting open citation for " + this.type + " with id: " + this.id, err);
|
253 |
56958
|
konstantin
|
}
|
254 |
|
|
);
|
255 |
|
|
}
|
256 |
59180
|
konstantin
|
|
257 |
57330
|
konstantin
|
private getProvenanceVocabularyAndResultLandingInfo() {
|
258 |
56958
|
konstantin
|
this.warningMessage = '';
|
259 |
|
|
this.errorMessage = '';
|
260 |
|
|
this.showLoading = true;
|
261 |
59180
|
konstantin
|
|
262 |
56958
|
konstantin
|
this.resultLandingInfo = null;
|
263 |
59180
|
konstantin
|
|
264 |
|
|
if (typeof document !== 'undefined') {
|
265 |
|
|
this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe(
|
266 |
|
|
provenanceActionVocabulary => {
|
267 |
|
|
this.getResultLandingInfo(provenanceActionVocabulary);
|
268 |
|
|
}, err => {
|
269 |
|
|
this.getResultLandingInfo(null);
|
270 |
|
|
this.handleError("Error getting provenance action vocabulary for " + this.type + " with id: " + this.id, err);
|
271 |
|
|
}
|
272 |
|
|
);
|
273 |
|
|
} else {
|
274 |
|
|
this.getResultLandingInfo(null);
|
275 |
|
|
}
|
276 |
|
|
|
277 |
57330
|
konstantin
|
}
|
278 |
59180
|
konstantin
|
|
279 |
|
|
private setActiveTab() {
|
280 |
|
|
if (this.hasPrimaryInfo || this.hasSecondaryInfo) {
|
281 |
|
|
this.activeTab = 'summary';
|
282 |
|
|
} else if (this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) {
|
283 |
|
|
this.activeTab = 'references';
|
284 |
|
|
} else if ((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) ||
|
285 |
|
|
(this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) {
|
286 |
|
|
this.activeTab = 'supplementary';
|
287 |
|
|
} else if ((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) ||
|
288 |
|
|
(this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) {
|
289 |
|
|
this.activeTab = 'related';
|
290 |
|
|
} else if (this.resultLandingInfo.bioentities && this.bioentitiesNum > 0) {
|
291 |
|
|
this.activeTab = 'bioentities';
|
292 |
|
|
}
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
// private get numberOfTabs(): number {
|
296 |
|
|
// let numberOfTabs = 0;
|
297 |
|
|
// if(this.hasPrimaryInfo || this.hasSecondaryInfo) {
|
298 |
|
|
// numberOfTabs++;
|
299 |
|
|
// }
|
300 |
|
|
// if(this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) {
|
301 |
|
|
// numberOfTabs++;
|
302 |
|
|
// }
|
303 |
|
|
// if((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) ||
|
304 |
|
|
// (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) {
|
305 |
|
|
// numberOfTabs++;
|
306 |
|
|
// }
|
307 |
|
|
// if((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) ||
|
308 |
|
|
// (this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) {
|
309 |
|
|
// numberOfTabs++;
|
310 |
|
|
// }
|
311 |
|
|
// if(this.resultLandingInfo.bioentities && this.bioentitiesNum > 0) {
|
312 |
|
|
// numberOfTabs++;
|
313 |
|
|
// }
|
314 |
|
|
// return numberOfTabs;
|
315 |
|
|
// }
|
316 |
|
|
|
317 |
57330
|
konstantin
|
private getResultLandingInfo(provenanceActionVocabulary: any) {
|
318 |
|
|
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, provenanceActionVocabulary, this.properties).subscribe(
|
319 |
56958
|
konstantin
|
data => {
|
320 |
|
|
this.resultLandingInfo = data;
|
321 |
59180
|
konstantin
|
if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType
|
322 |
58176
|
argiro.kok
|
this.updateUrlWithType();
|
323 |
|
|
}
|
324 |
59452
|
konstantin
|
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.relcanId);
|
325 |
56958
|
konstantin
|
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
|
326 |
58275
|
k.triantaf
|
this.getOpenCitations();
|
327 |
56958
|
konstantin
|
}
|
328 |
59180
|
konstantin
|
|
329 |
56958
|
konstantin
|
if (this.resultLandingInfo.title) {
|
330 |
|
|
this.updateTitle(this.resultLandingInfo.title);
|
331 |
|
|
this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description) : ("," + this.resultLandingInfo.title)));
|
332 |
|
|
}
|
333 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
334 |
|
|
this.piwiksub = this._piwikService.trackView(this.properties, this.resultLandingInfo.title/*.name*/, this.piwikSiteId).subscribe();
|
335 |
|
|
}
|
336 |
59180
|
konstantin
|
|
337 |
56958
|
konstantin
|
let bioentitiesNum = 0;
|
338 |
|
|
if (this.resultLandingInfo.bioentities != undefined) {
|
339 |
|
|
this.resultLandingInfo.bioentities.forEach(function (value, key, map) {
|
340 |
|
|
bioentitiesNum += value.size;
|
341 |
|
|
});
|
342 |
|
|
}
|
343 |
|
|
this.bioentitiesNum = bioentitiesNum;
|
344 |
59180
|
konstantin
|
if (typeof document !== 'undefined') {
|
345 |
|
|
if (this.resultLandingInfo.identifiers != undefined && this.resultLandingInfo.identifiers.has('doi')) {
|
346 |
|
|
this.doi = this.resultLandingInfo.identifiers.get('doi')[0];
|
347 |
|
|
this.metricsService.hasAltMetrics(this.properties.altMetricsAPIURL, this.doi).subscribe(hasAltMetrics => {
|
348 |
|
|
this.hasAltMetrics = hasAltMetrics;
|
349 |
|
|
}, error => {
|
350 |
|
|
this.hasAltMetrics = false;
|
351 |
|
|
});
|
352 |
|
|
}
|
353 |
56958
|
konstantin
|
}
|
354 |
|
|
this.showLoading = false;
|
355 |
59180
|
konstantin
|
this.setActiveTab();
|
356 |
56958
|
konstantin
|
},
|
357 |
|
|
err => {
|
358 |
59180
|
konstantin
|
this.handleError("Error getting " + this.type + " for id: " + this.id, err);
|
359 |
|
|
|
360 |
|
|
if (err.status == 404) {
|
361 |
57536
|
konstantin
|
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
|
362 |
57494
|
konstantin
|
}
|
363 |
59180
|
konstantin
|
|
364 |
|
|
if (this.type == "publication" || this.type == "software") {
|
365 |
|
|
this.errorMessage = 'No ' + this.type + ' found';
|
366 |
|
|
} else if (this.type == "dataset") {
|
367 |
56958
|
konstantin
|
this.errorMessage += "No research data found";
|
368 |
59180
|
konstantin
|
} else if (this.type == "orp") {
|
369 |
56958
|
konstantin
|
this.errorMessage += "No research product found";
|
370 |
|
|
}
|
371 |
|
|
this.showLoading = false;
|
372 |
59452
|
konstantin
|
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToSearchPage);
|
373 |
56958
|
konstantin
|
}
|
374 |
|
|
);
|
375 |
|
|
}
|
376 |
59180
|
konstantin
|
|
377 |
56958
|
konstantin
|
public metricsResults($event) {
|
378 |
|
|
this.totalViews = $event.totalViews;
|
379 |
|
|
this.totalDownloads = $event.totalDownloads;
|
380 |
|
|
this.pageViews = $event.pageViews;
|
381 |
|
|
}
|
382 |
59180
|
konstantin
|
|
383 |
|
|
public get hasPrimaryInfo(): boolean {
|
384 |
|
|
return !!this.resultLandingInfo && (!!this.resultLandingInfo.description || !!this.resultLandingInfo.identifiers || !!this.resultLandingInfo.subjects);
|
385 |
56958
|
konstantin
|
}
|
386 |
59180
|
konstantin
|
|
387 |
|
|
public get hasSecondaryInfo(): boolean {
|
388 |
|
|
return (this.resultLandingInfo.fundedByProjects && this.resultLandingInfo.fundedByProjects.length > 0) ||
|
389 |
|
|
(this.resultLandingInfo.contexts && this.resultLandingInfo.contexts.length > 0) ||
|
390 |
|
|
(this.resultLandingInfo.hostedBy_collectedFrom && this.resultLandingInfo.hostedBy_collectedFrom.length > 0);
|
391 |
|
|
}
|
392 |
|
|
|
393 |
|
|
public get hasMetrics(): boolean {
|
394 |
|
|
return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0;
|
395 |
|
|
}
|
396 |
|
|
|
397 |
56958
|
konstantin
|
private updateDescription(description: string) {
|
398 |
57820
|
argiro.kok
|
this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
|
399 |
|
|
this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
|
400 |
56958
|
konstantin
|
}
|
401 |
59180
|
konstantin
|
|
402 |
56958
|
konstantin
|
private updateTitle(title: string) {
|
403 |
|
|
var _prefix = "";
|
404 |
57820
|
argiro.kok
|
// if(!this.communityId) {
|
405 |
|
|
// _prefix = "OpenAIRE | ";
|
406 |
|
|
// }
|
407 |
|
|
// var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
|
408 |
|
|
this._title.setTitle(title);
|
409 |
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
410 |
56958
|
konstantin
|
}
|
411 |
59180
|
konstantin
|
|
412 |
56958
|
konstantin
|
private updateUrl(url: string) {
|
413 |
|
|
this._meta.updateTag({content: url}, "property='og:url'");
|
414 |
|
|
}
|
415 |
59180
|
konstantin
|
|
416 |
56958
|
konstantin
|
public totalPages(totalResults: number): number {
|
417 |
|
|
let totalPages: any = totalResults / this.pageSize;
|
418 |
|
|
if (!(Number.isInteger(totalPages))) {
|
419 |
|
|
totalPages = (parseInt(totalPages, this.pageSize) + 1);
|
420 |
|
|
}
|
421 |
|
|
return totalPages;
|
422 |
|
|
}
|
423 |
59180
|
konstantin
|
|
424 |
56958
|
konstantin
|
public updateReferencesPage($event) {
|
425 |
|
|
this.referencesPage = $event.value;
|
426 |
|
|
}
|
427 |
58275
|
k.triantaf
|
|
428 |
|
|
public updateBioentitiesPage($event) {
|
429 |
|
|
this.bioentitiesPage = $event.value;
|
430 |
|
|
}
|
431 |
|
|
|
432 |
59180
|
konstantin
|
public updateRelatedPage($event) {
|
433 |
|
|
this.relatedPage = $event.value;
|
434 |
58275
|
k.triantaf
|
}
|
435 |
59180
|
konstantin
|
|
436 |
|
|
public updateSimilarPage($event) {
|
437 |
|
|
this.similarPage = $event.value;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
public updateSupplementaryPage($event) {
|
441 |
|
|
this.supplementaryPage = $event.value;
|
442 |
|
|
}
|
443 |
|
|
|
444 |
|
|
public updateSupplementedByPage($event) {
|
445 |
|
|
this.supplementedByPage = $event.value;
|
446 |
|
|
}
|
447 |
|
|
|
448 |
56958
|
konstantin
|
public updateOrganizationsPage($event) {
|
449 |
|
|
this.organizationsPage = $event.value;
|
450 |
|
|
}
|
451 |
59180
|
konstantin
|
|
452 |
56958
|
konstantin
|
public updateOpenCitationsPage($event) {
|
453 |
|
|
this.openCitationsPage = $event.value;
|
454 |
|
|
}
|
455 |
58064
|
k.triantaf
|
|
456 |
|
|
public accessClass(accessMode: string): string {
|
457 |
59180
|
konstantin
|
if (accessMode.toLowerCase().indexOf('open') !== -1) {
|
458 |
58064
|
k.triantaf
|
return 'open';
|
459 |
59180
|
konstantin
|
} else if (accessMode.toLowerCase() === 'not available') {
|
460 |
58064
|
k.triantaf
|
return 'unknown';
|
461 |
|
|
} else {
|
462 |
|
|
return 'closed';
|
463 |
|
|
}
|
464 |
|
|
}
|
465 |
59180
|
konstantin
|
|
466 |
56958
|
konstantin
|
public keysToArray(bioentities: Map<string, string>): string[] {
|
467 |
|
|
let keys: string[] = [];
|
468 |
|
|
bioentities.forEach(function (value, key, map) {
|
469 |
|
|
keys.push(key);
|
470 |
|
|
});
|
471 |
|
|
return keys;
|
472 |
|
|
}
|
473 |
59180
|
konstantin
|
|
474 |
56958
|
konstantin
|
public getKeys(map) {
|
475 |
|
|
return Array.from(map.keys());
|
476 |
|
|
}
|
477 |
59180
|
konstantin
|
|
478 |
56958
|
konstantin
|
public scroll() {
|
479 |
|
|
HelperFunctions.scroll();
|
480 |
|
|
}
|
481 |
59180
|
konstantin
|
|
482 |
56958
|
konstantin
|
private handleError(message: string, error) {
|
483 |
59180
|
konstantin
|
if (this.type == "publication") {
|
484 |
56958
|
konstantin
|
console.error("Publication Landing Page: " + message, error);
|
485 |
59180
|
konstantin
|
} else if (this.type == "dataset") {
|
486 |
56958
|
konstantin
|
console.error("Research Data Landing Page: " + message, error);
|
487 |
59180
|
konstantin
|
} else if (this.type == "software") {
|
488 |
56958
|
konstantin
|
console.error("Software Landing Page: " + message, error);
|
489 |
59180
|
konstantin
|
} else if (this.type == "orp") {
|
490 |
56958
|
konstantin
|
console.error("Other Research Product Landing Page: " + message, error);
|
491 |
|
|
} else {
|
492 |
|
|
console.error("Landing Page: " + message, error);
|
493 |
|
|
}
|
494 |
|
|
}
|
495 |
59180
|
konstantin
|
|
496 |
56958
|
konstantin
|
isRouteAvailable(routeToCheck: string) {
|
497 |
|
|
for (let i = 0; i < this.router.config.length; i++) {
|
498 |
|
|
let routePath: string = this.router.config[i].path;
|
499 |
|
|
if (routePath == routeToCheck) {
|
500 |
|
|
return true;
|
501 |
|
|
}
|
502 |
|
|
}
|
503 |
|
|
return false;
|
504 |
|
|
}
|
505 |
59180
|
konstantin
|
|
506 |
56958
|
konstantin
|
openDeletedByInference() {
|
507 |
57201
|
konstantin
|
this.deleteByInferenceOpened = true;
|
508 |
56958
|
konstantin
|
this.alertModalDeletedByInference.cancelButton = false;
|
509 |
|
|
this.alertModalDeletedByInference.okButton = false;
|
510 |
58275
|
k.triantaf
|
this.alertModalDeletedByInference.alertTitle = "Other versions of";
|
511 |
56958
|
konstantin
|
this.alertModalDeletedByInference.open();
|
512 |
|
|
}
|
513 |
58275
|
k.triantaf
|
|
514 |
|
|
public getResultPreview(result: RelationResult): ResultPreview {
|
515 |
|
|
return ResultPreview.relationResultConvert(result, this.relation);
|
516 |
|
|
}
|
517 |
|
|
|
518 |
59180
|
konstantin
|
updateUrlWithType() {
|
519 |
58176
|
argiro.kok
|
this.type = this.resultLandingInfo.resultType;
|
520 |
59180
|
konstantin
|
if (this.type == "publication") {
|
521 |
58176
|
argiro.kok
|
this.linkToLandingPage = this.properties.searchLinkToPublication;
|
522 |
|
|
this.linkToSearchPage = this.properties.searchLinkToPublications;
|
523 |
59180
|
konstantin
|
} else if (this.type == "dataset") {
|
524 |
58176
|
argiro.kok
|
this.linkToLandingPage = this.properties.searchLinkToDataset;
|
525 |
|
|
this.linkToSearchPage = this.properties.searchLinkToDatasets;
|
526 |
59180
|
konstantin
|
} else if (this.type == "software") {
|
527 |
58391
|
argiro.kok
|
this.linkToLandingPage = this.properties.searchLinkToSoftwareLanding;
|
528 |
|
|
this.linkToSearchPage = this.properties.searchLinkToSoftware;
|
529 |
59180
|
konstantin
|
} else if (this.type == "other") {
|
530 |
|
|
this.type = "orp";
|
531 |
58176
|
argiro.kok
|
this.linkToLandingPage = this.properties.searchLinkToOrp;
|
532 |
|
|
this.linkToSearchPage = this.properties.searchLinkToOrps;
|
533 |
|
|
}
|
534 |
|
|
this._location.go(this.linkToLandingPage + this.id);
|
535 |
|
|
}
|
536 |
58310
|
k.triantaf
|
|
537 |
|
|
public getReferenceUrl(id: Id): string {
|
538 |
59180
|
konstantin
|
if (id.type === "doi") {
|
539 |
58310
|
k.triantaf
|
return this.properties.doiURL + id.value;
|
540 |
59180
|
konstantin
|
} else if (id.type === "pmc") {
|
541 |
58310
|
k.triantaf
|
return this.properties.pmcURL + id.value;
|
542 |
59180
|
konstantin
|
} else if (id.type === "pmid") {
|
543 |
58310
|
k.triantaf
|
return this.properties.pmidURL + id.value;
|
544 |
59180
|
konstantin
|
} else if (id.type === "handle") {
|
545 |
58310
|
k.triantaf
|
return this.properties.handleURL + id.value;
|
546 |
|
|
} else {
|
547 |
59180
|
konstantin
|
return null;
|
548 |
58310
|
k.triantaf
|
}
|
549 |
|
|
}
|
550 |
|
|
|
551 |
|
|
public getReferenceIdName(id: Id): string {
|
552 |
59180
|
konstantin
|
if (id.type === "doi") {
|
553 |
58310
|
k.triantaf
|
return 'DOI'
|
554 |
59180
|
konstantin
|
} else if (id.type === "pmc") {
|
555 |
58310
|
k.triantaf
|
return 'Europe PMC'
|
556 |
59180
|
konstantin
|
} else if (id.type === "pmid") {
|
557 |
58310
|
k.triantaf
|
return 'PubMed';
|
558 |
59180
|
konstantin
|
} else if (id.type === "handle") {
|
559 |
58310
|
k.triantaf
|
return 'Handle.NET';
|
560 |
|
|
} else {
|
561 |
59180
|
konstantin
|
return null;
|
562 |
58310
|
k.triantaf
|
}
|
563 |
|
|
}
|
564 |
59180
|
konstantin
|
|
565 |
|
|
public openLinkModal() {
|
566 |
|
|
this.linkModal.cancelButton = false;
|
567 |
|
|
this.linkModal.okButton = false;
|
568 |
|
|
this.linkModal.alertTitle = "Link this " + this.getTypeName() + " to";
|
569 |
|
|
this.linkModal.open();
|
570 |
|
|
}
|
571 |
|
|
|
572 |
|
|
public openCiteModal() {
|
573 |
|
|
this.citeThisClicked = true;
|
574 |
|
|
this.citeModal.cancelButton = false;
|
575 |
|
|
this.citeModal.okButton = false;
|
576 |
|
|
this.citeModal.alertTitle = "Cite this " + this.getTypeName() + " to";
|
577 |
|
|
this.citeModal.open();
|
578 |
|
|
}
|
579 |
56958
|
konstantin
|
}
|