Project

General

Profile

1
import {Component, ViewChild}         from '@angular/core';
2
import {Input}            from '@angular/core';
3
import {ActivatedRoute, Router}       from '@angular/router';
4
import {Params}                       from '@angular/router';
5
import {Title, Meta}                  from '@angular/platform-browser';
6

    
7
import {Observable}                   from 'rxjs';
8

    
9
import {ProjectService}               from './project.service';
10
import {ProjectInfo}                  from '../../utils/entities/projectInfo';
11
import {RouterHelper}                 from '../../utils/routerHelper.class';
12

    
13
import {FetchPublications}            from '../../utils/fetchEntitiesClasses/fetchPublications.class';
14
import {SearchPublicationsService}    from '../../services/searchPublications.service';
15
import {FetchDatasets}                from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
16
import {SearchDatasetsService}        from '../../services/searchDatasets.service';
17
import {FetchSoftware}                from '../../utils/fetchEntitiesClasses/fetchSoftware.class';
18
import {SearchSoftwareService}        from '../../services/searchSoftware.service';
19
import {FetchOrps}                from '../../utils/fetchEntitiesClasses/fetchOrps.class';
20
import {SearchOrpsService}        from '../../services/searchOrps.service';
21

    
22
import {ModalLoading}                 from '../../utils/modal/loading.component';
23

    
24
import {ReportsService}               from '../../services/reports.service';
25
import {ErrorCodes}                   from '../../utils/properties/errorCodes'
26

    
27
import {PiwikService}                 from '../../utils/piwik/piwik.service';
28
import {EnvProperties}                from '../../utils/properties/env-properties';
29
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
30
import {HelperFunctions} from "../../utils/HelperFunctions.class";
31

    
32
@Component({
33
    selector: 'project',
34
    templateUrl: 'project.component.html',
35
 })
36

    
37
export class ProjectComponent{
38
  @Input() piwikSiteId = null;
39
  public projectInfo: ProjectInfo;
40
  public projectId : string ;
41
  public projectName: string;
42

    
43
  // Metrics tab variables
44
  public metricsClicked: boolean;
45
  public viewsFrameUrl: string;
46
  public downloadsFrameUrl: string;
47
  private totalViews: number;
48
  private totalDownloads: number;
49
  private pageViews: number;
50

    
51
  // Statistics tab variables
52
  public statsClicked: boolean;
53
  public chartScientificResultsUrl: string;
54
  public chartAccessModeUrl: string;
55
  public chartDatasourcesUrl: string;
56

    
57
  // HTML variables in APP BOX
58
  public publications_dynamic: string;
59
  public datasets_dynamic: string;
60
  public software_dynamic: string;
61
  public orps_dynamic: string;
62

    
63
  public project ;
64

    
65
  // CSV variables
66
  public downloadURLAPI: string;
67
  public csvParams: string;
68
  public csvParamsDatasets: string;
69
  public csvParamsSoftware: string;
70
  public csvParamsOrps: string;
71

    
72
  // Message variables
73
  public warningMessage = "";
74
  public errorMessage = "";
75
  public showLoading: boolean = true;
76

    
77
  // Active tab variable for responsiveness
78
  public activeTab: string = "Publications";
79

    
80
  // Request results for publications, research data and software only the one time (first time tab is clicked)
81
  private reloadPublications: boolean = true;
82
  private reloadDatasets: boolean = true;
83
  private reloadSoftware: boolean = true;
84
  private reloadOrps: boolean = true;
85

    
86
  // Variables for publications, research data, software tabs
87
  public fetchPublications : FetchPublications;
88
  public linkToSearchPublications = "";
89
  public fetchDatasets : FetchDatasets;
90
  public linkToSearchDatasets = "";
91
  public fetchSoftware: FetchSoftware;
92
  public linkToSearchSoftware = "";
93
  public fetchOrps: FetchOrps;
94
  public linkToSearchOrps = "";
95

    
96
  public routerHelper:RouterHelper = new RouterHelper();
97
  public errorCodes:ErrorCodes = new ErrorCodes();
98

    
99
  @ViewChild (ModalLoading) loading : ModalLoading ;
100
  // Alert box when something is wrong with CSV requests
101
  @ViewChild('AlertModalCsvError') alertCsvError;
102

    
103
  sub: any; piwiksub: any; infoSub: any; downloadFilePiwikSub: any;
104
properties:EnvProperties;
105
  constructor ( private _projectService: ProjectService,
106
                private _piwikService:PiwikService,
107
                private  route: ActivatedRoute,
108
                private _searchPublicationsService: SearchPublicationsService,
109
                private _searchDatasetsService: SearchDatasetsService,
110
                private _searchSoftwareService: SearchSoftwareService,
111
                private _searchOrpsService: SearchOrpsService,
112
                private _reportsService: ReportsService,
113
                private _meta: Meta,
114
                private _title: Title,
115
                private _router: Router,
116
              private seoService: SEOService) {
117
  }
118

    
119
  ngOnInit() {
120
    this.route.data
121
      .subscribe((data: { envSpecific: EnvProperties }) => {
122
         this.properties = data.envSpecific;
123
         this.updateUrl(data.envSpecific.baseLink+this._router.url);
124

    
125
      });
126
    this.sub =  this.route.queryParams.subscribe(params => {
127
        this.metricsClicked = false;
128
        this.statsClicked = false;
129
        this.fetchPublications = new FetchPublications( this._searchPublicationsService);
130
        this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
131
        this.fetchSoftware = new FetchSoftware(this._searchSoftwareService);
132
        this.fetchOrps = new FetchOrps(this._searchOrpsService);
133

    
134
        var title = "Project";
135
        var description = "";
136

    
137
        this.updateTitle(title);
138
        this.updateDescription(description);
139
      this.projectId = params['projectId'];
140
      var grantId = params['grantId'];
141
      var funder = params['funder'];
142

    
143

    
144
       if(this.projectId){
145
         this.getProjectInfo(this.projectId);
146
         this.actionsAfterLoadId();
147
      }else if(grantId && funder){
148
        this.getProjectInfoByGrantId(grantId,funder);
149
      }else{
150

    
151
          this.showLoading = false;
152
		      this.warningMessage="No valid project id";
153
      }
154

    
155
      this.downloadURLAPI = this.properties.csvAPIURL;
156

    
157
      this.createClipboard();
158
      this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact \""+this.projectId+"\"))";
159
      this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact \""+this.projectId+"\"))";
160
      this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact \""+this.projectId+"\"))";
161
      this.csvParamsOrps = "?format=csv-special&type=other&fq=(((oaftype exact result) and (resulttypeid exact other)) and (relprojectid exact \""+this.projectId+"\"))";
162

    
163
      HelperFunctions.scroll();
164
  });
165
}
166

    
167
actionsAfterLoadId(){
168
  this.publications_dynamic =
169
       "<script type=\"text/javascript\">"
170
       + "\n<!--"
171
       + "\ndocument.write('<div id=\"oa_widget\"></div>');"
172
       + "\ndocument.write('<script type=\"text/javascript\""
173
       + "\nsrc=\""+this.properties.widgetLink
174
       + this.projectId + "&type=publication\"></script>');"
175
       + "\n-->"
176
       + "\n</script>";
177

    
178
   this.datasets_dynamic =
179
       "<script type=\"text/javascript\">"
180
       + "\n<!--"
181
       + "\ndocument.write('<div id=\"oa_widget\"></div>');"
182
       + "\ndocument.write('<script type=\"text/javascript\""
183
       + "\nsrc=\""+this.properties.widgetLink
184
       + this.projectId + "&type=dataset\"></script>');"
185
       + "\n-->"
186
       + "\n</script>";
187

    
188
   this.software_dynamic =
189
       "<script type=\"text/javascript\">"
190
       + "\n<!--"
191
       + "\ndocument.write('<div id=\"oa_widget\"></div>');"
192
       + "\ndocument.write('<script type=\"text/javascript\""
193
       + "\nsrc=\""+this.properties.widgetLink
194
       + this.projectId + "&type=software\"></script>');"
195
       + "\n-->"
196
       + "\n</script>";
197

    
198
     this.orps_dynamic =
199
         "<script type=\"text/javascript\">"
200
         + "\n<!--"
201
         + "\ndocument.write('<div id=\"oa_widget\"></div>');"
202
         + "\ndocument.write('<script type=\"text/javascript\""
203
         + "\nsrc=\""+this.properties.widgetLink
204
         + this.projectId + "&type=other\"></script>');"
205
         + "\n-->"
206
         + "\n</script>";
207

    
208
 this.getProjectInfo(this.projectId);
209
 //this.searchPublications();
210
 this.fetchPublications.getNumForEntity("project", this.projectId, this.properties);
211
 this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties);
212
 this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties);
213
 this.fetchOrps.getNumForEntity("project", this.projectId, this.properties);
214
}
215
  ngOnDestroy() {
216
    if(this.sub){
217
      this.sub.unsubscribe();
218
    }
219
    if(this.piwiksub){
220
      this.piwiksub.unsubscribe();
221
    }
222
    if(this.infoSub) {
223
      this.infoSub.unsubscribe();
224
    }
225
    if(this.downloadFilePiwikSub) {
226
      this.downloadFilePiwikSub.unsubscribe();
227
    }
228
  }
229

    
230
  private createClipboard() {
231
      if(typeof window !== 'undefined') {
232

    
233
          let publ_clipboard, datasets_clipboard, software_clipboard, orps_clipboard;
234
          let Clipboard;
235
          Clipboard = require('clipboard');
236
          publ_clipboard = new Clipboard('.publ_clipboard_btn');
237
          datasets_clipboard = new Clipboard('.datasets_clipboard_btn');
238
          software_clipboard = new Clipboard('.software_clipboard_btn');
239
          orps_clipboard = new Clipboard('.orps_clipboard_btn');
240
      }
241
  }
242

    
243
  private searchPublications() {
244
    this.fetchPublications.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
245
    this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications;// + "?project=" + this.projectId+"&pr=and";
246
    //if(this.fetchPublications.searchUtils.totalResults > 0) {
247
      //this.activeTab = "Publications";
248
    //} else {
249
      //this.searchDatasetsInit();
250
    //}
251
    this.reloadPublications = false;
252
  }
253

    
254
  private searchDatasets() {
255
      this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
256
      this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;// + "?project=" + this.projectId+"&pr=and";
257

    
258
      this.reloadDatasets = false;
259
      //this.activeTab = "Research Data";
260
  }
261

    
262
  private searchSoftware() {
263
      this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
264
      this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware;
265
      this.reloadSoftware = false;
266
  }
267

    
268
  private searchOrps() {
269
      this.fetchOrps.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
270
      this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps;
271
      this.reloadOrps = false;
272
  }
273

    
274
  public searchPublicationsInit() {
275
      if(this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) {
276
        this.searchPublications();
277
      } else if(this.fetchPublications.searchUtils.totalResults == 0) {
278
        //this.statsClicked=true;
279
        //this.activeTab = "Statistics";
280
      }
281
  }
282

    
283
  public searchDatasetsInit() {
284
      if(this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) {
285
	      this.searchDatasets();
286
      } else if(this.fetchDatasets.searchUtils.totalResults == 0) {
287
        //this.statsClicked=true;
288
        //this.activeTab = "Statistics";
289
      }
290
  }
291

    
292
  public searchSoftwareInit() {
293
      if(this.reloadSoftware && this.fetchSoftware.searchUtils.totalResults > 0) {
294
	      this.searchSoftware();
295
      }
296
  }
297

    
298
  public searchOrpsInit() {
299
      if(this.reloadOrps && this.fetchOrps.searchUtils.totalResults > 0) {
300
	      this.searchOrps();
301
      }
302
  }
303

    
304
  private getProjectInfo (id:string)  {
305
	  this.warningMessage = '';
306
    this.errorMessage=""
307
    this.showLoading = true;
308

    
309
    this.projectInfo = null;
310

    
311
    this.infoSub = this._projectService.getProjectInfo(id, this.properties).subscribe(
312
      data => {
313
          this.projectInfo = data;
314

    
315
          this.actionsAfterGettingProjectInfo();
316
      },
317
      err => {
318
		      //console.log(err);
319
          this.handleError("Error getting project for id: "+this.projectId, err);
320
        this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects);
321
		      this.errorMessage = 'No project found';
322
          this.showLoading = false;
323
		  }
324
    );
325
   }
326
   private getProjectInfoByGrantId (grantId:string,  funder:string)  {
327
 	   this.warningMessage = '';
328
     this.errorMessage=""
329
     this.showLoading = true;
330

    
331
     this.projectInfo = null;
332

    
333
     this._projectService.getProjectInfoByGrantId(grantId,funder,this.properties).subscribe(
334
       data =>{
335

    
336
           this.projectInfo = data;
337

    
338
           this.actionsAfterGettingProjectInfo();
339
           this.projectId = this.projectInfo.id;
340
           this.actionsAfterLoadId();
341
       },
342
       err => {
343
 		      //console.log(err);
344
          this.handleError("Error getting project for grant id: "+grantId+" and funder: "+funder, err);
345
         this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToProjects);
346
 		      this.errorMessage = 'No project found';
347
          this.showLoading = false;
348
 		  }
349
     );
350
    }
351
actionsAfterGettingProjectInfo(){
352
  this.projectName = this.projectInfo.acronym;
353
  if(this.projectName == undefined || this.projectName == '') {
354
      this.projectName = this.projectInfo.title;
355
  }
356
  this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url);
357
  this.updateTitle(this.projectName);
358
  this.updateDescription("project, "+this.projectName+ ","+this.projectInfo.funder+","+this.projectInfo.acronym);
359
  if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
360
    this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe();
361
  }
362

    
363
  this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate };
364

    
365
  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":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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';
366

    
367
  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":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","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';
368

    
369
  //stats tab charts
370
  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 Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250';
371
  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 Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250';
372
  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 Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=100%&h=250';
373

    
374
  this.showLoading = false;
375
}
376
   public downloadfile(url:string, filename: string){
377
       this.openLoading();
378
       this.setMessageLoading("Downloading CSV file");
379

    
380
       this._reportsService.downloadCSVFile(url).subscribe(
381
            data => {
382
                this.closeLoading();
383

    
384
                var url = window.URL.createObjectURL(data);
385
                var a = window.document.createElement('a');
386
                window.document.body.appendChild(a);
387
                a.setAttribute('style', 'display: none');
388
                a.href = url;
389
                a.download = filename+".csv";
390
                a.click();
391
                window.URL.revokeObjectURL(url);
392
                a.remove(); // remove the element
393

    
394
                //window.open(window.URL.createObjectURL(data));
395
                if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
396
                  this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe();
397
                }
398
            },
399
            error => {
400
              //console.log("Error downloading the file.");
401
              this.handleError("Error downloading file: "+filename, error);
402

    
403
              this.closeLoading();
404
              this.confirmOpenCsvError();
405
            }/*,
406
            () => console.log('Completed file download.')*/
407
        );
408
    }
409

    
410
/*
411
    showHTML(){
412
      let info:string = "<h1>Publications of Project ";
413

    
414
      if(this.projectInfo.title != undefined && this.projectInfo.title != "") {
415
          info += this.projectInfo.title;
416
      }
417
      if((this.projectInfo.title != undefined && this.projectInfo.title != "") &&
418
         ((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") ||
419
          (this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) {
420
                info += "(";
421
      }
422
      if(this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") {
423
          info += this.projectInfo.acronym + " - ";
424
      }
425
      if(this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != "") {
426
          info += this.projectInfo.callIdentifier;
427
      }
428
      if((this.projectInfo.title != undefined && this.projectInfo.title != "") &&
429
         ((this.projectInfo.acronym != undefined && this.projectInfo.acronym != "") ||
430
          (this.projectInfo.callIdentifier != undefined && this.projectInfo.callIdentifier != ""))) {
431
                info += ")";
432
      }
433
      info +="</h1>";
434
      info += "<h3>"+this.fetchPublications.searchUtils.totalResults+" publications</h3>";
435

    
436
      let htmlParams = 'resources?format=html&page=0&size='+this.fetchPublications.searchUtils.totalResults+'&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "'+this.projectId+'"))';
437
      this._reportsService.downloadHTMLFile(this.downloadURLAPI+htmlParams, info)
438
          .subscribe(data => this.funct(data),
439
                      error => console.log("Error downloading the file."),
440
                      () => console.log('Completed file download.'));
441
     }
442

    
443
     funct(data) {
444
         var win = window.open(window.URL.createObjectURL(data));
445
     }
446
*/
447
    public metricsResults($event) {
448
      this.totalViews = $event.totalViews;
449
      this.totalDownloads = $event.totalDownloads;
450
      this.pageViews = $event.pageViews;
451
    }
452

    
453
    private updateDescription(description:string) {
454
      this._meta.updateTag({content:description},"name='description'");
455
      this._meta.updateTag({content:description},"property='og:description'");
456
    }
457
    private updateTitle(title:string) {
458
      var _prefix ="OpenAIRE | ";
459
      var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
460
      this._title.setTitle(_title);
461
      this._meta.updateTag({content:_title},"property='og:title'");
462
    }
463
    private updateUrl(url:string) {
464
      this._meta.updateTag({content:url},"property='og:url'");
465
    }
466

    
467
    private openLoading(){
468
      if(this.loading){
469
        this.loading.open();
470
      }
471
    }
472
    private closeLoading(){
473
      if(this.loading){
474
        this.loading.close();
475
      }
476
    }
477
    private setMessageLoading(message: string){
478
      if(this.loading){
479
        this.loading.message = message;
480
      }
481
    }
482

    
483
    public confirmOpenCsvError(){
484
      this.alertCsvError.cancelButton = false;
485
      this.alertCsvError.okButton = true;
486
      this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE";
487
      this.alertCsvError.message = "There was an error in csv downloading. Please try again later.";
488
      this.alertCsvError.okButtonText = "OK";
489
      this.alertCsvError.open();
490
    }
491

    
492
    private handleError(message: string, error) {
493
        console.error("Project Landing Page: "+message, error);
494
    }
495
}
(2-2/5)