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
|
import { Meta} from '../../angular2-meta';
|
6
|
import {PiwikService} from '../utils/piwik/piwik.service';
|
7
|
|
8
|
|
9
|
@Component({
|
10
|
selector: 'deposit',
|
11
|
template: `
|
12
|
<div class="uk-margin-top">
|
13
|
<div class="page-header" >
|
14
|
<h2>Deposit {{requestFor}}</h2>
|
15
|
</div>
|
16
|
|
17
|
<div>
|
18
|
<p>
|
19
|
<i>
|
20
|
Are you a grant recipient from the following: H2020; FP7 with SC39; or ERC?
|
21
|
</i>
|
22
|
Then you are required to publish in
|
23
|
<a href="{{openAccess}}" target="_blank">open access (<i class="custom-external"></i>)</a>.
|
24
|
One way to do this is to deposit your {{requestFor}} into an
|
25
|
<a href="{{openAccessRepo}}" target="_blank">open access repository (<i class="custom-external"></i>)</a>.
|
26
|
</p>
|
27
|
<p>
|
28
|
Click the following to find more information:
|
29
|
<a href="{{fp7Guidlines}}" target="_blank">FP7 guidelines (<i class="custom-external"></i>)</a>,
|
30
|
<a href="{{h2020Guidlines}}" target="_blank">H2020 guidelines (<i class="custom-external"></i>)</a>,
|
31
|
<a href="{{ercGuidlines}}" target="_blank">ERC guidelines (<i class="custom-external"></i>)</a> OR
|
32
|
<a href="{{helpdesk}}" target="_blank">ask a question (<i class="custom-external"></i>)</a> to OpenAIRE’s national representative.
|
33
|
</p>
|
34
|
|
35
|
<h3>Locate content provider via your institution</h3>
|
36
|
|
37
|
<form class= "uk-grid">
|
38
|
<div class="uk-width-1-2 ">
|
39
|
<entities-autocomplete fieldId="organization" (click)="warningMessage = ''" [entityType]="'organization'" [depositType]=compatibility [selectedValue]=selectedId [showSelected]=true
|
40
|
[placeHolderMessage] = "'Search for Organizations'" [title] = "'Organizations'" [multipleSelections]=false
|
41
|
(selectedValueChanged)="valueChanged($event)">
|
42
|
</entities-autocomplete>
|
43
|
</div>
|
44
|
<button class=" uk-button uk-button-default" type="submit" (click)="organizationSelected(selectedId)" >
|
45
|
Locate
|
46
|
</button>
|
47
|
<div *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">{{warningMessage}}</div>
|
48
|
</form>
|
49
|
</div>
|
50
|
</div>
|
51
|
`
|
52
|
})
|
53
|
|
54
|
export class DepositComponent {
|
55
|
@Input() keyword: string='';
|
56
|
public openAccess: string;
|
57
|
public openAccessRepo: string;
|
58
|
public fp7Guidlines: string;
|
59
|
public h2020Guidlines: string;
|
60
|
public ercGuidlines: string;
|
61
|
public helpdesk: string;
|
62
|
@Input() compatibility: string = '';
|
63
|
@Input() requestFor: string = "Publications";
|
64
|
|
65
|
public status: number;
|
66
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
67
|
public selectedId: string = "";
|
68
|
public warningMessage: string = "";
|
69
|
piwiksub:any;
|
70
|
|
71
|
constructor (private _router: Router, private _meta: Meta, private _piwikService:PiwikService) {
|
72
|
|
73
|
this.openAccess = OpenaireProperties.getOpenAccess();
|
74
|
this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
|
75
|
this.fp7Guidlines = OpenaireProperties.getFP7Guidlines();
|
76
|
this.h2020Guidlines = OpenaireProperties.getH2020Guidlines();
|
77
|
this.ercGuidlines = OpenaireProperties.getERCGuidlines();
|
78
|
this.helpdesk = OpenaireProperties.getHelpdesk();
|
79
|
this.updateTitle("Deposit "+this.requestFor);
|
80
|
this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor);
|
81
|
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
82
|
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
|
83
|
}
|
84
|
ngOnDestroy() {
|
85
|
if(this.piwiksub){
|
86
|
this.piwiksub.unsubscribe();
|
87
|
}
|
88
|
}
|
89
|
updateDescription(description:string){
|
90
|
this._meta.updateMeta("description", description);
|
91
|
this._meta.updateProperty("og:description", description);
|
92
|
}
|
93
|
updateTitle(title:string){
|
94
|
var _prefix ="OpenAIRE | ";
|
95
|
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
96
|
this._meta.setTitle(_title );
|
97
|
this._meta.updateProperty("og:title",_title);
|
98
|
}
|
99
|
updateUrl(url:string){
|
100
|
this._meta.updateProperty("og:url", url);
|
101
|
}
|
102
|
|
103
|
organizationSelected(id: string) {
|
104
|
console.info("organization selected");
|
105
|
if(id && id.length > 0){
|
106
|
if(this.requestFor == "Publications") {
|
107
|
this._router.navigate( ['participate/deposit-publications-result'], { queryParams: { "organizationId": id } } );
|
108
|
} else if(this.requestFor == "Research Data") {
|
109
|
this._router.navigate( ['participate/deposit-datasets-result'], { queryParams: { "organizationId": id } } );
|
110
|
}
|
111
|
} else {
|
112
|
this.warningMessage = "No organization selected";
|
113
|
}
|
114
|
}
|
115
|
|
116
|
valueChanged($event){
|
117
|
this.selectedId = $event.value;
|
118
|
}
|
119
|
}
|