Project

General

Profile

« Previous | Next » 

Revision 56644

[Trunk|Library]: Add Helper on search Page, landings and deposit first page.

View differences:

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

  
6
import {Observable}                   from 'rxjs';
5
import {EnvProperties} from '../../utils/properties/env-properties';
6
import {PublicationInfo} from '../../utils/entities/publicationInfo';
7
import {RouterHelper} from '../../utils/routerHelper.class';
7 8

  
8
import {EnvProperties}                from '../../utils/properties/env-properties';
9
import {PublicationInfo}              from '../../utils/entities/publicationInfo';
10
import {RouterHelper}                 from '../../utils/routerHelper.class';
11

  
12
import {PiwikService}                 from '../../utils/piwik/piwik.service';
13
import {PublicationService}           from './publication.service';
14
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
9
import {PiwikService} from '../../utils/piwik/piwik.service';
10
import {PublicationService} from './publication.service';
11
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
15 12
import {HelperFunctions} from "../../utils/HelperFunctions.class";
13
import {HelperService} from "../../utils/helper/helper.service";
16 14

  
17 15

  
18 16
@Component({
19
    selector: 'publication',
20
    templateUrl: 'publication.component.html',
17
  selector: 'publication',
18
  templateUrl: 'publication.component.html',
21 19

  
22 20
})
23 21

  
24 22
export class PublicationComponent {
25 23
  @Input() piwikSiteId = null;
24
  @Input() communityId = null;
26 25
  public publicationInfo: PublicationInfo;
27 26
  public articleId: string;
28 27

  
......
65 64
  public errorMessage = "";
66 65
  public showLoading: boolean = true;
67 66

  
68
  public routerHelper:RouterHelper = new RouterHelper();
67
  public routerHelper: RouterHelper = new RouterHelper();
69 68

  
70 69
  private doi: string;
71 70
  public doiURL: string;
72 71
  private result;
73
  sub: any; piwiksub: any; infoSub: any;
74
  properties:EnvProperties;
72
  sub: any;
73
  piwiksub: any;
74
  infoSub: any;
75
  properties: EnvProperties;
76
  public pageContents = null;
77
  public divContents = null;
75 78

  
76
  constructor ( private _publicationService: PublicationService,
77
                private _piwikService:PiwikService,
78
                private route: ActivatedRoute,
79
                private router: Router,
80
                private _meta: Meta,
81
                private _title: Title,
82
                private _router: Router,
79
  constructor(private _publicationService: PublicationService,
80
              private _piwikService: PiwikService,
81
              private route: ActivatedRoute,
82
              private router: Router,
83
              private _meta: Meta,
84
              private _title: Title,
85
              private _router: Router,
86
              private helper: HelperService,
83 87
              private seoService: SEOService) {
84 88
  }
85 89

  
86 90
  ngOnInit() {
87 91
    this.route.data
88 92
      .subscribe((data: { envSpecific: EnvProperties }) => {
89
         this.properties = data.envSpecific;
90
         this.doiURL = this.properties.doiURL;
91
         this.updateUrl(data.envSpecific.baseLink+this._router.url);
93
        this.properties = data.envSpecific;
94
        //this.getDivContents();
95
        this.getPageContents();
96
        this.doiURL = this.properties.doiURL;
97
        this.updateUrl(data.envSpecific.baseLink + this._router.url);
92 98

  
93 99
      });
94
       this.sub =  this.route.queryParams.subscribe(data => {
95
           this.publicationInfo = null;
96
           this.updateTitle("Publication");
97
           this.updateDescription("");
98
          this.articleId = data['articleId'];
100
    this.sub = this.route.queryParams.subscribe(data => {
101
      this.publicationInfo = null;
102
      this.updateTitle("Publication");
103
      this.updateDescription("");
104
      this.articleId = data['articleId'];
99 105

  
100
          this.metricsClicked = false;
106
      this.metricsClicked = false;
101 107

  
102
          if(this.articleId){
108
      if (this.articleId) {
103 109

  
104
              this.getPublicationInfo(this.articleId);
105
              // if (typeof document !== 'undefined') {
106
              //   switcher(UIkit);
107
              // }
108
          }else{
109
              this.showLoading = false;
110
              this.warningMessage="No valid publication id";
111
          }
110
        this.getPublicationInfo(this.articleId);
111
        // if (typeof document !== 'undefined') {
112
        //   switcher(UIkit);
113
        // }
114
      } else {
115
        this.showLoading = false;
116
        this.warningMessage = "No valid publication id";
117
      }
112 118

  
113
          this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.articleId+'", "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';
119
      this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.articleId + '", "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';
114 120

  
115
          this.downloadsFrameUrl =this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.articleId+'", "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';
121
      this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.articleId + '", "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';
116 122

  
117
          this.scroll();
123
      this.scroll();
118 124
    });
119 125
  }
126
  
127
  private getPageContents() {
128
    this.helper.getPageHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
129
      this.pageContents = contents;
130
    })
131
  }
120 132

  
121
    ngOnDestroy() {
122
        if(this.sub){
123
          this.sub.unsubscribe();
133
  private getDivContents() {
134
    this.helper.getDivHelpContents(this._router.url, this.properties, this.communityId).subscribe(contents => {
135
      this.divContents = contents;
136
    })
137
  }
138

  
139
  ngOnDestroy() {
140
    if (this.sub) {
141
      this.sub.unsubscribe();
142
    }
143
    if (this.piwiksub) {
144
      this.piwiksub.unsubscribe();
145
    }
146
    if (this.infoSub) {
147
      this.infoSub.unsubscribe();
148
    }
149
  }
150

  
151
  private getOpenCitations(id: string) {
152
    this._publicationService.getOpenCitations(this.articleId, this.properties).subscribe(
153
      data => {
154
        this.publicationInfo.openCitations = data[1];
155
      },
156
      err => {
157
        //console.log(err);
158
        this.handleError("Error getting open citation for publication with id: " + this.articleId, err);
159
      }
160
    );
161
  }
162

  
163
  private getPublicationInfo(id: string) {
164
    this.warningMessage = '';
165
    this.errorMessage = ""
166
    this.showLoading = true;
167

  
168
    this.publicationInfo = null;
169

  
170
    this.infoSub = this._publicationService.getPublicationInfo(this.articleId, this.properties).subscribe(
171
      data => {
172
        this.publicationInfo = data;
173
        this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublication + this.publicationInfo.record["result"]["header"]["dri:objIdentifier"]);
174
        if ((this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
175
          this.getOpenCitations(this.articleId);
124 176
        }
125
        if(this.piwiksub){
126
          this.piwiksub.unsubscribe();
177

  
178
        // this.result = []
179
        // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestaccessright, embargoEndDate: ''};
180
        /*if(this.publicationInfo.title.name != undefined && this.publicationInfo.title.name!= ''){
181
          this.updateTitle(this.publicationInfo.title.name);
182
          this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name);
183
        }*/
184
        if (this.publicationInfo.title) {
185
          this.updateTitle(this.publicationInfo.title);
186
          this.updateDescription((this.publicationInfo.description ? (this.publicationInfo.description) : ("," + this.publicationInfo.title)));
127 187
        }
128
        if(this.infoSub) {
129
          this.infoSub.unsubscribe();
188
        if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
189
          this.piwiksub = this._piwikService.trackView(this.properties, this.publicationInfo.title/*.name*/, this.piwikSiteId).subscribe();
130 190
        }
131
    }
132 191

  
133
    private getOpenCitations(id: string) {
134
      this._publicationService.getOpenCitations(this.articleId, this.properties).subscribe(
135
        data => {
136
          this.publicationInfo.openCitations = data[1];
137
        },
138
        err => {
139
          //console.log(err);
140
          this.handleError("Error getting open citation for publication with id: "+this.articleId, err);
192
        let bioentitiesNum = 0;
193
        if (this.publicationInfo.bioentities != undefined) {
194
          this.publicationInfo.bioentities.forEach(function (value, key, map) {
195
            bioentitiesNum += value.size;
196
          });
141 197
        }
142
      );
143
    }
198
        this.bioentitiesNum = bioentitiesNum;
144 199

  
145
    private getPublicationInfo(id:string) {
146
        this.warningMessage = '';
147
        this.errorMessage=""
148
        this.showLoading = true;
200
        let relatedResearchResultsNum = 0;
201
        if (this.publicationInfo.relatedResearchResults != undefined) {
202
          this.publicationInfo.relatedResearchResults.forEach(function (value, key, map) {
203
            relatedResearchResultsNum += value.length;
204
          });
205
        }
206
        this.relatedResearchResultsNum = relatedResearchResultsNum;
149 207

  
150
        this.publicationInfo = null;
208
        this.result = {
209
          id: this.articleId,
210
          type: "publication",
211
          source: "openaire",
212
          title: this.publicationInfo.title,
213
          url: '',
214
          result: '',
215
          accessRights: /*this.publicationInfo.title.accessMode*/this.publicationInfo.accessMode,
216
          embargoEndDate: ''
217
        };
218
        // this.result.push(result_);
151 219

  
152
        this.infoSub = this._publicationService.getPublicationInfo(this.articleId, this.properties).subscribe(
153
            data => {
154
                this.publicationInfo = data;
155
                this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublication + this.publicationInfo.record["result"]["header"]["dri:objIdentifier"]);
156
                if((this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
157
                  this.getOpenCitations(this.articleId);
158
                }
220
        if (this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) {
221
          this.doi = this.publicationInfo.identifiers.get('doi')[0];
222
        }
159 223

  
160
                // this.result = []
161
                // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestaccessright, embargoEndDate: ''};
162
                /*if(this.publicationInfo.title.name != undefined && this.publicationInfo.title.name!= ''){
163
                  this.updateTitle(this.publicationInfo.title.name);
164
                  this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name);
165
                }*/
166
                if(this.publicationInfo.title){
167
                  this.updateTitle(this.publicationInfo.title);
168
                  this.updateDescription((this.publicationInfo.description?(this.publicationInfo.description):(","+this.publicationInfo.title)));
169
                }
170
                if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
171
                  this.piwiksub =  this._piwikService.trackView(this.properties, this.publicationInfo.title/*.name*/, this.piwikSiteId).subscribe();
172
                }
224
        this.showLoading = false;
173 225

  
174
                let bioentitiesNum = 0;
175
                if(this.publicationInfo.bioentities != undefined) {
176
                    this.publicationInfo.bioentities.forEach(function (value, key, map) {
177
                        bioentitiesNum += value.size;
178
                    });
179
                }
180
                this.bioentitiesNum = bioentitiesNum;
226
        if (this.publicationInfo.references) {
227
          this.activeTab = "References";
228
        } else if (this.publicationInfo.relatedResearchResults) {
229
          this.activeTab = "Related Research Results";
230
        } else if (this.publicationInfo.similarResearchResults) {
231
          this.activeTab = "Similar Research Results";
232
        } else if (this.publicationInfo.organizations) {
233
          this.activeTab = "Related Organizations";
234
        } else if (this.publicationInfo.bioentities) {
235
          this.activeTab = "bioentities";
236
        } else if (this.publicationInfo.software) {
237
          this.activeTab = "Software";
238
        } else {
239
          this.activeTab = "Metrics";
240
          this.metricsClicked = true;
241
        }
242
      },
243
      err => {
244
        //console.log(err);
245
        this.handleError("Error getting publication for id: " + this.articleId, err);
181 246

  
182
                let relatedResearchResultsNum = 0;
183
                if(this.publicationInfo.relatedResearchResults != undefined) {
184
                    this.publicationInfo.relatedResearchResults.forEach(function (value, key, map) {
185
                        relatedResearchResultsNum += value.length;
186
                    });
187
                }
188
                this.relatedResearchResultsNum = relatedResearchResultsNum;
247
        this.errorMessage = 'No publication found';
248
        this.showLoading = false;
249
        this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublications);
250
      }
251
    );
252
  }
189 253

  
190
                this.result = {id: this.articleId, type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: /*this.publicationInfo.title.accessMode*/this.publicationInfo.accessMode, embargoEndDate: ''};
191
                // this.result.push(result_);
254
  public metricsResults($event) {
255
    this.totalViews = $event.totalViews;
256
    this.totalDownloads = $event.totalDownloads;
257
    this.pageViews = $event.pageViews;
258
  }
192 259

  
193
                if(this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) {
194
                    this.doi = this.publicationInfo.identifiers.get('doi')[0];
195
                }
260
  public buildCurationTooltip() {
261
    let tooltipContent: string = "<div class='uk-margin uk-padding-small'>";
196 262

  
197
                this.showLoading = false;
263
    tooltipContent += "<h4>Record in preview</h4>";
264
    tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p>";
198 265

  
199
                if(this.publicationInfo.references) {
200
                  this.activeTab = "References";
201
                } else if(this.publicationInfo.relatedResearchResults) {
202
                  this.activeTab = "Related Research Results";
203
                } else if(this.publicationInfo.similarResearchResults) {
204
                  this.activeTab = "Similar Research Results";
205
                } else if(this.publicationInfo.organizations) {
206
                  this.activeTab = "Related Organizations";
207
                } else if(this.publicationInfo.bioentities) {
208
                  this.activeTab = "bioentities";
209
                } else if(this.publicationInfo.software) {
210
                  this.activeTab = "Software";
211
                } else {
212
                  this.activeTab = "Metrics";
213
                  this.metricsClicked = true;
214
                }
215
            },
216
            err => {
217
              //console.log(err);
218
              this.handleError("Error getting publication for id: "+this.articleId, err);
266
    return tooltipContent += "</div>";
267
  }
219 268

  
220
              this.errorMessage = 'No publication found';
221
              this.showLoading = false;
222
              this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.properties.searchLinkToPublications);
223
            }
224
      );
225
    }
269
  private updateDescription(description: string) {
270
    this._meta.updateTag({content: description}, "name='description'");
271
    this._meta.updateTag({content: description}, "property='og:description'");
272
  }
226 273

  
227
    public metricsResults($event) {
228
      this.totalViews = $event.totalViews;
229
      this.totalDownloads = $event.totalDownloads;
230
      this.pageViews = $event.pageViews;
231
    }
274
  private updateTitle(title: string) {
275
    var _prefix = "OpenAIRE | ";
276
    var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
277
    this._title.setTitle(title);
278
    this._meta.updateTag({content: title}, "property='og:title'");
279
  }
232 280

  
233
    public buildCurationTooltip() {
234
        let tooltipContent: string = "<div class='uk-margin uk-padding-small'>";
281
  private updateUrl(url: string) {
282
    this._meta.updateTag({content: url}, "property='og:url'");
283
  }
235 284

  
236
        tooltipContent += "<h4>Record in preview</h4>";
237
        tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p>";
238

  
239
        return tooltipContent+= "</div>";
285
  public totalPages(totalResults: number): number {
286
    let totalPages: any = totalResults / this.pageSize;
287
    if (!(Number.isInteger(totalPages))) {
288
      totalPages = (parseInt(totalPages, this.pageSize) + 1);
240 289
    }
290
    return totalPages;
291
  }
241 292

  
242
    private updateDescription(description:string){
243
      this._meta.updateTag({content:description},"name='description'");
244
      this._meta.updateTag({content:description},"property='og:description'");
245
    }
246
    private updateTitle(title:string){
247
      var _prefix ="OpenAIRE | ";
248
      var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
249
      this._title.setTitle(title);
250
      this._meta.updateTag({content:title},"property='og:title'");
251
    }
293
  public updateReferencesPage($event) {
294
    this.referencesPage = $event.value;
295
  }
252 296

  
253
    private updateUrl(url:string){
254
      this._meta.updateTag({content:url},"property='og:url'");
255
    }
297
  public updateOrganizationsPage($event) {
298
    this.organizationsPage = $event.value;
299
  }
256 300

  
257
    public totalPages(totalResults: number): number {
258
      let totalPages:any = totalResults/this.pageSize;
259
      if(!(Number.isInteger(totalPages))) {
260
          totalPages = (parseInt(totalPages, this.pageSize) + 1);
261
      }
262
      return totalPages;
263
    }
301
  public updateSoftwarePage($event) {
302
    this.softwarePage = $event.value;
303
  }
264 304

  
265
    public updateReferencesPage($event) {
266
      this.referencesPage = $event.value;
267
    }
305
  public updateBioentitiesPage($event) {
306
    this.bioentitiesPage = $event.value;
307
  }
268 308

  
269
    public updateOrganizationsPage($event) {
270
      this.organizationsPage = $event.value;
271
    }
309
  public updateOpenCitationsPage($event) {
310
    this.openCitationsPage = $event.value;
311
  }
272 312

  
273
    public updateSoftwarePage($event) {
274
      this.softwarePage = $event.value;
275
    }
313
  public keysToArray(bioentities: Map<string, string>): string[] {
314
    let keys: string[] = [];
315
    bioentities.forEach(function (value, key, map) {
316
      keys.push(key);
317
    });
318
    return keys;
319
  }
276 320

  
277
    public updateBioentitiesPage($event) {
278
      this.bioentitiesPage = $event.value;
279
    }
321
  public getKeys(map) {
322
    return Array.from(map.keys());
323
  }
280 324

  
281
    public updateOpenCitationsPage($event) {
282
      this.openCitationsPage = $event.value;
283
    }
325
  public scroll() {
326
    HelperFunctions.scroll();
327
  }
284 328

  
285
    public keysToArray(bioentities: Map<string, string>) : string[] {
286
      let keys: string[] = [];
287
      bioentities.forEach(function (value, key, map) {
288
        keys.push(key);
289
      });
290
      return keys;
291
    }
292
    public getKeys( map) {
293
      return Array.from(map.keys());
294
    }
329
  /*
330
      start(i: number, bioentitiesPage: number) {
331
        let sum = 0;
332
        let index=0;
333
        let retValue = 0;
334
        let valuesToPage = this.pageSize*bioentitiesPage;
335
        let valuesToPreviousPage = valuesToPage - this.pageSize;
295 336

  
296
    public scroll() {
297
      HelperFunctions.scroll();
298
    }
299
/*
300
    start(i: number, bioentitiesPage: number) {
301
      let sum = 0;
302
      let index=0;
303
      let retValue = 0;
304
      let valuesToPage = this.pageSize*bioentitiesPage;
305
      let valuesToPreviousPage = valuesToPage - this.pageSize;
337
        if(bioentitiesPage == 1) {
338
          return 0;
339
        }
306 340

  
307
      if(bioentitiesPage == 1) {
308
        return 0;
309
      }
341
        this.publicationInfo.bioentities.forEach(function (value, key, map) {
342
          sum += map.get(key).size;
310 343

  
311
      this.publicationInfo.bioentities.forEach(function (value, key, map) {
312
        sum += map.get(key).size;
313

  
314
        if(index == i) {
315
          if(sum <= valuesToPreviousPage) {
316
            retValue =  0;
317
          } else if((sum-map.get(key).size) >= valuesToPage){
318
            retValue = 0;
319
          } else {
320
            if(map.get(key).size < (sum - valuesToPreviousPage)) {
344
          if(index == i) {
345
            if(sum <= valuesToPreviousPage) {
346
              retValue =  0;
347
            } else if((sum-map.get(key).size) >= valuesToPage){
321 348
              retValue = 0;
322 349
            } else {
323
              retValue = map.get(key).size - (sum - valuesToPreviousPage);
350
              if(map.get(key).size < (sum - valuesToPreviousPage)) {
351
                retValue = 0;
352
              } else {
353
                retValue = map.get(key).size - (sum - valuesToPreviousPage);
354
              }
324 355
            }
325 356
          }
326
        }
327
        index++;
328
      });
329
      this.startt = retValue;
330
      return retValue;
331
    }
357
          index++;
358
        });
359
        this.startt = retValue;
360
        return retValue;
361
      }
332 362

  
333
    stop(i: number, bioentitiesPage: number) {
334
      let sum = 0;
335
      let index=0;
336
      let retValue = 0;
337
      let valuesToPage = this.pageSize*bioentitiesPage;
338
      let valuesToPreviousPage = valuesToPage - this.pageSize;
363
      stop(i: number, bioentitiesPage: number) {
364
        let sum = 0;
365
        let index=0;
366
        let retValue = 0;
367
        let valuesToPage = this.pageSize*bioentitiesPage;
368
        let valuesToPreviousPage = valuesToPage - this.pageSize;
339 369

  
340
      this.publicationInfo.bioentities.forEach(function (value, key, map) {
341
        sum += map.get(key).size;
342
        if(index == i) {
343
          if(sum <= valuesToPreviousPage) {
344
            retValue =  0;
345
          } else if((sum - map.get(key).size) >= valuesToPage){
346
            retValue = 0;
347
          } else {
348
            if(sum < valuesToPage) {
349
              retValue = map.get(key).size;
370
        this.publicationInfo.bioentities.forEach(function (value, key, map) {
371
          sum += map.get(key).size;
372
          if(index == i) {
373
            if(sum <= valuesToPreviousPage) {
374
              retValue =  0;
375
            } else if((sum - map.get(key).size) >= valuesToPage){
376
              retValue = 0;
350 377
            } else {
351
              retValue = map.get(key).size - (sum - valuesToPage);
378
              if(sum < valuesToPage) {
379
                retValue = map.get(key).size;
380
              } else {
381
                retValue = map.get(key).size - (sum - valuesToPage);
382
              }
352 383
            }
353 384
          }
354
        }
355
        index++;
356
      });
357
      this.stopp = retValue;
358
      return retValue;
359
    }
360
*/
385
          index++;
386
        });
387
        this.stopp = retValue;
388
        return retValue;
389
      }
390
  */
361 391

  
362 392
  private handleError(message: string, error) {
363
    console.error("Publication Landing Page: "+message, error);
393
    console.error("Publication Landing Page: " + message, error);
364 394
  }
365
  isRouteAvailable(routeToCheck:string){
395

  
396
  isRouteAvailable(routeToCheck: string) {
366 397
    for (let i = 0; i < this.router.config.length; i++) {
367
      let routePath:string = this.router.config[i].path;
368
      if(routePath == routeToCheck){
398
      let routePath: string = this.router.config[i].path;
399
      if (routePath == routeToCheck) {
369 400
        return true;
370 401
      }
371 402
    }

Also available in: Unified diff