Revision 56571
Added by Konstantina Galouni over 5 years ago
modules/uoa-connect-portal/trunk/src/app/deposit/deposit.module.ts | ||
---|---|---|
11 | 11 |
import {DepositRoutingModule} from "./deposit-routing.module"; |
12 | 12 |
import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module"; |
13 | 13 |
|
14 |
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service"; |
|
15 |
import {CommunityService} from "../openaireLibrary/connect/community/community.service"; |
|
16 |
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service"; |
|
17 |
|
|
14 | 18 |
@NgModule({ |
15 | 19 |
imports: [ |
16 | 20 |
CommonModule, FormsModule, |
... | ... | |
22 | 26 |
exports: [ |
23 | 27 |
OpenaireDepositComponent, |
24 | 28 |
], |
25 |
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled] |
|
29 |
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, |
|
30 |
ZenodoCommunitiesService, CommunityService, SearchZenodoCommunitiesService] |
|
26 | 31 |
}) |
27 | 32 |
export class LibDepositModule { } |
modules/uoa-connect-portal/trunk/src/app/deposit/deposit.component.ts | ||
---|---|---|
2 | 2 |
import {ActivatedRoute} from '@angular/router'; |
3 | 3 |
|
4 | 4 |
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; |
5 |
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; |
|
6 |
import {ZenodoInformationClass} from "../openaireLibrary/deposit/utils/zenodoInformation.class"; |
|
7 |
import {FetchZenodoInformation} from "./utils/fetchZenodoInformation.class"; |
|
8 |
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service"; |
|
9 |
import {CommunityService} from "../openaireLibrary/connect/community/community.service"; |
|
10 |
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service"; |
|
5 | 11 |
|
6 | 12 |
@Component({ |
7 | 13 |
selector: 'openaire-deposit', |
8 | 14 |
template: ` |
9 |
<deposit-first-page></deposit-first-page> |
|
15 |
<deposit-first-page [zenodoInformation]="zenodoInformation"></deposit-first-page>
|
|
10 | 16 |
` |
11 | 17 |
}) |
12 | 18 |
|
13 | 19 |
export class OpenaireDepositComponent { |
14 | 20 |
properties:EnvProperties; |
15 |
|
|
16 | 21 |
piwikSiteId = null; |
17 | 22 |
|
18 |
constructor ( private route: ActivatedRoute ) { |
|
23 |
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass(); |
|
24 |
fetchZenodoInformation: FetchZenodoInformation; |
|
25 |
|
|
26 |
constructor ( private route: ActivatedRoute, |
|
27 |
private _zenodoCommunitieService: ZenodoCommunitiesService, |
|
28 |
private _communityService: CommunityService, |
|
29 |
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) { |
|
30 |
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService); |
|
19 | 31 |
} |
20 | 32 |
|
21 | 33 |
public ngOnInit() { |
22 | 34 |
this.route.data |
23 | 35 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
24 | 36 |
this.properties = data.envSpecific; |
37 |
|
|
25 | 38 |
this.route.queryParams.subscribe(params => { |
39 |
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); |
|
40 |
if (!communityId) { |
|
41 |
communityId = params['communityId']; |
|
42 |
} |
|
26 | 43 |
|
44 |
if (communityId) { |
|
45 |
|
|
46 |
if (communityId != null && communityId != '') { |
|
47 |
|
|
48 |
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe( |
|
49 |
community => { |
|
50 |
let masterZenodoCommunityId = community.zenodoCommunity; |
|
51 |
if (masterZenodoCommunityId) { |
|
52 |
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage+communityId; |
|
53 |
} else { |
|
54 |
this.zenodoInformation.url = this.properties.zenodo; |
|
55 |
this.zenodoInformation.name = "Zenodo"; |
|
56 |
} |
|
57 |
}, |
|
58 |
error => { |
|
59 |
this.handleError("Error getting community with id: " + communityId, error); |
|
60 |
} |
|
61 |
); |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
if (!this.zenodoInformation.shareInZenodoUrl) { |
|
66 |
this.zenodoInformation.url = this.properties.zenodo; |
|
67 |
} |
|
68 |
if (!this.zenodoInformation.name) { |
|
69 |
this.zenodoInformation.name = "Zenodo"; |
|
70 |
} |
|
27 | 71 |
}); |
72 |
|
|
28 | 73 |
}); |
29 | 74 |
} |
30 | 75 |
|
modules/uoa-connect-portal/trunk/src/app/deposit/searchDataprovidersToDeposit.component.ts | ||
---|---|---|
16 | 16 |
selector: 'openaire-search-deposit', |
17 | 17 |
template: ` |
18 | 18 |
<!-- [piwikSiteId]=piwikSiteId [zenodoInformation]="zenodoInformation"--> |
19 |
<search-dataproviders></search-dataproviders> |
|
19 |
<search-dataproviders [zenodoInformation]="zenodoInformation"></search-dataproviders>
|
|
20 | 20 |
` |
21 | 21 |
}) |
22 | 22 |
|
... | ... | |
53 | 53 |
community => { |
54 | 54 |
var community = community; |
55 | 55 |
var masterZenodoCommunityId = community.zenodoCommunity; |
56 |
if(masterZenodoCommunityId){ |
|
57 |
this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation); |
|
58 |
} |
|
59 |
this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation); |
|
60 |
}, |
|
56 |
if (masterZenodoCommunityId) { |
|
57 |
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage+communityId; |
|
58 |
} else { |
|
59 |
this.zenodoInformation.url = this.properties.zenodo; |
|
60 |
this.zenodoInformation.name = "Zenodo"; |
|
61 |
} }, |
|
61 | 62 |
error => { |
62 | 63 |
this.handleError("Error getting community with id: "+communityId, error); |
63 | 64 |
} |
64 | 65 |
); |
65 | 66 |
} |
66 | 67 |
} |
68 |
|
|
69 |
if (!this.zenodoInformation.shareInZenodoUrl) { |
|
70 |
this.zenodoInformation.url = this.properties.zenodo; |
|
71 |
} |
|
72 |
if (!this.zenodoInformation.name) { |
|
73 |
this.zenodoInformation.name = "Zenodo"; |
|
74 |
} |
|
67 | 75 |
}); |
68 | 76 |
}); |
69 | 77 |
} |
Also available in: Unified diff
[Trunk | Connect]: Bug fix in deposit pages: Get information for zenodo communities in connect components.