Revision 56925
Added by Konstantina Galouni over 4 years ago
modules/uoa-services-library/branches/mergeResultLandingPages/ng-openaire-library/src/app/landingPages/resultLanding.component.html | ||
---|---|---|
1 |
<div id="tm-main" class=" uk-section uk-padding-remove-top uk-margin-small-top tm-middle"> |
|
2 |
<div uk-grid > |
|
3 |
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first "> |
|
4 |
<div class="uk-container publication"> |
|
5 |
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-margin-large-top" |
|
6 |
role="alert">{{warningMessage}}</div> |
|
7 |
<div *ngIf="errorMessage.length > 0" class="uk-alert uk-alert-danger uk-margin-large-top" |
|
8 |
role="alert">{{errorMessage}}</div> |
|
9 |
<div [style.display]="showLoading ? 'inline' : 'none'" |
|
10 |
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><span |
|
11 |
class="loading-gif uk-align-center"></span></div> |
|
12 |
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" |
|
13 |
[texts]="pageContents['top']"></helper> |
|
14 |
<div *ngIf="resultLandingInfo != null" class="uk-grid"> |
|
15 |
|
|
16 |
<div class="uk-width-2-3@m uk-width-1-1@s uk-margin-bottom"> |
|
17 |
<schema2jsonld *ngIf="resultLandingInfo.record" [data]=resultLandingInfo.record |
|
18 |
[URL]="properties.baseLink+linkToLandingPage+id"></schema2jsonld> |
|
19 |
<showTitle [titleName]="resultLandingInfo.title"></showTitle> |
|
20 |
<p class="uk-text-large" *ngIf="resultLandingInfo.subtitle"> |
|
21 |
<span [innerHTML]="resultLandingInfo.subtitle"></span> |
|
22 |
</p> |
|
23 |
<span *ngIf="resultLandingInfo.types && resultLandingInfo.types.length > 0" |
|
24 |
class="uk-label custom-label label-blue label-publication" |
|
25 |
title="Type">{{resultLandingInfo.types.join(", ")}}</span>{{" "}} |
|
26 |
<span *ngIf="resultLandingInfo.programmingLanguages && resultLandingInfo.programmingLanguages.length > 0" |
|
27 |
class="uk-label custom-label label-progrLanguage " |
|
28 |
title="Programming Language">{{resultLandingInfo.programmingLanguages.join(", ")}}</span>{{" "}} |
|
29 |
<span *ngIf="resultLandingInfo.languages && resultLandingInfo.languages.length > 0" |
|
30 |
class="uk-label custom-label label-language " |
|
31 |
title="Language">{{resultLandingInfo.languages.join(", ")}}</span>{{" "}} |
|
32 |
<span *ngIf="resultLandingInfo.countries && resultLandingInfo.countries.length > 0" |
|
33 |
class="uk-label custom-label label-country " |
|
34 |
title="Country">{{resultLandingInfo.countries.join(", ")}}</span>{{" "}} |
|
35 |
<!-- <span *ngIf="resultLandingInfo.title && resultLandingInfo.title.accessMode" [class]="'uk-label custom-label label-'+ resultLandingInfo.title.accessMode ">{{resultLandingInfo.title.accessMode}}</span> --> |
|
36 |
<span *ngIf="resultLandingInfo.accessMode" |
|
37 |
[class]="'uk-label custom-label label-'+ resultLandingInfo.accessMode " |
|
38 |
title="Access Mode">{{resultLandingInfo.accessMode}}</span>{{" "}} |
|
39 |
|
|
40 |
<span *ngIf="resultLandingInfo.underCurationMessage" class="uk-label custom-label label-underCuration"> |
|
41 |
<span uk-tooltip="pos:right; delay:10" |
|
42 |
title="{{buildCurationTooltip()}}"> |
|
43 |
<i>Record in preview</i> |
|
44 |
<i class="uk-icon-info-circle"></i> |
|
45 |
</span></span>{{" "}} |
|
46 |
|
|
47 |
|
|
48 |
<div class=" uk-margin-top"> |
|
49 |
<showAuthors [authors]="resultLandingInfo.authors"></showAuthors> |
|
50 |
<span *ngIf="resultLandingInfo.date != ''">({{resultLandingInfo.date}})</span> |
|
51 |
</div> |
|
52 |
|
|
53 |
<ul class="uk-list"> |
|
54 |
<showPublisher [publisher]="resultLandingInfo.publisher" |
|
55 |
[journal]="resultLandingInfo.journal" [properties]="properties"></showPublisher> |
|
56 |
<li *ngIf="resultLandingInfo.embargoEndDate"><span |
|
57 |
class="uk-text-bold">Embargo end date:</span> {{resultLandingInfo.embargoEndDate}}</li> |
|
58 |
<li *ngIf="resultLandingInfo.identifiers && resultLandingInfo.identifiers.size > 0"> |
|
59 |
<showIdentifiers [identifiers]="resultLandingInfo.identifiers"></showIdentifiers> |
|
60 |
</li> |
|
61 |
<li |
|
62 |
*ngIf="resultLandingInfo"> |
|
63 |
<showSubjects [subjects]="resultLandingInfo.subjects" |
|
64 |
[otherSubjects]="resultLandingInfo.otherSubjects" |
|
65 |
[classifiedSubjects]="resultLandingInfo.classifiedSubjects"> |
|
66 |
</showSubjects> |
|
67 |
</li> |
|
68 |
</ul> |
|
69 |
<hr *ngIf="resultLandingInfo.description"> |
|
70 |
<div *ngIf="resultLandingInfo.description" |
|
71 |
class="uk-text-justify descriptionText uk-height-max-medium uk-overflow-auto"> |
|
72 |
<span>{{resultLandingInfo.description.substring(0, showNumDescription)}}</span |
|
73 |
><span |
|
74 |
*ngIf="showNumDescription == thresholdDescription && resultLandingInfo.description.length > thresholdDescription">...</span |
|
75 |
><span |
|
76 |
*ngIf="showNumDescription == thresholdDescription && resultLandingInfo.description.length > thresholdDescription" |
|
77 |
class="uk-text-right"> |
|
78 |
<a (click)="showNumDescription = resultLandingInfo.description.length;"> |
|
79 |
View more |
|
80 |
</a> |
|
81 |
</span> |
|
82 |
</div> |
|
83 |
<div *ngIf="resultLandingInfo.description && showNumDescription > thresholdDescription" |
|
84 |
class="uk-width-1-1 uk-text-right"> |
|
85 |
<!-- scroll() --> |
|
86 |
<a (click)="showNumDescription = thresholdDescription;"> |
|
87 |
View less |
|
88 |
</a> |
|
89 |
</div> |
|
90 |
|
|
91 |
|
|
92 |
<ul class="custom-accordion" uk-accordion> |
|
93 |
|
|
94 |
<li *ngIf="resultLandingInfo.references" (click)="activeTab='References'"> |
|
95 |
<a class="uk-accordion-title" href="#"> |
|
96 |
References |
|
97 |
({{resultLandingInfo.references.length | number}}) |
|
98 |
</a> |
|
99 |
<div class="uk-accordion-content"> |
|
100 |
<div> |
|
101 |
<div *ngIf="resultLandingInfo.references.length > pageSize" class="uk-margin-bottom"> |
|
102 |
<span class="uk-h6">{{resultLandingInfo.references.length | number}} |
|
103 |
references, page {{referencesPage | number}} |
|
104 |
of {{totalPages(resultLandingInfo.references.length) | number}}</span> |
|
105 |
<paging-no-load class="uk-float-right" [currentPage]="referencesPage" |
|
106 |
[totalResults]="resultLandingInfo.references.length" [size]="pageSize" |
|
107 |
(pageChange)="updateReferencesPage($event)"></paging-no-load> |
|
108 |
</div> |
|
109 |
|
|
110 |
<div |
|
111 |
*ngFor="let item of resultLandingInfo.references.slice((referencesPage-1)*pageSize, referencesPage*pageSize)"> |
|
112 |
<p *ngIf=" item && item['url']" |
|
113 |
class="custom-external custom-icon"> |
|
114 |
<a href="{{item['url']}}" target="_blank"> |
|
115 |
{{item['name']}} |
|
116 |
</a> |
|
117 |
</p> |
|
118 |
<p *ngIf="!item['url']" class="pseudo-external custom-icon"> |
|
119 |
{{item['name']}} |
|
120 |
</p> |
|
121 |
</div> |
|
122 |
</div> |
|
123 |
</div> |
|
124 |
</li> |
|
125 |
|
|
126 |
<li *ngIf="resultLandingInfo.relatedResearchResults" (click)="activeTab='Related Research Results'"> |
|
127 |
<a class="uk-accordion-title" href="#"> |
|
128 |
Related Research Results |
|
129 |
({{relatedResearchResultsNum | number}}) |
|
130 |
</a> |
|
131 |
<div class="uk-accordion-content"> |
|
132 |
<div> |
|
133 |
<div *ngFor="let provenanceaction of getKeys(resultLandingInfo.relatedResearchResults)"> |
|
134 |
<div class="uk-text-large">{{provenanceaction}}</div> |
|
135 |
|
|
136 |
<tabTable percentageName="trust" |
|
137 |
[info]="resultLandingInfo.relatedResearchResults.get(provenanceaction)" |
|
138 |
[properties]=properties></tabTable> |
|
139 |
</div> |
|
140 |
</div> |
|
141 |
</div> |
|
142 |
</li> |
|
143 |
|
|
144 |
<li *ngIf="resultLandingInfo.similarResearchResults" (click)="activeTab='Similar Research Results'"> |
|
145 |
<a class="uk-accordion-title" href="#"> |
|
146 |
Similar Research Results |
|
147 |
({{resultLandingInfo.similarResearchResults.length | number}}) |
|
148 |
</a> |
|
149 |
<div class="uk-accordion-content"> |
|
150 |
<div> |
|
151 |
<tabTable percentageName="similarity" [info]="resultLandingInfo.similarResearchResults" |
|
152 |
[properties]=properties></tabTable> |
|
153 |
</div> |
|
154 |
</div> |
|
155 |
</li> |
|
156 |
|
|
157 |
<li *ngIf="resultLandingInfo.organizations" (click)="activeTab='Related Organizations'"> |
|
158 |
<a class="uk-accordion-title" href="#"> |
|
159 |
Related Organizations |
|
160 |
({{resultLandingInfo.organizations.length | number}}) |
|
161 |
</a> |
|
162 |
<div class="uk-accordion-content"> |
|
163 |
<div> |
|
164 |
<div *ngIf="resultLandingInfo.organizations.length > pageSize" class="uk-margin-bottom"> |
|
165 |
<span class="uk-text-bold">{{resultLandingInfo.organizations.length | number}} |
|
166 |
organizations, page {{organizationsPage | number}} |
|
167 |
of {{totalPages(resultLandingInfo.organizations.length) | number}}</span> |
|
168 |
<paging-no-load class="uk-float-right" [currentPage]="organizationsPage" |
|
169 |
[totalResults]="resultLandingInfo.organizations.length" [size]="pageSize" |
|
170 |
(pageChange)="updateOrganizationsPage($event)"></paging-no-load> |
|
171 |
</div> |
|
172 |
|
|
173 |
<table class="uk-table uk-table-small uk-table-divider uk-table-middle "> |
|
174 |
<tbody> |
|
175 |
<tr |
|
176 |
*ngFor="let organization of resultLandingInfo.organizations.slice((organizationsPage-1)*pageSize, organizationsPage*pageSize)"> |
|
177 |
<td> |
|
178 |
<a *ngIf="(organization['id']) && ((organization['name']) || (organization['shortname']))" |
|
179 |
[queryParams]="{organizationId: organization.id}" routerLinkActive="router-link-active" |
|
180 |
routerLink="/search/organization"> |
|
181 |
{{organization['name']}} |
|
182 |
<span *ngIf="organization.name && organization.shortname"> ( </span> |
|
183 |
<span *ngIf="organization.shortname">{{organization.shortname}}</span> |
|
184 |
<span *ngIf="organization.name && organization.shortname"> ) </span> |
|
185 |
</a> |
|
186 |
<p *ngIf="(!organization['id']) && ((organization['name']) || (organization['shortname']))"> |
|
187 |
{{organization['name']}} |
|
188 |
<span *ngIf="organization.name && organization.shortname"> ( </span> |
|
189 |
<span *ngIf="organization.shortname">{{organization.shortname}}</span> |
|
190 |
<span *ngIf="organization.name && organization.shortname"> ) </span> |
|
191 |
</p> |
|
192 |
<div *ngIf="organization.country">{{organization.country}}</div> |
|
193 |
<div *ngIf="organization.websiteUrl">Website url: |
|
194 |
<a href="{{organization.websiteUrl}}" target="_blank">{{organization.websiteUrl}}</a> |
|
195 |
</div> |
|
196 |
</td> |
|
197 |
<td> |
|
198 |
<div *ngIf="organization['trust']" title="{{organization['trust']}}%"> |
|
199 |
<div class="uk-text-center">{{organization['trust']}}%</div> |
|
200 |
<progress class="uk-progress uk-margin-remove" value="{{organization['trust']}}" |
|
201 |
max="100"></progress> |
|
202 |
</div> |
|
203 |
<div *ngIf="!organization['trust']"> |
|
204 |
<p>no trust available</p> |
|
205 |
</div> |
|
206 |
</td> |
|
207 |
</tr> |
|
208 |
</tbody> |
|
209 |
</table> |
|
210 |
|
|
211 |
</div> |
|
212 |
</div> |
|
213 |
</li> |
|
214 |
|
|
215 |
<li *ngIf="resultLandingInfo.bioentities" (click)="activeTab='Bioentities'"> |
|
216 |
<a class="uk-accordion-title" href="#"> |
|
217 |
Bioentities |
|
218 |
({{bioentitiesNum | number}}) |
|
219 |
</a> |
|
220 |
<div class="uk-accordion-content"> |
|
221 |
<div *ngIf="resultLandingInfo.bioentities && bioentitiesNum > pageSize" class="uk-margin-bottom"> |
|
222 |
<span class="uk-text-bold"> {{bioentitiesNum | number}} |
|
223 |
bioentities, page {{bioentitiesPage | number}} of {{totalPages(bioentitiesNum) | number}}</span> |
|
224 |
<paging-no-load class="uk-float-right" [currentPage]="bioentitiesPage" |
|
225 |
[totalResults]="bioentitiesNum" [size]="pageSize" |
|
226 |
(pageChange)="updateBioentitiesPage($event)"></paging-no-load> |
|
227 |
</div> |
|
228 |
|
|
229 |
<table id="bioentitiesTable" class="uk-table "> |
|
230 |
<tbody> |
|
231 |
<ng-container *ngFor="let key of getKeys(resultLandingInfo.bioentities) let i=index"> |
|
232 |
<tr |
|
233 |
*ngFor="let keyIn of keysToArray(resultLandingInfo.bioentities.get(key)).slice((bioentitiesPage-1)*pageSize, bioentitiesPage*pageSize)"> |
|
234 |
<td class="uk-text-center" *ngIf="keyIn"> |
|
235 |
<span class="custom-external custom-icon"> |
|
236 |
<a href="{{resultLandingInfo.bioentities.get(key).get(keyIn)}}" |
|
237 |
target="_blank"> |
|
238 |
{{keyIn}} |
|
239 |
</a> |
|
240 |
</span> |
|
241 |
</td> |
|
242 |
<td class="uk-text-center"> |
|
243 |
{{key}} |
|
244 |
</td> |
|
245 |
</tr> |
|
246 |
</ng-container> |
|
247 |
</tbody> |
|
248 |
</table> |
|
249 |
</div> |
|
250 |
</li> |
|
251 |
|
|
252 |
<li *ngIf="resultLandingInfo.software" (click)="activeTab='Software'"> |
|
253 |
<a class="uk-accordion-title" href="#"> |
|
254 |
Software |
|
255 |
({{resultLandingInfo.software.length | number}}) |
|
256 |
</a> |
|
257 |
<div class="uk-accordion-content"> |
|
258 |
<div *ngIf="resultLandingInfo.software && resultLandingInfo.software.length > pageSize" |
|
259 |
class="uk-margin-bottom"> |
|
260 |
<span class="uk-text-bold">{{resultLandingInfo.software.length | number}} |
|
261 |
software results, page {{softwarePage | number}} |
|
262 |
of {{totalPages(resultLandingInfo.software.length) | number}}</span> |
|
263 |
<paging-no-load class="uk-float-right" [currentPage]="softwarePage" |
|
264 |
[totalResults]="resultLandingInfo.software.length" [size]="pageSize" |
|
265 |
(pageChange)="updateSoftwarePage($event)"></paging-no-load> |
|
266 |
</div> |
|
267 |
|
|
268 |
<table id="softwareTable" class="uk-table "> |
|
269 |
<tbody> |
|
270 |
<tr |
|
271 |
*ngFor="let item of resultLandingInfo.software.slice((softwarePage-1)*pageSize, softwarePage*pageSize)" |
|
272 |
class="uk-text-center"> |
|
273 |
<td> |
|
274 |
<span class="custom-external custom-icon"> |
|
275 |
<a href="{{item.url}}" target="_blank"> |
|
276 |
{{item.name}} |
|
277 |
</a> |
|
278 |
</span> |
|
279 |
</td> |
|
280 |
</tr> |
|
281 |
</tbody> |
|
282 |
</table> |
|
283 |
</div> |
|
284 |
</li> |
|
285 |
|
|
286 |
<li (click)="activeTab='Other Citations'" |
|
287 |
*ngIf="resultLandingInfo.openCitations && resultLandingInfo.openCitations.length > 0"> |
|
288 |
<a class="uk-accordion-title" href="#"> |
|
289 |
Open Citations |
|
290 |
({{resultLandingInfo.openCitations.length | number}}) |
|
291 |
</a> |
|
292 |
<div class="uk-accordion-content"> |
|
293 |
<div *ngIf="resultLandingInfo.openCitations.length > pageSize" class="uk-margin-bottom"> |
|
294 |
<span class="uk-h6">{{resultLandingInfo.openCitations.length | number}} |
|
295 |
open citations, page {{openCitationsPage | number}} |
|
296 |
of {{totalPages(resultLandingInfo.openCitations.length) | number}}</span> |
|
297 |
<paging-no-load class="uk-float-right" [currentPage]="openCitationsPage" |
|
298 |
[totalResults]="resultLandingInfo.openCitations.length" [size]="pageSize" |
|
299 |
(pageChange)="updateOpenCitationsPage($event)"></paging-no-load> |
|
300 |
</div> |
|
301 |
|
|
302 |
<ul class="uk-list uk-list-divider uk-margin"> |
|
303 |
<li |
|
304 |
*ngFor="let result of resultLandingInfo.openCitations.slice((openCitationsPage-1)*pageSize, openCitationsPage*pageSize)"> |
|
305 |
<h5 *ngIf="result.title"> |
|
306 |
<span *ngIf="result.url" |
|
307 |
class="custom-external"> |
|
308 |
|
|
309 |
<a *ngIf="result.title" href="{{result.url}}" target="_blank" |
|
310 |
[innerHTML]="result.title"> |
|
311 |
</a> |
|
312 |
<a *ngIf="!result.title" href="{{result.url}}" target="_blank"> |
|
313 |
[no title available] |
|
314 |
</a> |
|
315 |
</span> |
|
316 |
<span *ngIf="result.title && !result.url" [innerHTML]="result.title"></span> |
|
317 |
<span *ngIf="!result.title && !result.url"> |
|
318 |
[no title available] |
|
319 |
</span> |
|
320 |
</h5> |
|
321 |
|
|
322 |
<div> |
|
323 |
<span *ngIf="result['authors']"> |
|
324 |
<span *ngFor="let author of result['authors'].slice(0,15)"> |
|
325 |
{{author}}; |
|
326 |
</span> |
|
327 |
<span *ngIf="result['authors'].length > 15">...</span> |
|
328 |
</span> |
|
329 |
<span *ngIf="result.year"> |
|
330 |
({{result.year}}) |
|
331 |
</span> |
|
332 |
</div> |
|
333 |
<span *ngIf="result.doi">Identifier: <a *ngIf="result.doi" target="_blank" |
|
334 |
class="custom-external custom-icon" |
|
335 |
href="{{doiURL}}{{result.doi}}">doi: {{result.doi}}</a></span> |
|
336 |
</li> |
|
337 |
</ul> |
|
338 |
</div> |
|
339 |
</li> |
|
340 |
|
|
341 |
<li (click)="metricsClicked=true; activeTab='Metrics'"> |
|
342 |
<a class="uk-accordion-title" href="#"> |
|
343 |
Metrics |
|
344 |
</a> |
|
345 |
<div class="uk-accordion-content"> |
|
346 |
<metrics [pageViews]="pageViews" |
|
347 |
[id]="id" [entityType]="'results'" [entity]="title" |
|
348 |
(metricsResults)="metricsResults($event)" [properties]=properties> |
|
349 |
</metrics> |
|
350 |
<i-frame *ngIf="metricsClicked && totalViews>0" |
|
351 |
[url]=viewsFrameUrl width="100%" height="250"> |
|
352 |
</i-frame> |
|
353 |
<i-frame *ngIf="metricsClicked && totalDownloads>0" |
|
354 |
[url]=downloadsFrameUrl width="100%" height="250"> |
|
355 |
</i-frame> |
|
356 |
</div> |
|
357 |
</li> |
|
358 |
|
|
359 |
<li (click)="activeTab='Other Versions'" |
|
360 |
*ngIf="properties.environment != 'production' && resultLandingInfo.deletedByInferenceIds"> |
|
361 |
<a class="uk-accordion-title" href="#"> |
|
362 |
Other Versions |
|
363 |
({{resultLandingInfo.deletedByInferenceIds.length | number}}) |
|
364 |
</a> |
|
365 |
<div *ngIf="activeTab=='Other Versions'" class="uk-accordion-content"> |
|
366 |
<deletedByInference *ngIf="type == 'publication'" |
|
367 |
[id]="id" [ids]="resultLandingInfo.deletedByInferenceIds" [type]="'publications'"></deletedByInference> |
|
368 |
<deletedByInference *ngIf="type == 'dataset'" |
|
369 |
[id]="id" [ids]="resultLandingInfo.deletedByInferenceIds" [type]="'research data'"></deletedByInference> |
|
370 |
<deletedByInference *ngIf="type == 'software'" |
|
371 |
[id]="id" [ids]="resultLandingInfo.deletedByInferenceIds" [type]="'software'"></deletedByInference> |
|
372 |
<deletedByInference *ngIf="type == 'orp'" |
|
373 |
[id]="id" [ids]="resultLandingInfo.deletedByInferenceIds" [type]="'other research products'"></deletedByInference> |
|
374 |
</div> |
|
375 |
</li> |
|
376 |
</ul> |
|
377 |
|
|
378 |
</div> |
|
379 |
|
|
380 |
<div class="uk-width-1-3@m uk-width-1-1@s"> |
|
381 |
<div *ngIf="isRouteAvailable('participate/direct-claim') " class=" uk-padding-small"> |
|
382 |
<button class=" uk-button portal-button uk-width-1-1 "> |
|
383 |
<span class="uk-icon"> |
|
384 |
<svg icon="link" ratio="1" xmlns="http://www.w3.org/2000/svg" width="25" viewBox="0 0 20 20" |
|
385 |
height="25"><path |
|
386 |
d="M10.625,12.375 L7.525,15.475 C6.825,16.175 5.925,16.175 5.225,15.475 L4.525,14.775 C3.825,14.074 3.825,13.175 4.525,12.475 L7.625,9.375" |
|
387 |
fill="none" stroke="#000" stroke-width="1.1"></path><path |
|
388 |
d="M9.325,7.375 L12.425,4.275 C13.125,3.575 14.025,3.575 14.724,4.275 L15.425,4.975 C16.125,5.675 16.125,6.575 15.425,7.275 L12.325,10.375" |
|
389 |
fill="none" stroke="#000" stroke-width="1.1"></path><path d="M7.925,11.875 L11.925,7.975" |
|
390 |
fill="none" stroke="#000" |
|
391 |
stroke-width="1.1"></path></svg> |
|
392 |
</span> |
|
393 |
Link this {{type.toLowerCase()}} to... |
|
394 |
</button> |
|
395 |
|
|
396 |
<div class=" uk-text-center uk-margin-expand uk-padding-small uk-margin-auto default-dropdown " |
|
397 |
uk-dropdown="mode:click"> |
|
398 |
<div class="uk-grid uk-child-width-1-3 uk-width-large "> |
|
399 |
<div><a |
|
400 |
[queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[id,type,'project'])" |
|
401 |
routerLinkActive="router-link-active" routerLink="/participate/direct-claim" |
|
402 |
> |
|
403 |
<button class="uk-icon-button portal-button"> |
|
404 |
<span class="uk-icon"> |
|
405 |
<svg height="20" icon="album" ratio="1" viewBox="0 0 20 20" width="20" |
|
406 |
xmlns="http://www.w3.org/2000/svg"><rect height="1" width="10" x="5" y="2"></rect><rect |
|
407 |
height="1" width="14" x="3" y="4"></rect><rect fill="none" height="11" stroke="#000" |
|
408 |
width="17" x="1.5" y="6.5"></rect></svg></span> |
|
409 |
</button> |
|
410 |
<div>Projects</div> |
|
411 |
</a></div> |
|
412 |
<div><a |
|
413 |
[queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[id,type,'result'])" |
|
414 |
routerLinkActive="router-link-active" routerLink="/participate/direct-claim"> |
|
415 |
<button class="uk-icon-button portal-button"> |
|
416 |
<span class="uk-icon"> |
|
417 |
<svg height="20" icon="copy" ratio="1" viewBox="0 0 20 20" width="20" |
|
418 |
xmlns="http://www.w3.org/2000/svg"><rect fill="none" height="16" stroke="#000" |
|
419 |
width="12" x="3.5" y="2.5"></rect><polyline |
|
420 |
fill="none" points="5 0.5 17.5 0.5 17.5 17" stroke="#000"></polyline></svg></span> |
|
421 |
</button> |
|
422 |
<div>Research results</div> |
|
423 |
</a></div> |
|
424 |
<div><a |
|
425 |
[queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[id,type,'context'])" |
|
426 |
routerLinkActive="router-link-active" routerLink="/participate/direct-claim"> |
|
427 |
<button class="uk-icon-button portal-button"> |
|
428 |
<span class="uk-icon"> |
|
429 |
<svg height="20" icon="users" ratio="1" viewBox="0 0 20 20" width="20" |
|
430 |
xmlns="http://www.w3.org/2000/svg"><circle cx="7.7" cy="8.6" fill="none" r="3.5" |
|
431 |
stroke="#000" stroke-width="1.1"></circle><path |
|
432 |
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3" fill="none" |
|
433 |
stroke="#000" stroke-width="1.1"></path><path |
|
434 |
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1" |
|
435 |
fill="none" stroke="#000" stroke-width="1.1"></path></svg></span> |
|
436 |
</button> |
|
437 |
<div>Communities</div> |
|
438 |
</a></div> |
|
439 |
</div> |
|
440 |
</div> |
|
441 |
</div> |
|
442 |
<div> |
|
443 |
<div class="sideInfoTitle uk-margin-small-bottom uk-margin-small-top">Share - Bookmark</div> |
|
444 |
<addThis></addThis> |
|
445 |
</div> |
|
446 |
<altmetrics *ngIf="resultLandingInfo.identifiers && resultLandingInfo.identifiers.get('doi')" |
|
447 |
id="{{resultLandingInfo.identifiers.get('doi')[0]}}" type="doi"> |
|
448 |
</altmetrics> |
|
449 |
<ul class="uk-list uk-margin-remove-bottom"> |
|
450 |
|
|
451 |
<li *ngIf="resultLandingInfo.hostedBy_collectedFrom && resultLandingInfo.hostedBy_collectedFrom.length > 0"> |
|
452 |
<availableOn [availableOn]="resultLandingInfo.hostedBy_collectedFrom"></availableOn> |
|
453 |
</li> |
|
454 |
<li |
|
455 |
*ngIf="resultLandingInfo.fundedByProjects != undefined && resultLandingInfo.fundedByProjects.length > 0"> |
|
456 |
<fundedBy [fundedByProjects]="resultLandingInfo.fundedByProjects"></fundedBy> |
|
457 |
</li> |
|
458 |
|
|
459 |
<li *ngIf="resultLandingInfo.contexts && resultLandingInfo.contexts.length >0 "> |
|
460 |
<dl class="uk-description-list-line"> |
|
461 |
<dt class="sideInfoTitle">Related to</dt> |
|
462 |
<dd class="line" *ngFor="let item of resultLandingInfo.contexts"> |
|
463 |
<span *ngIf="!item['inline']"> |
|
464 |
<span>{{item['labelContext']}}</span> |
|
465 |
<span *ngIf="item['labelCategory']">-> {{item['labelCategory']}}</span> |
|
466 |
<span *ngIf="item['labelConcept']">: {{item['labelConcept']}}</span> |
|
467 |
</span> |
|
468 |
<mark *ngIf="item['inline']"> |
|
469 |
<span>{{item['labelContext']}}</span> |
|
470 |
<span *ngIf="item['labelCategory']">-> {{item['labelCategory']}}</span> |
|
471 |
<span *ngIf="item['labelConcept']">: {{item['labelConcept']}}</span> |
|
472 |
</mark> |
|
473 |
</dd> |
|
474 |
</dl> |
|
475 |
|
|
476 |
</li> |
|
477 |
<!-- <li>--> |
|
478 |
<!-- <metrics [pageViews]="pageViews" shortView=true--> |
|
479 |
<!-- [id]="id" [entityType]="'results'" [entity]="'Publication'"--> |
|
480 |
<!-- (metricsResults)="metricsResults($event)" [(properties)] = properties>--> |
|
481 |
<!-- </metrics>--> |
|
482 |
<!-- </li>--> |
|
483 |
<li> |
|
484 |
<div class=" sideInfoTitle cite-this-button uk-width-1-1" type="button"> |
|
485 |
Cite this {{type.toLowerCase()}} |
|
486 |
</div> |
|
487 |
<div class=" "> |
|
488 |
<citeThis [result]="resultLandingInfo" [id]="id" [type]="type.toLowerCase()"></citeThis> |
|
489 |
</div> |
|
490 |
</li> |
|
491 |
</ul> |
|
492 |
</div> |
|
493 |
</div> |
|
494 |
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" |
|
495 |
[texts]="pageContents['bottom']"></helper> |
|
496 |
</div> |
|
497 |
|
|
498 |
</div> |
|
499 |
|
|
500 |
</div> |
|
501 |
</div> |
|
502 |
|
|
503 |
|
modules/uoa-services-library/branches/mergeResultLandingPages/ng-openaire-library/src/app/landingPages/resultLanding.service.ts | ||
---|---|---|
1 |
import {Injectable} from '@angular/core'; |
|
2 |
import {HttpClient, HttpErrorResponse} from "@angular/common/http"; |
|
3 |
import {throwError} from 'rxjs'; |
|
4 |
import {ResultLandingInfo} from '../utils/entities/resultLandingInfo'; |
|
5 |
import {EnvProperties} from '../utils/properties/env-properties'; |
|
6 |
import {ParsingFunctions} from './landing-utils/parsingFunctions.class'; |
|
7 |
import {map} from "rxjs/operators"; |
|
8 |
|
|
9 |
@Injectable() |
|
10 |
export class ResultLandingService { |
|
11 |
|
|
12 |
constructor(private http: HttpClient ) { |
|
13 |
this.parsingFunctions = new ParsingFunctions(); |
|
14 |
} |
|
15 |
|
|
16 |
public parsingFunctions: ParsingFunctions; |
|
17 |
resultLandingInfo: ResultLandingInfo; |
|
18 |
|
|
19 |
getResultLandingInfo (id: string, type: string, properties: EnvProperties): any { |
|
20 |
let url = properties.searchAPIURLLAst; |
|
21 |
if (type === 'publication') { |
|
22 |
url += 'publications/'; |
|
23 |
} else if (type === 'dataset') { |
|
24 |
url += 'datasets/'; |
|
25 |
} else if (type === 'software') { |
|
26 |
url += 'software/'; |
|
27 |
} else if (type === 'orp') { |
|
28 |
url += 'other/'; |
|
29 |
} |
|
30 |
url += id + '?format=json'; |
|
31 |
|
|
32 |
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) |
|
33 |
.pipe(map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity'], res])) |
|
34 |
.pipe(map(res => [ |
|
35 |
res[1]['oaf:result'], // 0 |
|
36 |
res[1]['oaf:result']['title'], // 1 |
|
37 |
res[1]['oaf:result']['rels']['rel'], // 2 |
|
38 |
res[1]['oaf:result']['children'], // 3 |
|
39 |
res[1]['oaf:result']['pid'], // 4 |
|
40 |
res[1]['oaf:result']['journal'], // 5 |
|
41 |
res[1]['oaf:result']['language'], // 6 |
|
42 |
res[1]['oaf:result']['subject'], // 7 |
|
43 |
res[1]['oaf:result']['context'], // 8 |
|
44 |
res[1]['oaf:result']['creator'], // 9 |
|
45 |
res[1]['oaf:result']['country'] , // 10 |
|
46 |
res[1]['oaf:result']['programmingLanguage'], // 11 - software |
|
47 |
//res[1]['oaf:result']['resulttype'], |
|
48 |
(res[1]['extraInfo'] !== undefined && res[1]['extraInfo']['citations'] !== undefined) |
|
49 |
? res[1]['extraInfo']['citations']['citation'] : null, // 12 |
|
50 |
res[0], // 13 |
|
51 |
res[2] // 14 |
|
52 |
])) |
|
53 |
.pipe(map(res => this.parseResultLandingInfo(res, properties))); |
|
54 |
} |
|
55 |
|
|
56 |
private handleError (error: HttpErrorResponse) { |
|
57 |
// in a real world app, we may send the error to some remote logging infrastructure |
|
58 |
// instead of just logging it to the console |
|
59 |
console.log(error); |
|
60 |
return throwError(error || 'Server error'); |
|
61 |
} |
|
62 |
|
|
63 |
parseResultLandingInfo (data: any, properties: EnvProperties): any { |
|
64 |
this.resultLandingInfo = new ResultLandingInfo(); |
|
65 |
|
|
66 |
// res |
|
67 |
this.resultLandingInfo.record = data[14]; |
|
68 |
|
|
69 |
// res['result']['metadata']['oaf:entity']['oaf:result'] |
|
70 |
if (data[0] != null) { |
|
71 |
let date: string = (data[0].dateofacceptance) + ''; // transform to string in case it is an integer |
|
72 |
this.resultLandingInfo.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; |
|
73 |
this.resultLandingInfo.dateofacceptance = data[0].dateofacceptance; |
|
74 |
this.resultLandingInfo.publisher = data[0].publisher; |
|
75 |
if(!Array.isArray(data[0].description)) { |
|
76 |
this.resultLandingInfo.description = String(data[0].description); |
|
77 |
} else { |
|
78 |
this.resultLandingInfo.description = String(data[0].description[0]); |
|
79 |
} |
|
80 |
this.resultLandingInfo.embargoEndDate = data[0].embargoenddate; |
|
81 |
} |
|
82 |
|
|
83 |
if(data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classid")) { |
|
84 |
this.resultLandingInfo.accessMode = data[0]['bestaccessright'].classid; |
|
85 |
} |
|
86 |
|
|
87 |
// res['result']['metadata']['oaf:entity']['oaf:result']['title'] |
|
88 |
if(data[1] != null) { |
|
89 |
if(Array.isArray(data[1])) { |
|
90 |
this.resultLandingInfo.title = String(data[1][0].content); |
|
91 |
if(data[1][1].classid === 'subtitle') { |
|
92 |
this.resultLandingInfo.subtitle = String(data[1][1].content); |
|
93 |
} |
|
94 |
} else { |
|
95 |
this.resultLandingInfo.title = String(data[1].content); |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
99 |
// res['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel'] |
|
100 |
if(data[2] != null) { |
|
101 |
let relation; |
|
102 |
let length = Array.isArray(data[2]) ? data[2].length : 1; |
|
103 |
|
|
104 |
for(let i=0; i<length; i++) { |
|
105 |
relation = Array.isArray(data[2]) ? data[2][i] : data[2]; |
|
106 |
if(relation.hasOwnProperty("to")) { |
|
107 |
if(relation['to'].class == "isProducedBy") { |
|
108 |
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation, this.resultLandingInfo.projectsProvenanceVocabulary); |
|
109 |
} else if(relation['to'].class == "isRelatedTo") { |
|
110 |
let provenanceAction: string; |
|
111 |
if(relation.provenanceaction in this.resultLandingInfo.researchResultsProvenanceVocabulary) { |
|
112 |
provenanceAction = this.resultLandingInfo.researchResultsProvenanceVocabulary[relation.provenanceaction]; |
|
113 |
} else { |
|
114 |
provenanceAction = "Other"; |
|
115 |
} |
|
116 |
|
|
117 |
this.resultLandingInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.resultLandingInfo.relatedResearchResults, relation, provenanceAction); |
|
118 |
} else if(relation['to'].class == "hasAmongTopNSimilarDocuments") { |
|
119 |
this.resultLandingInfo.similarResearchResults = this.parsingFunctions.parseSimilarResearchResults(this.resultLandingInfo.similarResearchResults, relation); |
|
120 |
} else if(relation['to'].class == "hasAuthorInstitution") { |
|
121 |
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation); |
|
122 |
} |
|
123 |
} |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
// res['result']['metadata']['oaf:entity']['oaf:result']['children'] |
|
128 |
if(data[3] != null) { |
|
129 |
if(data[3].hasOwnProperty("result")) { |
|
130 |
this.resultLandingInfo.deletedByInferenceIds = []; |
|
131 |
let length = Array.isArray(data[3]['result']) ? data[3]['result'].length : 1; |
|
132 |
|
|
133 |
for(let i=0; i<length; i++) { |
|
134 |
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result']; |
|
135 |
this.resultLandingInfo.deletedByInferenceIds.push(result.objidentifier); |
|
136 |
} |
|
137 |
|
|
138 |
} |
|
139 |
|
|
140 |
if(data[3].hasOwnProperty("instance")) { |
|
141 |
this.resultLandingInfo.hostedBy_collectedFrom = new Array<{"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}>(); |
|
142 |
|
|
143 |
|
|
144 |
this.resultLandingInfo.types = new Array<string>(); |
|
145 |
let types = new Set<string>(); |
|
146 |
|
|
147 |
let counter = 0; |
|
148 |
let instance; |
|
149 |
|
|
150 |
let length = Array.isArray(data[3]['instance']) ? data[3]['instance'].length : 1; |
|
151 |
|
|
152 |
for(let i=0; i<length; i++) { |
|
153 |
instance = Array.isArray(data[3]['instance']) ? data[3]['instance'][i] : data[3]['instance']; |
|
154 |
|
|
155 |
this.parsingFunctions.parseTypes(this.resultLandingInfo.types, types, instance); |
|
156 |
|
|
157 |
if(instance.hasOwnProperty("webresource")) { |
|
158 |
let url; |
|
159 |
if(!Array.isArray(instance['webresource'])) { |
|
160 |
url = instance['webresource'].url; |
|
161 |
} else{ |
|
162 |
url = instance['webresource'][0].url; |
|
163 |
} |
|
164 |
|
|
165 |
/**********************************************************/ |
|
166 |
if(instance.hasOwnProperty("hostedby")) { |
|
167 |
counter = this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, data[0], url, counter/*, this.resultLandingInfo.title*/, this.resultLandingInfo.accessMode); |
|
168 |
} |
|
169 |
/**********************************************************/ |
|
170 |
} |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
if(data[3].hasOwnProperty("externalreference")) { |
|
175 |
let externalResults: [Map<string, Map<string, string>>, { "name": string, "url": string}[]] = this.parseBioentitiesAndSoftware(data[3]); |
|
176 |
this.resultLandingInfo.bioentities = externalResults[0]; |
|
177 |
this.resultLandingInfo.software = externalResults[1]; |
|
178 |
} |
|
179 |
} |
|
180 |
|
|
181 |
// res['result']['metadata']['oaf:entity']['oaf:result']['pid'] |
|
182 |
if(data[4] != null) { |
|
183 |
this.resultLandingInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]); |
|
184 |
} |
|
185 |
|
|
186 |
// res['result']['metadata']['oaf:entity']['oaf:result']['journal'] |
|
187 |
if(data[5] != null) { |
|
188 |
this.resultLandingInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": "", "issue": "", "volume": "", "start_page": "", "end_page": ""} |
|
189 |
|
|
190 |
this.resultLandingInfo.journal['journal'] = data[5].content; |
|
191 |
this.resultLandingInfo.journal['issn'] = data[5].issn; |
|
192 |
this.resultLandingInfo.journal['lissn'] = data[5].lissn; |
|
193 |
this.resultLandingInfo.journal['eissn'] = data[5].eissn; |
|
194 |
this.resultLandingInfo.journal['issue'] = data[5].iss; |
|
195 |
this.resultLandingInfo.journal['volume'] = data[5].vol; |
|
196 |
this.resultLandingInfo.journal['start_page'] = data[5].sp; |
|
197 |
this.resultLandingInfo.journal['end_page'] = data[5].ep; |
|
198 |
} |
|
199 |
|
|
200 |
// res['result']['metadata']['oaf:entity']['oaf:result']['language'] |
|
201 |
if(data[6] != null) { |
|
202 |
this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(data[6]); |
|
203 |
} |
|
204 |
|
|
205 |
// res['result']['metadata']['oaf:entity']['oaf:result']['country'] |
|
206 |
if(data[10] != null) { |
|
207 |
this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(data[10]); |
|
208 |
} |
|
209 |
|
|
210 |
// res['result']['metadata']['oaf:entity']['oaf:result']['subject'] |
|
211 |
if(data[7] != null) { |
|
212 |
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[7]); |
|
213 |
this.resultLandingInfo.subjects = subjectResults[0]; |
|
214 |
this.resultLandingInfo.otherSubjects = subjectResults[1]; |
|
215 |
this.resultLandingInfo.classifiedSubjects = subjectResults[2]; |
|
216 |
} |
|
217 |
|
|
218 |
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom( |
|
219 |
this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher, |
|
220 |
this.resultLandingInfo.journal, this.resultLandingInfo.identifiers); |
|
221 |
|
|
222 |
// res['result']['metadata']['oaf:entity']['oaf:result']['programmingLanguage'] |
|
223 |
if(data[11] != null) { |
|
224 |
this.resultLandingInfo.programmingLanguages = this.parsingFunctions.parseProgrammingLanguages(data[11]); |
|
225 |
} |
|
226 |
|
|
227 |
// res['result']['metadata']['oaf:entity']['extraInfo']['citations']['citation'] |
|
228 |
if(data[12] != null) { |
|
229 |
this.resultLandingInfo.references = this.parsingFunctions.parseReferences(data[12]); |
|
230 |
} |
|
231 |
|
|
232 |
// res['result']['metadata']['oaf:entity']['oaf:result']['context'] |
|
233 |
if(data[8] != null) { |
|
234 |
this.resultLandingInfo.contexts = this.parsingFunctions.parseContexts(data[8]); |
|
235 |
} |
|
236 |
|
|
237 |
// res['result']['header']['dri:status'] |
|
238 |
if(data[13] != null && data[13] == "under curation") { |
|
239 |
this.resultLandingInfo.underCurationMessage = true; |
|
240 |
} else { |
|
241 |
this.resultLandingInfo.underCurationMessage = false; |
|
242 |
} |
|
243 |
|
|
244 |
// res['result']['metadata']['oaf:entity']['oaf:result']['creator'] |
|
245 |
if(data[9] != null) { |
|
246 |
if(this.resultLandingInfo.authors == undefined) { |
|
247 |
this.resultLandingInfo.authors = new Array<{"fullName": string, "orcid": string}>(); |
|
248 |
} |
|
249 |
|
|
250 |
let authors = data[9]; |
|
251 |
let length = Array.isArray(authors) ? authors.length : 1; |
|
252 |
|
|
253 |
for(let i=0; i<length; i++) { |
|
254 |
let author = Array.isArray(authors) ? authors[i] : authors; |
|
255 |
if(author) { |
|
256 |
this.resultLandingInfo['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID}; |
|
257 |
} |
|
258 |
} |
|
259 |
this.resultLandingInfo.authors = this.resultLandingInfo.authors.filter(function (item) { |
|
260 |
return (item != undefined && item.fullName != undefined); |
|
261 |
}); |
|
262 |
} |
|
263 |
|
|
264 |
if(this.resultLandingInfo.relatedResearchResults) { |
|
265 |
let self = this; |
|
266 |
this.resultLandingInfo.relatedResearchResults.forEach(function (value, key, map) { |
|
267 |
self.resultLandingInfo.relatedResearchResults.set(key, self.parsingFunctions.sortByPercentage(value)); |
|
268 |
}); |
|
269 |
} |
|
270 |
this.resultLandingInfo.similarResearchResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.similarResearchResults); |
|
271 |
|
|
272 |
return this.resultLandingInfo; |
|
273 |
} |
|
274 |
|
|
275 |
parseRelatedOrganizations(organizations: {"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[], relation: any): |
|
276 |
{"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[] { |
|
277 |
if(organizations == undefined) { |
|
278 |
organizations = new Array<{ |
|
279 |
"name": string, "shortname": string, |
|
280 |
"id": string, "websiteUrl": string, |
|
281 |
"country": string, "trust": number}>(); |
|
282 |
} |
|
283 |
|
|
284 |
let organization: { "name": string, "shortname": string, |
|
285 |
"id": string, "websiteUrl": string, |
|
286 |
"country": string, "trust": number |
|
287 |
} = { |
|
288 |
"name": "", "shortname": "", |
|
289 |
"id": "", "websiteUrl": "", |
|
290 |
"country": "", "trust": null |
|
291 |
}; |
|
292 |
|
|
293 |
organization.id = relation['to'].content; |
|
294 |
organization.name = relation.legalname; |
|
295 |
organization.shortname = relation.legalshortname; |
|
296 |
organization.websiteUrl = relation.websiteurl; |
|
297 |
if(relation.country) { |
|
298 |
organization.country = relation.country.classname; |
|
299 |
} |
|
300 |
if(relation.trust) { |
|
301 |
organization.trust = Math.round(relation.trust*100); |
|
302 |
} |
|
303 |
|
|
304 |
organizations.push(organization); |
|
305 |
return organizations; |
|
306 |
} |
|
307 |
|
|
308 |
parseBioentitiesAndSoftware(children: any) : [Map<string, Map<string, string>>, { "name": string, "url": string}[]] { |
|
309 |
let bioentities: Map<string, Map<string, string>>; |
|
310 |
let software: {"name": string, "url": string}[]; |
|
311 |
|
|
312 |
let length = Array.isArray(children['externalreference']) ? children['externalreference'].length : 1; |
|
313 |
|
|
314 |
let externalreference; |
|
315 |
for(let i=0; i<length; i++) { |
|
316 |
externalreference = Array.isArray(children['externalreference']) ? children['externalreference'][i] : children['externalreference']; |
|
317 |
|
|
318 |
if(externalreference.hasOwnProperty("qualifier")) { |
|
319 |
if(externalreference['qualifier'].classid == "accessionNumber") { |
|
320 |
|
|
321 |
if(bioentities == undefined) { |
|
322 |
bioentities = new Map<string, Map<string, string>>(); |
|
323 |
} |
|
324 |
|
|
325 |
if(!bioentities.has(externalreference.sitename)) { |
|
326 |
bioentities.set(externalreference.sitename, new Map<string, string>()); |
|
327 |
} |
|
328 |
bioentities.get(externalreference.sitename).set(externalreference.refidentifier, externalreference.url); |
|
329 |
|
|
330 |
} else if(externalreference['qualifier'].classid == "software") { |
|
331 |
|
|
332 |
if(software == undefined) { |
|
333 |
software = new Array<{"name": string, "url": string}>(); |
|
334 |
} |
|
335 |
|
|
336 |
software.push({"name": externalreference.sitename, "url": externalreference.url}); |
|
337 |
} |
|
338 |
} |
|
339 |
} |
|
340 |
|
|
341 |
return [bioentities, software]; |
|
342 |
} |
|
343 |
|
|
344 |
getOpenCitations(id: string, properties:EnvProperties) { |
|
345 |
//https://services.openaire.eu/opencitations/getCitations?id=doajarticles::2634200c24772ee8f10232d3e184ec65 |
|
346 |
let url = properties.openCitationsAPIURL+id;// "https://services.openaire.eu/opencitations/getCitations?id=" + id; |
|
347 |
let key = url; |
|
348 |
|
|
349 |
//return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) |
|
350 |
return this.http.get(url) |
|
351 |
.pipe(map(res => [res['total'], this.parseOpenCitations(res['results'])])); |
|
352 |
} |
|
353 |
|
|
354 |
parseOpenCitations(openCitations: any): {"url": string, "title": string, "year": string, "doi": string, "authors": string[]}[] { |
|
355 |
//title, doi, authors |
|
356 |
let citations = new Array<{"url": string, "title": string, "year": string, "doi": string, "authors": string[]}>(); |
|
357 |
|
|
358 |
let openCitation; |
|
359 |
|
|
360 |
let length = Array.isArray(openCitations) ? openCitations.length : 1; |
|
361 |
for(let i=0; i<length; i++) { |
|
362 |
openCitation = Array.isArray(openCitations) ? openCitations[i] : openCitations; |
|
363 |
|
|
364 |
let citation: {"url": string, "title": string, "year": string, "doi": string, "authors": string[]} = {"url": "", "title": "", "year": "", "doi": "", "authors": []}; |
|
365 |
|
|
366 |
if(openCitation && openCitation.id) { |
|
367 |
citation.url = openCitation.id; |
|
368 |
citation.title = openCitation.title; |
|
369 |
//citation.type = openCitation.type; |
|
370 |
citation.year = (openCitation.pubDate && (openCitation.pubDate).indexOf('-') !== -1)?openCitation.pubDate.split('-')[0]:openCitation.pubDate; |
|
371 |
citation.doi = openCitation.doi; |
|
372 |
|
|
373 |
let authorsLength = Array.isArray(openCitation.authors) ? openCitation.authors.length : 1; |
|
374 |
for(let i=0; i<authorsLength; i++) { |
|
375 |
let author = Array.isArray(openCitation.authors) ? openCitation.authors[i] : openCitation.authors; |
|
376 |
|
|
377 |
if(author) { |
|
378 |
let lastFirstName: string = ""; |
|
379 |
if(author.lastName) { |
|
380 |
lastFirstName = author.lastName; |
|
381 |
} |
|
382 |
if(author.lastName && author.firstName) { |
|
383 |
lastFirstName += ", "; |
|
384 |
} |
|
385 |
if(author.firstName) { |
|
386 |
lastFirstName += author.firstName; |
|
387 |
} |
|
388 |
|
|
389 |
if(lastFirstName) { |
|
390 |
citation.authors.push(lastFirstName); |
|
391 |
} |
|
392 |
} |
|
393 |
} |
|
394 |
citations.push(citation); |
|
395 |
} |
|
396 |
} |
|
397 |
return citations; |
|
398 |
} |
|
399 |
} |
modules/uoa-services-library/branches/mergeResultLandingPages/ng-openaire-library/src/app/landingPages/orp/orp.component.ts | ||
---|---|---|
1 | 1 |
import {Component, Input} from '@angular/core'; |
2 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
3 |
import {Meta, Title} from '@angular/platform-browser'; |
|
4 | 2 |
|
5 |
import {OrpInfo} from '../../utils/entities/orpInfo'; |
|
6 |
import {EnvProperties} from '../../utils/properties/env-properties'; |
|
7 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
|
8 |
|
|
9 |
import {OrpService} from './orp.service'; |
|
10 |
import {PiwikService} from '../../utils/piwik/piwik.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 |
|
|
15 |
|
|
16 | 3 |
@Component({ |
17 | 4 |
selector: 'orp', |
18 |
templateUrl: 'orp.component.html', |
|
19 |
}) |
|
5 |
template: ` |
|
6 |
<result-landing type="orp" [piwikSiteId]="piwikSiteId" [communityId]="communityId" [activeTab]="'References'"></result-landing> |
|
7 |
`}) |
|
20 | 8 |
|
21 | 9 |
export class OrpComponent { |
22 | 10 |
@Input() piwikSiteId = null; |
23 | 11 |
@Input() communityId = null; |
24 |
public orpInfo: OrpInfo; |
|
25 |
public orpId: string; |
|
26 | 12 |
|
27 |
// APP BOX variables |
|
28 |
public showAllCollectedFrom: boolean = false; |
|
29 |
public showAllDownloadFrom: boolean = false; |
|
30 |
public showAllPublishedIn: boolean = false; |
|
13 |
constructor() {} |
|
31 | 14 |
|
32 |
public thresholdDescription: number = 270; |
|
33 |
public showNumDescription: number = 270; |
|
34 |
|
|
35 |
// Metrics tab variables |
|
36 |
public metricsClicked: boolean; |
|
37 |
public viewsFrameUrl: string; |
|
38 |
public downloadsFrameUrl: string; |
|
39 |
public totalViews: number; |
|
40 |
public totalDownloads: number; |
|
41 |
public pageViews: number; |
|
42 |
|
|
43 |
// Custom tab paging variables |
|
44 |
public referencesPage: number = 1; |
|
45 |
public pageSize: number = 10; |
|
46 |
|
|
47 |
// Active tab variable for responsiveness |
|
48 |
public activeTab: string = "References"; |
|
49 |
|
|
50 |
// Map counting variable |
|
51 |
public relatedResearchResultsNum: number = 0; |
|
52 |
|
|
53 |
// Message variables |
|
54 |
public warningMessage = ""; |
|
55 |
public errorMessage = ""; |
|
56 |
public showLoading: boolean = true; |
|
57 |
public pageContents = null; |
|
58 |
public divContents = null; |
|
59 |
|
|
60 |
public routerHelper: RouterHelper = new RouterHelper(); |
|
61 |
|
|
62 |
private result; |
|
63 |
sub: any; |
|
64 |
piwiksub: any; |
|
65 |
infoSub: any; |
|
66 |
properties: EnvProperties; |
|
67 |
|
|
68 |
constructor(private _orpService: OrpService, |
|
69 |
private _piwikService: PiwikService, |
|
70 |
private route: ActivatedRoute, |
|
71 |
private router: Router, |
|
72 |
private _meta: Meta, |
|
73 |
private _title: Title, |
|
74 |
private _router: Router, |
|
75 |
private helper: HelperService, |
|
76 |
private seoService: SEOService) { |
|
77 |
} |
|
78 |
|
|
79 |
ngOnInit() { |
|
80 |
this.route.data |
|
81 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
82 |
this.properties = data.envSpecific; |
|
83 |
//this.getDivContents(); |
|
84 |
this.getPageContents(); |
|
85 |
this.updateUrl(data.envSpecific.baseLink + this._router.url); |
|
86 |
|
|
87 |
}); |
|
88 |
this.sub = this.route.queryParams.subscribe(params => { |
|
89 |
this.orpInfo = null; |
|
90 |
this.updateTitle("Other Research Product"); |
|
91 |
this.updateDescription(""); |
|
92 |
this.orpId = params['orpId']; |
|
93 |
|
|
94 |
if (this.orpId) { |
|
95 |
this.getOrpInfo(this.orpId); |
|
96 |
} else { |
|
97 |
this.showLoading = false; |
|
98 |
this.warningMessage = "No valid research product id"; |
|
99 |
} |
|
100 |
|
|
101 |
this.metricsClicked = false; |
|
102 |
|
|
103 |
this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.orpId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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'; |
|
104 |
|
|
105 |
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.orpId + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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'; |
|
106 |
|
|
107 |
this.scroll(); |
|
108 |
}); |
|
109 |
|
|
110 |
} |
|
111 |
|
|
112 |
private getPageContents() { |
|
113 |
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
114 |
this.pageContents = contents; |
|
115 |
}) |
|
116 |
} |
|
117 |
|
|
118 |
private getDivContents() { |
|
119 |
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
120 |
this.divContents = contents; |
|
121 |
}) |
|
122 |
} |
|
123 |
|
|
124 |
ngOnDestroy() { |
|
125 |
if (this.sub) { |
|
126 |
this.sub.unsubscribe(); |
|
127 |
} |
|
128 |
if (this.piwiksub) { |
|
129 |
this.piwiksub.unsubscribe(); |
|
130 |
} |
|
131 |
if (this.infoSub) { |
|
132 |
this.infoSub.unsubscribe(); |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
private getOrpInfo(id: string) { |
|
137 |
this.warningMessage = ''; |
|
138 |
this.errorMessage = "" |
|
139 |
this.showLoading = true; |
|
140 |
|
|
141 |
this.orpInfo = null; |
|
142 |
|
|
143 |
this.infoSub = this._orpService.getOrpInfo(id, this.properties).subscribe( |
|
144 |
data => { |
|
145 |
this.orpInfo = data; |
|
146 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrp + this.orpInfo.record["result"]["header"]["dri:objIdentifier"]); |
|
147 |
if (this.orpInfo.title) { |
|
148 |
this.updateTitle(this.orpInfo.title); |
|
149 |
this.updateDescription((this.orpInfo.description ? (this.orpInfo.description) : ("," + this.orpInfo.title))); |
|
150 |
} |
|
151 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
152 |
this.piwiksub = this._piwikService.trackView(this.properties, this.orpInfo.title, this.piwikSiteId).subscribe(); |
|
153 |
} |
|
154 |
|
|
155 |
this.result = [] |
|
156 |
this.result = { |
|
157 |
id: id, |
|
158 |
type: "orp", |
|
159 |
source: "openaire", |
|
160 |
title: this.orpInfo.title, |
|
161 |
url: '', |
|
162 |
result: '', |
|
163 |
accessRights: this.orpInfo.accessMode, |
|
164 |
embargoEndDate: '' |
|
165 |
}; |
|
166 |
|
|
167 |
let relatedResearchResultsNum = 0; |
|
168 |
if (this.orpInfo.relatedResearchResults != undefined) { |
|
169 |
this.orpInfo.relatedResearchResults.forEach(function (value, key, map) { |
|
170 |
relatedResearchResultsNum += value.length; |
|
171 |
}); |
|
172 |
} |
|
173 |
this.relatedResearchResultsNum = relatedResearchResultsNum; |
|
174 |
|
|
175 |
this.showLoading = false; |
|
176 |
}, |
|
177 |
err => { |
|
178 |
//console.log(err) |
|
179 |
this.handleError("Error getting other research product for id: " + this.orpId, err); |
|
180 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToOrps); |
|
181 |
this.errorMessage = 'No research product found'; |
|
182 |
this.showLoading = false; |
|
183 |
} |
|
184 |
); |
|
185 |
} |
|
186 |
|
|
187 |
public metricsResults($event) { |
|
188 |
this.totalViews = $event.totalViews; |
|
189 |
this.totalDownloads = $event.totalDownloads; |
|
190 |
this.pageViews = $event.pageViews; |
|
191 |
} |
|
192 |
|
|
193 |
private updateDescription(description: string) { |
|
194 |
this._meta.updateTag({content: description}, "name='description'"); |
|
195 |
this._meta.updateTag({content: description}, "property='og:description'"); |
|
196 |
} |
|
197 |
|
|
198 |
private updateTitle(title: string) { |
|
199 |
var _prefix = ""; |
|
200 |
if(!this.communityId) { |
|
201 |
_prefix = "OpenAIRE | "; |
|
202 |
} |
|
203 |
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); |
|
204 |
this._title.setTitle(_title); |
|
205 |
this._meta.updateTag({content: _title}, "property='og:title'"); |
|
206 |
} |
|
207 |
|
|
208 |
private updateUrl(url: string) { |
|
209 |
this._meta.updateTag({content: url}, "property='og:url'"); |
|
210 |
} |
|
211 |
|
|
212 |
public buildCurationTooltip() { |
|
213 |
let tooltipContent: string = "<div class='uk-padding-small uk-light'>"; |
|
214 |
|
|
215 |
tooltipContent += "<h4>Record in preview</h4>"; |
|
216 |
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p></di>"; |
|
217 |
|
|
218 |
return tooltipContent; |
|
219 |
} |
|
220 |
|
|
221 |
public getKeys(map) { |
|
222 |
return Array.from(map.keys()); |
|
223 |
} |
|
224 |
|
|
225 |
public scroll() { |
|
226 |
HelperFunctions.scroll(); |
|
227 |
} |
|
228 |
|
|
229 |
private handleError(message: string, error) { |
|
230 |
console.error("Other Research Product Landing Page: " + message, error); |
|
231 |
} |
|
232 |
|
|
233 |
public updateReferencesPage($event) { |
|
234 |
this.referencesPage = $event.value; |
|
235 |
} |
|
236 |
|
|
237 |
public totalPages(totalResults: number): number { |
|
238 |
let totalPages: any = totalResults / this.pageSize; |
|
239 |
if (!(Number.isInteger(totalPages))) { |
|
240 |
totalPages = (parseInt(totalPages, this.pageSize) + 1); |
|
241 |
} |
|
242 |
return totalPages; |
|
243 |
} |
|
244 |
|
|
245 |
isRouteAvailable(routeToCheck: string) { |
|
246 |
for (let i = 0; i < this.router.config.length; i++) { |
|
247 |
let routePath: string = this.router.config[i].path; |
|
248 |
if (routePath == routeToCheck) { |
|
249 |
return true; |
|
250 |
} |
|
251 |
} |
|
252 |
return false; |
|
253 |
} |
|
15 |
ngOnInit() {} |
|
254 | 16 |
} |
modules/uoa-services-library/branches/mergeResultLandingPages/ng-openaire-library/src/app/landingPages/orp/orp.module.ts | ||
---|---|---|
1 | 1 |
import {NgModule} from '@angular/core'; |
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {FormsModule} from '@angular/forms'; |
|
4 |
import {RouterModule} from '@angular/router'; |
|
5 |
|
|
6 |
import {SharedModule} from '../../shared/shared.module'; |
|
7 |
|
|
2 |
import {FreeGuard} from '../../login/freeGuard.guard'; |
|
3 |
import {IsRouteEnabled} from "../../error/isRouteEnabled.guard"; |
|
4 |
import {SharedModule} from "../../shared/shared.module"; |
|
5 |
import {LandingModule} from '../landing-utils/landing.module'; |
|
6 |
import {ResultLandingModule} from '../resultLanding.module'; |
|
8 | 7 |
import {OrpComponent} from './orp.component'; |
9 | 8 |
|
10 |
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; |
|
11 |
import {LandingModule} from '../landing-utils/landing.module'; |
|
12 |
import {ResultLandingModule} from '../landing-utils/resultLanding.module'; |
|
13 |
import {MetricsModule} from '../landing-utils/metrics.module'; |
|
14 |
import {AltMetricsModule} from '../../utils/altmetrics.module'; |
|
15 |
import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module'; |
|
16 |
import {IFrameModule} from '../../utils/iframe.module'; |
|
17 |
import {PagingModule} from '../../utils/paging.module'; |
|
18 |
|
|
19 |
import {OrpService} from './orp.service'; |
|
20 |
|
|
21 |
import {FreeGuard} from '../../login/freeGuard.guard'; |
|
22 |
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; |
|
23 |
import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module'; |
|
24 |
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; |
|
25 |
import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/deletedByInference.module"; |
|
26 |
import {HelperModule} from "../../utils/helper/helper.module"; |
|
27 |
|
|
28 |
|
|
29 | 9 |
@NgModule({ |
30 | 10 |
imports: [ |
31 |
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, |
|
32 |
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, |
|
33 |
AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, |
|
34 |
ShowAuthorsModule, DeletedByInferenceModule, HelperModule |
|
11 |
SharedModule, LandingModule, ResultLandingModule |
|
35 | 12 |
], |
36 | 13 |
declarations: [ |
37 | 14 |
OrpComponent |
38 | 15 |
], |
39 | 16 |
providers: [ |
40 |
OrpService, FreeGuard
|
|
17 |
FreeGuard, IsRouteEnabled
|
|
41 | 18 |
], |
42 | 19 |
exports: [ |
43 | 20 |
OrpComponent |
modules/uoa-services-library/branches/mergeResultLandingPages/ng-openaire-library/src/app/landingPages/resultLanding.component.ts | ||
---|---|---|
1 |
import {Component, Input} from '@angular/core'; |
|
2 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
3 |
import {Meta, Title} from '@angular/platform-browser'; |
|
4 |
|
|
5 |
import {EnvProperties} from '../utils/properties/env-properties'; |
|
6 |
import {ResultLandingInfo} from '../utils/entities/resultLandingInfo'; |
|
7 |
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 |
|
|
15 |
|
|
16 |
@Component({ |
|
17 |
selector: 'result-landing', |
|
18 |
templateUrl: 'resultLanding.component.html', |
|
19 |
|
|
20 |
}) |
|
21 |
|
|
22 |
export class ResultLandingComponent { |
|
23 |
@Input() type: string = "publication"; |
|
24 |
@Input() piwikSiteId = null; |
|
25 |
@Input() communityId = null; |
|
26 |
|
|
27 |
// Active tab variable for responsiveness |
|
28 |
@Input() activeTab: string = "References"; |
|
29 |
|
|
30 |
public resultLandingInfo: ResultLandingInfo; |
|
31 |
public id: string; |
|
32 |
public title: string; |
|
33 |
|
|
34 |
// Links for SEO |
|
35 |
public linkToLandingPage: string = null; |
|
36 |
public linkToSearchPage: string = null; |
|
37 |
|
|
38 |
// APP BOX variables |
|
39 |
public showAllCollectedFrom: boolean = false; |
|
40 |
public showAllDownloadFrom: boolean = false; |
|
41 |
|
|
42 |
public thresholdDescription: number = 270; |
|
43 |
public showNumDescription: number = 270; |
|
44 |
|
|
45 |
// Metrics tab variables |
|
46 |
public metricsClicked: boolean; |
|
47 |
public viewsFrameUrl: string; |
|
48 |
public downloadsFrameUrl: string; |
|
49 |
public totalViews: number; |
|
50 |
public totalDownloads: number; |
|
51 |
public pageViews: number; |
|
52 |
|
|
53 |
// Custom tab paging variables |
|
54 |
public referencesPage: number = 1; |
|
55 |
public organizationsPage: number = 1; |
|
56 |
public softwarePage: number = 1; |
|
57 |
public bioentitiesPage: number = 1; |
|
58 |
public openCitationsPage: number = 1; |
|
59 |
public pageSize: number = 10; |
|
60 |
|
|
61 |
// Map counting variables |
|
62 |
public bioentitiesNum: number = 0; |
|
63 |
public relatedResearchResultsNum: number = 0; |
|
64 |
|
|
65 |
// Message variables |
|
66 |
public warningMessage = ""; |
|
67 |
public errorMessage = ""; |
|
68 |
public showLoading: boolean = true; |
|
69 |
|
|
70 |
public routerHelper: RouterHelper = new RouterHelper(); |
|
71 |
|
|
72 |
private doi: string; |
|
73 |
public doiURL: string; |
|
74 |
private result; |
|
75 |
sub: any; |
|
76 |
piwiksub: any; |
|
77 |
infoSub: any; |
|
78 |
properties: EnvProperties; |
|
79 |
public pageContents = null; |
|
80 |
public divContents = null; |
|
81 |
|
|
82 |
constructor(private _resultLaningService: ResultLandingService, |
|
83 |
private _piwikService: PiwikService, |
|
84 |
private route: ActivatedRoute, |
|
85 |
private router: Router, |
|
86 |
private _meta: Meta, |
|
87 |
private _title: Title, |
|
88 |
private _router: Router, |
|
89 |
private helper: HelperService, |
|
90 |
private seoService: SEOService) { |
|
91 |
} |
|
92 |
|
|
93 |
ngOnInit() { |
|
94 |
this.route.data |
|
95 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
96 |
this.properties = data.envSpecific; |
|
97 |
//this.getDivContents(); |
|
98 |
this.getPageContents(); |
|
99 |
this.doiURL = this.properties.doiURL; |
|
100 |
this.updateUrl(data.envSpecific.baseLink + this._router.url); |
|
101 |
|
|
102 |
this.sub = this.route.queryParams.subscribe(data => { |
|
103 |
this.resultLandingInfo = null; |
|
104 |
if(this.type == "publication") { |
|
105 |
this.updateTitle("Publication"); |
|
106 |
this.linkToLandingPage = this.properties.searchLinkToPublication; |
|
107 |
this.linkToSearchPage = this.properties.searchLinkToPublications; |
|
108 |
this.id = data['articleId']; |
|
109 |
this.title = "Publication"; |
|
110 |
} else if(this.type == "dataset") { |
|
111 |
this.updateTitle("Dataset"); |
|
112 |
this.linkToLandingPage = this.properties.searchLinkToDataset; |
|
113 |
this.linkToSearchPage = this.properties.searchLinkToDatasets; |
|
114 |
this.id = data['datasetId']; |
|
115 |
this.title = "Research Data"; |
|
116 |
} else if(this.type == "software") { |
|
117 |
this.updateTitle("Software"); |
|
118 |
this.linkToLandingPage = this.properties.searchLinkToSoftware; |
|
119 |
this.linkToSearchPage = this.properties.searchLinkToSoftwareLanding; |
|
120 |
this.id = data['softwareId']; |
|
121 |
this.title = "Software"; |
|
122 |
} else if(this.type == "orp") { |
|
123 |
this.updateTitle("Other Research Product"); |
|
124 |
this.linkToLandingPage = this.properties.searchLinkToOrp; |
|
125 |
this.linkToSearchPage = this.properties.searchLinkToOrps; |
|
126 |
this.id = data['orpId']; |
|
127 |
this.title = "Other Research Product"; |
|
128 |
} |
|
129 |
this.updateDescription(""); |
|
130 |
|
|
131 |
this.metricsClicked = false; |
|
132 |
|
|
133 |
if (this.id) { |
|
134 |
this.getResultLandingInfo(this.id); |
|
135 |
} else { |
|
136 |
this.showLoading = false; |
|
137 |
|
|
138 |
this.warningMessage = "No valid "; |
|
139 |
if(this.type == "publication" || this.type == "software") { |
|
140 |
this.warningMessage += this.type + " "; |
|
141 |
} else if(this.type == "dataset") { |
|
142 |
this.warningMessage += "research data "; |
|
143 |
} else if(this.type == "orp") { |
|
144 |
this.warningMessage += "other research product "; |
|
145 |
} |
|
146 |
this.warningMessage += "id"; |
|
147 |
} |
|
148 |
|
|
149 |
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":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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'; |
|
150 |
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":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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'; |
|
151 |
|
|
152 |
this.scroll(); |
|
153 |
}); |
|
154 |
}); |
|
155 |
} |
|
156 |
|
|
157 |
private getPageContents() { |
|
158 |
this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
159 |
this.pageContents = contents; |
|
160 |
}); |
|
161 |
} |
|
162 |
|
|
163 |
private getDivContents() { |
|
164 |
this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => { |
|
165 |
this.divContents = contents; |
|
166 |
}); |
|
167 |
} |
|
168 |
|
|
169 |
ngOnDestroy() { |
|
170 |
if (this.sub) { |
|
171 |
this.sub.unsubscribe(); |
|
172 |
} |
|
173 |
if (this.piwiksub) { |
|
174 |
this.piwiksub.unsubscribe(); |
|
175 |
} |
|
176 |
if (this.infoSub) { |
|
177 |
this.infoSub.unsubscribe(); |
|
178 |
} |
|
179 |
} |
|
180 |
|
|
181 |
private getOpenCitations(id: string) { |
|
182 |
this._resultLaningService.getOpenCitations(this.id, this.properties).subscribe( |
|
183 |
data => { |
|
184 |
this.resultLandingInfo.openCitations = data[1]; |
|
185 |
}, |
|
186 |
err => { |
|
187 |
this.handleError("Error getting open citation for "+this.type+" with id: " + this.id, err); |
|
188 |
} |
|
189 |
); |
|
190 |
} |
|
191 |
|
|
192 |
private getResultLandingInfo(id: string) { |
|
193 |
this.warningMessage = ''; |
|
194 |
this.errorMessage = ''; |
|
195 |
this.showLoading = true; |
|
196 |
|
|
197 |
this.resultLandingInfo = null; |
|
198 |
|
|
199 |
this.infoSub = this._resultLaningService.getResultLandingInfo(this.id, this.type, this.properties).subscribe( |
|
200 |
data => { |
|
201 |
this.resultLandingInfo = data; |
|
202 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.record["result"]["header"]["dri:objIdentifier"]); |
|
203 |
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { |
|
204 |
this.getOpenCitations(this.id); |
|
205 |
} |
|
206 |
|
|
207 |
if (this.resultLandingInfo.title) { |
|
208 |
this.updateTitle(this.resultLandingInfo.title); |
|
209 |
this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description) : ("," + this.resultLandingInfo.title))); |
|
210 |
} |
|
211 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
212 |
this.piwiksub = this._piwikService.trackView(this.properties, this.resultLandingInfo.title/*.name*/, this.piwikSiteId).subscribe(); |
|
213 |
} |
|
214 |
|
|
215 |
if(this.type == "publication") { |
|
216 |
let bioentitiesNum = 0; |
|
217 |
if (this.resultLandingInfo.bioentities != undefined) { |
|
218 |
this.resultLandingInfo.bioentities.forEach(function (value, key, map) { |
|
219 |
bioentitiesNum += value.size; |
|
220 |
}); |
|
221 |
} |
|
222 |
this.bioentitiesNum = bioentitiesNum; |
|
223 |
} |
|
224 |
|
|
225 |
let relatedResearchResultsNum = 0; |
|
226 |
if (this.resultLandingInfo.relatedResearchResults != undefined) { |
|
227 |
this.resultLandingInfo.relatedResearchResults.forEach(function (value, key, map) { |
|
228 |
relatedResearchResultsNum += value.length; |
|
229 |
}); |
|
230 |
} |
|
231 |
this.relatedResearchResultsNum = relatedResearchResultsNum; |
|
232 |
|
|
233 |
this.result = { |
|
234 |
id: this.id, |
|
235 |
type: this.type, |
|
236 |
source: "openaire", |
|
237 |
title: this.resultLandingInfo.title, |
|
238 |
url: '', |
|
239 |
result: '', |
|
240 |
accessRights: this.resultLandingInfo.accessMode, |
|
241 |
embargoEndDate: '' |
|
242 |
}; |
|
243 |
|
|
244 |
if (this.resultLandingInfo.identifiers != undefined && this.resultLandingInfo.identifiers.has('doi')) { |
|
245 |
this.doi = this.resultLandingInfo.identifiers.get('doi')[0]; |
|
246 |
} |
|
247 |
|
|
248 |
this.showLoading = false; |
|
249 |
|
|
250 |
if (this.resultLandingInfo.references) { |
|
251 |
this.activeTab = "References"; |
|
252 |
} else if (this.resultLandingInfo.relatedResearchResults) { |
|
253 |
this.activeTab = "Related Research Results"; |
|
254 |
} else if (this.resultLandingInfo.similarResearchResults) { |
|
255 |
this.activeTab = "Similar Research Results"; |
|
256 |
} else if (this.resultLandingInfo.organizations) { |
|
257 |
this.activeTab = "Related Organizations"; |
|
258 |
} else if (this.resultLandingInfo.bioentities) { |
|
259 |
this.activeTab = "Bioentities"; |
|
260 |
} else if (this.resultLandingInfo.software) { |
|
261 |
this.activeTab = "Software"; |
|
262 |
} else { |
|
263 |
this.activeTab = "Metrics"; |
|
264 |
this.metricsClicked = true; |
|
265 |
} |
Also available in: Unified diff
[mergeResultLandingPages | Library]:
1. Rename 'resultLanding.module' to 'resultLandingUtils.module'
2. Add property 'searchLinkToSoftwareLanding'
3. Add files: resultLandingInfo.ts, resultLanding.module.ts, resultLanding.component.ts, resultLanding.component.html for merging result landing pages (publication, dataset, software, orp)