diff --git a/src/app/deposit/datasets/depositBySubjectResult.component.ts b/src/app/deposit/datasets/depositBySubjectResult.component.ts
index ae65ba2..c719fa3 100644
--- a/src/app/deposit/datasets/depositBySubjectResult.component.ts
+++ b/src/app/deposit/datasets/depositBySubjectResult.component.ts
@@ -1,19 +1,67 @@
import {Component, Input} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
+import {ActivatedRoute} from '@angular/router';
+
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
+import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
+
+import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
+import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
+
+import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
+import {FetchZenodoInformation} from '../utils/fetchZenodoInformation.class';
@Component({
selector: 'openaire-deposit-by-subject-result',
- template:``
+ template:``
})
export class OpenaireDepositBySubjectResultComponent {
+ public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
+ properties:EnvProperties;
+ fetchZenodoInformation: FetchZenodoInformation;
+
piwikSiteId = null;
- constructor ( ) {
- var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
- this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ constructor ( private route: ActivatedRoute,
+ private _ΖenodoCommunitieService: ZenodoCommunitiesService,
+ private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
+ this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
}
+ public ngOnInit() {
+ this.route.data
+ .subscribe((data: { envSpecific: EnvProperties }) => {
+ this.properties = data.envSpecific;
+ this.route.queryParams.subscribe(params => {
+ var communityId = params['communityId'];
+ if(!communityId){
+ communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
+ }
+ this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ if(communityId) {
+
+ if (communityId != null && communityId != '') {
+
+ this._communityService.getCommunity(this.properties, this.properties.communityAPI+communityId).subscribe (
+ community => {
+ var community = community;
+ var masterZenodoCommunityId = community.zenodoCommunity;
+ if(masterZenodoCommunityId){
+ this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
+ }
+ this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
+ },
+ error => {
+ console.log("Community couldn't be loaded");
+ }
+ );
+ }
+ }
+ });
+ });
+ }
}
diff --git a/src/app/deposit/datasets/depositBySubjectResults.module.ts b/src/app/deposit/datasets/depositBySubjectResults.module.ts
index 63815f7..d2159a7 100644
--- a/src/app/deposit/datasets/depositBySubjectResults.module.ts
+++ b/src/app/deposit/datasets/depositBySubjectResults.module.ts
@@ -8,13 +8,19 @@ import {DepositBySubjectResultsRoutingModule} from './depositBySubjectResult-rou
import {DepositBySubjectResultsModule } from '../../openaireLibrary/deposit/datasets/depositBySubjectResults.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
-import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
+import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
+
+import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
+import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
+
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
@NgModule({
imports: [
CommonModule, FormsModule,
DepositBySubjectResultsModule,
- DepositBySubjectResultsRoutingModule
+ DepositBySubjectResultsRoutingModule,
+ ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule
],
declarations: [
@@ -24,6 +30,6 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
exports: [
OpenaireDepositBySubjectResultComponent
],
- providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
+ providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService]
})
export class LibDepositBySubjectResultsModule { }
diff --git a/src/app/deposit/datasets/depositDatasets.component.ts b/src/app/deposit/datasets/depositDatasets.component.ts
index b52a8b0..45d9f2c 100644
--- a/src/app/deposit/datasets/depositDatasets.component.ts
+++ b/src/app/deposit/datasets/depositDatasets.component.ts
@@ -1,21 +1,69 @@
import {Component, Input} from '@angular/core';
+import {ActivatedRoute} from '@angular/router';
+
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
+import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
+
+import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
+import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
+
+import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
+import {FetchZenodoInformation} from '../utils/fetchZenodoInformation.class';
@Component({
selector: 'openaire-deposit-datasets',
template: `
-
+
`
})
export class OpenaireDepositDatasetsComponent {
+ public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
+ properties:EnvProperties;
+ fetchZenodoInformation: FetchZenodoInformation;
+
piwikSiteId = null;
- constructor ( ) {
- var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
- this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+ constructor ( private route: ActivatedRoute,
+ private _ΖenodoCommunitieService: ZenodoCommunitiesService,
+ private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
+ this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
}
+ public ngOnInit() {
+ this.route.data
+ .subscribe((data: { envSpecific: EnvProperties }) => {
+ this.properties = data.envSpecific;
+ this.route.queryParams.subscribe(params => {
+ var communityId = params['communityId'];
+ if(!communityId){
+ communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
+ }
+ this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ if(communityId) {
+
+ if (communityId != null && communityId != '') {
+
+ this._communityService.getCommunity(this.properties, this.properties.communityAPI+communityId).subscribe (
+ community => {
+ var community = community;
+ var masterZenodoCommunityId = community.zenodoCommunity;
+ if(masterZenodoCommunityId){
+ this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
+ }
+ this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
+ },
+ error => {
+ console.log("Community couldn't be loaded");
+ }
+ );
+ }
+ }
+ });
+ });
+ }
}
diff --git a/src/app/deposit/datasets/depositDatasets.module.ts b/src/app/deposit/datasets/depositDatasets.module.ts
index 257a1e3..907d292 100644
--- a/src/app/deposit/datasets/depositDatasets.module.ts
+++ b/src/app/deposit/datasets/depositDatasets.module.ts
@@ -7,12 +7,19 @@ import { OpenaireDepositDatasetsComponent } from './depositDatasets.component';
import {DepositDatasetsModule} from '../../openaireLibrary/deposit/datasets/depositDatasets.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
-import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
+import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
+
+import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
+import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
+
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
+
@NgModule({
imports: [
CommonModule, FormsModule,
DepositDatasetsModule,
- DepositDatasetsRoutingModule
+ DepositDatasetsRoutingModule,
+ ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule
],
declarations: [
@@ -22,6 +29,6 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
exports: [
OpenaireDepositDatasetsComponent
],
- providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
+ providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService]
})
export class LibDepositDatasetsModule { }
diff --git a/src/app/deposit/datasets/depositDatasetsResult.component.ts b/src/app/deposit/datasets/depositDatasetsResult.component.ts
index 4bbad41..46c8fb7 100644
--- a/src/app/deposit/datasets/depositDatasetsResult.component.ts
+++ b/src/app/deposit/datasets/depositDatasetsResult.component.ts
@@ -1,21 +1,69 @@
import {Component, Input} from '@angular/core';
+import {ActivatedRoute} from '@angular/router';
+
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
+import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
+
+import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
+import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
+
+import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
+import {FetchZenodoInformation} from '../utils/fetchZenodoInformation.class';
@Component({
selector: 'openaire-deposit-datasets-result',
template: `
-
-
-
+
`
})
export class OpenaireDepositDatasetsResultComponent {
+ public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
+ properties:EnvProperties;
+ fetchZenodoInformation: FetchZenodoInformation;
+
piwikSiteId = null;
- constructor ( ) {
- var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
- this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ constructor ( private route: ActivatedRoute,
+ private _ΖenodoCommunitieService: ZenodoCommunitiesService,
+ private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
+ this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
+ }
+
+ public ngOnInit() {
+ this.route.data
+ .subscribe((data: { envSpecific: EnvProperties }) => {
+ this.properties = data.envSpecific;
+ this.route.queryParams.subscribe(params => {
+ var communityId = params['communityId'];
+ if(!communityId){
+ communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
+ }
+ this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ if(communityId) {
+
+ if (communityId != null && communityId != '') {
+
+ this._communityService.getCommunity(this.properties, this.properties.communityAPI+communityId).subscribe (
+ community => {
+ var community = community;
+ var masterZenodoCommunityId = community.zenodoCommunity;
+ if(masterZenodoCommunityId){
+ this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
+ }
+ this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
+ },
+ error => {
+ console.log("Community couldn't be loaded");
+ }
+ );
+ }
+ }
+ });
+ });
}
}
diff --git a/src/app/deposit/datasets/depositDatasetsResults.module.ts b/src/app/deposit/datasets/depositDatasetsResults.module.ts
index 1843d32..b3f5d20 100644
--- a/src/app/deposit/datasets/depositDatasetsResults.module.ts
+++ b/src/app/deposit/datasets/depositDatasetsResults.module.ts
@@ -8,13 +8,19 @@ import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-rout
import {DepositDatasetsResultsModule} from '../../openaireLibrary/deposit/datasets/depositDatasetsResults.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
-import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
+import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
+
+import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
+import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
+
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
@NgModule({
imports: [
CommonModule, FormsModule,
DepositDatasetsResultsModule,
- DepositDatasetsResultsRoutingModule
+ DepositDatasetsResultsRoutingModule,
+ ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule
],
declarations: [
@@ -24,6 +30,6 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
exports: [
OpenaireDepositDatasetsResultComponent,
],
- providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
+ providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService]
})
export class LibDepositDatasetsResultsModule { }
diff --git a/src/app/deposit/publications/depositPublications.component.ts b/src/app/deposit/publications/depositPublications.component.ts
index 99a4580..f2e3b8d 100644
--- a/src/app/deposit/publications/depositPublications.component.ts
+++ b/src/app/deposit/publications/depositPublications.component.ts
@@ -1,19 +1,99 @@
import {Component, Input} from '@angular/core';
+import {ActivatedRoute} from '@angular/router';
+
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
+import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
+
+import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
+import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
+
+import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
+import {FetchZenodoInformation} from '../utils/fetchZenodoInformation.class';
@Component({
selector: 'openaire-deposit-publications',
template: `
-
+
`
})
export class OpenaireDepositPublicationsComponent {
+ public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
+ properties:EnvProperties;
+ fetchZenodoInformation: FetchZenodoInformation;
+
piwikSiteId = null;
- constructor ( ) {
- var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
- this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ constructor ( private route: ActivatedRoute,
+ private _ΖenodoCommunitieService: ZenodoCommunitiesService,
+ private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
+ //var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
+ //this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+ this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
}
- }
+ public ngOnInit() {
+ //this.zenodoSearchUtils.status = this.errorCodes.LOADING;;
+ this.route.data
+ .subscribe((data: { envSpecific: EnvProperties }) => {
+ this.properties = data.envSpecific;
+ this.route.queryParams.subscribe(params => {
+ var communityId = params['communityId'];
+ if(!communityId){
+ communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
+ }
+ this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ if(communityId) {
+
+ if (communityId != null && communityId != '') {
+
+ this._communityService.getCommunity(this.properties, this.properties.communityAPI+communityId).subscribe (
+ community => {
+ var community = community;
+ var masterZenodoCommunityId = community.zenodoCommunity;
+ if(masterZenodoCommunityId){
+ this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
+ }
+ this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
+
+ /*
+ if(masterZenodoCommunityId){
+ this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe(
+ result => {
+ var masterZenodoCommunity = result;
+ this.zenodoInformation.name = masterZenodoCommunity.title;
+ this.zenodoInformation.url = masterZenodoCommunity.link;
+ },
+ error => {
+ console.log("Master Zenodo community'"+masterZenodoCommunityId+"' couldn't be loaded");
+ }
+ );
+ }
+
+ this._searchZenodoCommunitiesService.searchZCommunities(this.properties,communityId).subscribe (
+ result => {
+ var CommunityIds = result;
+ var totalResults = CommunityIds.length;
+ if(totalResults > 0) {
+ this.zenodoInformation.shareInZenodoUrl = "http://duffy.di.uoa.gr:4200/participate/share-zenodo?communityId="+communityId;
+ }
+ },
+ error => {
+ console.log("list of zenodo communities couldn't be loaded");
+ }
+ );
+ */
+ },
+ error => {
+ console.log("Community couldn't be loaded");
+ }
+ );
+ }
+ }
+ });
+ });
+ }
+}
diff --git a/src/app/deposit/publications/depositPublications.module.ts b/src/app/deposit/publications/depositPublications.module.ts
index b019607..e326565 100644
--- a/src/app/deposit/publications/depositPublications.module.ts
+++ b/src/app/deposit/publications/depositPublications.module.ts
@@ -8,12 +8,18 @@ import {DepositPublicationsRoutingModule} from './depositPublications-routing.mo
import {DepositPublicationsModule} from '../../openaireLibrary/deposit/publications/depositPublications.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
-import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
+import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
+import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
+import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
+
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
+
@NgModule({
imports: [
CommonModule, FormsModule,
DepositPublicationsModule,
- DepositPublicationsRoutingModule
+ DepositPublicationsRoutingModule,
+ ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule
],
declarations: [
OpenaireDepositPublicationsComponent
@@ -21,6 +27,6 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
exports: [
OpenaireDepositPublicationsComponent,
],
- providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
+ providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService]
})
export class LibDepositPublicationsModule { }
diff --git a/src/app/deposit/publications/depositPublicationsResult.component.ts b/src/app/deposit/publications/depositPublicationsResult.component.ts
index 3051d67..ef8a9e0 100644
--- a/src/app/deposit/publications/depositPublicationsResult.component.ts
+++ b/src/app/deposit/publications/depositPublicationsResult.component.ts
@@ -1,20 +1,67 @@
import {Component, Input} from '@angular/core';
+import {ActivatedRoute} from '@angular/router';
import {PiwikHelper} from '../../utils/piwikHelper';
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
+import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
+
+import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
+import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
+
+import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
+import {FetchZenodoInformation} from '../utils/fetchZenodoInformation.class';
+
@Component({
selector: 'openaire-deposit-publications-result',
template: `
-
+
`
})
export class OpenaireDepositPublicationsResultComponent {
+ public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
+ properties:EnvProperties;
+ fetchZenodoInformation: FetchZenodoInformation;
+
piwikSiteId = null;
- constructor ( ) {
- var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
- this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ constructor ( private route: ActivatedRoute,
+ private _ΖenodoCommunitieService: ZenodoCommunitiesService,
+ private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
+ this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
}
+ public ngOnInit() {
+ this.route.data
+ .subscribe((data: { envSpecific: EnvProperties }) => {
+ this.properties = data.envSpecific;
+ this.route.queryParams.subscribe(params => {
+ var communityId = params['communityId'];
+ if(!communityId){
+ communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
+ }
+ this.piwikSiteId = PiwikHelper.siteIDs[communityId];
+
+ if(communityId) {
+ if (communityId != null && communityId != '') {
+ this._communityService.getCommunity(this.properties, this.properties.communityAPI+communityId).subscribe (
+ community => {
+ var community = community;
+ var masterZenodoCommunityId = community.zenodoCommunity;
+ if(masterZenodoCommunityId){
+ this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
+ }
+ this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
+ },
+ error => {
+ console.log("Community couldn't be loaded");
+ }
+ );
+ }
+ }
+ });
+ });
+ }
}
diff --git a/src/app/deposit/publications/depositPublicationsResults.module.ts b/src/app/deposit/publications/depositPublicationsResults.module.ts
index b8411c8..819ef06 100644
--- a/src/app/deposit/publications/depositPublicationsResults.module.ts
+++ b/src/app/deposit/publications/depositPublicationsResults.module.ts
@@ -8,12 +8,18 @@ import {DepositPublicationsResultRoutingModule} from './depositPublicationsResul
import {DepositPublicationsResultsModule} from '../../openaireLibrary/deposit/publications/depositPublicationsResults.module';
import {FreeGuard} from '../../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
-import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
+import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
+
+import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
+import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
+
+import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
@NgModule({
imports: [
CommonModule, FormsModule,
DepositPublicationsResultsModule,
- DepositPublicationsResultRoutingModule
+ DepositPublicationsResultRoutingModule,
+ ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule
],
declarations: [
OpenaireDepositPublicationsResultComponent
@@ -21,6 +27,6 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
exports: [
OpenaireDepositPublicationsResultComponent
],
- providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
+ providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService]
})
export class LibDepositPublicationsResultsModule { }
diff --git a/src/app/deposit/utils/fetchZenodoInformation.class.ts b/src/app/deposit/utils/fetchZenodoInformation.class.ts
new file mode 100644
index 0000000..58b93cf
--- /dev/null
+++ b/src/app/deposit/utils/fetchZenodoInformation.class.ts
@@ -0,0 +1,40 @@
+import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
+import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
+import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
+
+import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
+
+export class FetchZenodoInformation {
+ constructor ( private _ΖenodoCommunitieService: ZenodoCommunitiesService,
+ private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { }
+
+ public ngOnDestroy() { }
+
+ public getZenodoCommunityNameAndUrlById(masterZenodoCommunityId: string, properties:EnvProperties, zenodoInformation: ZenodoInformationClass){
+ this._ΖenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe(
+ result => {
+ var masterZenodoCommunity = result;
+ //zenodoInformation.name = masterZenodoCommunity.title;
+ zenodoInformation.url = masterZenodoCommunity.link;
+ },
+ error => {
+ console.log("Master Zenodo community'"+masterZenodoCommunityId+"' couldn't be loaded");
+ }
+ );
+ }
+
+ public searchNumberOfZCommunities(communityId: string, properties: EnvProperties, zenodoInformation: ZenodoInformationClass) {
+ this._searchZenodoCommunitiesService.searchZCommunities(properties,communityId).subscribe (
+ result => {
+ var CommunityIds = result;
+ var totalResults = CommunityIds.length;
+ if(totalResults > 0) {
+ zenodoInformation.shareInZenodoUrl = "http://duffy.di.uoa.gr:4200/participate/share-zenodo?communityId="+communityId;
+ }
+ },
+ error => {
+ console.log("list of zenodo communities couldn't be loaded");
+ }
+ );
+ }
+}