1 |
51835
|
sofia.balt
|
import {Component, Input} from '@angular/core';
|
2 |
|
|
import {Router, ActivatedRoute} from '@angular/router';
|
3 |
|
|
import {Title, Meta} from '@angular/platform-browser';
|
4 |
50169
|
argiro.kok
|
|
5 |
55964
|
argiro.kok
|
import {Observable} from 'rxjs';
|
6 |
50169
|
argiro.kok
|
|
7 |
51835
|
sofia.balt
|
import {EnvProperties} from '../utils/properties/env-properties';
|
8 |
|
|
|
9 |
|
|
import {PiwikService} from '../utils/piwik/piwik.service';
|
10 |
53740
|
argiro.kok
|
import { SEOService } from '../sharedComponents/SEO/SEO.service';
|
11 |
51835
|
sofia.balt
|
|
12 |
53973
|
konstantin
|
import {ZenodoInformationClass} from './utils/zenodoInformation.class';
|
13 |
51835
|
sofia.balt
|
|
14 |
50169
|
argiro.kok
|
@Component({
|
15 |
|
|
selector: 'deposit',
|
16 |
|
|
templateUrl: 'deposit.component.html'
|
17 |
|
|
})
|
18 |
|
|
|
19 |
|
|
export class DepositComponent {
|
20 |
53973
|
konstantin
|
@Input() zenodoInformation: ZenodoInformationClass;
|
21 |
50169
|
argiro.kok
|
@Input() compatibility: string = '';
|
22 |
|
|
@Input() mapUrl: string = null; // optional in case i-frame is needed
|
23 |
|
|
@Input() searchBySubjects: boolean = false; // optional: in case search by subjects is needed
|
24 |
51746
|
argiro.kok
|
@Input() piwikSiteId = null;
|
25 |
50169
|
argiro.kok
|
|
26 |
|
|
public status: number;
|
27 |
|
|
|
28 |
|
|
// Type of entity: Publication or Research Data
|
29 |
|
|
@Input() requestFor: string = "Publications";
|
30 |
|
|
|
31 |
|
|
// url's needed for information text
|
32 |
|
|
public openAccess: string;
|
33 |
|
|
public openAccessRepo: string;
|
34 |
|
|
public fp7Guidlines: string;
|
35 |
|
|
public h2020Guidlines: string;
|
36 |
|
|
public ercGuidlines: string;
|
37 |
|
|
public helpdesk: string;
|
38 |
|
|
|
39 |
|
|
// Id of the new selected organization to be searched
|
40 |
|
|
public selectedId: string = "";
|
41 |
|
|
|
42 |
|
|
public warningMessage: string = "";
|
43 |
|
|
|
44 |
|
|
piwiksub:any;
|
45 |
50586
|
argiro.kok
|
properties:EnvProperties;
|
46 |
53740
|
argiro.kok
|
url=null;
|
47 |
51835
|
sofia.balt
|
constructor (private route: ActivatedRoute, private _router: Router,
|
48 |
|
|
private _meta: Meta, private _title: Title,
|
49 |
53740
|
argiro.kok
|
private _piwikService:PiwikService,
|
50 |
|
|
private seoService: SEOService ) {
|
51 |
50169
|
argiro.kok
|
|
52 |
51835
|
sofia.balt
|
var title = "Deposit "+this.requestFor;
|
53 |
|
|
var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor;
|
54 |
|
|
this.updateTitle(title);
|
55 |
|
|
this.updateDescription(description);
|
56 |
50169
|
argiro.kok
|
}
|
57 |
50586
|
argiro.kok
|
ngOnInit() {
|
58 |
|
|
this.route.data
|
59 |
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
60 |
|
|
this.properties = data.envSpecific;
|
61 |
54756
|
konstantin
|
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url, false);
|
62 |
|
|
this.updateUrl(data.envSpecific.baseLink+this._router.url);
|
63 |
|
|
this.url = data.envSpecific.baseLink+this._router.url;
|
64 |
|
|
|
65 |
50586
|
argiro.kok
|
this.openAccess = this.properties.openAccess;
|
66 |
|
|
this.openAccessRepo = this.properties.openAccessRepo;
|
67 |
|
|
this.fp7Guidlines = this.properties.fp7Guidlines
|
68 |
|
|
this.h2020Guidlines = this.properties.h2020Guidlines
|
69 |
|
|
this.ercGuidlines = this.properties.ercGuidlines
|
70 |
|
|
this.helpdesk = this.properties.helpdesk;
|
71 |
54756
|
konstantin
|
|
72 |
50586
|
argiro.kok
|
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
73 |
51746
|
argiro.kok
|
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor, this.piwikSiteId).subscribe();
|
74 |
50586
|
argiro.kok
|
}
|
75 |
|
|
});
|
76 |
|
|
}
|
77 |
50169
|
argiro.kok
|
ngOnDestroy() {
|
78 |
|
|
if(this.piwiksub){
|
79 |
|
|
this.piwiksub.unsubscribe();
|
80 |
|
|
}
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
public organizationSelected(id: string) {
|
84 |
|
|
if(id && id.length > 0){
|
85 |
|
|
if(this.requestFor == "Publications") {
|
86 |
|
|
this._router.navigate( ['participate/deposit-publications-result'], { queryParams: { "organizationId": id } } );
|
87 |
|
|
} else if(this.requestFor == "Research Data") {
|
88 |
|
|
this._router.navigate( ['participate/deposit-datasets-result'], { queryParams: { "organizationId": id } } );
|
89 |
|
|
}
|
90 |
|
|
} else {
|
91 |
|
|
this.warningMessage = "No organization selected";
|
92 |
|
|
}
|
93 |
|
|
}
|
94 |
|
|
|
95 |
51835
|
sofia.balt
|
public valueChanged($event) {
|
96 |
50169
|
argiro.kok
|
this.selectedId = $event.value;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
51835
|
sofia.balt
|
private updateDescription(description:string) {
|
100 |
|
|
this._meta.updateTag({content:description},"name='description'");
|
101 |
|
|
this._meta.updateTag({content:description},"property='og:description'");
|
102 |
50169
|
argiro.kok
|
}
|
103 |
51835
|
sofia.balt
|
private updateTitle(title:string) {
|
104 |
50169
|
argiro.kok
|
var _prefix ="OpenAIRE | ";
|
105 |
|
|
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
106 |
51835
|
sofia.balt
|
this._title.setTitle(_title);
|
107 |
|
|
this._meta.updateTag({content:_title},"property='og:title'");
|
108 |
50169
|
argiro.kok
|
}
|
109 |
51835
|
sofia.balt
|
private updateUrl(url:string) {
|
110 |
|
|
this._meta.updateTag({content:url},"property='og:url'");
|
111 |
50169
|
argiro.kok
|
}
|
112 |
|
|
}
|