1
|
import {Component, ViewChild} from '@angular/core';
|
2
|
import {Observable} from 'rxjs/Observable';
|
3
|
import {PublicationService} from '../../services/publication.service';
|
4
|
import {PublicationInfo} from '../../utils/entities/publicationInfo';
|
5
|
import {ActivatedRoute} from '@angular/router';
|
6
|
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
7
|
import {InlineClaimContextComponent} from '../../claimPages/inlineClaims/inlineClaimContext.component';
|
8
|
import {InlineClaimProjectComponent} from '../../claimPages/inlineClaims/inlineClaimProject.component';
|
9
|
import {InlineClaimResultComponent} from '../../claimPages/inlineClaims/inlineClaimResult.component';
|
10
|
|
11
|
@Component({
|
12
|
selector: 'publication',
|
13
|
templateUrl: 'publication.component.html',
|
14
|
|
15
|
})
|
16
|
|
17
|
export class PublicationComponent {
|
18
|
public showAllCollectedFrom: boolean = false;
|
19
|
public showAllDownloadFrom: boolean = false;
|
20
|
public showAllFundedBy: boolean = false;
|
21
|
public showAllPublishedIn: boolean = false;
|
22
|
|
23
|
constructor (private _publicationService: PublicationService,
|
24
|
private route: ActivatedRoute) {
|
25
|
}
|
26
|
ngOnInit() {
|
27
|
this.sub = this.route.queryParams.subscribe(data => {
|
28
|
this.articleId = data['articleId'];
|
29
|
console.info("Article id is :"+this.articleId);
|
30
|
if(this.articleId){
|
31
|
this.getPublicationInfo(this.articleId);
|
32
|
}else{
|
33
|
console.info("Article id not found");
|
34
|
}
|
35
|
});
|
36
|
|
37
|
this.metricsClicked = false;
|
38
|
//this.viewsFrameUrl = 'http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"result_stats_monthly","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":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Number of views for '+this.publicationInfo.title.name+'","yaxisheaders":["sum of views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"result_stats_monthly(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]}]&info_types=["spline"]&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';
|
39
|
this.openaireViewsFrameUrl = 'http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"result_stats_monthly_charts","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":"OpenAIRE","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"result_stats_monthly_charts(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]},{"table":"repo_view_stats_monthly_charts","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"repo_view_stats_monthly_charts(source)-(piwik_id)datasource_piwik(openaire_id)-(id)datasource-name","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"repo_view_stats_monthly_charts(id)-(orid)result_oids(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]}]&info_types=["column","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(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';
|
40
|
|
41
|
}
|
42
|
|
43
|
ngOnDestroy() {
|
44
|
this.sub.unsubscribe();
|
45
|
}
|
46
|
sub: any;getPublicationView
|
47
|
articleId: string;
|
48
|
public publicationInfo: PublicationInfo;
|
49
|
private metricsClicked: boolean;
|
50
|
private viewsFrameUrl: string;
|
51
|
private openaireViewsFrameUrl: string;
|
52
|
|
53
|
public showAllReferences: boolean = false;
|
54
|
public showAllRelResData: boolean = false;
|
55
|
public showAllSimilPubl: boolean = false;
|
56
|
public showAllBioentities: boolean = false;
|
57
|
public showFundingDetails: boolean = false;
|
58
|
|
59
|
public bioentitiesNum: number = 0;
|
60
|
|
61
|
public result ;
|
62
|
|
63
|
/* @ViewChild (InlineClaimProjectComponent) inlineClaimProject : InlineClaimProjectComponent ;
|
64
|
@ViewChild (InlineClaimContextComponent) inlineClaimContext : InlineClaimContextComponent ;
|
65
|
@ViewChild (InlineClaimResultComponent) inlineClaimResult : InlineClaimResultComponent ;
|
66
|
*/
|
67
|
public warningMessage = "";
|
68
|
public errorMessage = "";
|
69
|
|
70
|
getPublicationInfo(id:string) {
|
71
|
this.warningMessage = '';
|
72
|
this.errorMessage=""
|
73
|
if(this.articleId==null || this.articleId==''){
|
74
|
this.warningMessage="No valid publication id";
|
75
|
}else{
|
76
|
this._publicationService.getPublicationInfo(this.articleId).subscribe(
|
77
|
data => {
|
78
|
this.publicationInfo = data;
|
79
|
// this.result = []
|
80
|
// this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''};
|
81
|
|
82
|
let bioentitiesNum = 0;
|
83
|
if(this.publicationInfo.bioentities != undefined) {
|
84
|
this.publicationInfo.bioentities.forEach(function (value, key, map) {
|
85
|
bioentitiesNum += value.size;
|
86
|
});
|
87
|
}
|
88
|
this.bioentitiesNum = bioentitiesNum;
|
89
|
|
90
|
this.result = {id: this.articleId, type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''};
|
91
|
// this.result.push(result_);
|
92
|
},
|
93
|
err => {
|
94
|
console.log(err);
|
95
|
console.info("error");
|
96
|
|
97
|
this.errorMessage = 'No publication found';
|
98
|
}
|
99
|
);
|
100
|
}
|
101
|
}
|
102
|
|
103
|
/*
|
104
|
********* Methods for Inline Claim of project / publication *****
|
105
|
*/
|
106
|
/* toggleClaimProject(){
|
107
|
this.inlineClaimProject.toggle();
|
108
|
}
|
109
|
projectAdded($event){
|
110
|
var projects =$event.value;
|
111
|
if(projects){
|
112
|
for(var i=0; i < projects.length; i++){
|
113
|
|
114
|
if(this.publicationInfo.fundedByProjects == undefined) {
|
115
|
this.publicationInfo.fundedByProjects = new Array<
|
116
|
{ "url": string, "acronym": string, "title": string,
|
117
|
"funderShortname": string, "funderName": string,
|
118
|
"funding": string, "code": string, "inline": boolean
|
119
|
}>();
|
120
|
}
|
121
|
var project =projects[i];
|
122
|
|
123
|
let counter = this.publicationInfo.fundedByProjects.length;
|
124
|
this.publicationInfo.fundedByProjects[counter] = {
|
125
|
"url": "", "acronym": "", "title": "",
|
126
|
"funderShortname": "", "funderName": "",
|
127
|
"funding": "", "code": "", "inline": true
|
128
|
}
|
129
|
this.publicationInfo.fundedByProjects[counter]['url'] =
|
130
|
OpenaireProperties.getsearchLinkToProject() + project.projectId;
|
131
|
this.publicationInfo.fundedByProjects[counter]['acronym'] = project.projectAcronym;
|
132
|
// TODO ARGIRO : code is undefined? this field was missing before
|
133
|
this.publicationInfo.fundedByProjects[counter]['code'] = "-";
|
134
|
this.publicationInfo.fundedByProjects[counter]['title'] = project.projectName;
|
135
|
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = project.funderName;
|
136
|
}
|
137
|
}
|
138
|
}
|
139
|
toggleClaimContext(){
|
140
|
this.inlineClaimContext.toggle();
|
141
|
}
|
142
|
contextAdded($event){
|
143
|
var contexts =$event.value;
|
144
|
if(contexts){
|
145
|
for(var i=0; i < contexts.length; i++){
|
146
|
var context = contexts[i];
|
147
|
if(!this.publicationInfo.contexts){
|
148
|
this.publicationInfo.contexts = new Array<
|
149
|
{ "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}>();
|
150
|
|
151
|
}
|
152
|
var position:number = this.publicationInfo.contexts.length;
|
153
|
|
154
|
this.publicationInfo.contexts[ position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: true };
|
155
|
this.publicationInfo.contexts[position]['labelContext'] = context.community;
|
156
|
this.publicationInfo.contexts[position]['labelCategory'] = context.category;
|
157
|
this.publicationInfo.contexts[position]['labelConcept'] = context.concept.label;
|
158
|
|
159
|
|
160
|
}
|
161
|
}
|
162
|
}
|
163
|
toggleClaimResult(){
|
164
|
this.inlineClaimResult.toggle();
|
165
|
}
|
166
|
resultsAdded($event, isPublication:boolean){
|
167
|
var results =$event.value;
|
168
|
|
169
|
//TODO
|
170
|
}
|
171
|
*/
|
172
|
showChange($event) {
|
173
|
this.showAllReferences=$event.value;
|
174
|
}
|
175
|
|
176
|
|
177
|
}
|