1
|
import {Component, Input} from '@angular/core';
|
2
|
import {Router} from '@angular/router';
|
3
|
import {ActivatedRoute} from '@angular/router';
|
4
|
import {Title, Meta} from '@angular/platform-browser';
|
5
|
|
6
|
import {Observable} from 'rxjs/Observable';
|
7
|
|
8
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
9
|
|
10
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
11
|
|
12
|
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
13
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
14
|
|
15
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
16
|
import {OrganizationService} from '../../services/organization.service';
|
17
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
18
|
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
|
19
|
|
20
|
import {ZenodoInformationClass} from '../utils/zenodoInformation.class';
|
21
|
|
22
|
@Component({
|
23
|
selector: 'deposit-by-subject-result',
|
24
|
template: `
|
25
|
<deposit-result [requestFor]="'Research Data'" [piwikSiteId]=piwikSiteId
|
26
|
[zenodoInformation]="zenodoInformation"
|
27
|
[subjectResults]="true" [subject]="subject">
|
28
|
</deposit-result>
|
29
|
`
|
30
|
//templateUrl: 'depositBySubjectResult.component.html'
|
31
|
})
|
32
|
|
33
|
export class DepositBySubjectResultComponent {
|
34
|
@Input() piwikSiteId = null;
|
35
|
@Input() zenodoInformation: ZenodoInformationClass;
|
36
|
|
37
|
public subject: string = "";
|
38
|
properties:EnvProperties;
|
39
|
|
40
|
constructor (private route: ActivatedRoute) {}
|
41
|
|
42
|
constructor (private _router: Router,
|
43
|
private route: ActivatedRoute,
|
44
|
private _searchDataprovidersService: SearchDataprovidersService,
|
45
|
private _meta: Meta,
|
46
|
private _title: Title,
|
47
|
private _piwikService:PiwikService,
|
48
|
private seoService: SEOService) {
|
49
|
|
50
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
51
|
|
52
|
this.status = this.errorCodes.LOADING;
|
53
|
|
54
|
var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor;
|
55
|
var title = "Deposit "+this.requestFor;
|
56
|
|
57
|
this.updateTitle(title);
|
58
|
this.updateDescription(description);
|
59
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url, false);
|
60
|
|
61
|
}
|
62
|
|
63
|
ngOnInit() {
|
64
|
this.route.data
|
65
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
66
|
this.properties = data.envSpecific;
|
67
|
|
68
|
if(!this.zenodoInformation.url) {
|
69
|
this.zenodoInformation.url = this.properties.zenodo;
|
70
|
}
|
71
|
if(!this.zenodoInformation.name) {
|
72
|
this.zenodoInformation.name = "Zenodo";
|
73
|
}
|
74
|
});
|
75
|
}
|
76
|
}
|