diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 2dce8f3..1f0d947 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -314,11 +314,13 @@ export class AppComponent implements OnInit{
'/pageContents', false, [], [], {communityId: this.communityId}),
items: []
});
- help.items.push({
- rootItem: new MenuItem('classes', 'Class Help Texts', '/classContents',
- '/classContents', false, [], [], {communityId: this.communityId}),
- items: []
- });
+ if (this.communityId === 'openaire' || this.communityId === 'connect') {
+ help.items.push({
+ rootItem: new MenuItem('classes', 'Class Help Texts', '/classContents',
+ '/classContents', false, [], [], {communityId: this.communityId}),
+ items: []
+ });
+ }
this.sideMenuItems.push(help);
if (this.communityId !== 'openaire' && this.communityId !== 'connect') {
const stats: SideMenuItem = {
diff --git a/src/app/pages/divhelpcontent/div-help-content-form.component.html b/src/app/pages/divhelpcontent/div-help-content-form.component.html
index 0bcda21..618a90e 100644
--- a/src/app/pages/divhelpcontent/div-help-content-form.component.html
+++ b/src/app/pages/divhelpcontent/div-help-content-form.component.html
@@ -13,17 +13,21 @@
diff --git a/src/app/pages/divhelpcontent/div-help-content-form.component.ts b/src/app/pages/divhelpcontent/div-help-content-form.component.ts
index cb8e54e..2fdca83 100644
--- a/src/app/pages/divhelpcontent/div-help-content-form.component.ts
+++ b/src/app/pages/divhelpcontent/div-help-content-form.component.ts
@@ -113,10 +113,10 @@ export class DivContentFormComponent implements OnInit{
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
- this.showLoading = true;
+ //this.showLoading = true;
this.errorMessage = '';
- this._helpContentService.getDivIdsFull(pageId, this.properties.adminToolsAPIURL).subscribe(
+ this._helpContentService.getDivIdsFull(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
divs => {
this.availableDivs = divs;
this.pageId = pageId;
diff --git a/src/app/pages/divhelpcontent/div-help-contents.component.html b/src/app/pages/divhelpcontent/div-help-contents.component.html
index 88b9603..ee85b5f 100644
--- a/src/app/pages/divhelpcontent/div-help-contents.component.html
+++ b/src/app/pages/divhelpcontent/div-help-contents.component.html
@@ -2,8 +2,8 @@
diff --git a/src/app/pages/divhelpcontent/edit-div-help-content.component.ts b/src/app/pages/divhelpcontent/edit-div-help-content.component.ts
index e9cbfc2..a1af624 100644
--- a/src/app/pages/divhelpcontent/edit-div-help-content.component.ts
+++ b/src/app/pages/divhelpcontent/edit-div-help-content.component.ts
@@ -9,6 +9,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
+import {Page} from "../../domain/page";
@Component({
selector: 'edit-div-help-content',
@@ -22,6 +23,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
public communityPid: string;
public pageId: string;
+ public page: Page;
private sub: Subscription;
@@ -51,6 +53,10 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
+ if(!divContentId) {
+ this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid} });
+ }
+
this.getDivHelpContent(divContentId);
});
});
@@ -71,6 +77,22 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
this.showLoading = false;
}
+ private getPage(pageId: string) {
+ this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
+ page => {
+ if( (this.communityPid == 'openaire' && !page.openaire)
+ || (this.communityPid == 'connect' && !page.connect)
+ || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
+ this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid} });
+ } else {
+ this.page = page;
+ this.showLoading = false;
+ }
+ },
+ error => this.handleError('System error retrieving page with id: '+pageId, error)
+ );
+ }
+
private getDivHelpContent(divContentId: string) {
if(!Session.isLoggedIn()){
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
@@ -81,6 +103,9 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
this._helpContentService.getDivHelpContent(divContentId, this.properties.adminToolsAPIURL).subscribe(
divHelpContent => {
+ if(this.pageId) {
+ this.getPage(this.pageId);
+ }
this.updateForm(divHelpContent);
this.showLoading = false;
},
diff --git a/src/app/pages/divhelpcontent/new-div-help-content.component.html b/src/app/pages/divhelpcontent/new-div-help-content.component.html
index c786e04..954b59b 100644
--- a/src/app/pages/divhelpcontent/new-div-help-content.component.html
+++ b/src/app/pages/divhelpcontent/new-div-help-content.component.html
@@ -5,7 +5,7 @@
-
New class help text
+
New Class help text of page "{{page.name}}"
diff --git a/src/app/pages/divhelpcontent/new-div-help-content.component.ts b/src/app/pages/divhelpcontent/new-div-help-content.component.ts
index fb191b4..4d81097 100644
--- a/src/app/pages/divhelpcontent/new-div-help-content.component.ts
+++ b/src/app/pages/divhelpcontent/new-div-help-content.component.ts
@@ -8,6 +8,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
+import {Page} from "../../domain/page";
@Component({
selector: 'new-div-help-content',
@@ -23,10 +24,12 @@ export class NewDivHelpContentComponent {
public communityPid: string;
- public pageId: string;
+ public pageId: string;
+ public page: Page;
+
public properties:EnvProperties = null;
- public showLoading: boolean = false;
+ public showLoading: boolean = true;
public errorMessage: string = '';
public updateErrorMessage: string = '';
@@ -45,11 +48,35 @@ export class NewDivHelpContentComponent {
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
+
+
+ if(this.pageId) {
+ this.getPage(this.pageId);
+ } else {
+ this.showLoading = false;
+ }
});
});
}
- public saveCustom() {
+ private getPage(pageId: string) {
+ this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
+ page => {
+ if( (this.communityPid == 'openaire' && !page.openaire)
+ || (this.communityPid == 'connect' && !page.connect)
+ || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
+ this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid} });
+ } else {
+ this.page = page;
+ this.showLoading = false;
+ console.info(this.page);
+ }
+ },
+ error => this.handleError('System error retrieving page with id: '+pageId, error)
+ );
+ }
+
+ public saveCustom() {
if(!Session.isLoggedIn()){
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
} else {
@@ -76,7 +103,7 @@ export class NewDivHelpContentComponent {
}
}
- public cancelCustom() {
+ public cancelCustom() {
if(this.pageId) {
this.router.navigate( ['/classContents/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
} else {
@@ -89,4 +116,10 @@ export class NewDivHelpContentComponent {
console.log('Server responded: ' + error);
this.showLoading = false;
}
+
+ handleError(message: string, error) {
+ this.errorMessage = message;
+ console.log('Server responded: ' + error);
+ this.showLoading = false;
+ }
}
diff --git a/src/app/pages/helpcontent/edit-page-help-content.component.html b/src/app/pages/helpcontent/edit-page-help-content.component.html
index 0f20923..8b8ca71 100644
--- a/src/app/pages/helpcontent/edit-page-help-content.component.html
+++ b/src/app/pages/helpcontent/edit-page-help-content.component.html
@@ -5,7 +5,7 @@
- Edit Help Text
+ Edit help text of page "{{page.name}}"
@@ -14,7 +14,7 @@
{{errorMessage}}
-
+
diff --git a/src/app/pages/helpcontent/edit-page-help-content.component.ts b/src/app/pages/helpcontent/edit-page-help-content.component.ts
index d9f5c12..df1120d 100644
--- a/src/app/pages/helpcontent/edit-page-help-content.component.ts
+++ b/src/app/pages/helpcontent/edit-page-help-content.component.ts
@@ -12,6 +12,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
+import {Page} from "../../domain/page";
@Component({
selector: 'edit-page-help-content',
@@ -23,9 +24,10 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
@ViewChild(PageContentFormComponent)
public formComponent : PageContentFormComponent;
- public communityPid: string;
+ public communityPid: string;
- public pageId: string;
+ public pageId: string;
+ public page: Page;
private sub: Subscription;
@@ -55,6 +57,10 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
+ if(!pageContentId) {
+ this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
+ }
+
this.getPageHelpContent(pageContentId);
});
});
@@ -75,6 +81,23 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.showLoading = false;
}
+ private getPage(pageId: string) {
+ this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
+ page => {
+ if( (this.communityPid == 'openaire' && !page.openaire)
+ || (this.communityPid == 'connect' && !page.connect)
+ || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
+ this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
+ } else {
+ this.page = page;
+ this.formComponent.setPlacements(this.page);
+ this.showLoading = false;
+ }
+ },
+ error => this.handleError('System error retrieving page with id: '+pageId, error)
+ );
+ }
+
private getPageHelpContent(pageContentId: string) {
if(!Session.isLoggedIn()){
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
@@ -85,8 +108,15 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL).subscribe(
pageHelpContent => {
+ if(this.pageId && this.pageId != pageHelpContent.page) {
+ this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
+ } else if(this.pageId) {
+ this.getPage(this.pageId);
+ } else {
+ this.getPage(pageHelpContent.page);
+ }
this.updateForm(pageHelpContent);
- this.showLoading = false;
+ //this.showLoading = false;
},
error => this.handleError('System error retrieving page help content', error));
}
diff --git a/src/app/pages/helpcontent/new-page-help-content.component.html b/src/app/pages/helpcontent/new-page-help-content.component.html
index 237b391..93cadd3 100644
--- a/src/app/pages/helpcontent/new-page-help-content.component.html
+++ b/src/app/pages/helpcontent/new-page-help-content.component.html
@@ -5,7 +5,7 @@
- New help text
+ New help text of page "{{page.name}}"
@@ -15,7 +15,7 @@
{{errorMessage}}
-
+
diff --git a/src/app/pages/helpcontent/new-page-help-content.component.ts b/src/app/pages/helpcontent/new-page-help-content.component.ts
index 4ff976d..b554fca 100644
--- a/src/app/pages/helpcontent/new-page-help-content.component.ts
+++ b/src/app/pages/helpcontent/new-page-help-content.component.ts
@@ -11,6 +11,7 @@ import { EnvProperties } from '../../openaireLibrary/utils/properties/env-proper
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
+import {Page} from "../../domain/page";
@Component({
selector: 'new-page-help-content',
@@ -26,10 +27,12 @@ export class NewPageHelpContentComponent {
public communityPid: string;
- public pageId: string;
+ public pageId: string;
+ public page: Page;
+
public properties:EnvProperties = null;
- public showLoading: boolean = false;
+ public showLoading: boolean = true;
public errorMessage: string = '';
public updateErrorMessage: string = '';
@@ -48,10 +51,34 @@ export class NewPageHelpContentComponent {
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
+
+ if(this.pageId) {
+ this.getPage(this.pageId);
+ } else {
+ this.showLoading = false;
+ }
});
});
}
+ private getPage(pageId: string) {
+ this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
+ page => {
+ if( (this.communityPid == 'openaire' && !page.openaire)
+ || (this.communityPid == 'connect' && !page.connect)
+ || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
+ this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
+ } else {
+ this.page = page;
+ this.formComponent.setPlacements(this.page);
+ this.showLoading = false;
+ console.info(this.page);
+ }
+ },
+ error => this.handleError('System error retrieving page with id: '+pageId, error)
+ );
+ }
+
public saveCustom() {
if(!Session.isLoggedIn()){
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
@@ -87,12 +114,18 @@ export class NewPageHelpContentComponent {
} else {
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} } );
}
- }
+ }
- handleUpdateError(message: string, error) {
- this.updateErrorMessage = message;
- console.log('Server responded: ' + error);
+ handleUpdateError(message: string, error) {
+ this.updateErrorMessage = message;
+ console.log('Server responded: ' + error);
- this.showLoading = false;
- }
+ this.showLoading = false;
+ }
+
+ handleError(message: string, error) {
+ this.errorMessage = message;
+ console.log('Server responded: ' + error);
+ this.showLoading = false;
+ }
}
diff --git a/src/app/pages/helpcontent/page-help-content-form.component.html b/src/app/pages/helpcontent/page-help-content-form.component.html
index d3ab62d..1106e65 100644
--- a/src/app/pages/helpcontent/page-help-content-form.component.html
+++ b/src/app/pages/helpcontent/page-help-content-form.component.html
@@ -16,7 +16,7 @@
-