1 |
56644
|
k.triantaf
|
import {Component, Input, ViewChild} from '@angular/core';
|
2 |
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
3 |
|
|
import {Meta, Title} from '@angular/platform-browser';
|
4 |
50169
|
argiro.kok
|
|
5 |
56644
|
k.triantaf
|
import {ProjectService} from './project.service';
|
6 |
|
|
import {ProjectInfo} from '../../utils/entities/projectInfo';
|
7 |
|
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
8 |
50169
|
argiro.kok
|
|
9 |
57027
|
konstantin
|
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
|
10 |
|
|
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
|
11 |
50169
|
argiro.kok
|
|
12 |
56644
|
k.triantaf
|
import {ModalLoading} from '../../utils/modal/loading.component';
|
13 |
50169
|
argiro.kok
|
|
14 |
56644
|
k.triantaf
|
import {ReportsService} from '../../services/reports.service';
|
15 |
|
|
import {ErrorCodes} from '../../utils/properties/errorCodes'
|
16 |
50169
|
argiro.kok
|
|
17 |
56644
|
k.triantaf
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
18 |
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
19 |
|
|
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
|
20 |
55418
|
konstantin
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
21 |
56644
|
k.triantaf
|
import {HelperService} from "../../utils/helper/helper.service";
|
22 |
57536
|
konstantin
|
import {Location} from "@angular/common";
|
23 |
58275
|
k.triantaf
|
import {HtmlProjectReportService} from "../htmlProjectReport/htmlProjectReport.service";
|
24 |
58656
|
konstantin
|
import {StringUtils} from "../../utils/string-utils.class";
|
25 |
58724
|
konstantin
|
import {ResultPreview} from "../../utils/result-preview/result-preview";
|
26 |
|
|
import {SearchResult} from "../../utils/entities/searchResult";
|
27 |
|
|
import {IndexInfoService} from "../../utils/indexInfo.service";
|
28 |
59816
|
argiro.kok
|
import {Subscriber} from "rxjs";
|
29 |
59899
|
argiro.kok
|
import {properties} from "../../../../environments/environment";
|
30 |
51835
|
sofia.balt
|
|
31 |
50169
|
argiro.kok
|
@Component({
|
32 |
56644
|
k.triantaf
|
selector: 'project',
|
33 |
|
|
templateUrl: 'project.component.html',
|
34 |
|
|
})
|
35 |
51835
|
sofia.balt
|
|
36 |
56644
|
k.triantaf
|
export class ProjectComponent {
|
37 |
51746
|
argiro.kok
|
@Input() piwikSiteId = null;
|
38 |
56644
|
k.triantaf
|
@Input() communityId = null;
|
39 |
50169
|
argiro.kok
|
public projectInfo: ProjectInfo;
|
40 |
56644
|
k.triantaf
|
public projectId: string;
|
41 |
50169
|
argiro.kok
|
public projectName: string;
|
42 |
|
|
|
43 |
|
|
// Metrics tab variables
|
44 |
|
|
public metricsClicked: boolean;
|
45 |
|
|
public viewsFrameUrl: string;
|
46 |
|
|
public downloadsFrameUrl: string;
|
47 |
59962
|
k.triantaf
|
public totalViews: number;
|
48 |
|
|
public totalDownloads: number;
|
49 |
|
|
public pageViews: number;
|
50 |
50169
|
argiro.kok
|
|
51 |
|
|
// Statistics tab variables
|
52 |
|
|
public statsClicked: boolean;
|
53 |
|
|
public chartScientificResultsUrl: string;
|
54 |
|
|
public chartAccessModeUrl: string;
|
55 |
|
|
public chartDatasourcesUrl: string;
|
56 |
|
|
|
57 |
58275
|
k.triantaf
|
// Clipboard variable for HTML dynamic content
|
58 |
|
|
public clipboard;
|
59 |
50169
|
argiro.kok
|
|
60 |
56644
|
k.triantaf
|
public project;
|
61 |
50169
|
argiro.kok
|
|
62 |
|
|
// CSV variables
|
63 |
|
|
public downloadURLAPI: string;
|
64 |
|
|
public csvParams: string;
|
65 |
|
|
|
66 |
58275
|
k.triantaf
|
// HTML (download) variables
|
67 |
|
|
public header1: string = "";
|
68 |
|
|
public header2: string = "";
|
69 |
|
|
public htmlResultDownload: string = "";
|
70 |
|
|
|
71 |
50169
|
argiro.kok
|
// Message variables
|
72 |
|
|
public warningMessage = "";
|
73 |
|
|
public errorMessage = "";
|
74 |
|
|
public showLoading: boolean = true;
|
75 |
|
|
|
76 |
|
|
// Active tab variable for responsiveness
|
77 |
58788
|
konstantin
|
public activeTab: string = "";
|
78 |
50169
|
argiro.kok
|
|
79 |
61075
|
k.triantaf
|
@ViewChild('statisticsModal') statisticsModal;
|
80 |
|
|
@ViewChild('linkProjectModal') linkProjectModal;
|
81 |
|
|
@ViewChild('shareResultsModal') shareResultsModal;
|
82 |
|
|
@ViewChild('downloadReportModal') downloadReportModal;
|
83 |
58717
|
konstantin
|
|
84 |
52401
|
konstantin
|
// Request results for publications, research data and software only the one time (first time tab is clicked)
|
85 |
|
|
private reloadPublications: boolean = true;
|
86 |
50169
|
argiro.kok
|
private reloadDatasets: boolean = true;
|
87 |
|
|
private reloadSoftware: boolean = true;
|
88 |
52828
|
konstantin
|
private reloadOrps: boolean = true;
|
89 |
60614
|
k.triantaf
|
private reloadDmps: boolean = true;
|
90 |
50169
|
argiro.kok
|
|
91 |
58275
|
k.triantaf
|
// Variables for entity selections on the right column
|
92 |
58788
|
konstantin
|
public share_research_results_type: string = "results";
|
93 |
58275
|
k.triantaf
|
public download_research_results_type: string = "";
|
94 |
|
|
|
95 |
50169
|
argiro.kok
|
// Variables for publications, research data, software tabs
|
96 |
57027
|
konstantin
|
public fetchPublications: FetchResearchResults;
|
97 |
|
|
public fetchDatasets: FetchResearchResults;
|
98 |
|
|
public fetchSoftware: FetchResearchResults;
|
99 |
|
|
public fetchOrps: FetchResearchResults;
|
100 |
60614
|
k.triantaf
|
public fetchDmps: FetchResearchResults;
|
101 |
58733
|
konstantin
|
public searchNumber: number = 5;
|
102 |
50169
|
argiro.kok
|
|
103 |
56644
|
k.triantaf
|
public routerHelper: RouterHelper = new RouterHelper();
|
104 |
|
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
105 |
|
|
public pageContents = null;
|
106 |
|
|
public divContents = null;
|
107 |
50169
|
argiro.kok
|
|
108 |
58275
|
k.triantaf
|
public indexUpdateDate: Date;
|
109 |
|
|
public showFeedback: boolean;
|
110 |
|
|
public feedbackFields: string [] = [
|
111 |
|
|
'Title', 'Funding Information', 'Duration',
|
112 |
|
|
'Organizations', 'Other'];
|
113 |
57853
|
konstantin
|
|
114 |
61075
|
k.triantaf
|
@ViewChild(ModalLoading) loading: ModalLoading;
|
115 |
50169
|
argiro.kok
|
// Alert box when something is wrong with CSV requests
|
116 |
61075
|
k.triantaf
|
@ViewChild('AlertModalCsvError') alertCsvError;
|
117 |
50169
|
argiro.kok
|
|
118 |
58275
|
k.triantaf
|
// Description variables for view more/less functionality
|
119 |
|
|
public thresholdDescription: number = 670;
|
120 |
|
|
public showNumDescription: number = 670;
|
121 |
|
|
|
122 |
|
|
// Organizations variables for view more/less functionality
|
123 |
|
|
public thresholdOrganizations: number = 20;
|
124 |
|
|
public showNumOrganizations: number = 20;
|
125 |
|
|
|
126 |
59816
|
argiro.kok
|
subscriptions = [];
|
127 |
56644
|
k.triantaf
|
properties: EnvProperties;
|
128 |
58275
|
k.triantaf
|
constructor(private route: ActivatedRoute,
|
129 |
|
|
private _router: Router,
|
130 |
|
|
private _location: Location,
|
131 |
|
|
private _meta: Meta,
|
132 |
|
|
private _title: Title,
|
133 |
|
|
private seoService: SEOService,
|
134 |
56644
|
k.triantaf
|
private _piwikService: PiwikService,
|
135 |
58275
|
k.triantaf
|
private helper: HelperService,
|
136 |
|
|
private _projectService: ProjectService,
|
137 |
57027
|
konstantin
|
private _searchResearchResultsService: SearchResearchResultsService,
|
138 |
56644
|
k.triantaf
|
private _reportsService: ReportsService,
|
139 |
58724
|
konstantin
|
private htmlService: HtmlProjectReportService,
|
140 |
|
|
private indexInfoService: IndexInfoService) {}
|
141 |
50169
|
argiro.kok
|
|
142 |
|
|
ngOnInit() {
|
143 |
59899
|
argiro.kok
|
|
144 |
|
|
this.properties = properties;
|
145 |
58874
|
konstantin
|
if (typeof document !== 'undefined') {
|
146 |
59816
|
argiro.kok
|
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
|
147 |
58874
|
konstantin
|
if (lastIndexUpdate) {
|
148 |
|
|
this.indexUpdateDate = new Date(lastIndexUpdate);
|
149 |
|
|
}
|
150 |
59816
|
argiro.kok
|
}));
|
151 |
58874
|
konstantin
|
}
|
152 |
56644
|
k.triantaf
|
//this.getDivContents();
|
153 |
|
|
this.getPageContents();
|
154 |
59413
|
argiro.kok
|
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
155 |
50586
|
argiro.kok
|
|
156 |
59899
|
argiro.kok
|
|
157 |
59816
|
argiro.kok
|
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
158 |
56644
|
k.triantaf
|
this.metricsClicked = false;
|
159 |
|
|
this.statsClicked = false;
|
160 |
57027
|
konstantin
|
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
161 |
|
|
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
162 |
|
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
163 |
|
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
164 |
60614
|
k.triantaf
|
this.fetchDmps = new FetchResearchResults(this._searchResearchResultsService);
|
165 |
56644
|
k.triantaf
|
var title = "Project";
|
166 |
|
|
var description = "";
|
167 |
50169
|
argiro.kok
|
|
168 |
58275
|
k.triantaf
|
this.header1 = "";
|
169 |
|
|
|
170 |
56644
|
k.triantaf
|
this.updateTitle(title);
|
171 |
|
|
this.updateDescription(description);
|
172 |
50169
|
argiro.kok
|
this.projectId = params['projectId'];
|
173 |
51318
|
argiro.kok
|
var grantId = params['grantId'];
|
174 |
|
|
var funder = params['funder'];
|
175 |
50169
|
argiro.kok
|
|
176 |
|
|
|
177 |
58940
|
argiro.kok
|
if (this.projectId && StringUtils.isOpenAIREID(this.projectId)) {
|
178 |
56644
|
k.triantaf
|
this.getProjectInfo(this.projectId);
|
179 |
|
|
this.actionsAfterLoadId();
|
180 |
|
|
} else if (grantId && funder) {
|
181 |
|
|
this.getProjectInfoByGrantId(grantId, funder);
|
182 |
|
|
} else {
|
183 |
50169
|
argiro.kok
|
|
184 |
56644
|
k.triantaf
|
this.showLoading = false;
|
185 |
57536
|
konstantin
|
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
|
186 |
57494
|
konstantin
|
//this.warningMessage = "No valid project id";
|
187 |
50169
|
argiro.kok
|
}
|
188 |
|
|
|
189 |
50586
|
argiro.kok
|
this.downloadURLAPI = this.properties.csvAPIURL;
|
190 |
50169
|
argiro.kok
|
|
191 |
|
|
this.createClipboard();
|
192 |
59816
|
argiro.kok
|
}));
|
193 |
56644
|
k.triantaf
|
}
|
194 |
50169
|
argiro.kok
|
|
195 |
58275
|
k.triantaf
|
public getFileNameType(type: string) {
|
196 |
|
|
if(type == "results") {
|
197 |
|
|
return "research-outcomes";
|
198 |
|
|
} else if(type == "publications") {
|
199 |
|
|
return "publications";
|
200 |
|
|
} else if(type == "datasets") {
|
201 |
|
|
return "research-data";
|
202 |
|
|
} else if(type == "software") {
|
203 |
|
|
return "software";
|
204 |
|
|
} else if(type == "other") {
|
205 |
|
|
return "other-research-products";
|
206 |
|
|
}
|
207 |
|
|
return "results";
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
public getCsvParams(type: string) {
|
211 |
|
|
// if(type == "results") {
|
212 |
|
|
// type = "publications&type=datasets&type=software&type=other";
|
213 |
|
|
// }
|
214 |
|
|
return "?format=csv-special&type="+type+"&fq=(relprojectid exact \"" + this.projectId + "\")";
|
215 |
|
|
}
|
216 |
|
|
|
217 |
56644
|
k.triantaf
|
private getPageContents() {
|
218 |
59007
|
k.triantaf
|
if(this.communityId) {
|
219 |
59816
|
argiro.kok
|
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
220 |
59007
|
k.triantaf
|
this.pageContents = contents;
|
221 |
59816
|
argiro.kok
|
}));
|
222 |
59007
|
k.triantaf
|
}
|
223 |
56644
|
k.triantaf
|
}
|
224 |
50169
|
argiro.kok
|
|
225 |
56644
|
k.triantaf
|
private getDivContents() {
|
226 |
59007
|
k.triantaf
|
if(this.communityId) {
|
227 |
59816
|
argiro.kok
|
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
228 |
59007
|
k.triantaf
|
this.divContents = contents;
|
229 |
59816
|
argiro.kok
|
}));
|
230 |
59007
|
k.triantaf
|
}
|
231 |
56644
|
k.triantaf
|
}
|
232 |
51318
|
argiro.kok
|
|
233 |
58275
|
k.triantaf
|
getDynamicContent(type: string) {
|
234 |
|
|
return "<script type=\"text/javascript\">"
|
235 |
56644
|
k.triantaf
|
+ "\n<!--"
|
236 |
|
|
+ "\ndocument.write('<div id=\"oa_widget\"></div>');"
|
237 |
|
|
+ "\ndocument.write('<script type=\"text/javascript\""
|
238 |
|
|
+ " src=\"" + this.properties.widgetLink
|
239 |
58275
|
k.triantaf
|
+ this.projectId + "&type="
|
240 |
|
|
+ type
|
241 |
|
|
+ "\"></script>');"
|
242 |
56644
|
k.triantaf
|
+ "\n-->"
|
243 |
|
|
+ "\n</script>";
|
244 |
58275
|
k.triantaf
|
}
|
245 |
51318
|
argiro.kok
|
|
246 |
58275
|
k.triantaf
|
actionsAfterLoadId() {
|
247 |
58874
|
konstantin
|
//this.getProjectInfo(this.projectId);
|
248 |
56644
|
k.triantaf
|
//this.searchPublications();
|
249 |
58874
|
konstantin
|
|
250 |
|
|
if (typeof document !== 'undefined') {
|
251 |
|
|
this.fetchPublications.getNumForEntity("publication", "project", this.projectId, this.properties);
|
252 |
|
|
this.fetchDatasets.getNumForEntity("dataset", "project", this.projectId, this.properties);
|
253 |
|
|
this.fetchSoftware.getNumForEntity("software", "project", this.projectId, this.properties);
|
254 |
|
|
this.fetchOrps.getNumForEntity("other", "project", this.projectId, this.properties);
|
255 |
60614
|
k.triantaf
|
this.searchDmps(1, this.searchNumber);
|
256 |
58874
|
konstantin
|
}
|
257 |
56644
|
k.triantaf
|
}
|
258 |
|
|
|
259 |
50169
|
argiro.kok
|
ngOnDestroy() {
|
260 |
59816
|
argiro.kok
|
this.subscriptions.forEach(subscription => {
|
261 |
|
|
if (subscription instanceof Subscriber) {
|
262 |
|
|
subscription.unsubscribe();
|
263 |
|
|
}
|
264 |
|
|
});
|
265 |
|
|
this.fetchDatasets.clearSubscriptions();
|
266 |
|
|
this.fetchPublications.clearSubscriptions();
|
267 |
|
|
this.fetchSoftware.clearSubscriptions();
|
268 |
60614
|
k.triantaf
|
this.fetchOrps.clearSubscriptions();
|
269 |
|
|
this.fetchDmps.clearSubscriptions();
|
270 |
50169
|
argiro.kok
|
}
|
271 |
|
|
|
272 |
|
|
private createClipboard() {
|
273 |
56644
|
k.triantaf
|
if (typeof window !== 'undefined') {
|
274 |
58275
|
k.triantaf
|
delete this.clipboard;
|
275 |
56644
|
k.triantaf
|
let Clipboard;
|
276 |
|
|
Clipboard = require('clipboard');
|
277 |
58275
|
k.triantaf
|
this.clipboard = new Clipboard('.clipboard_btn');
|
278 |
56644
|
k.triantaf
|
}
|
279 |
50169
|
argiro.kok
|
}
|
280 |
|
|
|
281 |
58812
|
konstantin
|
public searchPublications(page: number, size: number) {
|
282 |
|
|
if (this.reloadPublications &&
|
283 |
|
|
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
|
284 |
|
|
(this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0)
|
285 |
|
|
)
|
286 |
|
|
) {
|
287 |
|
|
this.fetchPublications.getResultsForEntity("publication", "project", this.projectId, page, size, this.properties);
|
288 |
|
|
}
|
289 |
52401
|
konstantin
|
this.reloadPublications = false;
|
290 |
50169
|
argiro.kok
|
}
|
291 |
60614
|
k.triantaf
|
|
292 |
|
|
public searchDmps(page: number, size: number) {
|
293 |
|
|
if (this.reloadDmps &&
|
294 |
|
|
(this.fetchDmps.searchUtils.status == this.errorCodes.LOADING ||
|
295 |
|
|
(this.fetchDmps.searchUtils.status == this.errorCodes.DONE && this.fetchDmps.searchUtils.totalResults > 0)
|
296 |
|
|
)
|
297 |
|
|
) {
|
298 |
|
|
this.fetchDmps.getDmps("project", this.projectId, page, size, this.properties);
|
299 |
|
|
}
|
300 |
|
|
this.reloadDmps = false;
|
301 |
|
|
}
|
302 |
50169
|
argiro.kok
|
|
303 |
58812
|
konstantin
|
public searchDatasets(page: number, size: number) {
|
304 |
|
|
if (this.reloadDatasets &&
|
305 |
|
|
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
306 |
|
|
(this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0)
|
307 |
|
|
)
|
308 |
|
|
) {
|
309 |
|
|
this.fetchDatasets.getResultsForEntity("dataset", "project", this.projectId, page, size, this.properties);
|
310 |
|
|
}
|
311 |
56644
|
k.triantaf
|
this.reloadDatasets = false;
|
312 |
50169
|
argiro.kok
|
}
|
313 |
|
|
|
314 |
58812
|
konstantin
|
private searchSoftware(page: number, size: number) {
|
315 |
|
|
if (this.reloadSoftware &&
|
316 |
|
|
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
|
317 |
|
|
(this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0)
|
318 |
|
|
)
|
319 |
|
|
) {
|
320 |
|
|
this.fetchSoftware.getResultsForEntity("software", "project", this.projectId, page, size, this.properties);
|
321 |
|
|
}
|
322 |
56644
|
k.triantaf
|
this.reloadSoftware = false;
|
323 |
50169
|
argiro.kok
|
}
|
324 |
|
|
|
325 |
58812
|
konstantin
|
private searchOrps(page: number, size: number) {
|
326 |
|
|
if (this.reloadOrps &&
|
327 |
|
|
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING ||
|
328 |
|
|
(this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0)
|
329 |
|
|
)
|
330 |
|
|
) {
|
331 |
|
|
this.fetchOrps.getResultsForEntity("other", "project", this.projectId, page, size, this.properties);
|
332 |
|
|
}
|
333 |
56644
|
k.triantaf
|
this.reloadOrps = false;
|
334 |
52828
|
konstantin
|
}
|
335 |
|
|
|
336 |
56644
|
k.triantaf
|
private getProjectInfo(id: string) {
|
337 |
|
|
this.warningMessage = '';
|
338 |
58286
|
konstantin
|
this.errorMessage = "";
|
339 |
50169
|
argiro.kok
|
this.showLoading = true;
|
340 |
|
|
|
341 |
52606
|
konstantin
|
this.projectInfo = null;
|
342 |
|
|
|
343 |
59816
|
argiro.kok
|
this.subscriptions.push(this._projectService.getProjectInfo(id, this.properties).subscribe(
|
344 |
50169
|
argiro.kok
|
data => {
|
345 |
56644
|
k.triantaf
|
this.projectInfo = data;
|
346 |
50169
|
argiro.kok
|
|
347 |
56644
|
k.triantaf
|
this.actionsAfterGettingProjectInfo();
|
348 |
50169
|
argiro.kok
|
},
|
349 |
|
|
err => {
|
350 |
56644
|
k.triantaf
|
//console.log(err);
|
351 |
|
|
this.handleError("Error getting project for id: " + this.projectId, err);
|
352 |
57494
|
konstantin
|
if(err.status == 404) {
|
353 |
57536
|
konstantin
|
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
|
354 |
57494
|
konstantin
|
}
|
355 |
59411
|
argiro.kok
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
|
356 |
58286
|
konstantin
|
this.errorMessage = 'No project found';
|
357 |
56644
|
k.triantaf
|
this.showLoading = false;
|
358 |
|
|
}
|
359 |
59816
|
argiro.kok
|
));
|
360 |
56644
|
k.triantaf
|
}
|
361 |
50169
|
argiro.kok
|
|
362 |
56644
|
k.triantaf
|
private getProjectInfoByGrantId(grantId: string, funder: string) {
|
363 |
|
|
this.warningMessage = '';
|
364 |
58286
|
konstantin
|
this.errorMessage = "";
|
365 |
56644
|
k.triantaf
|
this.showLoading = true;
|
366 |
52606
|
konstantin
|
|
367 |
56644
|
k.triantaf
|
this.projectInfo = null;
|
368 |
51318
|
argiro.kok
|
|
369 |
59816
|
argiro.kok
|
this.subscriptions.push(this._projectService.getProjectInfoByGrantId(grantId, funder, this.properties).subscribe(
|
370 |
56644
|
k.triantaf
|
data => {
|
371 |
51318
|
argiro.kok
|
|
372 |
56644
|
k.triantaf
|
this.projectInfo = data;
|
373 |
|
|
|
374 |
|
|
this.actionsAfterGettingProjectInfo();
|
375 |
|
|
this.projectId = this.projectInfo.id;
|
376 |
|
|
this.actionsAfterLoadId();
|
377 |
|
|
},
|
378 |
|
|
err => {
|
379 |
|
|
//console.log(err);
|
380 |
|
|
this.handleError("Error getting project for grant id: " + grantId + " and funder: " + funder, err);
|
381 |
58286
|
konstantin
|
if(err.status == 404) {
|
382 |
|
|
this._router.navigate(['/error'], {queryParams: {"page": this._location.path(true), "page_type": "project"}});
|
383 |
|
|
}
|
384 |
59411
|
argiro.kok
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToProjects);
|
385 |
56644
|
k.triantaf
|
this.errorMessage = 'No project found';
|
386 |
|
|
this.showLoading = false;
|
387 |
|
|
}
|
388 |
59816
|
argiro.kok
|
));
|
389 |
51318
|
argiro.kok
|
}
|
390 |
|
|
|
391 |
56644
|
k.triantaf
|
actionsAfterGettingProjectInfo() {
|
392 |
|
|
this.projectName = this.projectInfo.acronym;
|
393 |
|
|
if (this.projectName == undefined || this.projectName == '') {
|
394 |
|
|
this.projectName = this.projectInfo.title;
|
395 |
|
|
}
|
396 |
59411
|
argiro.kok
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url);
|
397 |
56644
|
k.triantaf
|
this.updateTitle(this.projectName);
|
398 |
59375
|
argiro.kok
|
this.updateDescription(this.projectInfo.description?this.projectInfo.description: ("project" + (this.projectInfo.title?"," + this.projectInfo.title:"") + (this.projectInfo.funding && this.projectInfo.funding.funderName?", funder: " + this.projectInfo.funding.funderName:"") + (this.projectInfo.acronym?"," + this.projectInfo.acronym:"")));
|
399 |
56644
|
k.triantaf
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
400 |
59816
|
argiro.kok
|
this.subscriptions.push(this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe());
|
401 |
56644
|
k.triantaf
|
}
|
402 |
51318
|
argiro.kok
|
|
403 |
56644
|
k.triantaf
|
this.project = {
|
404 |
|
|
funderId: "",
|
405 |
58275
|
k.triantaf
|
funderName: ((this.projectInfo.funding) ? this.projectInfo.funding.funderShortName: ''),
|
406 |
56644
|
k.triantaf
|
projectId: this.projectId,
|
407 |
|
|
projectName: this.projectInfo.title,
|
408 |
|
|
projectAcronym: this.projectInfo.acronym,
|
409 |
|
|
startDate: this.projectInfo.startDate,
|
410 |
|
|
endDate: this.projectInfo.endDate
|
411 |
|
|
};
|
412 |
51318
|
argiro.kok
|
|
413 |
59063
|
argiro.kok
|
this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"' + this.projectId + '","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":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&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(124, 181, 236, 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';
|
414 |
51318
|
argiro.kok
|
|
415 |
59063
|
argiro.kok
|
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"projRepoDownloads","projTitle":"' + this.projectId + '","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":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&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(124, 181, 236, 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';
|
416 |
51318
|
argiro.kok
|
|
417 |
56644
|
k.triantaf
|
//stats tab charts
|
418 |
58656
|
konstantin
|
if (this.properties.useNewStatistisTool) {
|
419 |
|
|
this.chartScientificResultsUrl = this.properties.statisticsFrameNewAPIURL +
|
420 |
58669
|
argiro.kok
|
'chart?json='+StringUtils.URIEncode('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"column","query":{"name":"projScient","parameters":["'+this.projectId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Produced research outcomes per year"},"subtitle":{},"yAxis":{"title":{"text":"Research outcomes"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
421 |
58656
|
konstantin
|
this.chartAccessModeUrl = this.properties.statisticsFrameNewAPIURL +
|
422 |
|
|
'chart?json='+StringUtils.URIEncode(
|
423 |
58678
|
argiro.kok
|
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"pie","query":{"name":"projOA","parameters":["'+this.projectId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Access mode of research outcomes"},"subtitle":{},"yAxis":{"title":{"text":"Research outcomes"}},"xAxis":{"title":{"text":"Access mode"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
424 |
58656
|
konstantin
|
this.chartDatasourcesUrl = this.properties.statisticsFrameNewAPIURL +
|
425 |
|
|
'chart?json='+StringUtils.URIEncode(
|
426 |
58799
|
konstantin
|
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research outcomes","type":"bar","query":{"name":"projPubsRepos","parameters":["'+this.projectId+'"]}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Research outcomes per datasource"},"subtitle":{},"yAxis":{"title":{"text":"Research outcomes"}},"xAxis":{"title":{"text":"Datasource"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":true}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}');
|
427 |
58656
|
konstantin
|
} else {
|
428 |
|
|
this.chartScientificResultsUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
|
429 |
|
|
this.chartAccessModeUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
|
430 |
|
|
this.chartDatasourcesUrl = this.properties.statisticsFrameAPIURL + 'chart.php?com=query&persistent=false&data={"query":"projPubsRepos","projTitle":"' + this.projectId + '", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
|
431 |
|
|
}
|
432 |
50169
|
argiro.kok
|
|
433 |
56644
|
k.triantaf
|
this.showLoading = false;
|
434 |
|
|
}
|
435 |
53731
|
konstantin
|
|
436 |
58275
|
k.triantaf
|
public downloadCsvFile(url: string, filename: string) {
|
437 |
56644
|
k.triantaf
|
this.openLoading();
|
438 |
|
|
this.setMessageLoading("Downloading CSV file");
|
439 |
53731
|
konstantin
|
|
440 |
59816
|
argiro.kok
|
this.subscriptions.push(this._reportsService.downloadCSVFile(url).subscribe(
|
441 |
56644
|
k.triantaf
|
data => {
|
442 |
|
|
this.closeLoading();
|
443 |
54825
|
konstantin
|
|
444 |
58275
|
k.triantaf
|
let url = window.URL.createObjectURL(data);
|
445 |
|
|
this.download(url, filename+".csv");
|
446 |
56644
|
k.triantaf
|
|
447 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
448 |
60406
|
argiro.kok
|
this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV"+filename, this.piwikSiteId).subscribe());
|
449 |
56644
|
k.triantaf
|
}
|
450 |
|
|
},
|
451 |
|
|
error => {
|
452 |
|
|
//console.log("Error downloading the file.");
|
453 |
|
|
this.handleError("Error downloading file: " + filename, error);
|
454 |
|
|
|
455 |
|
|
this.closeLoading();
|
456 |
58275
|
k.triantaf
|
this.confirmOpenFileDownloadError("CSV");
|
457 |
56644
|
k.triantaf
|
}/*,
|
458 |
54778
|
konstantin
|
() => console.log('Completed file download.')*/
|
459 |
59816
|
argiro.kok
|
));
|
460 |
56644
|
k.triantaf
|
}
|
461 |
50169
|
argiro.kok
|
|
462 |
56644
|
k.triantaf
|
public metricsResults($event) {
|
463 |
|
|
this.totalViews = $event.totalViews;
|
464 |
|
|
this.totalDownloads = $event.totalDownloads;
|
465 |
|
|
this.pageViews = $event.pageViews;
|
466 |
|
|
}
|
467 |
58598
|
k.triantaf
|
|
468 |
|
|
public get hasMetrics(): boolean {
|
469 |
60826
|
argiro.kok
|
return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0||this.pageViews > 0;
|
470 |
58598
|
k.triantaf
|
}
|
471 |
50169
|
argiro.kok
|
|
472 |
58275
|
k.triantaf
|
public openStatistics() {
|
473 |
|
|
this.statsClicked = true;
|
474 |
|
|
this.statisticsModal.cancelButton = false;
|
475 |
|
|
this.statisticsModal.okButton = false;
|
476 |
|
|
this.statisticsModal.alertTitle = "Statistics of";
|
477 |
|
|
this.statisticsModal.open();
|
478 |
|
|
}
|
479 |
|
|
|
480 |
58717
|
konstantin
|
public openLinkProjectModal() {
|
481 |
|
|
this.linkProjectModal.cancelButton = false;
|
482 |
|
|
this.linkProjectModal.okButton = false;
|
483 |
|
|
this.linkProjectModal.alertTitle = "Link this project to";
|
484 |
58733
|
konstantin
|
//this.linkProjectModal.alertHeader = false;
|
485 |
58717
|
konstantin
|
this.linkProjectModal.open();
|
486 |
|
|
}
|
487 |
|
|
|
488 |
|
|
public openShareResultsModal() {
|
489 |
|
|
this.shareResultsModal.cancelButton = false;
|
490 |
|
|
this.shareResultsModal.okButton = false;
|
491 |
|
|
this.shareResultsModal.alertTitle = "Share results";
|
492 |
|
|
this.shareResultsModal.open();
|
493 |
|
|
}
|
494 |
|
|
|
495 |
|
|
public openDownloadReportModal() {
|
496 |
58788
|
konstantin
|
if(this.fetchPublications.searchUtils.totalResults > 0 || this.fetchDatasets.searchUtils.totalResults > 0 ||
|
497 |
|
|
this.fetchSoftware.searchUtils.totalResults > 0 || this.fetchOrps.searchUtils.totalResults > 0) {
|
498 |
|
|
this.download_research_results_type = "results";
|
499 |
|
|
}
|
500 |
58717
|
konstantin
|
this.downloadReportModal.cancelButton = false;
|
501 |
|
|
this.downloadReportModal.okButton = false;
|
502 |
|
|
this.downloadReportModal.alertTitle = "Download report";
|
503 |
|
|
this.downloadReportModal.open();
|
504 |
|
|
}
|
505 |
|
|
|
506 |
58275
|
k.triantaf
|
private createHeaders(type: string) {
|
507 |
|
|
this.openLoading();
|
508 |
|
|
this.setMessageLoading("Downloading HTML file");
|
509 |
|
|
|
510 |
|
|
if(!this.header1) {
|
511 |
|
|
this.createHeader1();
|
512 |
|
|
}
|
513 |
|
|
|
514 |
|
|
if (type == "publications") {
|
515 |
|
|
this.header2 = this.fetchPublications.searchUtils.totalResults.toLocaleString('en-US') + " publications";
|
516 |
|
|
} else if (type == "datasets") {
|
517 |
|
|
this.header2 = this.fetchDatasets.searchUtils.totalResults.toLocaleString('en-US') + " research data";
|
518 |
|
|
} else if (type == "software") {
|
519 |
|
|
this.header2 = this.fetchSoftware.searchUtils.totalResults.toLocaleString('en-US') + " software";
|
520 |
|
|
} else if (type == "other") {
|
521 |
|
|
this.header2 = this.fetchOrps.searchUtils.totalResults.toLocaleString('en-US') + " other research products";
|
522 |
|
|
} else if (type == "results") {
|
523 |
|
|
let totalResults: number = (+this.fetchPublications.searchUtils.totalResults) +
|
524 |
|
|
(+this.fetchDatasets.searchUtils.totalResults) +
|
525 |
|
|
(+this.fetchSoftware.searchUtils.totalResults) +
|
526 |
|
|
(+this.fetchOrps.searchUtils.totalResults);
|
527 |
|
|
|
528 |
|
|
this.header2 = totalResults.toLocaleString('en-US') + " research outcomes";
|
529 |
|
|
}
|
530 |
|
|
}
|
531 |
|
|
|
532 |
|
|
private createHtmlFile(type: string, filename: string) {
|
533 |
|
|
let intro: string = '<!doctype html>';
|
534 |
|
|
intro += '<html lang="en-gb" dir="ltr" vocab="http://schema.org/">';
|
535 |
|
|
intro += '<head>';
|
536 |
|
|
intro += '<title>' + this.header1 + '</title>';
|
537 |
|
|
intro += '</head>';
|
538 |
|
|
|
539 |
|
|
if (typeof window !== 'undefined') {
|
540 |
59816
|
argiro.kok
|
this.subscriptions.push(this.htmlService.getHTML(this.projectId, type, this.properties.csvAPIURL).subscribe(
|
541 |
58275
|
k.triantaf
|
data => {
|
542 |
|
|
//console.info(data);
|
543 |
|
|
this.htmlResultDownload = intro + '<body><div>' + this.header1 + '</div><div><h4>' + this.header2 + '</h4></div>';
|
544 |
|
|
this.htmlResultDownload += "<table><thead><tr> <th>Type</th><th>Title</th><th>Authors</th><th>Publication Year</th><th>DOI</th><th>Permanent Identifier</th><th>Publication type</th><th>Journal</th><th>Project Name (GA Number)</th><th>Access Mode</th></tr></thead><tbody>" + data + "</tbody></table>";
|
545 |
|
|
this.htmlResultDownload += '</body></html>';
|
546 |
|
|
|
547 |
|
|
//console.info(this.htmlResultDownload);
|
548 |
|
|
this.closeLoading();
|
549 |
|
|
|
550 |
|
|
let url = window.URL.createObjectURL(new Blob([this.htmlResultDownload], { type: 'text/html' }));
|
551 |
|
|
this.download(url, filename+".html");
|
552 |
|
|
|
553 |
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
554 |
60406
|
argiro.kok
|
this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadHTML"+filename, this.piwikSiteId).subscribe());
|
555 |
58275
|
k.triantaf
|
}
|
556 |
|
|
},
|
557 |
|
|
err => {
|
558 |
|
|
this.handleError("Error getting html for id: " + this.projectId, err);
|
559 |
|
|
//this.errorMessage = 'Service not available';
|
560 |
|
|
this.closeLoading();
|
561 |
|
|
this.confirmOpenFileDownloadError("HTML");
|
562 |
|
|
}
|
563 |
59816
|
argiro.kok
|
));
|
564 |
58275
|
k.triantaf
|
} else {
|
565 |
|
|
this.closeLoading();
|
566 |
|
|
this.confirmOpenFileDownloadError("HTML");
|
567 |
|
|
}
|
568 |
|
|
}
|
569 |
|
|
|
570 |
|
|
downloadHtmlFile(type: string, filename: string) {
|
571 |
|
|
this.createHeaders(type);
|
572 |
|
|
this.createHtmlFile(type, filename);
|
573 |
|
|
}
|
574 |
|
|
|
575 |
|
|
createHeader1() {
|
576 |
|
|
// if (title != undefined && title != "") {
|
577 |
|
|
// this.header1 += title;
|
578 |
|
|
// }
|
579 |
|
|
// if ((title != undefined && title != "") &&
|
580 |
|
|
// ((acronym != undefined && acronym != "") ||
|
581 |
|
|
// (code != undefined && code != ""))) {
|
582 |
|
|
// this.header1 += "(";
|
583 |
|
|
// }
|
584 |
|
|
// if (acronym != undefined && acronym != "") {
|
585 |
|
|
// this.header1 += acronym + " - ";
|
586 |
|
|
// }
|
587 |
|
|
// if (code != undefined && code != "") {
|
588 |
|
|
// this.header1 += code;
|
589 |
|
|
// }
|
590 |
|
|
// if ((title != undefined && title != "") &&
|
591 |
|
|
// ((acronym != undefined && acronym != "") ||
|
592 |
|
|
// (code != undefined && code != ""))) {
|
593 |
|
|
// this.header1 += ")";
|
594 |
|
|
// }
|
595 |
|
|
|
596 |
|
|
this.header1 = "<div style=\"font-size:12px;\"><span>Project</span>";
|
597 |
|
|
|
598 |
|
|
if(this.projectInfo.startDate || this.projectInfo.endDate) {
|
599 |
|
|
this.header1 += "<span> . "
|
600 |
|
|
}
|
601 |
|
|
if(this.projectInfo.startDate && !this.projectInfo.endDate) {
|
602 |
|
|
this.header1 += "from ";
|
603 |
|
|
}
|
604 |
|
|
if(!this.projectInfo.startDate && this.projectInfo.endDate) {
|
605 |
|
|
this.header1 += "until ";
|
606 |
|
|
}
|
607 |
|
|
if(this.projectInfo.startDate) {
|
608 |
|
|
let startYear = (new Date(this.projectInfo.startDate)).getFullYear();
|
609 |
|
|
this.header1 += startYear;
|
610 |
|
|
}
|
611 |
|
|
if(this.projectInfo.startDate && this.projectInfo.endDate) {
|
612 |
|
|
this.header1 += " - ";
|
613 |
|
|
}
|
614 |
|
|
if(this.projectInfo.endDate) {
|
615 |
|
|
let endYear = (new Date(this.projectInfo.endDate)).getFullYear();
|
616 |
|
|
this.header1 += endYear;
|
617 |
|
|
}
|
618 |
|
|
if(this.projectInfo.startDate || this.projectInfo.endDate) {
|
619 |
|
|
this.header1 += "</span>"
|
620 |
|
|
}
|
621 |
|
|
|
622 |
|
|
if(this.projectInfo.status) {
|
623 |
|
|
this.header1 += "<span> . "+this.projectInfo.status+"</span>";
|
624 |
|
|
}
|
625 |
|
|
|
626 |
|
|
if(this.projectInfo.funding && this.projectInfo.funding.code) {
|
627 |
|
|
this.header1 += "<span> . "+this.projectInfo.funding.code+"</span>";
|
628 |
|
|
}
|
629 |
|
|
this.header1 += "</div>";
|
630 |
|
|
|
631 |
|
|
this.header1 += "<h1 style=\"margin:0;\"><div><a href=\""+window.location.href +"\">";
|
632 |
|
|
if(this.projectInfo.acronym) {
|
633 |
|
|
this.header1 += this.projectInfo.acronym;
|
634 |
|
|
} else {
|
635 |
|
|
this.header1 += "[no title available]";
|
636 |
|
|
}
|
637 |
|
|
this.header1 += "</a></div></h2>";
|
638 |
|
|
//<showTitle [titleName]="title" classNames="uk-margin-remove-bottom"></showTitle>
|
639 |
|
|
if(this.projectInfo.title) {
|
640 |
|
|
this.header1 += "<div><span>"+this.projectInfo.title+"</span></div>";
|
641 |
|
|
}
|
642 |
|
|
}
|
643 |
|
|
|
644 |
|
|
public download(url, filename) {
|
645 |
|
|
//var url = window.URL.createObjectURL(new Blob([this.htmlResultDownload], { type: 'text/html' }));
|
646 |
|
|
var a = window.document.createElement('a');
|
647 |
|
|
window.document.body.appendChild(a);
|
648 |
|
|
a.setAttribute('style', 'display: none');
|
649 |
|
|
a.href = url;
|
650 |
|
|
a.download = filename;
|
651 |
|
|
a.click();
|
652 |
|
|
window.URL.revokeObjectURL(url);
|
653 |
|
|
a.remove(); // remove the element
|
654 |
|
|
}
|
655 |
|
|
|
656 |
|
|
|
657 |
58717
|
konstantin
|
public onSelectActiveTab(activeTabId) {
|
658 |
58735
|
k.triantaf
|
if(this.activeTab != activeTabId) { // tab really changed
|
659 |
58717
|
konstantin
|
if (activeTabId == 'summary') {
|
660 |
|
|
this.activeTab = 'summary';
|
661 |
|
|
} else if (activeTabId == 'publications') {
|
662 |
|
|
this.activeTab = 'publications';
|
663 |
58812
|
konstantin
|
this.searchPublications(1, this.searchNumber);
|
664 |
58717
|
konstantin
|
} else if (activeTabId == 'datasets') {
|
665 |
|
|
this.activeTab = 'datasets';
|
666 |
58812
|
konstantin
|
this.searchDatasets(1, this.searchNumber);
|
667 |
58717
|
konstantin
|
} else if (activeTabId == 'software') {
|
668 |
|
|
this.activeTab = 'software';
|
669 |
58812
|
konstantin
|
this.searchSoftware(1, this.searchNumber);
|
670 |
58717
|
konstantin
|
} else if (activeTabId == 'other') {
|
671 |
|
|
this.activeTab = "other";
|
672 |
58812
|
konstantin
|
this.searchOrps(1, this.searchNumber);
|
673 |
58717
|
konstantin
|
} else if (activeTabId == 'statistics') {
|
674 |
|
|
this.activeTab = 'statistics';
|
675 |
|
|
this.statsClicked = true;
|
676 |
60614
|
k.triantaf
|
} else if (activeTabId == 'dmps') {
|
677 |
|
|
this.activeTab = 'dmps';
|
678 |
|
|
this.searchDmps(1, this.searchNumber);
|
679 |
58717
|
konstantin
|
}
|
680 |
|
|
}
|
681 |
|
|
}
|
682 |
|
|
|
683 |
56644
|
k.triantaf
|
private updateDescription(description: string) {
|
684 |
57820
|
argiro.kok
|
this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
|
685 |
|
|
this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
|
686 |
56644
|
k.triantaf
|
}
|
687 |
|
|
|
688 |
|
|
private updateTitle(title: string) {
|
689 |
56840
|
konstantin
|
var _prefix = "";
|
690 |
57820
|
argiro.kok
|
// if(!this.communityId) {
|
691 |
|
|
// _prefix = "OpenAIRE | ";
|
692 |
|
|
// }
|
693 |
|
|
// var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
|
694 |
|
|
this._title.setTitle(title);
|
695 |
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
696 |
56644
|
k.triantaf
|
}
|
697 |
|
|
|
698 |
|
|
private updateUrl(url: string) {
|
699 |
|
|
this._meta.updateTag({content: url}, "property='og:url'");
|
700 |
|
|
}
|
701 |
|
|
|
702 |
|
|
private openLoading() {
|
703 |
|
|
if (this.loading) {
|
704 |
|
|
this.loading.open();
|
705 |
50169
|
argiro.kok
|
}
|
706 |
56644
|
k.triantaf
|
}
|
707 |
50169
|
argiro.kok
|
|
708 |
56644
|
k.triantaf
|
private closeLoading() {
|
709 |
|
|
if (this.loading) {
|
710 |
|
|
this.loading.close();
|
711 |
50169
|
argiro.kok
|
}
|
712 |
56644
|
k.triantaf
|
}
|
713 |
50169
|
argiro.kok
|
|
714 |
56644
|
k.triantaf
|
private setMessageLoading(message: string) {
|
715 |
|
|
if (this.loading) {
|
716 |
|
|
this.loading.message = message;
|
717 |
50169
|
argiro.kok
|
}
|
718 |
56644
|
k.triantaf
|
}
|
719 |
54825
|
konstantin
|
|
720 |
58275
|
k.triantaf
|
public confirmOpenFileDownloadError(fileType: string) {
|
721 |
56644
|
k.triantaf
|
this.alertCsvError.cancelButton = false;
|
722 |
|
|
this.alertCsvError.okButton = true;
|
723 |
58275
|
k.triantaf
|
this.alertCsvError.alertTitle = "ERROR DOWNLOADING "+fileType+" FILE";
|
724 |
56644
|
k.triantaf
|
this.alertCsvError.message = "There was an error in csv downloading. Please try again later.";
|
725 |
|
|
this.alertCsvError.okButtonText = "OK";
|
726 |
|
|
this.alertCsvError.open();
|
727 |
|
|
}
|
728 |
|
|
|
729 |
|
|
private handleError(message: string, error) {
|
730 |
|
|
console.error("Project Landing Page: " + message, error);
|
731 |
|
|
}
|
732 |
|
|
|
733 |
|
|
isRouteAvailable(routeToCheck: string) {
|
734 |
58275
|
k.triantaf
|
for (let i = 0; i < this._router.config.length; i++) {
|
735 |
|
|
let routePath: string = this._router.config[i].path;
|
736 |
56644
|
k.triantaf
|
if (routePath == routeToCheck) {
|
737 |
56059
|
argiro.kok
|
return true;
|
738 |
|
|
}
|
739 |
|
|
}
|
740 |
|
|
return false;
|
741 |
|
|
}
|
742 |
58717
|
konstantin
|
|
743 |
|
|
private getEntityName (entityType:string, plural:boolean, full:boolean): string {
|
744 |
|
|
if(entityType == "publication") {
|
745 |
|
|
return "publication" + (plural ? "s" : "");
|
746 |
|
|
} else if(entityType == "dataset") {
|
747 |
|
|
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
|
748 |
|
|
} else if(entityType == "software") {
|
749 |
|
|
return "software";
|
750 |
|
|
} else if(entityType == "other") {
|
751 |
|
|
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
752 |
|
|
} else if(entityType == "dataprovider") {
|
753 |
|
|
return (full ? ("content provider" + (plural ? "s" : "")) : "dataprovider" + (plural ? "s" : ""));
|
754 |
|
|
} else {
|
755 |
|
|
return entityType + (plural ? "s" : "");
|
756 |
|
|
}
|
757 |
|
|
}
|
758 |
58724
|
konstantin
|
|
759 |
|
|
public getResultPreview(result: SearchResult, type: string): ResultPreview {
|
760 |
|
|
return ResultPreview.searchResultConvert(result, type);
|
761 |
|
|
}
|
762 |
58737
|
k.triantaf
|
|
763 |
|
|
public scroll() {
|
764 |
|
|
HelperFunctions.scroll();
|
765 |
|
|
}
|
766 |
58788
|
konstantin
|
|
767 |
60614
|
k.triantaf
|
public getParamsForSearchLink(type: string = null, subtype: string = null) {
|
768 |
58799
|
konstantin
|
if(type) {
|
769 |
60614
|
k.triantaf
|
if(subtype) {
|
770 |
|
|
return this.routerHelper.createQueryParams(['f0', 'fv0', 'type', 'instancetypename', 'qf', 'sortBy'], ['relprojectid', this.projectId, type, subtype, 'false', 'resultdateofacceptance,descending']);
|
771 |
|
|
} else {
|
772 |
|
|
return this.routerHelper.createQueryParams(['f0', 'fv0', 'type', 'qf', 'sortBy'], ['relprojectid', this.projectId, type, 'false', 'resultdateofacceptance,descending']);
|
773 |
|
|
}
|
774 |
58799
|
konstantin
|
} else {
|
775 |
|
|
return this.routerHelper.createQueryParams(['f0', 'fv0'], ['relprojectid', this.projectId]);
|
776 |
|
|
}
|
777 |
|
|
}
|
778 |
|
|
|
779 |
58788
|
konstantin
|
public get hasPrimaryInfo(): boolean {
|
780 |
|
|
return !!this.projectInfo && (
|
781 |
|
|
!!this.projectInfo.description
|
782 |
|
|
);
|
783 |
|
|
}
|
784 |
|
|
|
785 |
|
|
public get hasSecondaryInfo(): boolean {
|
786 |
|
|
return !!this.projectInfo && (
|
787 |
|
|
(!!this.projectInfo.organizations && this.projectInfo.organizations.length > 0)
|
788 |
|
|
);
|
789 |
|
|
}
|
790 |
|
|
|
791 |
58807
|
konstantin
|
// public get numberOfTabs(): number {
|
792 |
|
|
// if(this.tabsAreInitialized) {
|
793 |
|
|
// return this._numberOfTabs;
|
794 |
|
|
// }
|
795 |
|
|
//
|
796 |
|
|
// if(!this.projectInfo
|
797 |
|
|
// || this.fetchPublications.searchUtils.status == this.errorCodes.LOADING
|
798 |
|
|
// || this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING
|
799 |
|
|
// || this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING
|
800 |
|
|
// || this.fetchOrps.searchUtils.status == this.errorCodes.LOADING) {
|
801 |
|
|
// return 0;
|
802 |
|
|
// }
|
803 |
|
|
//
|
804 |
|
|
// if (this.hasPrimaryInfo || this.hasSecondaryInfo) {
|
805 |
|
|
// this.firstTab = "summary";
|
806 |
|
|
// this._numberOfTabs++;
|
807 |
|
|
// }
|
808 |
|
|
// if(this.fetchPublications.searchUtils.totalResults > 0 || this.fetchDatasets.searchUtils.totalResults > 0
|
809 |
|
|
// || this.fetchSoftware.searchUtils.totalResults > 0 || this.fetchOrps.searchUtils.totalResults > 0) {
|
810 |
|
|
// if(this.fetchPublications.searchUtils.totalResults > 0) {
|
811 |
|
|
// if(this._numberOfTabs == 0) {
|
812 |
|
|
// this.firstTab = 'publications';
|
813 |
|
|
// this.searchPublicationsInit();
|
814 |
|
|
// }
|
815 |
|
|
// this._numberOfTabs++;
|
816 |
|
|
// }
|
817 |
|
|
// if(this.fetchDatasets.searchUtils.totalResults > 0) {
|
818 |
|
|
// if(this._numberOfTabs == 0) {
|
819 |
|
|
// this.firstTab = 'datasets';
|
820 |
|
|
// this.searchDatasetsInit();
|
821 |
|
|
// }
|
822 |
|
|
// this._numberOfTabs++;
|
823 |
|
|
// }
|
824 |
|
|
// if(this.fetchSoftware.searchUtils.totalResults > 0) {
|
825 |
|
|
// if(this._numberOfTabs == 0) {
|
826 |
|
|
// this.firstTab = 'software';
|
827 |
|
|
// this.searchSoftwareInit();
|
828 |
|
|
// }
|
829 |
|
|
// this._numberOfTabs++;
|
830 |
|
|
// }
|
831 |
|
|
// if(this.fetchOrps.searchUtils.totalResults > 0) {
|
832 |
|
|
// if(this._numberOfTabs == 0) {
|
833 |
|
|
// this.firstTab = 'other';
|
834 |
|
|
// this.searchOrpsInit();
|
835 |
|
|
// }
|
836 |
|
|
// this._numberOfTabs++;
|
837 |
|
|
// }
|
838 |
|
|
// this._numberOfTabs++;
|
839 |
|
|
// }
|
840 |
|
|
// this.activeTab = this.firstTab;
|
841 |
|
|
// this.tabsAreInitialized = true;
|
842 |
|
|
// return this._numberOfTabs;
|
843 |
|
|
// }
|
844 |
50169
|
argiro.kok
|
}
|