[Trunk | Admin]:
1. pages.component: Show link to add pageHelpContents only when at least one posiiton is enabled. 2. help-content.service: Add 'pid' parameter in 'getDivIdsFull()' method to be able to get divIds that are enabled in a community. Add 'with_positions' parameter in 'getPages()' method to be able to get pages that have at least one position or no positions enabled. 3. app.component: Hide '/classContents' route for communities (currently no divIds for communities). 4. div-help-content-form.component: Get divIds that are enabled for the community. 5. div-help-contents.component: When a page is pre-selected ('pageId' url param exists), check if page is enabled in the community, otherwise redirect. 6. edit-div-help-content.component & new-div-help-content.component: Add 'getPage()' method, to get page (if disabled in community, redirect - if pageId is pre-selected) and show it in the page title. 7. edit-div-help-content.component: If there is no 'divContentId' url param, redirect 8. edit-page-help-content.component: If there is no 'pageContentId' url param, redirect Add 'getPage()' method, to get page (if disabled in community, redirect - if pageId is pre-selected or use pageHelpContent.page - if pageId != pageHelpContent.page, redirect) and show it in the p$ 9. new-page-help-content.component: Add 'getPage()' method, to get page (if disabled in community, redirect - if pageId is pre-selected) and show it in the page title. 10. page-help-content-form.component: Do not perform a query to get page when it is pre-selected (new & edit do the query now) | Get pages with at least one posiiton enabled. 11. page-help-contents.component: When a page is pre-selected ('pageId' url param exists), check if page is enabled in the community, otherwise redirect | Get pages with at least one posiiton enabled. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56740 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
25ceec0d6a
commit
f6f86634ce
|
@ -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 = {
|
||||
|
|
|
@ -13,17 +13,21 @@
|
|||
<div class="form-group">
|
||||
<div class="uk-margin-bottom" *ngIf="selectedDiv">Class content displayed in page(s): <span *ngFor="let page of selectedDiv.pages let i=index">{{page.name}}<span *ngIf="i<(selectedDiv.pages.length-1)">, </span></span></div>
|
||||
|
||||
<label *ngIf="showPageSelect && !editMode" for="pageTag">Select Page</label>
|
||||
<select *ngIf="showPageSelect && !editMode" id="pageTag" (change)="pageSelected($event)" [value]="pageId ? pageId : ''">
|
||||
<option *ngIf="!pageId"></option>
|
||||
<option *ngFor="let page of availablePages" [value]="page._id">{{page.name}}</option>
|
||||
</select>
|
||||
<div *ngIf="showPageSelect && !editMode" class="form-group">
|
||||
<label for="pageTag">Select Page</label>
|
||||
<select id="pageTag" (change)="pageSelected($event)" [value]="pageId ? pageId : ''">
|
||||
<!-- <option *ngIf="!pageId">No page selected</option>-->
|
||||
<option *ngFor="let page of availablePages" [value]="page._id">{{page.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label *ngIf="pageId || selectedDiv" for="divTag">Select Class</label>
|
||||
<select *ngIf="pageId || selectedDiv" formControlName="divId" id="divTag" class="form-control">
|
||||
<div *ngIf="pageId || selectedDiv" class="form-group">
|
||||
<label for="divTag">Select Class</label>
|
||||
<select formControlName="divId" id="divTag" class="form-control">
|
||||
<!-- <option *ngIf="selectedDiv" [value]="selectedDiv._id">{{selectedDiv.name}}</option> -->
|
||||
<option *ngFor="let div of availableDivs" [value]="div._id" (click)="divIdSelected(div)">{{div.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.content.valid && myForm.controls.content.dirty}">
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
<div class="menubar ">
|
||||
|
||||
<div *ngIf="!selectedPageId" class="divHelpContent-title uk-text-large">Class Help Texts</div>
|
||||
<div *ngIf="selectedPageId && page" class="divHelpContent-title uk-text-large">Help Texts of page '{{page.name}}'</div>
|
||||
<div *ngIf="!selectedPageId" class="divHelpContent-title uk-text-large">Class help texts</div>
|
||||
<div *ngIf="selectedPageId && page" class="divHelpContent-title uk-text-large">Class help texts of page '{{page.name}}'</div>
|
||||
|
||||
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
|
||||
<a class="uk-alert-close" uk-close></a>
|
||||
|
|
|
@ -89,8 +89,14 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
page => {
|
||||
if( (this.selectedCommunityPid == 'openaire' && !page.openaire)
|
||||
|| (this.selectedCommunityPid == 'connect' && !page.connect)
|
||||
|| (this.selectedCommunityPid != 'openaire' && this.selectedCommunityPid != 'connect' && !page.communities)) {
|
||||
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.selectedCommunityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
this.getDivHelpContents(this.selectedCommunityPid);
|
||||
}
|
||||
},
|
||||
error => this.handleError('System error retrieving page', error));
|
||||
}
|
||||
|
@ -105,6 +111,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
this.errorMessage = "";
|
||||
|
||||
this._helpService.getCommunityPagesWithDivId(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
//this._helpService.getPagesWithDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
this.pages = pages;
|
||||
this.getDivHelpContents(this.selectedCommunityPid);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<i class="ion-navicon"></i>
|
||||
</div>
|
||||
|
||||
<div class="uk-text-large">Edit Class help text</div>
|
||||
<div class="uk-text-large">Edit Class help text <span *ngIf="page && page.name">of page "{{page.name}}"</span></div>
|
||||
</div>
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<i class="ion-navicon"></i>
|
||||
</div>
|
||||
|
||||
<div class="uk-text-large">New class help text</div>
|
||||
<div class="uk-text-large">New Class help text <span *ngIf="page && page.name">of page "{{page.name}}"</span></div>
|
||||
</div>
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<i class="ion-navicon"></i>
|
||||
</div>
|
||||
|
||||
<div class="uk-text-large">Edit Help Text</div>
|
||||
<div class="uk-text-large">Edit help text <span *ngIf="page && page.name">of page "{{page.name}}"</span></div>
|
||||
</div>
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
@ -14,7 +14,7 @@
|
|||
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
||||
<div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-width-1-1" role="alert"><img class="uk-align-center loading-gif"></div>
|
||||
|
||||
<page-content-form [communityPid]="communityPid" [pageId]="pageId" [updateErrorMessage]="updateErrorMessage"></page-content-form>
|
||||
<page-content-form [communityPid]="communityPid" [pageId]="pageId" [page]="page" [updateErrorMessage]="updateErrorMessage"></page-content-form>
|
||||
<button (click)="saveCustom()" class="uk-button uk-button-primary">Update help text</button>
|
||||
<button (click)="cancelCustom()" class="uk-button">Cancel</button>
|
||||
</div>
|
||||
|
|
|
@ -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(<string>pageHelpContent.page);
|
||||
}
|
||||
this.updateForm(pageHelpContent);
|
||||
this.showLoading = false;
|
||||
//this.showLoading = false;
|
||||
},
|
||||
error => this.handleError('System error retrieving page help content', error));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<i class="ion-navicon"></i>
|
||||
</div>
|
||||
|
||||
<div class="uk-text-large">New help text</div>
|
||||
<div class="uk-text-large">New help text <span *ngIf="page && page.name">of page "{{page.name}}"</span></div>
|
||||
</div>
|
||||
|
||||
<div class="content-wrapper">
|
||||
|
@ -15,7 +15,7 @@
|
|||
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
||||
<div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-width-1-1" role="alert"><img class="uk-align-center loading-gif"></div>
|
||||
|
||||
<page-content-form [communityPid]="communityPid" [pageId]="pageId" [updateErrorMessage]="updateErrorMessage"></page-content-form>
|
||||
<page-content-form [communityPid]="communityPid" [pageId]="pageId" [page]="page" [updateErrorMessage]="updateErrorMessage"></page-content-form>
|
||||
<button (click)="saveCustom()" class="uk-button uk-button-primary uk-margin-small-right">Save help text</button>
|
||||
<button (click)="cancelCustom()" class="uk-button">Cancel</button>
|
||||
</div>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<option *ngFor="let page of availablePages" [value]="page._id">{{page.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div *ngIf="pageId || (myForm.controls.page.value)" class="form-group" [ngClass]="{'has-error':!myForm.controls.placement.valid && myForm.controls.placement.dirty}">
|
||||
<div *ngIf="myForm.controls.page.value" class="form-group" [ngClass]="{'has-error':!myForm.controls.placement.valid && myForm.controls.placement.dirty}">
|
||||
<label for="placementTag">Select Placement</label>
|
||||
<select formControlName="placement" id="placementTag" class="form-control">
|
||||
<option *ngIf="placements.top" [value]="'top'">Top</option>
|
||||
|
|
|
@ -21,6 +21,8 @@ export class PageContentFormComponent implements OnInit{
|
|||
communityPid: string;
|
||||
@Input('pageId')
|
||||
pageId: string;
|
||||
@Input('page')
|
||||
page: Page;
|
||||
placements = {"top": false, "bottom": false, "left": false, "right": false}
|
||||
|
||||
private availablePages : Page[] = [];
|
||||
|
@ -44,27 +46,15 @@ export class PageContentFormComponent implements OnInit{
|
|||
if(!Session.isLoggedIn()){
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(this.pageId) {
|
||||
this._helpContentService.getPage(this.pageId,this.properties.adminToolsAPIURL).subscribe(page => {
|
||||
this.placements.top = page.top;
|
||||
this.placements.bottom = page.bottom;
|
||||
this.placements.left = page.left;
|
||||
this.placements.right = page.right;
|
||||
|
||||
});
|
||||
} else {
|
||||
if(!this.pageId) {
|
||||
this.myForm.valueChanges.subscribe(value => {
|
||||
let pid = value.page;
|
||||
this._helpContentService.getPage(pid, this.properties.adminToolsAPIURL).subscribe(page => {
|
||||
this.placements.top = page.top;
|
||||
this.placements.bottom = page.bottom;
|
||||
this.placements.left = page.left;
|
||||
this.placements.right = page.right;
|
||||
|
||||
let pageId = value.page;
|
||||
this._helpContentService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(page => {
|
||||
this.setPlacements(page);
|
||||
});
|
||||
});
|
||||
}
|
||||
this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid, true).subscribe(
|
||||
pages => {
|
||||
this.availablePages = pages;
|
||||
this.showLoading = false;
|
||||
|
@ -74,9 +64,16 @@ export class PageContentFormComponent implements OnInit{
|
|||
});
|
||||
}
|
||||
|
||||
public setPlacements(page: Page) {
|
||||
this.placements.top = page.top;
|
||||
this.placements.bottom = page.bottom;
|
||||
this.placements.left = page.left;
|
||||
this.placements.right = page.right;
|
||||
}
|
||||
|
||||
public get form() {
|
||||
return this._fb.group({
|
||||
page : [this.pageId,Validators.required],
|
||||
page : [this.pageId, Validators.required],
|
||||
community : this.communityPid,
|
||||
placement : ['', Validators.required],
|
||||
content : ['', Validators.required],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div id="pageHelpContents">
|
||||
<div class="menubar ">
|
||||
<div *ngIf="!selectedPageId" class="pageHelpContent-title uk-text-large">Page help text</div>
|
||||
<div *ngIf="selectedPageId && page" class="pageHelpContent-title uk-text-large">Help Text of page '{{page.name}}'</div>
|
||||
<div *ngIf="!selectedPageId" class="pageHelpContent-title uk-text-large">Page help texts</div>
|
||||
<div *ngIf="selectedPageId && page" class="pageHelpContent-title uk-text-large">Page help texts of page '{{page.name}}'</div>
|
||||
|
||||
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
|
||||
<a class="uk-alert-close" uk-close></a>
|
||||
|
|
|
@ -102,8 +102,14 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
page => {
|
||||
this.page = page;
|
||||
this.getPageHelpContents(this.selectedCommunityPid);
|
||||
if( (this.selectedCommunityPid == 'openaire' && !page.openaire)
|
||||
|| (this.selectedCommunityPid == 'connect' && !page.connect)
|
||||
|| (this.selectedCommunityPid != 'openaire' && this.selectedCommunityPid != 'connect' && !page.communities)) {
|
||||
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.selectedCommunityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
this.getPageHelpContents(this.selectedCommunityPid);
|
||||
}
|
||||
},
|
||||
error => this.handleError('System error retrieving page', error));
|
||||
}
|
||||
|
@ -117,8 +123,9 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
||||
this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
//this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.getPages(this.properties.adminToolsAPIURL, community_pid, true).subscribe(
|
||||
pages => {
|
||||
this.pages = pages;
|
||||
this.getPageHelpContents(this.selectedCommunityPid);
|
||||
},
|
||||
|
|
|
@ -98,7 +98,11 @@
|
|||
</div>
|
||||
</td>
|
||||
<td *ngIf="!isPortalAdministrator" class="uk-text-center">
|
||||
<a class="helpContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/pageContents">add page contents</a>
|
||||
<a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right" class="helpContents"
|
||||
[queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/pageContents">
|
||||
add page contents
|
||||
</a>
|
||||
<span *ngIf="!check.page.top && !check.page.bottom && !check.page.left && !check.page.right">-</span>
|
||||
</td>
|
||||
<td *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)" class="uk-text-center">
|
||||
<a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/classContents">add class contents</a>
|
||||
|
|
|
@ -30,16 +30,21 @@ export class HelpContentService {
|
|||
}
|
||||
}
|
||||
|
||||
getDivIdsFull(page_id: string, helpContentUrl:string) {
|
||||
if(page_id) {
|
||||
return this.http.get<Array<DivId>>(helpContentUrl + 'divFull?&page='+page_id)
|
||||
//.map(res => <Array<DivId>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
} else {
|
||||
return this.http.get<Array<DivId>>(helpContentUrl + 'divFull')
|
||||
//.map(res => <Array<DivId>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
getDivIdsFull(page_id: string, helpContentUrl:string, pid: string = null) {
|
||||
let parameters: string = "";
|
||||
if(page_id || pid) {
|
||||
parameters = "?";
|
||||
if(page_id) {
|
||||
parameters += "&page="+page_id;
|
||||
}
|
||||
if(pid) {
|
||||
parameters += "&communityId="+pid;
|
||||
}
|
||||
}
|
||||
|
||||
return this.http.get<Array<DivId>>(helpContentUrl + 'divFull'+parameters)
|
||||
//.map(res => <Array<DivId>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updateDivId(divId: DivId, helpContentUrl:string) {
|
||||
|
@ -126,8 +131,18 @@ export class HelpContentService {
|
|||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getPages(helpContentUrl:string,pid:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + 'page'+(pid?("?pid="+pid):""))
|
||||
getPages(helpContentUrl:string,pid:string,with_positions:boolean=null) {
|
||||
let parameters: string = "";
|
||||
if(pid || with_positions == true || with_positions == false) {
|
||||
parameters = "?";
|
||||
if(pid) {
|
||||
parameters += "&pid="+pid;
|
||||
}
|
||||
if(with_positions == true || with_positions == false) {
|
||||
parameters += "&with_positions="+with_positions;
|
||||
}
|
||||
}
|
||||
return this.http.get<Array<Page>>(helpContentUrl + 'page'+parameters)
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
|
||||
|
||||
"adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools/",
|
||||
"adminToolsAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-admin-tools/",
|
||||
|
||||
"adminToolsCommunity" :"openaire",
|
||||
"communityAPI": "https://dev-openaire.d4science.org/openaire/community/",
|
||||
|
|
Loading…
Reference in New Issue