diff --git a/src/app/pages/community/community-edit-form/community-edit-form.component.ts b/src/app/pages/community/community-edit-form/community-edit-form.component.ts index a203084..03b3747 100644 --- a/src/app/pages/community/community-edit-form/community-edit-form.component.ts +++ b/src/app/pages/community/community-edit-form/community-edit-form.component.ts @@ -166,9 +166,7 @@ export class CommunityEditFormComponent implements OnInit{ this.sendMailToNewManagers(newManagers); this.informOldManagersForTheNewOnes(); for (let i = 0; i < newManagers.length; i++) { - this._subscribeService.subscribeToCommunity( - this.communityId, newManagers[i], this.properties.adminToolsAPIURL). - subscribe( + this._subscribeService.subscribeToCommunity(this.properties, this.communityId, newManagers[i]).subscribe( res => { // console.log(res); } diff --git a/src/app/pages/curator/curator.component.ts b/src/app/pages/curator/curator.component.ts index fb040e8..a522dd9 100644 --- a/src/app/pages/curator/curator.component.ts +++ b/src/app/pages/curator/curator.component.ts @@ -72,8 +72,7 @@ export class CuratorComponent implements OnInit { this.userManagementService.getUserInfo().subscribe(user => { this.user = user; this.curatorId = this.user.id; - this.curatorService.getCurator(this.properties, - this.properties.adminToolsAPIURL + 'curator/' + this.curatorId).subscribe( + this.curatorService.getCurator(this.properties, this.curatorId).subscribe( curator => { if (curator && Object.keys(curator).length > 0) { this.curator = curator; @@ -120,8 +119,7 @@ export class CuratorComponent implements OnInit { if (this.curatorId != null && this.curatorId !== '') { this.showLoading = true; this.updateErrorMessage = ''; - this.curatorService.getCurator(this.properties, - this.properties.adminToolsAPIURL + 'curator/' + this.curatorId).subscribe( + this.curatorService.getCurator(this.properties, this.curatorId).subscribe( curator => { if (curator) { this.curator = curator; @@ -238,8 +236,7 @@ export class CuratorComponent implements OnInit { this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe(); } this.curator.photo = res.filename; - this.curatorService.updateCurator(this.properties.adminToolsAPIURL + 'curator', - this.curator).subscribe((curator) => { + this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => { if (curator) { this.handleSuccessfulSave('Your data has been saved successfully!'); this.newCurator = false; @@ -259,8 +256,7 @@ export class CuratorComponent implements OnInit { this.utilitiesService.deletePhoto(this.properties.utilsService + '/delete/' + this.curator.photo).subscribe(); this.curator.photo = ''; } - this.curatorService.updateCurator(this.properties.adminToolsAPIURL + 'curator', - this.curator).subscribe((curator) => { + this.curatorService.updateCurator(this.properties, this.curator).subscribe((curator) => { if (curator) { this.handleSuccessfulSave('Your data has been saved successfully!'); this.resetChange(); diff --git a/src/app/pages/customization/customization.component.ts b/src/app/pages/customization/customization.component.ts index 9764447..4876438 100644 --- a/src/app/pages/customization/customization.component.ts +++ b/src/app/pages/customization/customization.component.ts @@ -67,7 +67,7 @@ export class CustomizationComponent implements OnInit { this.showLoading = true; this.errorMessage = ''; this.successfulSaveMessage = ''; - this.layoutService.getLayout(this.communityId, this.properties.adminToolsAPIURL + 'community/').subscribe(layout => { + this.layoutService.getLayout(this.properties, this.communityId).subscribe(layout => { this.publishedCustomizationOptions = (layout?layout:new CustomizationOptions()); this.initializeCustomizationOptions(true); }, error => { @@ -89,7 +89,7 @@ export class CustomizationComponent implements OnInit { queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} }); } - this.layoutService.saveLayout(this.communityId, this.properties.adminToolsAPIURL + 'community/', this.draftCustomizationOptions).subscribe(layout => { + this.layoutService.saveLayout(this.properties, this.communityId, this.draftCustomizationOptions).subscribe(layout => { this.publishedCustomizationOptions = layout; this.initializeCustomizationOptions(JSON.stringify(this.publishedCustomizationOptions) != this.previewCustomization); this.successfulSaveMessage = "Customization Options saved!" diff --git a/src/app/pages/subscribers/manage-subscribers.component.ts b/src/app/pages/subscribers/manage-subscribers.component.ts index d59737a..a209329 100644 --- a/src/app/pages/subscribers/manage-subscribers.component.ts +++ b/src/app/pages/subscribers/manage-subscribers.component.ts @@ -229,7 +229,7 @@ export class ManageSubscribersComponent implements OnInit { if(!Session.isLoggedIn()){ this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); } else { - this.subRemove = this._subscribeService.unSubscribeToCommunity(this.communityId, this.selectedSubscriberEmail, this.properties.adminToolsAPIURL).subscribe( + this.subRemove = this._subscribeService.unSubscribeToCommunity(this.properties, this.communityId, this.selectedSubscriberEmail).subscribe( result => { this.communitySubscribers = result; }, diff --git a/src/app/pages/usernotifications/manage-user-notifications.component.ts b/src/app/pages/usernotifications/manage-user-notifications.component.ts index 6039517..9ccb4be 100644 --- a/src/app/pages/usernotifications/manage-user-notifications.component.ts +++ b/src/app/pages/usernotifications/manage-user-notifications.component.ts @@ -67,8 +67,7 @@ export class ManageUserNotificationsComponent implements OnInit { this.user = user; if (this.user) { this.userEmail = this.user.email; - this._manageUserNotificationsService.getUserNotifications( - this.properties.adminToolsAPIURL + 'community/' + this.communityId + '/notifications', this.userEmail).subscribe( + this._manageUserNotificationsService.getUserNotifications(this.properties, this.communityId, this.userEmail).subscribe( userNotifications => { this.initialUserNotifications = userNotifications; if (this.initialUserNotifications['notifyForNewManagers'] == null || @@ -120,9 +119,7 @@ export class ManageUserNotificationsComponent implements OnInit { this.successfulSaveMessage = ''; this.showLoading = true; const userNotifications = this.parseUpdatedUserNotifications(); - this._manageUserNotificationsService.updateUserNotifications( - this.properties.adminToolsAPIURL + 'community/' + this.communityId + '/notifications', - userNotifications).subscribe( + this._manageUserNotificationsService.updateUserNotifications(this.properties, this.communityId, userNotifications).subscribe( userNotifications => { this.initialUserNotifications = JSON.parse(JSON.stringify(this.userNotifications)); this.handleSuccessfulSave('Notification settings saved!'); diff --git a/src/app/pages/usernotifications/manage-user-notifications.service.ts b/src/app/pages/usernotifications/manage-user-notifications.service.ts index 3d1c12b..52ee09b 100644 --- a/src/app/pages/usernotifications/manage-user-notifications.service.ts +++ b/src/app/pages/usernotifications/manage-user-notifications.service.ts @@ -12,16 +12,17 @@ export class ManageUserNotificationsService { constructor(private http: HttpClient) { } - getUserNotifications(url: string, email: string) { + getUserNotifications(properties: EnvProperties, pid: string, email: string) { + let url: string = properties.adminToolsAPIURL + 'community/'+ pid + '/notifications'; return this.http.get(url)//.map(res => res.json()) .pipe(map(res => this.parseUserNotifications(res, email))); } - updateUserNotifications(url: string, userNotificationsRights: any) { + updateUserNotifications(properties: EnvProperties, pid: string, userNotificationsRights: any) { //let headers = new Headers({'Content-Type': 'application/json'}); //let options = new RequestOptions({headers: headers}); let body = JSON.stringify(userNotificationsRights); - + let url: string = properties.adminToolsAPIURL + 'community/' + pid + '/notifications'; return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody()); //.do(request => console.log("Insert Response:"+request.status)); } diff --git a/src/app/services/manageContentProviders.service.ts b/src/app/services/manageContentProviders.service.ts index 8fe69b0..d1f9aec 100644 --- a/src/app/services/manageContentProviders.service.ts +++ b/src/app/services/manageContentProviders.service.ts @@ -9,15 +9,15 @@ export class ManageCommunityContentProvidersService { constructor(private http: HttpClient) { } - removeContentProvider(properties: EnvProperties, communityId: string, id: string): any { + removeContentProvider(properties: EnvProperties, pid: string, id: string): any { let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); - let url = properties.communityAPI + communityId + '/contentproviders'; + let url = properties.communityAPI + pid + '/contentproviders'; return this.http.request('delete', url, {body: id, headers: headers}); } - addContentProvider(properties: EnvProperties, communityId: string, contentProvider: any): Observable { - let url = properties.communityAPI + communityId + '/contentproviders'; - let communityContentProvider = this.convertSearchContentProviderToCommunityContentProvider(contentProvider, communityId); + addContentProvider(properties: EnvProperties, pid: string, contentProvider: any): Observable { + let url = properties.communityAPI + pid + '/contentproviders'; + let communityContentProvider = this.convertSearchContentProviderToCommunityContentProvider(contentProvider, pid); return this.http.post(url, communityContentProvider); } diff --git a/src/app/services/manageProjects.service.ts b/src/app/services/manageProjects.service.ts index e4d504e..6f99db7 100644 --- a/src/app/services/manageProjects.service.ts +++ b/src/app/services/manageProjects.service.ts @@ -6,26 +6,26 @@ import {HttpClient, HttpHeaders} from '@angular/common/http'; export class ManageCommunityProjectsService { constructor(private http: HttpClient ) {} - removeProject (properties:EnvProperties, communityId: string, id: string):any { + removeProject (properties:EnvProperties, pid: string, id: string):any { //let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'}); //let options = new RequestOptions({headers: headers, body: id}); let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); - let url = properties.communityAPI+communityId+"/projects"; + let url = properties.communityAPI+pid+"/projects"; //return this.http.delete(url, options) return this.http.request('delete', url, { body: id, headers: headers}) } - addProject(properties:EnvProperties, communityId: string, project: any) { + addProject(properties:EnvProperties, pid: string, project: any) { //let headers = new Headers({'Content-Type': 'application/json'}); //let options = new RequestOptions({headers: headers}); let headers = new HttpHeaders({'Content-Type': 'application/json'}); - let url = properties.communityAPI+communityId+"/projects"; + let url = properties.communityAPI+pid+"/projects"; - let communityProject = this.convertSearchProjectToCommunityProject(project, communityId); + let communityProject = this.convertSearchProjectToCommunityProject(project, pid); let testProject: any = { "acronym": "test", "communityId": "egi", diff --git a/src/app/services/manageZenodoCommunities.service.ts b/src/app/services/manageZenodoCommunities.service.ts index 3257313..0cdd3a0 100644 --- a/src/app/services/manageZenodoCommunities.service.ts +++ b/src/app/services/manageZenodoCommunities.service.ts @@ -6,26 +6,26 @@ import{EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; export class ManageZenodoCommunitiesService { constructor(private http: HttpClient ) {} - removeZCommunity (properties: EnvProperties, communityId: string,id: string):any { + removeZCommunity (properties: EnvProperties, pid: string,id: string):any { //let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'}); //let options = new RequestOptions({headers: headers, body: id}); let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); - let url = properties.communityAPI + communityId + "/zenodocommunities"; + let url = properties.communityAPI + pid + "/zenodocommunities"; //return this.http.delete(url, options); return this.http.request('delete', url, { body: id, headers: headers}) } - addZCommunity(properties:EnvProperties, communityId: string,zenodoid: string) { + addZCommunity(properties:EnvProperties, pid: string,zenodoid: string) { //let headers = new Headers({'Content-Type': 'application/json'}); //let options = new RequestOptions({headers: headers}); let headers = new HttpHeaders({'Content-Type': 'application/json'}); - let url = properties.communityAPI+communityId+"/zenodocommunities"; + let url = properties.communityAPI+pid+"/zenodocommunities"; var zCommunity: any = { - "communityId": communityId, + "communityId": pid, "zenodoid": zenodoid };