1
|
import {Component, Input} from '@angular/core';
|
2
|
import {Observable} from 'rxjs/Observable';
|
3
|
import { Router } from '@angular/router';
|
4
|
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
5
|
|
6
|
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
|
7
|
|
8
|
@Component({
|
9
|
selector: 'deposit',
|
10
|
template: `
|
11
|
<div class="container">
|
12
|
<div class="page-header" >
|
13
|
<h2>Deposit {{requestFor}}</h2>
|
14
|
</div>
|
15
|
|
16
|
<div>
|
17
|
<p>
|
18
|
<i>
|
19
|
Are you a grant recipient from the following: H2020; FP7 with SC39; or ERC?
|
20
|
</i>
|
21
|
Then you are required to publish in
|
22
|
<a href="{{openAccess}}">open access</a>.
|
23
|
One way to do this is to deposit your publications into an
|
24
|
<a href="{{openAccessRepo}}">open access repository</a>.
|
25
|
</p>
|
26
|
<p>
|
27
|
Click the following to find more information:
|
28
|
<a href="{{fp7Guidlines}}">FP7 guidelines</a>,
|
29
|
<a href="{{h2020Guidlines}}">H2020 guidelines</a>,
|
30
|
<a href="{{ercGuidlines}}">ERC guidelines</a> OR
|
31
|
<a href="{{helpdesk}}">ask a question</a> to OpenAIRE’s national representative.
|
32
|
</p>
|
33
|
|
34
|
<h3>Locate data provider via your institution</h3>
|
35
|
|
36
|
<form>
|
37
|
<div class="input-group">
|
38
|
<span class="input-group-addon" id="sizing-addon2">Filter</span>
|
39
|
<span>
|
40
|
<input type="text" class="form-control" placeholder="Type keywords..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
41
|
</span>
|
42
|
<span class="input-group-btn">
|
43
|
<button (click)="keywordChanged()" type="submit" class="btn btn-default">SELECT</button>
|
44
|
</span>
|
45
|
</div>
|
46
|
<div>
|
47
|
<ul class="list-group" >
|
48
|
<li class="list-group-item" *ngIf="status == errorCodes.LOADING">
|
49
|
<div class="alert alert-info" role="alert">
|
50
|
Loading...
|
51
|
</div>
|
52
|
</li>
|
53
|
<li class="list-group-item" *ngIf="status == errorCodes.NONE">
|
54
|
<div class="alert alert-warning" role="alert">
|
55
|
No organizations found
|
56
|
</div>
|
57
|
</li>
|
58
|
<li class="list-group-item" *ngIf="status == errorCodes.ERROR">
|
59
|
<div class="alert alert-danger" role="alert">
|
60
|
Sorry! Organizations are not currently available
|
61
|
</div>
|
62
|
</li>
|
63
|
<li class="list-group-item" *ngFor=" let item of organizations">
|
64
|
<a style="cursor:pointer;" (click)="organizationSelected(item.id)">{{item.name}}</a>
|
65
|
</li>
|
66
|
</ul>
|
67
|
</div>
|
68
|
</form>
|
69
|
</div>
|
70
|
</div>
|
71
|
`
|
72
|
})
|
73
|
|
74
|
export class DepositComponent {
|
75
|
public keyword: string='';
|
76
|
public openAccess: string;
|
77
|
public openAccessRepo: string;
|
78
|
public fp7Guidlines: string;
|
79
|
public h2020Guidlines: string;
|
80
|
public ercGuidlines: string;
|
81
|
public helpdesk: string;
|
82
|
public organizations: {"name": string, "id": string}[] = [];
|
83
|
@Input() compatibility: string = '';
|
84
|
@Input() requestFor: string = "Publications";
|
85
|
|
86
|
public status: number;
|
87
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
88
|
|
89
|
constructor (private _router: Router,
|
90
|
private _searchOrganizationsService: SearchOrganizationsService) {
|
91
|
console.info("constructor deposit");
|
92
|
|
93
|
this.openAccess = OpenaireProperties.getOpenAccess();
|
94
|
this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
|
95
|
this.fp7Guidlines = OpenaireProperties.getFP7Guidlines();
|
96
|
this.h2020Guidlines = OpenaireProperties.getH2020Guidlines();
|
97
|
this.ercGuidlines = OpenaireProperties.getERCGuidlines();
|
98
|
this.helpdesk = OpenaireProperties.getHelpdesk();
|
99
|
}
|
100
|
|
101
|
keywordChanged() {
|
102
|
console.info("keywordChanged: "+this.keyword);
|
103
|
this.status = this.errorCodes.LOADING;
|
104
|
this.organizations = [];
|
105
|
|
106
|
this._searchOrganizationsService.searchOrganizationsForDeposit(this.keyword, this.compatibility, 1, 10).subscribe(
|
107
|
data => {
|
108
|
this.organizations = data;
|
109
|
this.status = this.errorCodes.DONE;
|
110
|
|
111
|
if(this.organizations.length == 0) {
|
112
|
this.status = this.errorCodes.NONE;
|
113
|
}
|
114
|
},
|
115
|
err => {
|
116
|
console.error(err);
|
117
|
|
118
|
this.status = this.errorCodes.ERROR;
|
119
|
console.info("error");
|
120
|
}
|
121
|
);
|
122
|
}
|
123
|
|
124
|
organizationSelected(id: string) {
|
125
|
if(this.requestFor == "Publications") {
|
126
|
this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } );
|
127
|
} else if(this.requestFor == "Datasets") {
|
128
|
console.info("call deposit result for datasets")
|
129
|
this._router.navigate( ['deposit-datasets-result'], { queryParams: { "organizationId": id } } );
|
130
|
}
|
131
|
}
|
132
|
}
|