[Trunk | Connect]:
1. app.module.ts & directLinking.module.ts & linkingGeneric.module.ts & community.module.ts & deposit.module.ts & searchDataprovidersToDeposit.module.ts & shareInZenodo.module.ts & subjects.module.ts & invite.module.ts & inviteBasic.module.ts & subscribe.module.ts: Remove CommunityService from providers (singleton service, providedIn: 'root'). 2. community.component.ts & curators.component.ts & deposit.component.ts & searchDataprovidersToDeposit.component.ts & shareInZenodo.component.ts & statistics.component.ts & subjects.component.ts & invite.component.ts & subscribe.component.ts: Get community from state (call communityService.getCommunityByState) | Add subscriptions in array to unsubscribe in ngOnDestroy | Get properties from environment (no service needed). git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@59141 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
b4df338564
commit
d71892ed9e
|
@ -51,7 +51,6 @@ import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.mod
|
|||
exports: [ AppComponent ],
|
||||
providers:[
|
||||
EnvironmentSpecificResolver, CommunitiesService, LayoutService, SubscribeService,
|
||||
//FreeGuard, PreviousRouteRecorder, PiwikService, CommunityService,
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: HttpInterceptorService,
|
||||
|
|
|
@ -8,13 +8,12 @@ import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
|
|||
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
|
||||
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
|
||||
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, DirectLinkingModule, DirectLinkingRoutingModule
|
||||
],
|
||||
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard, CommunityService],
|
||||
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard],
|
||||
declarations: [
|
||||
OpenaireDirectLinkingComponent
|
||||
], exports:[OpenaireDirectLinkingComponent]
|
||||
|
|
|
@ -3,18 +3,17 @@ import { NgModule } from '@angular/core';
|
|||
import { SharedModule } from '../../shared/shared.module';
|
||||
import {OpenaireLinkingComponent} from './linkingGeneric.component';
|
||||
import {LinkingRoutingModule} from './linking-routing.module';
|
||||
import{ LinkingGenericModule} from '../../openaireLibrary/claims/linking/linkingGeneric.module';
|
||||
import {LinkingGenericModule} from '../../openaireLibrary/claims/linking/linkingGeneric.module';
|
||||
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
|
||||
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
|
||||
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule, LinkingRoutingModule, LinkingGenericModule
|
||||
],
|
||||
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard, CommunityService],
|
||||
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard],
|
||||
declarations: [
|
||||
OpenaireLinkingComponent
|
||||
], exports:[
|
||||
|
|
|
@ -26,6 +26,7 @@ import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/sea
|
|||
import {FetchResearchResults} from "../openaireLibrary/utils/fetchEntitiesClasses/fetchResearchResults.class";
|
||||
import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes";
|
||||
import {Subscription} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
@Component({
|
||||
selector: 'community',
|
||||
|
@ -143,124 +144,121 @@ export class CommunityComponent {
|
|||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.subs.push(this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.searchLinkToResults = this.properties.searchLinkToResults;
|
||||
this.searchLinkToProjects = this.properties.searchLinkToProjects;
|
||||
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
|
||||
this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults;
|
||||
this.shareInZenodoPage = this.properties.shareInZenodoPage;
|
||||
this.url = data.envSpecific.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url, false);
|
||||
this._meta.updateTag({content: this.url}, "property='og:url'");
|
||||
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
this.properties = properties;
|
||||
this.searchLinkToResults = this.properties.searchLinkToResults;
|
||||
this.searchLinkToProjects = this.properties.searchLinkToProjects;
|
||||
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
|
||||
this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults;
|
||||
this.shareInZenodoPage = this.properties.shareInZenodoPage;
|
||||
this.url =properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url, false);
|
||||
this._meta.updateTag({content: this.url}, "property='og:url'");
|
||||
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
}));
|
||||
if (this.communityId != null && this.communityId != '') {
|
||||
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
|
||||
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
if (typeof document !== 'undefined') {
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
this.community = community;
|
||||
if(community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
|
||||
this.thresholdDescription = community.description.length;
|
||||
}
|
||||
|
||||
if (this.properties.environment == "development") {
|
||||
this.params = {communityId: community.communityId};
|
||||
}
|
||||
this._meta.updateTag({content: community.description}, "name='description'");
|
||||
this._meta.updateTag({content: community.description}, "property='og:description'");
|
||||
this._meta.updateTag({content: community.title}, "property='og:title'");
|
||||
this._title.setTitle(community.title);
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, community.title, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
|
||||
}
|
||||
if (this.community.zenodoCommunity) {
|
||||
this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
|
||||
result => {
|
||||
this.masterZenodoCommunity = result;
|
||||
|
||||
},
|
||||
error => {
|
||||
// var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
||||
// emptyCommunity.id = this.masterZenodoCommunityId;
|
||||
// emptyCommunity.title = this.masterZenodoCommunityId;
|
||||
// this.masterZenodoCommunity = emptyCommunity;
|
||||
//console.log("Master Zenodo community'" + this.community.zenodoCommunity + "' couldn't be loaded");
|
||||
this.handleError("Error getting Master Zenodo community with id: " + this.community.zenodoCommunityId, error);
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
||||
result => {
|
||||
this.zenodoCommunityIdS = result;
|
||||
|
||||
|
||||
},
|
||||
error => {
|
||||
//console.error("list of zenodo communities couldn't be loaded");
|
||||
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
||||
} //this.handleError('System error retrieving community profile', error)
|
||||
));
|
||||
|
||||
//console.log(community);
|
||||
}));
|
||||
if (this.communityId != null && this.communityId != '') {
|
||||
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
if (typeof document !== 'undefined') {
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
this.community = community;
|
||||
if(community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
|
||||
this.thresholdDescription = community.description.length;
|
||||
}
|
||||
|
||||
if (this.properties.environment == "development") {
|
||||
this.params = {communityId: community.communityId};
|
||||
}
|
||||
this._meta.updateTag({content: community.description}, "name='description'");
|
||||
this._meta.updateTag({content: community.description}, "property='og:description'");
|
||||
this._meta.updateTag({content: community.title}, "property='og:title'");
|
||||
this._title.setTitle(community.title);
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, community.title, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
|
||||
}
|
||||
if (this.community.zenodoCommunity) {
|
||||
this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
|
||||
result => {
|
||||
this.masterZenodoCommunity = result;
|
||||
this.countResearchResults("publication");
|
||||
this.countResearchResults("dataset");
|
||||
this.countResearchResults("software");
|
||||
this.countResearchResults("other");
|
||||
|
||||
},
|
||||
error => {
|
||||
// var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
||||
// emptyCommunity.id = this.masterZenodoCommunityId;
|
||||
// emptyCommunity.title = this.masterZenodoCommunityId;
|
||||
// this.masterZenodoCommunity = emptyCommunity;
|
||||
//console.log("Master Zenodo community'" + this.community.zenodoCommunity + "' couldn't be loaded");
|
||||
this.handleError("Error getting Master Zenodo community with id: " + this.community.zenodoCommunityId, error);
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
||||
result => {
|
||||
this.zenodoCommunityIdS = result;
|
||||
|
||||
|
||||
},
|
||||
error => {
|
||||
//console.error("list of zenodo communities couldn't be loaded");
|
||||
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
||||
} //this.handleError('System error retrieving community profile', error)
|
||||
));
|
||||
|
||||
//console.log(community);
|
||||
}));
|
||||
|
||||
this.countResearchResults("publication");
|
||||
this.countResearchResults("dataset");
|
||||
this.countResearchResults("software");
|
||||
this.countResearchResults("other");
|
||||
|
||||
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
|
||||
projectTotal => {
|
||||
this.projectTotal = projectTotal;
|
||||
//console.log(projectTotal);
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
|
||||
},
|
||||
() => {
|
||||
this.projectsCalculated = true;
|
||||
}
|
||||
));
|
||||
|
||||
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
|
||||
contentProviderTotal => {
|
||||
this.contentProviderTotal = contentProviderTotal;
|
||||
//console.log(contentProviderTotal);
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
|
||||
},
|
||||
() => {
|
||||
this.contentProvidersCalculated = true;
|
||||
}
|
||||
));
|
||||
|
||||
// this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe(
|
||||
// organizationTotal => {
|
||||
// this.organizationTotal = organizationTotal;
|
||||
// console.log(organizationTotal);
|
||||
// });
|
||||
|
||||
|
||||
/**/
|
||||
this.subs.push(this.config.communityInformationState.subscribe(
|
||||
res => {
|
||||
this.communityInfo = res;
|
||||
},
|
||||
error => {
|
||||
//console.log(error)
|
||||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
}
|
||||
));
|
||||
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
|
||||
projectTotal => {
|
||||
this.projectTotal = projectTotal;
|
||||
//console.log(projectTotal);
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
|
||||
},
|
||||
() => {
|
||||
this.projectsCalculated = true;
|
||||
}
|
||||
}));
|
||||
));
|
||||
|
||||
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
|
||||
contentProviderTotal => {
|
||||
this.contentProviderTotal = contentProviderTotal;
|
||||
//console.log(contentProviderTotal);
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
|
||||
},
|
||||
() => {
|
||||
this.contentProvidersCalculated = true;
|
||||
}
|
||||
));
|
||||
|
||||
// this._searchEntriesService.countTotal(this.properties.communityAPI+this.communityId+'/organizations').subscribe(
|
||||
// organizationTotal => {
|
||||
// this.organizationTotal = organizationTotal;
|
||||
// console.log(organizationTotal);
|
||||
// });
|
||||
|
||||
|
||||
/**/
|
||||
this.subs.push(this.config.communityInformationState.subscribe(
|
||||
res => {
|
||||
this.communityInfo = res;
|
||||
},
|
||||
error => {
|
||||
//console.log(error)
|
||||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private searchPublications(page: number, size: number) {
|
||||
|
|
|
@ -3,10 +3,8 @@ import {CommonModule} from '@angular/common';
|
|||
import {FormsModule} from '@angular/forms';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {CommunityComponent} from './community.component';
|
||||
import {SearchTabComponent} from '../openaireLibrary/utils/tabs/contents/search-tab.component';
|
||||
|
||||
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||
import {CommunityService} from '../openaireLibrary/connect/community/community.service';
|
||||
|
||||
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
@ -45,8 +43,7 @@ import {ErrorMessagesModule} from "../openaireLibrary/utils/errorMessages.module
|
|||
CommunityComponent
|
||||
],
|
||||
providers:[
|
||||
FreeGuard, PreviousRouteRecorder,
|
||||
PiwikService, CommunityService
|
||||
FreeGuard, PreviousRouteRecorder, PiwikService
|
||||
],
|
||||
exports: [
|
||||
CommunityComponent
|
||||
|
|
|
@ -3,7 +3,7 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/env-properti
|
|||
import {CuratorService} from "../openaireLibrary/connect/curators/curator.service";
|
||||
import {Curator} from "../openaireLibrary/utils/entities/CuratorInfo";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {CommunitiesService} from "../openaireLibrary/connect/communities/communities.service";
|
||||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
|
||||
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
|
||||
|
@ -13,6 +13,8 @@ import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
|
|||
import {PiwikHelper} from "../utils/piwikHelper";
|
||||
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
||||
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
||||
import {Subscription} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
@Component({
|
||||
selector: 'curators',
|
||||
|
@ -39,15 +41,16 @@ export class CuratorsComponent {
|
|||
public pageContents = null;
|
||||
public divContents = null;
|
||||
|
||||
public piwiksub: any;
|
||||
public url: string = null;
|
||||
public pageTitle: string = "Curators";
|
||||
|
||||
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'About - curators'}];
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor (private route: ActivatedRoute,
|
||||
private curatorsService: CuratorService,
|
||||
private communitiesService: CommunitiesService,
|
||||
private communityService: CommunityService,
|
||||
private _router: Router,
|
||||
private helper: HelperService,
|
||||
private _meta: Meta,
|
||||
|
@ -56,12 +59,11 @@ export class CuratorsComponent {
|
|||
private _piwikService: PiwikService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.showLoading = true;
|
||||
this.properties = data.envSpecific;
|
||||
this.properties = properties;
|
||||
if(this.longView) {
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe();
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
|
||||
}
|
||||
this.url = this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
|
@ -72,56 +74,55 @@ export class CuratorsComponent {
|
|||
this.downloadUrl = this.properties.utilsService + '/download/';
|
||||
if(!this.longView) {
|
||||
let emails = this.managers.join();
|
||||
this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
|
||||
this.subs.push(this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
|
||||
this.curators = curators;
|
||||
for(let i = 0; i < this.curators.length; i++) {
|
||||
this.showMore[i]= false;
|
||||
}
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
})
|
||||
}));
|
||||
} else {
|
||||
this.route.queryParams.subscribe(data => {
|
||||
this.subs.push(this.route.queryParams.subscribe(data => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = data['communityId'];
|
||||
}
|
||||
//this.getDivContents();
|
||||
this.getPageContents();
|
||||
this.communitiesService.getCommunities(this.properties,
|
||||
this.subs.push(this.communityService.getCommunityByState(this.properties,
|
||||
this.properties.communityAPI + this.communityId).subscribe(community => {
|
||||
this.managers = community[0].managers;
|
||||
this.managers = community.managers;
|
||||
let emails = this.managers.join();
|
||||
this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
|
||||
this.subs.push(this.curatorsService.getCurators(this.properties, emails).subscribe(curators => {
|
||||
this.curators = curators;
|
||||
for(let i = 0; i < this.curators.length; i++) {
|
||||
this.showMore[i]= false;
|
||||
}
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
});
|
||||
})
|
||||
});
|
||||
}));
|
||||
}));
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if(this.piwiksub) {
|
||||
this.piwiksub.unsubscribe();
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private getPageContents() {
|
||||
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
private getDivContents() {
|
||||
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
public toggle(index: number) {
|
||||
|
|
|
@ -9,6 +9,8 @@ import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommuni
|
|||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
|
||||
import {PiwikHelper} from "../utils/piwikHelper";
|
||||
import {Subscription} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
@Component({
|
||||
selector: 'openaire-deposit',
|
||||
|
@ -25,10 +27,11 @@ export class OpenaireDepositComponent {
|
|||
public divContents = null;
|
||||
public communityId = null;
|
||||
|
||||
|
||||
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
||||
fetchZenodoInformation: FetchZenodoInformation;
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor ( private route: ActivatedRoute,
|
||||
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private _communityService: CommunityService,
|
||||
|
@ -37,45 +40,46 @@ export class OpenaireDepositComponent {
|
|||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.properties = properties;
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if (!communityId) {
|
||||
communityId = params['communityId'];
|
||||
}
|
||||
if (communityId != null && communityId != '') {
|
||||
this.communityId = communityId;
|
||||
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe(
|
||||
community => {
|
||||
let masterZenodoCommunityId = community.zenodoCommunity;
|
||||
if (masterZenodoCommunityId) {
|
||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
|
||||
} else {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting community with id: " + communityId, error);
|
||||
}
|
||||
);
|
||||
}
|
||||
this.subs.push(this.route.queryParams.subscribe(params => {
|
||||
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if (!communityId) {
|
||||
communityId = params['communityId'];
|
||||
}
|
||||
if (communityId != null && communityId != '') {
|
||||
this.communityId = communityId;
|
||||
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
|
||||
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + communityId).subscribe(
|
||||
community => {
|
||||
let masterZenodoCommunityId = community.zenodoCommunity;
|
||||
if (masterZenodoCommunityId) {
|
||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
|
||||
} else {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting community with id: " + communityId, error);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
if (!this.zenodoInformation.shareInZenodoUrl) {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
}
|
||||
if (!this.zenodoInformation.name) {
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
if (!this.zenodoInformation.shareInZenodoUrl) {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
}
|
||||
if (!this.zenodoInformation.name) {
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
console.error("Deposit First Page: "+message, error);
|
||||
|
|
|
@ -12,7 +12,6 @@ import {DepositRoutingModule} from "./deposit-routing.module";
|
|||
import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module";
|
||||
|
||||
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
|
||||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
|
||||
|
||||
@NgModule({
|
||||
|
@ -27,6 +26,6 @@ import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoC
|
|||
OpenaireDepositComponent,
|
||||
],
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled,
|
||||
ZenodoCommunitiesService, CommunityService, SearchZenodoCommunitiesService]
|
||||
ZenodoCommunitiesService, SearchZenodoCommunitiesService]
|
||||
})
|
||||
export class LibDepositModule { }
|
||||
|
|
|
@ -11,6 +11,8 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s
|
|||
|
||||
import {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInformation.class';
|
||||
import {FetchZenodoInformation} from './utils/fetchZenodoInformation.class';
|
||||
import {Subscription} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
@Component({
|
||||
selector: 'openaire-search-deposit',
|
||||
|
@ -27,6 +29,8 @@ export class OpenaireSearchDataprovidersToDepositComponent {
|
|||
piwikSiteId = null;
|
||||
communityId: string = null;
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor ( private route: ActivatedRoute,
|
||||
private _ΖenodoCommunitieService: ZenodoCommunitiesService,
|
||||
private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) {
|
||||
|
@ -34,45 +38,48 @@ export class OpenaireSearchDataprovidersToDepositComponent {
|
|||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = params['communityId'];
|
||||
}
|
||||
this.properties = properties;
|
||||
this.subs.push(this.route.queryParams.subscribe(params => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = params['communityId'];
|
||||
}
|
||||
|
||||
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
|
||||
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
|
||||
|
||||
if(this.communityId) {
|
||||
if(this.communityId) {
|
||||
|
||||
if (this.communityId != '') {
|
||||
if (this.communityId != '') {
|
||||
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
|
||||
community => {
|
||||
let masterZenodoCommunityId = community.zenodoCommunity;
|
||||
if (masterZenodoCommunityId) {
|
||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
|
||||
} else {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
} },
|
||||
error => {
|
||||
this.handleError("Error getting community with id: "+this.communityId, error);
|
||||
}
|
||||
);
|
||||
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI+this.communityId).subscribe (
|
||||
community => {
|
||||
let masterZenodoCommunityId = community.zenodoCommunity;
|
||||
if (masterZenodoCommunityId) {
|
||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
|
||||
} else {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
} },
|
||||
error => {
|
||||
this.handleError("Error getting community with id: "+this.communityId, error);
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.zenodoInformation.shareInZenodoUrl) {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
}
|
||||
if (!this.zenodoInformation.name) {
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
}
|
||||
});
|
||||
});
|
||||
if (!this.zenodoInformation.shareInZenodoUrl) {
|
||||
this.zenodoInformation.url = this.properties.zenodo;
|
||||
}
|
||||
if (!this.zenodoInformation.name) {
|
||||
this.zenodoInformation.name = "Zenodo";
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
|
|
|
@ -12,8 +12,6 @@ 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,
|
||||
|
@ -27,6 +25,6 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s
|
|||
exports: [
|
||||
OpenaireSearchDataprovidersToDepositComponent,
|
||||
],
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService]
|
||||
providers: [FreeGuard,PreviousRouteRecorder, IsRouteEnabled]
|
||||
})
|
||||
export class LibSearchDataprovidersToDepositModule { }
|
||||
|
|
|
@ -17,6 +17,8 @@ import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service
|
|||
import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service";
|
||||
import {PiwikHelper} from "../../utils/piwikHelper";
|
||||
import {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
||||
import {properties} from "../../../environments/environment";
|
||||
import {Subscription} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'share-in-zenodo',
|
||||
|
@ -26,7 +28,6 @@ export class ShareInZenodoComponent {
|
|||
public url: string = null;
|
||||
public title: string = "Share in Zenodo";
|
||||
|
||||
piwiksub:any;
|
||||
public piwikSiteId = null;
|
||||
|
||||
properties: EnvProperties;
|
||||
|
@ -52,6 +53,9 @@ export class ShareInZenodoComponent {
|
|||
depositLearnHowPage: string = null;
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
breadcrumbs:Breadcrumb[] = [];
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
private _meta: Meta,
|
||||
|
@ -67,86 +71,88 @@ export class ShareInZenodoComponent {
|
|||
public ngOnInit() {
|
||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.url = data.envSpecific.baseLink + this._router.url;
|
||||
this.url = properties.baseLink + this._router.url;
|
||||
|
||||
this.seoService.createLinkForCanonicalURL(this.url, false);
|
||||
this.updateUrl(this.url);
|
||||
this.updateTitle(this.title);
|
||||
this.updateDescription("Zenodo, repository, deposit, share");
|
||||
this.seoService.createLinkForCanonicalURL(this.url, false);
|
||||
this.updateUrl(this.url);
|
||||
this.updateTitle(this.title);
|
||||
this.updateDescription("Zenodo, repository, deposit, share");
|
||||
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if (!this.communityId) {
|
||||
this.communityId = params['communityId'];
|
||||
}
|
||||
this.properties = properties;
|
||||
this.subs.push(this.route.queryParams.subscribe(params => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if (!this.communityId) {
|
||||
this.communityId = params['communityId'];
|
||||
}
|
||||
|
||||
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
|
||||
this.piwikSiteId = PiwikHelper.getSiteId(this.communityId,this.properties.environment);
|
||||
|
||||
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe();
|
||||
}
|
||||
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.title, this.piwikSiteId).subscribe());
|
||||
}
|
||||
|
||||
this.depositLearnHowPage = this.properties.depositLearnHowPage;
|
||||
this.breadcrumbs.push({name: 'home', route: '/'}, {name: "Deposit", route: this.depositLearnHowPage},{name:"Deposit in zenodo",route:null});
|
||||
this.depositLearnHowPage = this.properties.depositLearnHowPage;
|
||||
this.breadcrumbs.push({name: 'home', route: '/'}, {name: "Deposit", route: this.depositLearnHowPage},{name:"Deposit in zenodo",route:null});
|
||||
|
||||
//this.getDivContents();
|
||||
this.getPageContents();
|
||||
if (this.communityId && this.communityId != '') {
|
||||
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
this.community = community;
|
||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||
if (typeof document !== 'undefined') {
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
if (this.masterZenodoCommunityId) {
|
||||
this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
|
||||
result => {
|
||||
this.masterZenodoCommunity = result;
|
||||
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting Master Zenodo community with id: " + this.masterZenodoCommunityId, error);
|
||||
|
||||
//this.getDivContents();
|
||||
this.getPageContents();
|
||||
if (this.communityId && this.communityId != '') {
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
this.community = community;
|
||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||
if (typeof document !== 'undefined') {
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
if (this.masterZenodoCommunityId) {
|
||||
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe(
|
||||
result => {
|
||||
this.masterZenodoCommunity = result;
|
||||
));
|
||||
}
|
||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
},
|
||||
error => {
|
||||
this.handleError("Error getting Master Zenodo community with id: " + this.masterZenodoCommunityId, error);
|
||||
|
||||
}
|
||||
);
|
||||
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
||||
result => {
|
||||
this.CommunityIds = result;
|
||||
this.zenodoSearchUtils.totalResults = this.CommunityIds.length;
|
||||
if (this.CommunityIds.length == 0) {
|
||||
this.zenodoSearchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
for (let i = 0; i < this.CommunityIds.length; i++) {
|
||||
this.getZenodoCommunityById(this.CommunityIds[i]["zenodoid"], this.CommunityIds[i]["id"]);
|
||||
}
|
||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
||||
result => {
|
||||
this.CommunityIds = result;
|
||||
this.zenodoSearchUtils.totalResults = this.CommunityIds.length;
|
||||
if (this.CommunityIds.length == 0) {
|
||||
this.zenodoSearchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
for (let i = 0; i < this.CommunityIds.length; i++) {
|
||||
this.getZenodoCommunityById(this.CommunityIds[i]["zenodoid"], this.CommunityIds[i]["id"]);
|
||||
}
|
||||
|
||||
},
|
||||
error => {
|
||||
//console.error("list of zenodo communities couldn't be loaded");
|
||||
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
||||
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
|
||||
} //this.handleError('System error retrieving community profile', error)
|
||||
);
|
||||
|
||||
},
|
||||
error => {
|
||||
//console.error("Community couldn't be loaded");
|
||||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
//console.error("list of zenodo communities couldn't be loaded");
|
||||
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
||||
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
} //this.handleError('System error retrieving community profile', error)
|
||||
));
|
||||
|
||||
},
|
||||
error => {
|
||||
//console.error("Community couldn't be loaded");
|
||||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
|
||||
}
|
||||
});
|
||||
});
|
||||
));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private updateDescription(description: string) {
|
||||
this._meta.updateTag({content: description}, "name='description'");
|
||||
|
@ -164,19 +170,19 @@ export class ShareInZenodoComponent {
|
|||
}
|
||||
|
||||
private getPageContents() {
|
||||
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
private getDivContents() {
|
||||
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
getZenodoCommunityById(zenodoid, openaireId) {
|
||||
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
|
||||
this.subs.push(this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
|
||||
result => {
|
||||
this.communities.push(result);
|
||||
this.zenodocommunitiesloadedCount++;
|
||||
|
@ -200,7 +206,7 @@ export class ShareInZenodoComponent {
|
|||
this.handleError("Error getting Zenodo community with id: " + zenodoid + " and openaire id: " + openaireId, error);
|
||||
|
||||
}
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
private handleError(message: string, error) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import {ShareInZenodoRoutingModule} from './shareInZenodo-routing.module';
|
|||
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';
|
||||
import {RouterModule} from "@angular/router";
|
||||
import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module";
|
||||
import {PiwikServiceModule} from "../../openaireLibrary/utils/piwik/piwikService.module";
|
||||
|
@ -27,7 +26,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr
|
|||
declarations: [
|
||||
ShareInZenodoComponent
|
||||
],
|
||||
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled, CommunityService],
|
||||
providers:[FreeGuard,PreviousRouteRecorder, IsRouteEnabled],
|
||||
exports: [
|
||||
ShareInZenodoComponent
|
||||
]
|
||||
|
|
|
@ -18,6 +18,8 @@ import {PiwikHelper} from '../utils/piwikHelper';
|
|||
import {CommunityCharts} from "../openaireLibrary/connect/statistics/communityCharts";
|
||||
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||
import {Subscription} from "rxjs";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -26,7 +28,6 @@ import {CommunityService} from "../openaireLibrary/connect/community/community.s
|
|||
})
|
||||
|
||||
export class StatisticsComponent {
|
||||
public piwiksub: any;
|
||||
public pageTitle = "OpenAIRE";
|
||||
properties: EnvProperties;
|
||||
@Input() communityId = null;
|
||||
|
@ -58,6 +59,8 @@ export class StatisticsComponent {
|
|||
status = null;
|
||||
communityName = null;
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
|
@ -83,44 +86,40 @@ export class StatisticsComponent {
|
|||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
this._meta.updateTag({content: title}, "property='og:title'");
|
||||
}
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
var url = data.envSpecific.baseLink + this._router.url;
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
|
||||
this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = communityId['communityId'];
|
||||
this.properties = properties;
|
||||
var url = properties.baseLink + this._router.url;
|
||||
this._meta.updateTag({content: url}, "property='og:url'");
|
||||
|
||||
this.subs.push(this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = communityId['communityId'];
|
||||
}
|
||||
|
||||
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, "Monitor " + this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe());
|
||||
}
|
||||
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
if (typeof document !== 'undefined') {
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
this.communityName = community.shortTitle;
|
||||
this.createStatisticsObjects();
|
||||
this.createChartUrlMap();
|
||||
}));
|
||||
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
|
||||
|
||||
if (this.currentMode == "showInMonitor" && this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, "Monitor " + this.communityId, PiwikHelper.siteIDs[this.communityId]).subscribe();
|
||||
}
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
if (typeof document !== 'undefined') {
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
this.communityName = community.shortTitle;
|
||||
this.createStatisticsObjects();
|
||||
this.createChartUrlMap();
|
||||
});
|
||||
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
|
||||
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ngOnDestroy() {
|
||||
if (this.piwiksub) {
|
||||
this.piwiksub.unsubscribe();
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getCamelCaseString(inputString: string) {
|
||||
|
@ -130,7 +129,7 @@ export class StatisticsComponent {
|
|||
createStatisticsObjects() {
|
||||
// console.log(" Stats! "+ this.properties.statisticsAPIURL);
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this._statisticsService.getCommunityStatistics(this.properties, this.communityId).subscribe(
|
||||
this.subs.push(this._statisticsService.getCommunityStatistics(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
if(res) {
|
||||
this.statisticsSum = res;
|
||||
|
@ -147,11 +146,11 @@ export class StatisticsComponent {
|
|||
//console.log(error);
|
||||
this.handleError("Error getting community statistics for community with id: " + this.communityId, error);
|
||||
this.status = this.errorCodes.ERROR;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
getDisplayOptions() {
|
||||
this._statisticsService.getCommunityAdminStatisticsChoices(this.properties, this.communityId)
|
||||
this.subs.push(this._statisticsService.getCommunityAdminStatisticsChoices(this.properties, this.communityId)
|
||||
.subscribe(
|
||||
res => {
|
||||
this.statisticsDisplay = res;
|
||||
|
@ -165,13 +164,13 @@ export class StatisticsComponent {
|
|||
this.handleError("Error getting community statistics choices by administrators for community with id: " + this.communityId, error);
|
||||
this.status = this.errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
getCommunityInfo() {
|
||||
// console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
|
||||
this._configService.getCommunityInformation(this.properties, this.communityId).subscribe(
|
||||
this.subs.push(this._configService.communityInformationState.subscribe(
|
||||
res => {
|
||||
this.communityInfo = res;
|
||||
/*for(let i=0; i<this.communityInfo.entities.length; i++){
|
||||
|
@ -187,7 +186,7 @@ export class StatisticsComponent {
|
|||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
},
|
||||
() => this.initializeDisplayedCharts()
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
initializeDisplayedCharts() {
|
||||
|
|
|
@ -11,6 +11,8 @@ import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
|
|||
import {PiwikHelper} from "../utils/piwikHelper";
|
||||
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
||||
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {Subscription} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'subjects',
|
||||
|
@ -65,12 +67,13 @@ export class SubjectsComponent {
|
|||
public pageContents = null;
|
||||
public divContents = null;
|
||||
|
||||
public piwiksub: any;
|
||||
public url: string = null;
|
||||
public pageTitle: string = "Subjects";
|
||||
|
||||
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'about - subjects'}];
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor (private route: ActivatedRoute,
|
||||
private communityService: CommunityService,
|
||||
private _router: Router,
|
||||
|
@ -81,33 +84,31 @@ export class SubjectsComponent {
|
|||
private _piwikService: PiwikService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.showLoading = true;
|
||||
this.properties = data.envSpecific;
|
||||
this.showLoading = true;
|
||||
this.properties = properties;
|
||||
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe();
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
|
||||
}
|
||||
this.url = this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
this.updateUrl(this.url);
|
||||
this.updateTitle(this.pageTitle);
|
||||
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
|
||||
|
||||
this.subs.push(this.route.queryParams.subscribe(data => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = data['communityId'];
|
||||
}
|
||||
this.url = this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
this.updateUrl(this.url);
|
||||
this.updateTitle(this.pageTitle);
|
||||
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
|
||||
|
||||
this.route.queryParams.subscribe(data => {
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
if(!this.communityId) {
|
||||
this.communityId = data['communityId'];
|
||||
}
|
||||
//this.getDivContents();
|
||||
this.getPageContents();
|
||||
this.communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(community => {
|
||||
this.subjects = community.subjects;
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
});
|
||||
});
|
||||
});
|
||||
//this.getDivContents();
|
||||
this.getPageContents();
|
||||
this.subs.push(this.communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(community => {
|
||||
this.subjects = community.subjects;
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
createParams(param) {
|
||||
|
@ -115,21 +116,21 @@ export class SubjectsComponent {
|
|||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if(this.piwiksub) {
|
||||
this.piwiksub.unsubscribe();
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private getPageContents() {
|
||||
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
private getDivContents() {
|
||||
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
private updateDescription(description: string) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import { RouterModule } from '@angular/router';
|
|||
|
||||
import {SubjectsComponent} from './subjects.component';
|
||||
import {SubjectsRoutingModule} from "./subjects-routing.module";
|
||||
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||
import {HelperModule} from "../openaireLibrary/utils/helper/helper.module";
|
||||
import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
|
||||
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module";
|
||||
|
@ -22,7 +21,7 @@ import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumb
|
|||
declarations: [
|
||||
SubjectsComponent
|
||||
],
|
||||
providers: [CommunityService],
|
||||
providers: [],
|
||||
exports: [
|
||||
SubjectsComponent
|
||||
]
|
||||
|
|
|
@ -23,6 +23,8 @@ import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
|
|||
import {PiwikHelper} from "../../piwikHelper";
|
||||
import {UserManagementService} from "../../../openaireLibrary/services/user-management.service";
|
||||
import {Breadcrumb} from "../../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
||||
import {Subscription} from "rxjs";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
|
||||
@Component({
|
||||
selector: 'invite',
|
||||
|
@ -69,11 +71,12 @@ export class InviteComponent implements OnInit {
|
|||
|
||||
public url: string = null;
|
||||
public pageTitle: string = "Invite";
|
||||
piwiksub: any;
|
||||
private user: User;
|
||||
|
||||
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'invite'}];
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
|
@ -93,36 +96,34 @@ export class InviteComponent implements OnInit {
|
|||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
if(!this.properties) {
|
||||
this.properties = data.envSpecific;
|
||||
}
|
||||
if(this.properties) {
|
||||
this.errorMessage = "";
|
||||
this.missingCommunityId = "";
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.userManageService.getUserInfo().subscribe(
|
||||
user => {
|
||||
this.user = user;
|
||||
this.init();
|
||||
},
|
||||
error => {
|
||||
this.init();
|
||||
}
|
||||
);
|
||||
//this.init();
|
||||
}
|
||||
});
|
||||
if(!this.properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
if(this.properties) {
|
||||
this.errorMessage = "";
|
||||
this.missingCommunityId = "";
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.subs.push(this.userManageService.getUserInfo().subscribe(
|
||||
user => {
|
||||
this.user = user;
|
||||
this.init();
|
||||
},
|
||||
error => {
|
||||
this.init();
|
||||
}
|
||||
));
|
||||
//this.init();
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.piwiksub) {
|
||||
this.piwiksub.unsubscribe();
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private init() {
|
||||
this.route.queryParams.subscribe(
|
||||
this.subs.push(this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
//if(!this.communityId && typeof document !== 'undefined'){
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||
|
@ -132,7 +133,7 @@ export class InviteComponent implements OnInit {
|
|||
|
||||
if (this.longView) {
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe();
|
||||
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
|
||||
}
|
||||
this.url = this.properties.baseLink + this._router.url;
|
||||
this.seoService.createLinkForCanonicalURL(this.url);
|
||||
|
@ -144,7 +145,7 @@ export class InviteComponent implements OnInit {
|
|||
if (this.communityId != null && this.communityId != '') {
|
||||
//this.getDivContents();
|
||||
this.getPageContents();
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
this.community = community;
|
||||
this.fullname = (this.user) ? this.user.fullname : null;
|
||||
|
@ -161,26 +162,26 @@ export class InviteComponent implements OnInit {
|
|||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
this.status = this.errorMessages.getErrorCode(error.status);
|
||||
}
|
||||
);
|
||||
));
|
||||
} else {
|
||||
this.status = this.errorCodes.DONE;
|
||||
this.missingCommunityId = "There is no community selected!";
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
|
||||
private getPageContents() {
|
||||
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
private getDivContents() {
|
||||
this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||
this.divContents = contents;
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,7 +195,7 @@ export class InviteComponent implements OnInit {
|
|||
if (this.validateEmails()) {
|
||||
this.composeEmail();
|
||||
|
||||
this._emailService.sendEmail(this.properties, this.email).subscribe(
|
||||
this.subs.push(this._emailService.sendEmail(this.properties, this.email).subscribe(
|
||||
res => {
|
||||
this.status = this.errorCodes.DONE;
|
||||
//console.log("Emails Sent: ",res);
|
||||
|
@ -225,7 +226,7 @@ export class InviteComponent implements OnInit {
|
|||
this.status = this.errorCodes.DONE;
|
||||
this.inviteErrorMessage = "There was an error sending emails. Please try again.";
|
||||
}
|
||||
);
|
||||
));
|
||||
} else {
|
||||
this.email.recipients = [];
|
||||
this.status = this.errorCodes.DONE;
|
||||
|
|
|
@ -1,45 +1,11 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {CKEditorModule} from 'ng2-ckeditor';
|
||||
|
||||
import {InviteComponent} from './invite.component';
|
||||
import {InviteRoutingModule} from './invite-routing.module';
|
||||
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
import {LoginGuard} from '../../../openaireLibrary/login/loginGuard.guard';
|
||||
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
|
||||
import {CommunityService} from '../../../openaireLibrary/connect/community/community.service';
|
||||
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module';
|
||||
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard";
|
||||
import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module";
|
||||
import {Schema2jsonldModule} from "../../../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
|
||||
import {SEOServiceModule} from "../../../openaireLibrary/sharedComponents/SEO/SEOService.module";
|
||||
import {PiwikService} from "../../../openaireLibrary/utils/piwik/piwik.service";
|
||||
import {InviteBasicModule} from "./inviteBasic.module";
|
||||
|
||||
@NgModule({
|
||||
// imports: [
|
||||
// //CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule, ErrorMessagesModule,
|
||||
// RouterModule, CommonModule, FormsModule, CKEditorModule, ErrorMessagesModule,
|
||||
// //InviteRoutingModule,
|
||||
// HelperModule, Schema2jsonldModule, SEOServiceModule
|
||||
// ],
|
||||
// declarations: [
|
||||
// InviteComponent
|
||||
// ],
|
||||
// providers: [
|
||||
// //LoginGuard,
|
||||
// PreviousRouteRecorder,
|
||||
// EmailService, CommunityService, IsRouteEnabled,
|
||||
// PiwikService
|
||||
// ],
|
||||
// exports: [
|
||||
// InviteComponent
|
||||
// ]
|
||||
|
||||
imports: [InviteBasicModule, InviteRoutingModule],
|
||||
providers: [LoginGuard]
|
||||
})
|
||||
|
|
|
@ -9,7 +9,6 @@ import {InviteComponent} from './invite.component';
|
|||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
|
||||
import {CommunityService} from '../../../openaireLibrary/connect/community/community.service';
|
||||
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module';
|
||||
import {IsRouteEnabled} from "../../../openaireLibrary/error/isRouteEnabled.guard";
|
||||
import {HelperModule} from "../../../openaireLibrary/utils/helper/helper.module";
|
||||
|
@ -28,7 +27,7 @@ import {BreadcrumbsModule} from "../../../openaireLibrary/utils/breadcrumbs/brea
|
|||
],
|
||||
providers: [
|
||||
PreviousRouteRecorder,
|
||||
EmailService, CommunityService, IsRouteEnabled,
|
||||
EmailService, IsRouteEnabled,
|
||||
PiwikService
|
||||
],
|
||||
exports: [
|
||||
|
|
|
@ -12,6 +12,8 @@ import {Email} from "../../openaireLibrary/utils/email/email";
|
|||
import {Composer} from "../../openaireLibrary/utils/email/composer";
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
|
||||
import {Subscription} from "rxjs";
|
||||
import {properties} from "../../../environments/environment";
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
|
@ -73,6 +75,8 @@ export class SubscribeComponent {
|
|||
@ViewChild(AlertModal) alert;
|
||||
private user: User;
|
||||
|
||||
subs: Subscription[] = [];
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _subscribeService: SubscribeService,
|
||||
private _emailService: EmailService,
|
||||
|
@ -82,30 +86,34 @@ export class SubscribeComponent {
|
|||
) {}
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
if(!this.properties) {
|
||||
this.properties = data.envSpecific;
|
||||
}
|
||||
if(!this.showNumbers) {
|
||||
this.userManagementService.getUserInfo().subscribe(
|
||||
user => {
|
||||
this.user = user;
|
||||
this.init();
|
||||
},
|
||||
error => {},
|
||||
() => {
|
||||
this.init();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
});
|
||||
if(!this.properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
if(!this.showNumbers) {
|
||||
this.subs.push(this.userManagementService.getUserInfo().subscribe(
|
||||
user => {
|
||||
this.user = user;
|
||||
this.init();
|
||||
},
|
||||
error => {},
|
||||
() => {
|
||||
this.init();
|
||||
}
|
||||
));
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
//this.init();
|
||||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
for (let sub of this.subs) {
|
||||
sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
private isSubscribed() {
|
||||
this._subscribeService.isSubscribed.subscribe(
|
||||
this.subs.push(this._subscribeService.isSubscribed.subscribe(
|
||||
res => {
|
||||
this.subscribed = res;
|
||||
if (this.subscribed) {
|
||||
|
@ -114,7 +122,7 @@ export class SubscribeComponent {
|
|||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
private init() {
|
||||
|
@ -143,7 +151,7 @@ export class SubscribeComponent {
|
|||
}
|
||||
} else {
|
||||
if (this.communityId) {
|
||||
this._subscribeService.getNumberOfCommunitySubscribers(this.properties, this.communityId).subscribe(
|
||||
this.subs.push(this._subscribeService.getNumberOfCommunitySubscribers(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
this.subscribers = (res && res.value) ? res.value : 0;//(res && res.subscribers && res.subscribers.length) ? res.subscribers.length : 0;
|
||||
this.countSubscribersEvent.emit({
|
||||
|
@ -152,13 +160,13 @@ export class SubscribeComponent {
|
|||
},
|
||||
error => {
|
||||
this.handleError("Error getting community subscribers for community with id: " + this.communityId, error);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
if (this.communityId) {
|
||||
this.emailToInformManagers = {body: "", subject: "", recipients: []};
|
||||
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
this.subs.push(this._communityService.getCommunityByState(this.properties, this.properties.communityAPI + this.communityId).subscribe(
|
||||
community => {
|
||||
this.community = community;
|
||||
},
|
||||
|
@ -166,7 +174,7 @@ export class SubscribeComponent {
|
|||
//console.log('System error retrieving community profile', error)
|
||||
this.handleError("Error getting community with id: " + this.communityId, error);
|
||||
}
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,7 +192,7 @@ export class SubscribeComponent {
|
|||
} else {
|
||||
this.loading = true;
|
||||
this.showLoginAlert = false;
|
||||
this._subscribeService.subscribeToCommunity(this.properties, this.communityId).subscribe(
|
||||
this.subs.push(this._subscribeService.subscribeToCommunity(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
this.loading = false;
|
||||
if (res.status && res.status != 200) {
|
||||
|
@ -203,7 +211,7 @@ export class SubscribeComponent {
|
|||
this.subscribeEvent.emit({
|
||||
value: "ok"
|
||||
});
|
||||
this._emailService.notifyForNewManagers(this.properties, this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers,
|
||||
this.subs.push(this._emailService.notifyForNewManagers(this.properties, this.communityId, Composer.composeEmailToInformManagers(this.community.title, this.communityId, this.community.managers,
|
||||
email, this.properties.adminPortalURL)).subscribe(
|
||||
res => {
|
||||
//console.log("The email has been sent successfully!")
|
||||
|
@ -212,7 +220,7 @@ export class SubscribeComponent {
|
|||
//console.log(error)
|
||||
this.handleError("Error notifying managers about new subscribers for community with id: " + this.communityId, error);
|
||||
}
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -229,7 +237,7 @@ export class SubscribeComponent {
|
|||
});
|
||||
//console.log(error)
|
||||
this.handleError("Error subscribing email: " + email + " to community with id: " + this.communityId, error);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +248,7 @@ export class SubscribeComponent {
|
|||
} else {
|
||||
this.loading = true;
|
||||
//this.properties.adminToolsAPIURL
|
||||
this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId).subscribe(
|
||||
this.subs.push(this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId).subscribe(
|
||||
res => {
|
||||
this.loading = false;
|
||||
if (res.status && res.status != 200) {
|
||||
|
@ -267,7 +275,7 @@ export class SubscribeComponent {
|
|||
});
|
||||
//console.log(error)
|
||||
this.handleError("Error unsubscribing email: " + email + " from community with id: " + this.communityId, error);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,6 @@ import {ModuleWithProviders, NgModule} from '@angular/core';
|
|||
import {CommonModule} from '@angular/common';
|
||||
import {RouterModule} from '@angular/router';
|
||||
|
||||
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service';
|
||||
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
|
||||
|
||||
import {EmailService} from "../../openaireLibrary/utils/email/email.service";
|
||||
import {SubscribeComponent} from './subscribe.component';
|
||||
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
|
||||
|
@ -25,7 +22,7 @@ export class SubscribeModule {
|
|||
return {
|
||||
ngModule: SubscribeModule,
|
||||
providers: [
|
||||
/*SubscribeService,*/ EmailService, CommunityService
|
||||
EmailService
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue