1
|
import {Component, Input} from '@angular/core';
|
2
|
import {Observable} from 'rxjs/Observable';
|
3
|
import {ActivatedRoute, Router} from '@angular/router';
|
4
|
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
|
5
|
import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class';
|
6
|
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
7
|
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
8
|
import { Meta} from '../../../angular2-meta';
|
9
|
declare var UIkit:any;
|
10
|
|
11
|
@Component({
|
12
|
selector: 'linking-generic',
|
13
|
template: `
|
14
|
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
|
15
|
<div uk-grid uk-grid>
|
16
|
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
|
17
|
|
18
|
<div class="uk-container uk-margin-top">
|
19
|
<div class="page-header">
|
20
|
<h1>Linking</h1>
|
21
|
</div>
|
22
|
<div class="uk-clearfix">
|
23
|
<a class="uk-float-right" uk-toggle="target: #linkingInfo; animation: uk-animation-fade"><span class="uk-icon">
|
24
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
25
|
</span> More Information </a>
|
26
|
</div>
|
27
|
<div id="linkingInfo" class="uk-card uk-card-default uk-card-body uk-margin-small" hidden>
|
28
|
<a uk-toggle="target: #linkingInfo; animation: uk-animation-fade" class="uk-float-right"><span class="uk-icon">
|
29
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="1"><path fill="none" stroke="#000" stroke-width="1.06" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.06" d="M16,4 L4,16"></path></svg>
|
30
|
</span></a>
|
31
|
<div class="uk-text-bold"><span class="uk-icon">
|
32
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" icon="info" ratio="1"><path d="M12.13,11.59 C11.97,12.84 10.35,14.12 9.1,14.16 C6.17,14.2 9.89,9.46 8.74,8.37 C9.3,8.16 10.62,7.83 10.62,8.81 C10.62,9.63 10.12,10.55 9.88,11.32 C8.66,15.16 12.13,11.15 12.14,11.18 C12.16,11.21 12.16,11.35 12.13,11.59 C12.08,11.95 12.16,11.35 12.13,11.59 L12.13,11.59 Z M11.56,5.67 C11.56,6.67 9.36,7.15 9.36,6.03 C9.36,5 11.56,4.54 11.56,5.67 L11.56,5.67 Z"></path><circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle></svg>
|
33
|
</span> Linking Functionality:</div>
|
34
|
<p>Through linking functioanilty you are able to create links from research results to projects and/ or communities. You have to select at least one research result and one project or community in order to be able to proceed.</p>
|
35
|
<p>You can search for reasearch results (publication and/ or research data) to link, in openaire, crossref, and/ or Datacite. </p>
|
36
|
|
37
|
<p *ngIf="show=='project'"><span class="uk-text-bold">Projects:</span> Search and add projects using keyword search. Limit the search space by specifying project Funder. </p>
|
38
|
<p *ngIf="show=='context'"><span class="uk-text-bold">Communities:</span> Search and add communities/ concepts by selecting community, category and using keyword search for . Or browse through the categories and add communities. </p>
|
39
|
<p *ngIf="show=='result'"><span class="uk-text-bold">Research Results:</span> Use search mode, to search and add results through keyword search. Use upload mode, to upload a list of DOIs of results. </p>
|
40
|
<p *ngIf="show=='claim'"><span class="uk-text-bold">Review Metadata:</span> For selected research results that came from 3rd party repositories (Datacite, Crossreff), you need to set access mode, and type before they are included in openaire information space.
|
41
|
Please have in mind that if you ignore this step they will have the default values.
|
42
|
</p>
|
43
|
|
44
|
|
45
|
|
46
|
</div>
|
47
|
|
48
|
<ul class="uk-breadcrumb">
|
49
|
<li [class]="(show=='project')?'uk-active':''" ><a (click)="show='project';"> Select Projects <span >({{projects.length}})</span></a></li>
|
50
|
<li [class]="(show=='context')?'uk-active':''" ><a (click)="show='context';"> Select Communities <span >({{contexts.length}})</span></a></li>
|
51
|
<li [class]="(show=='result')?'uk-active':''" ><a (click)="show='result';"> Select Research Results <span >({{results.length}})</span></a></li>
|
52
|
<li [class]="(show=='claim')?'uk-active':''" (click)="canProceedToMetadata();"><a [class]="(results.length == 0)?'uk-disabled':''" (click)="show='claim';" > Review metadata</a></li>
|
53
|
</ul>
|
54
|
<!--start-over [results]="results" [contexts]="contexts" [projects]="projects" ></start-over-->
|
55
|
|
56
|
|
57
|
|
58
|
|
59
|
<!--ul class="uk-pagination uk-margin-remove-bottom">
|
60
|
<li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li>
|
61
|
<li *ngIf="show != 'claim' " (click)="next()" class="uk-margin-auto-left"><a>Next <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
|
62
|
<li *ngIf="show == 'claim' " (click)="next()" class="uk-margin-auto-left">
|
63
|
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [show] = "show"
|
64
|
(showChange)="showChange($event)" ></claim-insert>
|
65
|
|
66
|
</li>
|
67
|
</ul-->
|
68
|
|
69
|
<!-- link with Projects & Contexts -->
|
70
|
<!--div class="uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-grid">
|
71
|
<div class="uk-width-1-1@s uk-width-1-2@m uk-width-1-2@l uk-width-1-2@xl "-->
|
72
|
<!--ul class=" uk-tab " uk-tab="connect: #tabs; animation: uk-animation-fade">
|
73
|
<li>
|
74
|
<a>Projects ({{projects.length}})</a>
|
75
|
</li>
|
76
|
<li>
|
77
|
<a>Communities ({{contexts.length}})</a>
|
78
|
</li>
|
79
|
</ul>
|
80
|
<ul id="tabs" class="uk-switcher uk-margin-left uk-width-1-1">
|
81
|
<li-->
|
82
|
<claim-selected-projects *ngIf="show=='project'" title="link Projects" [projects]="projects" [show]="show" [linkType]=linkType
|
83
|
(showChange)="showChange($event)" > </claim-selected-projects>
|
84
|
<!--/li>
|
85
|
<li-->
|
86
|
<claim-selected-contexts *ngIf="show=='context'" title="link Communities" [contexts]="contexts" [projects]="projects" [results]="results" [inlineEntity] = "inlineResult" [show]="show" [linkType]=linkType
|
87
|
(showChange)="showChange($event)" > </claim-selected-contexts>
|
88
|
<!--/li-->
|
89
|
<!--/div>
|
90
|
<div class="uk-width-1-1@s uk-width-1-2@m uk-width-1-2@l uk-width-1-2@xl "-->
|
91
|
|
92
|
<!--/ul>
|
93
|
<!--/div-->
|
94
|
<!--/div-->
|
95
|
<!--hr-->
|
96
|
<!-- Research Results -->
|
97
|
<div *ngIf="show=='result' || show=='claim'" class="uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l">
|
98
|
<claim-selected-results title= "Selected Research Results" [results]="results" [bulkMode]="bulkMode" [showSearch]="show=='claim'|| bulkMode? false: true" [showAccessRights]="show=='claim' || bulkMode? true: false">
|
99
|
</claim-selected-results>
|
100
|
</div>
|
101
|
|
102
|
|
103
|
|
104
|
|
105
|
<ul class="uk-pagination">
|
106
|
<!--li *ngIf="show != 'result' " (click)="prev()"><a><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a></li-->
|
107
|
<li *ngIf="show != 'claim' && this.results.length > 0 " (click)="canProceedToMetadata()" class="uk-margin-auto-left"><a> Review Metadata <span class="uk-margin-small-left" uk-pagination-next></span></a></li>
|
108
|
<li *ngIf="show == 'claim' " (click)="next()" class="uk-margin-auto-left">
|
109
|
<claim-insert [contexts]="contexts" [results]="results" [projects]="projects" [show] = "show"
|
110
|
(showChange)="showChange($event)" ></claim-insert>
|
111
|
|
112
|
</li>
|
113
|
</ul>
|
114
|
</div>
|
115
|
|
116
|
</div>
|
117
|
</div>
|
118
|
</div>
|
119
|
`
|
120
|
|
121
|
})
|
122
|
export class LinkingGenericComponent {
|
123
|
|
124
|
@Input() bulkMode: boolean = false;
|
125
|
sourceType:string;
|
126
|
targetType:string;
|
127
|
step:number = 1;
|
128
|
contexts=[];
|
129
|
projects=[];
|
130
|
results = [];
|
131
|
show = "project";
|
132
|
date='8-6-2016';
|
133
|
keyword: string = "";
|
134
|
linkType:string ="project"; // link type (selected in home page) : project, context, software, etc
|
135
|
/* url Parameters for inline linking */
|
136
|
id:string = null; //entity id
|
137
|
type:string = null; // entity type (publication or research data)
|
138
|
linkTo:string = null; // entity type (project or context or result)
|
139
|
|
140
|
entityTypes=["dataset", "publication", "project","context"];
|
141
|
inlineResult:ClaimResult =null;
|
142
|
sub:any =null;
|
143
|
constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
|
144
|
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private _meta: Meta) {
|
145
|
this._meta.setTitle("OpenAIRE | Linking");
|
146
|
}
|
147
|
ngOnInit() {
|
148
|
if( typeof localStorage !== 'undefined') {
|
149
|
if(localStorage.getItem("projects")){
|
150
|
this.projects = JSON.parse(localStorage.getItem("projects"));
|
151
|
|
152
|
}
|
153
|
if(localStorage.getItem("contexts")){
|
154
|
this.contexts = JSON.parse(localStorage.getItem("contexts"));
|
155
|
}
|
156
|
if(localStorage.getItem("results")){
|
157
|
this.results = JSON.parse(localStorage.getItem("results"));
|
158
|
|
159
|
}
|
160
|
localStorage.removeItem("projects");
|
161
|
localStorage.removeItem("contexts");
|
162
|
localStorage.removeItem("results");
|
163
|
}
|
164
|
}
|
165
|
|
166
|
next(){
|
167
|
|
168
|
if((this.show == 'result' && this.keyword == '')||(this.show == 'dataset' || this.show == 'publication')){
|
169
|
this.show='claim';
|
170
|
|
171
|
}
|
172
|
}
|
173
|
prev(){
|
174
|
if(this.show == 'claim'){
|
175
|
this.show='result';
|
176
|
}
|
177
|
}
|
178
|
|
179
|
|
180
|
resultsChange($event) {
|
181
|
this.results=$event.value;
|
182
|
}
|
183
|
|
184
|
projectsChange($event) {
|
185
|
this.projects=$event.value;
|
186
|
}
|
187
|
|
188
|
linkTypeChange($event) {
|
189
|
|
190
|
this.linkType =$event.value;
|
191
|
this.show="result";
|
192
|
if(this.bulkMode){
|
193
|
this.show="claim";
|
194
|
}
|
195
|
}
|
196
|
|
197
|
showChange($event) {
|
198
|
this.show=$event.value;
|
199
|
this.showChangedType($event.value);
|
200
|
}
|
201
|
|
202
|
showChangedType(type:string) {
|
203
|
this.show=type;
|
204
|
if(this.show == 'project' || this.show == 'context' || this.show == 'software'){
|
205
|
this.linkType = this.show;
|
206
|
}
|
207
|
}
|
208
|
|
209
|
canProceedToMetadata(){
|
210
|
if(this.results.length == 0){
|
211
|
|
212
|
UIkit.notification({
|
213
|
message : 'No research results selected!<br>Please select research results to link with projects and/ or ommunities.',
|
214
|
status : 'warning',
|
215
|
timeout : 1000,
|
216
|
pos : 'top-center'
|
217
|
});
|
218
|
}else{
|
219
|
this.show = 'claim';
|
220
|
}
|
221
|
}
|
222
|
}
|