import {Component, ViewChild} from '@angular/core'; import {ElementRef, Input} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Title, Meta} from '@angular/platform-browser'; import {Observable} from 'rxjs/Observable'; import {EnvProperties} from '../../utils/properties/env-properties'; import {PublicationInfo} from '../../utils/entities/publicationInfo'; import {RouterHelper} from '../../utils/routerHelper.class'; import {PiwikService} from '../../utils/piwik/piwik.service'; import {PublicationService} from './publication.service'; @Component({ selector: 'publication', templateUrl: 'publication.component.html', }) export class PublicationComponent { @Input() piwikSiteId = null; public publicationInfo: PublicationInfo; public articleId: string; // APP BOX variables public showAllCollectedFrom: boolean = false; public showAllDownloadFrom: boolean = false; // Metrics tab variables public metricsClicked: boolean; public viewsFrameUrl: string; public downloadsFrameUrl: string; public totalViews: number; public totalDownloads: number; public pageViews: number; // Custom tab paging variables public referencesPage: number = 1; public organizationsPage: number = 1; public softwarePage: number = 1; public bioentitiesPage: number = 1; public pageSize: number = 10; /* public startt: number = 0; public stopp: number = 0; */ // Active tab variable for responsiveness public activeTab: string = "References"; // Map counting variables public bioentitiesNum: number = 0; public relatedResearchResultsNum: number = 0; // Message variables public warningMessage = ""; public errorMessage = ""; public showLoading: boolean = true; public routerHelper:RouterHelper = new RouterHelper(); private doi: string; private result; sub: any; piwiksub: any; infoSub: any; properties:EnvProperties; constructor ( private element: ElementRef, private _publicationService: PublicationService, private _piwikService:PiwikService, private route: ActivatedRoute, private _meta: Meta, private _title: Title, private _router: Router) { } ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.updateUrl(data.envSpecific.baseLink+this._router.url); }); this.sub = this.route.queryParams.subscribe(data => { this.publicationInfo = null; this.updateTitle("Publication"); this.updateDescription("Publication, open access, collected from"); this.articleId = data['articleId']; console.info("Article id is :"+this.articleId); this.metricsClicked = false; if(this.articleId){ this.getPublicationInfo(this.articleId); // if (typeof document !== 'undefined') { // switcher(UIkit); // } }else{ this.showLoading = false; this.warningMessage="No valid publication id"; } 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'; 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'; if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); } }); } ngOnDestroy() { if(this.sub){ this.sub.unsubscribe(); } if(this.piwiksub){ this.piwiksub.unsubscribe(); } if(this.infoSub) { this.infoSub.unsubscribe(); } } private getPublicationInfo(id:string) { this.warningMessage = ''; this.errorMessage="" this.showLoading = true; this.publicationInfo = null; this.infoSub = this._publicationService.getPublicationInfo(this.articleId, this.properties).subscribe( data => { this.publicationInfo = data; // this.result = [] // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestaccessright, embargoEndDate: ''}; /*if(this.publicationInfo.title.name != undefined && this.publicationInfo.title.name!= ''){ this.updateTitle(this.publicationInfo.title.name); this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name); }*/ if(this.publicationInfo.title){ this.updateTitle(this.publicationInfo.title); this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title); } if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.properties, this.publicationInfo.title/*.name*/, this.piwikSiteId).subscribe(); } let bioentitiesNum = 0; if(this.publicationInfo.bioentities != undefined) { this.publicationInfo.bioentities.forEach(function (value, key, map) { bioentitiesNum += value.size; }); } this.bioentitiesNum = bioentitiesNum; let relatedResearchResultsNum = 0; if(this.publicationInfo.relatedResearchResults != undefined) { this.publicationInfo.relatedResearchResults.forEach(function (value, key, map) { relatedResearchResultsNum += value.length; }); } this.relatedResearchResultsNum = relatedResearchResultsNum; this.result = {id: this.articleId, type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: /*this.publicationInfo.title.accessMode*/this.publicationInfo.accessMode, embargoEndDate: ''}; // this.result.push(result_); if(this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) { this.doi = this.publicationInfo.identifiers.get('doi')[0]; } this.showLoading = false; if(this.publicationInfo.references) { this.activeTab = "References"; } else if(this.publicationInfo.relatedResearchResults) { this.activeTab = "Related Research Results"; } else if(this.publicationInfo.similarResearchResults) { this.activeTab = "Similar Research Results"; } else if(this.publicationInfo.organizations) { this.activeTab = "Related Organizations"; } else if(this.publicationInfo.bioentities) { this.activeTab = "bioentities"; } else if(this.publicationInfo.software) { this.activeTab = "Software"; } else { this.activeTab = "Metrics"; this.metricsClicked = true; } console.info("activeTab is "+this.activeTab); }, err => { console.log(err); console.info("error"); this.errorMessage = 'No publication found'; this.showLoading = false; } ); } public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; this.pageViews = $event.pageViews; } public buildCurationTooltip() { let tooltipContent: string = "
Bibliographic record accepted by the system, but not yet processed by
OpenAIRE tools for information quality improvement and de-duplication