[Trunk | Admin]: Merging branch 'use-UoaAdminToolsLibrary' into trunk for revisions 58405:59467
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@59468 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
4fee54d705
commit
d1fba2997f
|
@ -27,7 +27,6 @@
|
|||
"@angular/router": "7.2.14",
|
||||
"@nguniversal/express-engine": "^6.0.0",
|
||||
"@types/express": "^4.16.1",
|
||||
"@types/node": "^6.0.101",
|
||||
"angular-datatables": "^4.4.1",
|
||||
"citation-js": "^0.3.4",
|
||||
"ng2-ckeditor": "1.1.9",
|
||||
|
@ -54,7 +53,7 @@
|
|||
"@types/jasmine": "~2.8.8",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/jquery": "^3.3.29",
|
||||
"@types/node": "~6.14.6",
|
||||
"@types/node": "^8.0.30",
|
||||
"codelyzer": "~4.5.0",
|
||||
"jasmine-core": "~2.99.1",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<navbar *ngIf="properties && showMenu" portal="connect-admin" logoPath="assets/imgs/" [onlyTop]="false"
|
||||
[userMenu]="true" [dark]="true"
|
||||
[userMenu]="true"
|
||||
[homeurl]="false" [user]="user" [userMenuItems]="userMenuItems" [menuItems]="menuItems"
|
||||
[properties]="properties"
|
||||
[community]="community"></navbar>
|
||||
|
|
|
@ -11,6 +11,7 @@ import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
|||
import {Session, User} from './openaireLibrary/login/utils/helper.class';
|
||||
import {HelperFunctions} from './openaireLibrary/utils/HelperFunctions.class';
|
||||
import {UserManagementService} from './openaireLibrary/services/user-management.service';
|
||||
import {ConnectHelper} from "./openaireLibrary/connect/connectHelper";
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
|
@ -75,6 +76,7 @@ export class AppComponent implements OnInit {
|
|||
this._communitiesService.updateCommunities(this.properties, this.properties.communityAPI + 'communities');
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.communityId = (params['communityId']) ? params['communityId'] : '';
|
||||
ConnectHelper.setPortalTypeFromPid(this.communityId);
|
||||
|
||||
this.communityType = null;
|
||||
this.menuItems = [];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { DivId } from './divId';
|
||||
import {Community} from './community';
|
||||
import {Portal} from './portal';
|
||||
|
||||
export interface DivHelpContent {
|
||||
_id: string;
|
||||
divId: DivId | string;
|
||||
community: string | Community;
|
||||
portal: string | Portal;
|
||||
content: string;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ export interface DivId {
|
|||
_id: string;
|
||||
name: string;
|
||||
pages: string[] | Page[];
|
||||
connect: boolean;
|
||||
communities: boolean;
|
||||
openaire: boolean;
|
||||
portalType: string;
|
||||
}
|
||||
|
||||
export interface CheckDivId {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Page } from "./page";
|
||||
import { Community } from "./community";
|
||||
import { Portal } from "./portal";
|
||||
|
||||
export interface HtmlPageContent {
|
||||
_id: string;
|
||||
page: Page | string;
|
||||
community: Community | string;
|
||||
community: Portal | string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
* Created by stefania on 7/13/17.
|
||||
*/
|
||||
import { Page } from './page';
|
||||
import { Community } from './community';
|
||||
import { Portal } from './portal';
|
||||
|
||||
export interface PageHelpContent {
|
||||
_id: string;
|
||||
page: Page | string;
|
||||
community: Community | string;
|
||||
portal: Portal | string;
|
||||
placement: string;
|
||||
order: number;
|
||||
content: string;
|
||||
|
|
|
@ -6,9 +6,7 @@ export interface Page {
|
|||
name: string;
|
||||
type: string;
|
||||
isEnabled: boolean;
|
||||
connect: boolean;
|
||||
communities: boolean;
|
||||
openaire: boolean;
|
||||
portalType: string;
|
||||
entities: Entity[] | string[];
|
||||
top: boolean;
|
||||
bottom: boolean;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import {Page} from './page';
|
||||
import {Entity} from './entity';
|
||||
|
||||
export interface Community {
|
||||
export interface Portal {
|
||||
_id: string;
|
||||
pid: string;
|
||||
name: string;
|
||||
type: string;
|
||||
entities: string[] | Entity[];
|
||||
pages: string[] | Page[];
|
||||
}
|
||||
|
||||
export interface CheckCommunity {
|
||||
community: Community;
|
||||
export interface CheckPortal {
|
||||
community: Portal;
|
||||
checked: boolean;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<ng-template #card let-organization="organization">
|
||||
<div class="uk-card-media-top affiliation-logo uk-padding-small">
|
||||
<img *ngIf= "organization.logo_url != null && organization.logo_url != '' " class="uk-text-center"
|
||||
src="{{organization.logo_url}}" alt="{{(organization.name)?organization.name:''}} logo">
|
||||
src="{{urlPrefix(organization.logo_url) + organization.logo_url}}" alt="{{(organization.name)?organization.name:''}} logo">
|
||||
<span *ngIf= "organization.logo_url == null || organization.logo_url == '' "class="uk-icon uk-padding-small">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" icon="image" ratio="2.5"><circle cx="16.1" cy="6.1" r="1.1"></circle><rect fill="none" stroke="#000" x="0.5" y="2.5" width="19" height="15"></rect><polyline fill="none" stroke="#000" stroke-width="1.01" points="4,13 8,9 13,14"></polyline><polyline fill="none" stroke="#000" stroke-width="1.01" points="11,12 12.5,10.5 16,14"></polyline></svg>
|
||||
</span>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<li *ngFor="let result of affiliations; let i=index"
|
||||
class="uk-animation-fade uk-height-small uk-flex uk-flex-middle" uk-grid>
|
||||
<div class="uk-width-1-5">
|
||||
<a *ngIf="result.website_url" target="_blank" [href]="result.website_url"
|
||||
<a *ngIf="result.website_url" target="_blank" [href]="urlPrefix(result.website_url) + result.website_url"
|
||||
class="affiliation-content uk-card uk-card-small uk-card-default uk-flex uk-flex-middle uk-flex-center">
|
||||
<ng-container *ngTemplateOutlet="card; context: { organization: result, fullView: true}"></ng-container>
|
||||
</a>
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
<div class="uk-width-3-5">
|
||||
<h3 class="uk-h3" title="{{result.name}}">{{_format(result.name)}}</h3>
|
||||
<a href="{{result.website_url}}" title="{{result.website_url}}" class="uk-margin-auto-top" target="_blank">{{_format(result.website_url)}}</a>
|
||||
<a href="{{urlPrefix(affiliation.website_url) + result.website_url}}" title="{{result.website_url}}" class="uk-margin-auto-top" target="_blank">{{_format(result.website_url)}}</a>
|
||||
</div>
|
||||
<div class="uk-width-1-5">
|
||||
<button class="uk-icon-button uk-icon uk-button-secondary uk-margin-small-right uk-margin-small-bottom" title="Edit" uk-icon="pencil" (click)="chooseAffiliation(i, 'edit')"></button>
|
||||
|
|
|
@ -12,6 +12,7 @@ import {UtilitiesService} from '../../openaireLibrary/services/utilities.service
|
|||
import {AffiliationService} from "../../openaireLibrary/connect/affiliations/affiliation.service";
|
||||
import {HelpContentService} from "../../services/help-content.service";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
|
||||
|
||||
@Component({
|
||||
selector: 'affiliations',
|
||||
|
@ -94,10 +95,10 @@ export class AffiliationsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getOrganizationsPageId() {
|
||||
this._helpContentService.getPageByRoute("/organizations", this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
if(pages && pages[0]) {
|
||||
this.organizationsPageId = pages[0]._id;
|
||||
this._helpContentService.getCommunityPageByRoute("/organizations", this.properties.adminToolsAPIURL, this.communityId).subscribe(
|
||||
page => {
|
||||
if(page) {
|
||||
this.organizationsPageId = page._id;
|
||||
}
|
||||
this.showLoading = false;
|
||||
},
|
||||
|
@ -280,4 +281,8 @@ export class AffiliationsComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
public urlPrefix(url: string): string {
|
||||
return StringUtils.urlPrefix(url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<form target="BSFormPanel_Admin_1" class="search">
|
||||
<!-- <input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Community name..." type="text" class="uk-input uk-width-medium"/>
|
||||
<button class="uk-button" type="submit">Search</button> -->
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Community name..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Community name, type..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<button (click)="filterBySearch(keyword)" type="submit" class=" uk-button">
|
||||
<span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
|
@ -48,6 +48,7 @@
|
|||
<tr>
|
||||
<th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -59,6 +60,9 @@
|
|||
<td>
|
||||
<div class="name" href="#">{{check.community.name}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="type" href="#">{{check.community.type}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="actions" href="#">
|
||||
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editCommunity(i)">
|
||||
|
|
|
@ -6,13 +6,14 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||
import { HelpContentService } from '../../services/help-content.service';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { CommunityFormComponent } from './community-form.component';
|
||||
import { CheckCommunity, Community } from '../../domain/community';
|
||||
import { CheckPortal, Portal } from '../../domain/portal';
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'communities',
|
||||
|
@ -38,9 +39,9 @@ export class CommunitiesComponent implements OnInit {
|
|||
@ViewChild(CommunityFormComponent)
|
||||
public formComponent: CommunityFormComponent;
|
||||
|
||||
public checkboxes: CheckCommunity[] = [];
|
||||
public checkboxes: CheckPortal[] = [];
|
||||
|
||||
public communities: Community[] = [];
|
||||
public communities: Portal[] = [];
|
||||
|
||||
// public errorMessage: string;
|
||||
|
||||
|
@ -70,7 +71,8 @@ export class CommunitiesComponent implements OnInit {
|
|||
|
||||
constructor(private element: ElementRef, private route: ActivatedRoute,
|
||||
private title: Title,
|
||||
private _router: Router, private _helpContentService: HelpContentService) {}
|
||||
private _router: Router, private _helpContentService: HelpContentService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
|
||||
getCommunities() {
|
||||
|
@ -87,7 +89,7 @@ export class CommunitiesComponent implements OnInit {
|
|||
communities => {
|
||||
this.communities = communities;
|
||||
communities.forEach(_ => {
|
||||
this.checkboxes.push(<CheckCommunity>{community : _, checked : false});
|
||||
this.checkboxes.push(<CheckPortal>{community : _, checked : false});
|
||||
});
|
||||
this.showLoading = false;
|
||||
},
|
||||
|
@ -160,6 +162,7 @@ export class CommunitiesComponent implements OnInit {
|
|||
_ => {
|
||||
this.deleteCommunitiesFromArray(this.selectedCommunities);
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("communities deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected communities', error)
|
||||
);
|
||||
|
@ -167,17 +170,19 @@ export class CommunitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public editCommunity(i: number) {
|
||||
const community: Community = this.checkboxes[i].community;
|
||||
const community: Portal = this.checkboxes[i].community;
|
||||
this.formGroup.patchValue(community);
|
||||
this.formGroup.controls['type'].disable();
|
||||
// this.updateModal.showModal();
|
||||
this.modalErrorMessage = '';
|
||||
this.communitiesModalOpen(this.alertModalUpdateCommunity, 'Update', 'Update Community');
|
||||
}
|
||||
|
||||
public newCommunity() {
|
||||
this.formComponent.reset();
|
||||
this.modalErrorMessage = '';
|
||||
this.communitiesModalOpen(this.alertModalSaveCommunity, 'Save', 'Add a new Community');
|
||||
this.formGroup.controls['type'].enable();
|
||||
this.formComponent.reset();
|
||||
this.modalErrorMessage = '';
|
||||
this.communitiesModalOpen(this.alertModalSaveCommunity, 'Save', 'Add a new Community');
|
||||
}
|
||||
|
||||
private communitiesModalOpen(modal: any, title: string, yesBtn: string) {
|
||||
|
@ -203,10 +208,11 @@ export class CommunitiesComponent implements OnInit {
|
|||
this.modalErrorMessage = 'Please fill in all required fields marked with *';
|
||||
} else {
|
||||
this.modalErrorMessage = '';
|
||||
this._helpContentService.saveCommunity(<Community> this.formGroup.value,
|
||||
this._helpContentService.saveCommunity(<Portal> this.formGroup.value,
|
||||
this.properties.adminToolsAPIURL).subscribe(
|
||||
community => {
|
||||
this.communitySavedSuccessfully(community);
|
||||
this._clearCacheService.clearCache("community saved");
|
||||
},
|
||||
error => this.handleUpdateError('System error creating community', error)
|
||||
);
|
||||
|
@ -223,10 +229,12 @@ export class CommunitiesComponent implements OnInit {
|
|||
this.communitiesModalOpen(this.alertModalUpdateCommunity, 'Update', 'Update Community');
|
||||
this.modalErrorMessage = 'Please fill in all required fields marked with *';
|
||||
} else {
|
||||
this._helpContentService.updateCommunity(<Community> this.formGroup.value,
|
||||
this.formGroup.controls['type'].enable();
|
||||
this._helpContentService.updateCommunity(<Portal> this.formGroup.value,
|
||||
this.properties.adminToolsAPIURL).subscribe(
|
||||
community => {
|
||||
this.communityUpdatedSuccessfully(community);
|
||||
this._clearCacheService.clearCache("community updated");
|
||||
},
|
||||
error => this.handleUpdateError('System error updating community', error)
|
||||
);
|
||||
|
@ -234,12 +242,12 @@ export class CommunitiesComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
public communitySavedSuccessfully(community: Community) {
|
||||
this.checkboxes.push(<CheckCommunity>{community : community, checked : false});
|
||||
public communitySavedSuccessfully(community: Portal) {
|
||||
this.checkboxes.push(<CheckPortal>{community : community, checked : false});
|
||||
this.applyCheck(false);
|
||||
}
|
||||
|
||||
public communityUpdatedSuccessfully(community: Community) {
|
||||
public communityUpdatedSuccessfully(community: Portal) {
|
||||
this.checkboxes.find(checkItem => checkItem.community._id === community._id).community = community;
|
||||
this.applyCheck(false);
|
||||
}
|
||||
|
@ -252,12 +260,12 @@ export class CommunitiesComponent implements OnInit {
|
|||
public applyFilter() {
|
||||
this.checkboxes = [];
|
||||
this.communities.filter(item => this.filterCommunities(item)).forEach(
|
||||
_ => this.checkboxes.push(<CheckCommunity>{community: _, checked: false})
|
||||
_ => this.checkboxes.push(<CheckPortal>{community: _, checked: false})
|
||||
);
|
||||
}
|
||||
|
||||
public filterCommunities(community: Community): boolean {
|
||||
const textFlag = this.searchText.toString() === '' || (community.name).match(this.searchText) != null;
|
||||
public filterCommunities(community: Portal): boolean {
|
||||
const textFlag = this.searchText.toString() === '' || (community.name || community.type).match(this.searchText) != null;
|
||||
return textFlag;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
<form [formGroup]="myForm">
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.name.dirty}">
|
||||
<label for="communityNameTag">*Community Name</label>
|
||||
<input type="text" class="form-control" formControlName="name" id="pageNameTag" placeholder="Community Name">
|
||||
</div>
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.pid.valid && myForm.controls.pid.dirty}">
|
||||
<label for="communityPidTag">*Community persistent id for portal</label>
|
||||
<input type="text" class="uk-input uk-width-medium" formControlName="pid" id="communityPidTag" placeholder="Community Pid">
|
||||
</div>
|
||||
<input type="hidden" formControlName="_id">
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.name.dirty}">
|
||||
<label for="portalNameTag">*Portal Name</label>
|
||||
<input type="text" class="form-control" formControlName="name" id="portalNameTag" placeholder="Portal Name">
|
||||
</div>
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.type.valid && myForm.controls.type.dirty}">
|
||||
<label for="portalTypeTag">*Portal Type</label>
|
||||
<select formControlName="type" id="portalTypeTag" class="form-control uk-select">
|
||||
<option [value]="'explore'">OpenAIRE Explore Portal</option>
|
||||
<option [value]="'connect'">OpenAIRE Connect Portal</option>
|
||||
<option [value]="'monitor'">OpenAIRE Monitor Portal</option>
|
||||
<option [value]="'community'">OpenAIRE Community Gateway</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.pid.valid && myForm.controls.pid.dirty}">
|
||||
<label for="communityPidTag">*Portal persistent id</label>
|
||||
<input type="text" class="uk-input uk-width-medium uk-margin-small-left" formControlName="pid" id="communityPidTag" placeholder="Portal Pid">
|
||||
</div>
|
||||
<input type="hidden" formControlName="_id">
|
||||
</form>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {Component, OnInit, Input} from '@angular/core';
|
||||
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import {FormGroup, FormBuilder, Validators} from "@angular/forms";
|
||||
|
||||
@Component({
|
||||
selector: 'community-form',
|
||||
|
@ -14,30 +13,32 @@ export class CommunityFormComponent implements OnInit{
|
|||
|
||||
public errorMessage: string;
|
||||
|
||||
constructor(public _fb: FormBuilder, private _helpContentService: HelpContentService) {}
|
||||
constructor(public _fb: FormBuilder) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public get form() {
|
||||
return this._fb.group({
|
||||
_id : '',
|
||||
pid: ['', Validators.required],
|
||||
name : ['', Validators.required]
|
||||
});
|
||||
return this._fb.group({
|
||||
_id: '',
|
||||
pid: ['', Validators.required],
|
||||
name: ['', Validators.required],
|
||||
type: ['', Validators.required]
|
||||
});
|
||||
}
|
||||
|
||||
public reset() {
|
||||
this.myForm.patchValue({
|
||||
name : '',
|
||||
_id : '',
|
||||
pid: ''
|
||||
});
|
||||
this.myForm.patchValue({
|
||||
name : '',
|
||||
_id : '',
|
||||
pid: '',
|
||||
type: ''
|
||||
});
|
||||
}
|
||||
|
||||
handleError(message: string, error) {
|
||||
if(error == null) {
|
||||
this.reset();
|
||||
}
|
||||
this.errorMessage = message + ' (Server responded: ' + error + ')';
|
||||
if(error == null) {
|
||||
this.reset();
|
||||
}
|
||||
this.errorMessage = message + ' (Server responded: ' + error + ')';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import {CommunityService} from '../../openaireLibrary/connect/community/communit
|
|||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
|
||||
|
||||
@Component({
|
||||
selector: 'dashboard',
|
||||
|
@ -30,6 +31,8 @@ export class DashboardComponent implements OnInit {
|
|||
this.route.queryParams.subscribe(data => {
|
||||
HelperFunctions.scroll();
|
||||
this.communityId = ((data['communityId']) ? data['communityId'] : data['community']);
|
||||
ConnectHelper.setPortalTypeFromPid(this.communityId);
|
||||
|
||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe (
|
||||
community => {
|
||||
this.communityType = community.type;
|
||||
|
|
|
@ -4,67 +4,65 @@
|
|||
<input type="text" class="form-control" formControlName="name" id="divIdNameTag" placeholder="Class Name">
|
||||
</div>
|
||||
|
||||
<div formArrayName="pages" class="form-group" [ngClass]="{'has-error':!myForm.controls.pages.valid && myForm.controls.pages.dirty}">
|
||||
<label for="pageNameTag">Page Name (*at least 1)</label>
|
||||
<div id="pageNameTag">
|
||||
<pre class="card card-block card-header"><span *ngFor="let page of myForm.controls.pages.value; let i=index">{{page.name}}<span *ngIf="i<(myForm.controls.pages.value.length-1)">, </span></span></pre>
|
||||
<div [ngClass]="{'has-error':!myForm.controls.portalType.valid && myForm.controls.portalType.dirty}" class="form-group uk-grid-small uk-margin-medium-bottom" uk-grid>
|
||||
<label class="uk-width-1-1 uk-margin-small-bottom">
|
||||
*Class exists in:
|
||||
</label>
|
||||
<label class="uk-width-1-1 radio uk-margin-large-left">
|
||||
<span class="uk-margin-small-right" style="font-weight: normal;">OpenAIRE portal</span>
|
||||
<!-- <input tabindex="0" type="checkbox" formControlName="openaire">-->
|
||||
<input type="radio" value="explore" formControlName="portalType">
|
||||
</label>
|
||||
<label class="uk-width-1-1 radio uk-margin-large-left">
|
||||
<span class="uk-margin-small-right" style="font-weight: normal;">OpenAIRE Connect portal</span>
|
||||
<!-- <input tabindex="0" type="checkbox" formControlName="connect">-->
|
||||
<input type="radio" value="connect" formControlName="portalType">
|
||||
</label>
|
||||
<label class="uk-width-1-1 radio uk-margin-large-left">
|
||||
<span class="uk-margin-small-right" style="font-weight: normal;">Communities' Gateway</span>
|
||||
<!-- <input tabindex="0" type="checkbox" formControlName="communities">-->
|
||||
<input type="radio" value="community" formControlName="portalType">
|
||||
</label>
|
||||
<div class="uk-text-small">If portal changes, selected pages will be lost</div>
|
||||
</div>
|
||||
|
||||
<button type="button" (click)="toggle()">Add / Remove pages</button>
|
||||
<div formArrayName="pages" [class]="(!myForm.controls.portalType.value ? 'uk-disabled' : '') + ' form-group'"
|
||||
[ngClass]="{'has-error':!myForm.controls.pages.valid && myForm.controls.pages.dirty}">
|
||||
<label for="pageNameTag">Page Name (*at least 1)</label>
|
||||
<div id="pageNameTag">
|
||||
<pre class="card card-block card-header"><span *ngFor="let page of myForm.controls.pages.value; let i=index">{{page.name}}<span *ngIf="i<(myForm.controls.pages.value.length-1)">, </span></span></pre>
|
||||
|
||||
<ng-container *ngIf="!myForm.value.isCollapsed">
|
||||
<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>
|
||||
<button type="button" class="uk-button-small" (click)="toggle()">Add / Remove pages</button>
|
||||
|
||||
<!-- <div *ngFor="let page of availablePages">
|
||||
<ng-container *ngIf="!myForm.value.isCollapsed">
|
||||
<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>
|
||||
|
||||
<!-- <div *ngFor="let page of availablePages">
|
||||
<span>
|
||||
<span *ngIf="indexOfPageInForm(page._id) >= 0" class="activated" >
|
||||
<input (click)="togglePage(false, page)" class="deactivate" src="assets/imgs/delete-icon.png" title="Disable" width="20" type="image" height="20">
|
||||
</span>
|
||||
<span *ngIf="indexOfPageInForm(page._id) < 0" class="deactivated" >
|
||||
<input (click)="togglePage(true, page)" class="activate" src="assets/imgs/add-icon.png" title="Enable" width="20" type="image" height="20">
|
||||
</span>
|
||||
{{page.name}}
|
||||
</span>
|
||||
</div> -->
|
||||
|
||||
<div *ngFor="let page of getKeys(allPagesFiltered)">
|
||||
<span>
|
||||
<span *ngIf="indexOfPageInForm(page._id) >= 0" class="activated" >
|
||||
<span *ngIf="allPagesFiltered.get(page)" class="activated" >
|
||||
<input (click)="togglePage(false, page)" class="deactivate" src="assets/imgs/delete-icon.png" title="Disable" width="20" type="image" height="20">
|
||||
</span>
|
||||
<span *ngIf="indexOfPageInForm(page._id) < 0" class="deactivated" >
|
||||
<span *ngIf="!allPagesFiltered.get(page)" class="deactivated" >
|
||||
<input (click)="togglePage(true, page)" class="activate" src="assets/imgs/add-icon.png" title="Enable" width="20" type="image" height="20">
|
||||
</span>
|
||||
{{page.name}}
|
||||
</span>
|
||||
</div> -->
|
||||
|
||||
<div *ngFor="let page of getKeys(allPages)">
|
||||
<span>
|
||||
<span *ngIf="allPages.get(page)" class="activated" >
|
||||
<input (click)="togglePage(false, page)" class="deactivate" src="assets/imgs/delete-icon.png" title="Disable" width="20" type="image" height="20">
|
||||
</span>
|
||||
<span *ngIf="!allPages.get(page)" class="deactivated" >
|
||||
<input (click)="togglePage(true, page)" class="activate" src="assets/imgs/add-icon.png" title="Enable" width="20" type="image" height="20">
|
||||
</span>
|
||||
{{page.name}}
|
||||
</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group uk-grid">
|
||||
<label class="uk-width-2-3">Select if this class exists in OpenAIRE portal</label>
|
||||
<label class="uk-width-1-3 checkbox">
|
||||
<span style="font-weight: normal;">openaire</span>
|
||||
<input tabindex="0" type="checkbox" formControlName="openaire">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group uk-grid uk-margin-remove-top">
|
||||
<label class="uk-width-2-3">Select if this class exists in connect portals</label>
|
||||
<label class="uk-width-1-3 checkbox">
|
||||
<span style="font-weight: normal;">connect</span>
|
||||
<input tabindex="0" type="checkbox" formControlName="connect">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group uk-grid uk-margin-remove-top">
|
||||
<label class="uk-width-2-3">Select if this class exists in connect portals (community specific)</label>
|
||||
<label class="uk-width-1-3 checkbox">
|
||||
<span style="font-weight: normal;">communities</span>
|
||||
<input tabindex="0" type="checkbox" formControlName="communities">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<input type="hidden" formControlName="_id">
|
||||
</form>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import {Component, OnInit, Input} from '@angular/core';
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
|
||||
import {FormGroup, FormArray, FormBuilder, Validators, FormControl} from "@angular/forms";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { Page } from "../../domain/page";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
import {Subscription} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'divId-form',
|
||||
|
@ -21,8 +22,8 @@ export class DivIdFormComponent implements OnInit{
|
|||
@Input('formPages')
|
||||
formPages: Page[] = [];
|
||||
|
||||
//public allPages : Page[] = [];
|
||||
public allPages: Map<Page, boolean> = new Map<Page, boolean>();
|
||||
public allPages : Page[] = [];
|
||||
public allPagesFiltered: Map<Page, boolean> = new Map<Page, boolean>();
|
||||
private gotPages: boolean = false;
|
||||
|
||||
public properties:EnvProperties = null;
|
||||
|
@ -30,16 +31,43 @@ export class DivIdFormComponent implements OnInit{
|
|||
public showLoading: boolean = false;
|
||||
public errorMessage: string = '';
|
||||
selectedCommunityPid = null;
|
||||
|
||||
private sub: Subscription = null;
|
||||
|
||||
constructor(private route: ActivatedRoute, private _router: Router, public _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.selectedCommunityPid = params['communityId'];
|
||||
});
|
||||
// this.route.queryParams.subscribe(params => {
|
||||
// this.selectedCommunityPid = params['communityId'];
|
||||
// });
|
||||
});
|
||||
|
||||
this. sub = this.myForm.get('portalType').valueChanges.subscribe(portalType => {
|
||||
let pages = this.myForm.get('pages').value;
|
||||
//pages = pages.filter(page => page.portalType == portalType);
|
||||
//this.setPages(pages);
|
||||
|
||||
pages.forEach((page, i) => {
|
||||
if(page.portalType != portalType) {
|
||||
this.pages.removeAt(i);
|
||||
}
|
||||
});
|
||||
|
||||
this.allPagesFiltered.clear();
|
||||
this.allPages.filter(page => page.portalType == portalType).forEach(page => {
|
||||
this.allPagesFiltered.set(page, false);
|
||||
})
|
||||
//this.myForm.value.pages = [];
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if(this.sub) {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
public getKeys( map) {
|
||||
|
@ -53,14 +81,16 @@ export class DivIdFormComponent implements OnInit{
|
|||
this.showLoading = true;
|
||||
this.errorMessage = "";
|
||||
|
||||
this._helpContentService.getPages(this.properties.adminToolsAPIURL,this.selectedCommunityPid).subscribe(
|
||||
this._helpContentService.getAllPages(this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
//this.allPages = allPages;
|
||||
this.allPages = pages;
|
||||
let self = this;
|
||||
pages = pages.filter(page => page.portalType == self.myForm.get('portalType').value);
|
||||
for(let page of pages) {
|
||||
if(includedPages.has(page._id)) {
|
||||
this.allPages.set(page, true);
|
||||
this.allPagesFiltered.set(page, true);
|
||||
} else {
|
||||
this.allPages.set(page, false);
|
||||
this.allPagesFiltered.set(page, false);
|
||||
}
|
||||
}
|
||||
this.showLoading = false;
|
||||
|
@ -82,14 +112,14 @@ export class DivIdFormComponent implements OnInit{
|
|||
includedPages.add(pageName._id);
|
||||
}
|
||||
|
||||
let allPages = this.allPages;
|
||||
let allPages = this.allPagesFiltered;
|
||||
|
||||
let self = this;
|
||||
allPages.forEach(function (status, page, map) {
|
||||
if(includedPages.has(page._id)) {
|
||||
self.allPages.set(page, true);
|
||||
self.allPagesFiltered.set(page, true);
|
||||
} else {
|
||||
self.allPages.set(page, false);
|
||||
self.allPagesFiltered.set(page, false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -104,29 +134,25 @@ export class DivIdFormComponent implements OnInit{
|
|||
}
|
||||
|
||||
public get form() {
|
||||
return this._fb.group({
|
||||
_id: '',
|
||||
name : ['', Validators.required],
|
||||
pages: this._fb.array([]),
|
||||
openaire: true,
|
||||
connect: false,
|
||||
communities: true,
|
||||
isCollapsed: [true]
|
||||
});
|
||||
return this._fb.group({
|
||||
_id: '',
|
||||
name : ['', Validators.required],
|
||||
pages: this._fb.array([], Validators.required),
|
||||
portalType: ['', Validators.required],
|
||||
isCollapsed: [true]
|
||||
});
|
||||
}
|
||||
|
||||
public reset() {
|
||||
this.myForm.patchValue({
|
||||
_id : '',
|
||||
name : '',
|
||||
openaire: true,
|
||||
connect: false,
|
||||
communities: true,
|
||||
isCollapsed: [true]
|
||||
});
|
||||
this.myForm.patchValue({
|
||||
_id : '',
|
||||
name : '',
|
||||
portalType: '',
|
||||
pages: [],
|
||||
isCollapsed: [true]
|
||||
});
|
||||
|
||||
this.setPages([]);
|
||||
this.formPages = [];
|
||||
this.formPages = [];
|
||||
}
|
||||
|
||||
public get pages(): FormArray {
|
||||
|
@ -137,9 +163,20 @@ export class DivIdFormComponent implements OnInit{
|
|||
//const pageFormArray = this._fb.array(pages);
|
||||
//this.myForm.setControl('pages', pageFormArray);
|
||||
|
||||
const pageFGs = pages.map(page => this._fb.group(page));
|
||||
const pageFormArray = this._fb.array(pageFGs);
|
||||
this.myForm.setControl('pages', pageFormArray);
|
||||
//const pageFGs = pages.map(page => this._fb.group(page));
|
||||
//if(pages && pages.length > 0) {
|
||||
// const pageCtrls = pages.map(page => this._fb.control(page));
|
||||
// const pageFormArray = this._fb.array(pageCtrls);
|
||||
// this.myForm.setControl('pages', pageFormArray);
|
||||
//}
|
||||
|
||||
while (this.pages.length !== 0) {
|
||||
this.pages.removeAt(0)
|
||||
}
|
||||
pages.forEach(page => {
|
||||
//array.push(new FormControl(page));
|
||||
this.pages.push(this._fb.control(page));
|
||||
});
|
||||
}
|
||||
|
||||
indexOfPageInForm(pageId: string): number {
|
||||
|
@ -177,13 +214,13 @@ export class DivIdFormComponent implements OnInit{
|
|||
}
|
||||
}
|
||||
|
||||
this.allPages.set(page, status);
|
||||
this.allPagesFiltered.set(page, status);
|
||||
|
||||
if(status && index<0) {
|
||||
this.myForm.value.pages.push(page);
|
||||
this.pages.push(this._fb.control(page));
|
||||
} else if(!status){
|
||||
if(index >= 0) {
|
||||
this.myForm.value.pages.splice(index, 1);
|
||||
this.pages.removeAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<form target="BSFormPanel_Admin_1" class="search">
|
||||
<!-- <input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Class name..." type="text" class="uk-input uk-width-medium"/>
|
||||
<button class="uk-button" type="submit">Search</button> -->
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Class name..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Class name, portal type..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<button (click)="filterBySearch(keyword)" type="submit" class=" uk-button">
|
||||
<span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
|
@ -58,6 +58,7 @@
|
|||
<th>Name</th>
|
||||
<!-- <th>Community</th> -->
|
||||
<th>Page</th>
|
||||
<th>Portal Type</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -78,6 +79,9 @@
|
|||
<span *ngFor="let page of check.divId.pages let i=index">{{page.name}}<span *ngIf="i<(check.divId.pages.length-1)">, </span></span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="portalType" href="#">{{check.divId.portalType}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="actions" href="#">
|
||||
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editDivId(i)">
|
||||
|
|
|
@ -12,6 +12,7 @@ import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
|||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'divIds',
|
||||
|
@ -71,7 +72,8 @@ export class DivIdsComponent implements OnInit {
|
|||
|
||||
constructor(private element: ElementRef, private route: ActivatedRoute,
|
||||
private _router: Router, private title: Title,
|
||||
private _helpContentService: HelpContentService) {}
|
||||
private _helpContentService: HelpContentService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
getDivIds() {
|
||||
if(!Session.isLoggedIn()){
|
||||
|
@ -81,7 +83,7 @@ export class DivIdsComponent implements OnInit {
|
|||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
||||
this._helpContentService.getDivIdsFull(null, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getAllDivIdsFull(this.properties.adminToolsAPIURL).subscribe(
|
||||
divIds => {
|
||||
this.divIds = divIds;
|
||||
this.checkboxes = [];
|
||||
|
@ -158,6 +160,7 @@ export class DivIdsComponent implements OnInit {
|
|||
_ => {
|
||||
this.deleteDivIdsFromArray(this.selectedDivIds);
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("classes deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected classes', error)
|
||||
);
|
||||
|
@ -177,12 +180,14 @@ export class DivIdsComponent implements OnInit {
|
|||
|
||||
this.formGroup.patchValue(divId);
|
||||
this.formComponent.setPages(divId.pages as Page[]);//pageIds);
|
||||
this.formGroup.controls['portalType'].disable();
|
||||
|
||||
//this.updateModal.showModal();
|
||||
this.divIdsModalOpen(this.alertModalUpdateDivId, "Update", "Update Class");
|
||||
}
|
||||
|
||||
public newDivId() {
|
||||
this.formGroup.controls['portalType'].enable();
|
||||
this.formComponent.reset();
|
||||
this.modalErrorMessage = "";
|
||||
this.divIdsModalOpen(this.alertModalSaveDivId, "Save", "Add a new Class");
|
||||
|
@ -212,6 +217,7 @@ export class DivIdsComponent implements OnInit {
|
|||
this._helpContentService.saveDivId(<DivId> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
|
||||
divId => {
|
||||
this.divIdSavedSuccessfully(divId);
|
||||
this._clearCacheService.clearCache("class saved");
|
||||
},
|
||||
error => this.handleUpdateError("System error creating class", error)
|
||||
);
|
||||
|
@ -227,9 +233,11 @@ export class DivIdsComponent implements OnInit {
|
|||
this.divIdsModalOpen(this.alertModalUpdateDivId, "Update", "Update Class");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
} else {
|
||||
this.formGroup.controls['portalType'].enable();
|
||||
this._helpContentService.updateDivId(<DivId> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
|
||||
divId => {
|
||||
this.divIdUpdatedSuccessfully(divId);
|
||||
this._clearCacheService.clearCache("class updated");
|
||||
},
|
||||
error => this.handleUpdateError("System error updating class", error)
|
||||
);
|
||||
|
@ -260,7 +268,7 @@ export class DivIdsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public filterDivIds(divId : DivId) : boolean {
|
||||
let textFlag = this.searchText.toString() == '' || (divId.name).match(this.searchText) != null;
|
||||
let textFlag = this.searchText.toString() == '' || (divId.name + ' ' + divId.portalType).match(this.searchText) != null;
|
||||
return textFlag;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<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 *ngIf="!pageId"></option>
|
||||
<option *ngFor="let page of availablePages" [value]="page._id">{{page.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -116,7 +116,7 @@ export class DivContentFormComponent implements OnInit{
|
|||
//this.showLoading = true;
|
||||
this.errorMessage = '';
|
||||
|
||||
this._helpContentService.getDivIdsFull(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
this._helpContentService.getDivIdsFullByPortal(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
divs => {
|
||||
this.availableDivs = divs;
|
||||
this.pageId = pageId;
|
||||
|
@ -136,7 +136,7 @@ export class DivContentFormComponent implements OnInit{
|
|||
divId: ['', Validators.required],
|
||||
content: ['', Validators.required],
|
||||
isActive: true,
|
||||
community: '',
|
||||
portal: this.communityPid,
|
||||
_id : '',
|
||||
});
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ export class DivContentFormComponent implements OnInit{
|
|||
divId: '',
|
||||
content: '',
|
||||
isActive: true,
|
||||
community: '',
|
||||
portal: this.communityPid,
|
||||
_id : ''
|
||||
});
|
||||
this.myForm.markAsPristine();
|
||||
|
|
|
@ -4,7 +4,7 @@ import { FormGroup } from "@angular/forms";
|
|||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { DivHelpContent, CheckDivHelpContent, DivHelpContentFilterOptions } from "../../domain/div-help-content";
|
||||
import { Page } from "../../domain/page";
|
||||
import { Community } from "../../domain/community";
|
||||
import { Portal } from "../../domain/portal";
|
||||
import { DivId } from "../../domain/divId";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe';
|
||||
|
@ -14,6 +14,7 @@ import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.cla
|
|||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {PageHelpContent} from "../../domain/page-help-content";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'div-help-contents',
|
||||
|
@ -43,13 +44,13 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
public counter = {all : 0, active : 0, inactive : 0};
|
||||
|
||||
public communities: Community[] = [];
|
||||
public communities: Portal[] = [];
|
||||
|
||||
public selectedCommunityPid: string;
|
||||
|
||||
public selectedPageId: string;
|
||||
|
||||
public community: Community;
|
||||
public community: Portal;
|
||||
|
||||
public page: Page;
|
||||
public properties:EnvProperties = null;
|
||||
|
@ -81,7 +82,8 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
constructor(private element: ElementRef, private route: ActivatedRoute,
|
||||
private title: Title,
|
||||
private _helpService: HelpContentService, private router : Router) {}
|
||||
private _helpService: HelpContentService, private router : Router,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
getPage(pageId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
|
@ -90,11 +92,12 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
|
||||
page => {
|
||||
if( (this.selectedCommunityPid == 'openaire' && !page.openaire)
|
||||
|| (this.selectedCommunityPid == 'connect' && !page.connect)
|
||||
|| (this.selectedCommunityPid != 'openaire' && this.selectedCommunityPid != 'connect' && !page.communities)) {
|
||||
// if( (this.selectedCommunityPid == 'openaire' && !page.openaire)
|
||||
// || (this.selectedCommunityPid == 'connect' && !page.connect)
|
||||
// || (this.selectedCommunityPid != 'openaire' && this.selectedCommunityPid != 'connect' && !page.communities)) {
|
||||
if(this.properties.adminToolsPortalType != page.portalType) {
|
||||
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.selectedCommunityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
|
@ -217,10 +220,11 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
this._helpService.deleteDivHelpContents(this.selectedDivContents, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.deleteDivHelpContents(this.selectedDivContents, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
|
||||
_ => {
|
||||
this.deleteDivHelpContentsFromArray(this.selectedDivContents);
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("class help contents deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected class content(s)', error)
|
||||
);
|
||||
|
@ -252,7 +256,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
} else {
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
this._helpService.toggleDivHelpContents(ids,status, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.toggleDivHelpContents(ids,status, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
|
||||
() => {
|
||||
for(let id of ids) {
|
||||
let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
|
||||
|
@ -260,6 +264,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
this.countDivHelpContents();
|
||||
this.applyCheck(false);
|
||||
this._clearCacheService.clearCache("class help contents toggled (status: "+status+")");
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
||||
);
|
||||
|
|
|
@ -11,6 +11,7 @@ import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.cla
|
|||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Page} from "../../domain/page";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'edit-div-help-content',
|
||||
|
@ -41,7 +42,8 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private title: Title,
|
||||
private _helpContentService: HelpContentService) {}
|
||||
private _helpContentService: HelpContentService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
|
@ -80,11 +82,12 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
}
|
||||
|
||||
private getPage(pageId: string) {
|
||||
this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
page => {
|
||||
if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
|| (this.communityPid == 'connect' && !page.connect)
|
||||
|| (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
// if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
// || (this.communityPid == 'connect' && !page.connect)
|
||||
// || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
if(this.properties.adminToolsPortalType != page.portalType) {
|
||||
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
|
@ -103,7 +106,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.errorMessage = "";
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
this._helpContentService.getDivHelpContent(divContentId, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getDivHelpContent(divContentId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
divHelpContent => {
|
||||
if(this.pageId) {
|
||||
this.getPage(this.pageId);
|
||||
|
@ -121,7 +124,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
} else {
|
||||
this.showLoading = true;
|
||||
|
||||
this._helpContentService.getDivIdFull(divId, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getDivIdFull(divId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
div => {
|
||||
this.formComponent.selectedDiv = div;
|
||||
|
||||
|
@ -154,7 +157,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
|
||||
let divHelpContent : DivHelpContent = this.formComponent.myForm.value;
|
||||
|
||||
this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.updateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/classContents/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
|
||||
|
@ -162,6 +165,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid } } );
|
||||
}
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("class help content updated");
|
||||
},
|
||||
err => this.handleUpdateError('System error updating class content', err)
|
||||
);
|
||||
|
|
|
@ -10,6 +10,7 @@ import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.cla
|
|||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Page} from "../../domain/page";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'new-div-help-content',
|
||||
|
@ -39,7 +40,8 @@ export class NewDivHelpContentComponent {
|
|||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private title: Title,
|
||||
private _helpContentService: HelpContentService) {}
|
||||
private _helpContentService: HelpContentService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
|
@ -62,11 +64,12 @@ export class NewDivHelpContentComponent {
|
|||
}
|
||||
|
||||
private getPage(pageId: string) {
|
||||
this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
page => {
|
||||
if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
|| (this.communityPid == 'connect' && !page.connect)
|
||||
|| (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
// if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
// || (this.communityPid == 'connect' && !page.connect)
|
||||
// || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
if(this.properties.adminToolsPortalType != page.portalType) {
|
||||
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
|
@ -88,7 +91,7 @@ export class NewDivHelpContentComponent {
|
|||
|
||||
let divHelpContent : DivHelpContent = this.formComponent.myForm.value;
|
||||
|
||||
this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.saveDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/classContents/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
|
||||
|
@ -96,6 +99,7 @@ export class NewDivHelpContentComponent {
|
|||
this.router.navigate(['/classContents'], { queryParams: { "communityId": this.communityPid } } );
|
||||
}
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("class help content saved");
|
||||
},
|
||||
err => this.handleUpdateError('System error saving page content', err)
|
||||
);
|
||||
|
|
|
@ -4,13 +4,14 @@ import { HelpContentService } from '../../services/help-content.service';
|
|||
import { FormGroup } from '@angular/forms';
|
||||
import { EntityFormComponent } from './entity-form.component';
|
||||
import { CheckEntity, Entity } from '../../domain/entity';
|
||||
import { Community } from '../../domain/community';
|
||||
import { Portal } from '../../domain/portal';
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {UserManagementService} from '../../openaireLibrary/services/user-management.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'entities',
|
||||
|
@ -42,7 +43,7 @@ export class EntitiesComponent implements OnInit {
|
|||
private searchText: RegExp = new RegExp('');
|
||||
public keyword = '';
|
||||
|
||||
public communities: Community[] = [];
|
||||
public communities: Portal[] = [];
|
||||
public selectedCommunityPid: string;
|
||||
|
||||
@ViewChild('AlertModalRelatedPages') alertModalRelatedPages;
|
||||
|
@ -60,7 +61,8 @@ export class EntitiesComponent implements OnInit {
|
|||
constructor(private element: ElementRef, private route: ActivatedRoute,
|
||||
private _router: Router, private title: Title,
|
||||
private _helpContentService: HelpContentService,
|
||||
private userManagementService: UserManagementService) {}
|
||||
private userManagementService: UserManagementService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.formGroup = this.formComponent.form;
|
||||
|
@ -178,6 +180,7 @@ export class EntitiesComponent implements OnInit {
|
|||
_ => {
|
||||
this.deleteEntitiesFromArray(this.selectedEntities);
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("entities deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected entities', error)
|
||||
);
|
||||
|
@ -224,6 +227,7 @@ export class EntitiesComponent implements OnInit {
|
|||
this._helpContentService.saveEntity(<Entity> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
|
||||
entity => {
|
||||
this.entitySavedSuccessfully(entity);
|
||||
this._clearCacheService.clearCache("entity saved");
|
||||
},
|
||||
error => this.handleUpdateError('System error creating entity', error)
|
||||
);
|
||||
|
@ -244,6 +248,7 @@ export class EntitiesComponent implements OnInit {
|
|||
<Entity> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
|
||||
entity => {
|
||||
this.entityUpdatedSuccessfully(entity);
|
||||
this._clearCacheService.clearCache("entity updated");
|
||||
},
|
||||
error => this.handleUpdateError('System error updating entity', error)
|
||||
);
|
||||
|
@ -335,6 +340,7 @@ export class EntitiesComponent implements OnInit {
|
|||
this.checkboxes[i].entity.isEnabled = this.toggleStatus;
|
||||
}
|
||||
this.applyCheck(false);
|
||||
this._clearCacheService.clearCache("entities toggled (status: "+this.toggleStatus+")");
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error)
|
||||
);
|
||||
|
|
|
@ -14,6 +14,7 @@ import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.cla
|
|||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Page} from "../../domain/page";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'edit-page-help-content',
|
||||
|
@ -46,7 +47,8 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private title: Title,
|
||||
private _helpContentService: HelpContentService) {}
|
||||
private _helpContentService: HelpContentService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
|
@ -84,11 +86,12 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
}
|
||||
|
||||
private getPage(pageId: string) {
|
||||
this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
page => {
|
||||
if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
|| (this.communityPid == 'connect' && !page.connect)
|
||||
|| (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
// if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
// || (this.communityPid == 'connect' && !page.connect)
|
||||
// || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
if(this.properties.adminToolsPortalType != page.portalType) {
|
||||
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
|
@ -108,7 +111,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.errorMessage = "";
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
pageHelpContent => {
|
||||
if(this.pageId && this.pageId != pageHelpContent.page) {
|
||||
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
|
||||
|
@ -139,7 +142,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.updateErrorMessage = "";
|
||||
|
||||
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
||||
this._helpContentService.updatePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.updatePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
|
||||
|
@ -147,6 +150,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} } );
|
||||
}
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("page help content updated");
|
||||
},
|
||||
err => this.handleUpdateError('System error updating page content', err)
|
||||
);
|
||||
|
|
|
@ -13,6 +13,7 @@ import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.cla
|
|||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Page} from "../../domain/page";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'new-page-help-content',
|
||||
|
@ -42,7 +43,8 @@ export class NewPageHelpContentComponent {
|
|||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private title: Title,
|
||||
private _helpContentService: HelpContentService) {}
|
||||
private _helpContentService: HelpContentService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
|
@ -64,11 +66,12 @@ export class NewPageHelpContentComponent {
|
|||
}
|
||||
|
||||
private getPage(pageId: string) {
|
||||
this._helpContentService.getPage(pageId,this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
page => {
|
||||
if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
|| (this.communityPid == 'connect' && !page.connect)
|
||||
|| (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
// if( (this.communityPid == 'openaire' && !page.openaire)
|
||||
// || (this.communityPid == 'connect' && !page.connect)
|
||||
// || (this.communityPid != 'openaire' && this.communityPid != 'connect' && !page.communities)) {
|
||||
if(this.properties.adminToolsPortalType != page.portalType) {
|
||||
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
|
@ -93,7 +96,7 @@ export class NewPageHelpContentComponent {
|
|||
|
||||
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
||||
|
||||
this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
|
||||
|
@ -101,6 +104,7 @@ export class NewPageHelpContentComponent {
|
|||
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
|
||||
}
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("page help content saved");
|
||||
},
|
||||
err => this.handleUpdateError('System error saving page content', err)
|
||||
);
|
||||
|
|
|
@ -49,12 +49,12 @@ export class PageContentFormComponent implements OnInit{
|
|||
if(!this.pageId) {
|
||||
this.myForm.valueChanges.subscribe(value => {
|
||||
let pageId = value.page;
|
||||
this._helpContentService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(page => {
|
||||
this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(page => {
|
||||
this.setPlacements(page);
|
||||
});
|
||||
});
|
||||
}
|
||||
this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid, true).subscribe(
|
||||
this._helpContentService.getCommunityPagesWithPositions(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
this.availablePages = pages;
|
||||
this.showLoading = false;
|
||||
|
@ -74,7 +74,7 @@ export class PageContentFormComponent implements OnInit{
|
|||
public get form() {
|
||||
return this._fb.group({
|
||||
page : [this.pageId, Validators.required],
|
||||
community : this.communityPid,
|
||||
portal : this.communityPid,
|
||||
placement : ['', Validators.required],
|
||||
content : ['', Validators.required],
|
||||
order : [1, Validators.required],
|
||||
|
@ -87,7 +87,7 @@ export class PageContentFormComponent implements OnInit{
|
|||
public reset() {
|
||||
this.myForm.patchValue({
|
||||
page : '',
|
||||
community : this.communityPid,
|
||||
portal : this.communityPid,
|
||||
placement : '',
|
||||
content : [''],
|
||||
order : 1,
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
|
||||
</td>
|
||||
<td *ngIf="!selectedPageId">
|
||||
<div class="community" href="#">{{check.pageHelpContent.community.name}}</div>
|
||||
<div class="community" href="#">{{check.pageHelpContent.portal.name}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<!-- <div class="content" [innerHtml]="check.pageHelpContent.content | safeHtml"></div>-->
|
||||
|
|
|
@ -7,7 +7,7 @@ import { ActivatedRoute, Router } from "@angular/router";
|
|||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { PageHelpContent, CheckPageHelpContent, PageHelpContentFilterOptions } from "../../domain/page-help-content";
|
||||
import { Page } from "../../domain/page";
|
||||
import { Community } from "../../domain/community";
|
||||
import { Portal } from "../../domain/portal";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe';
|
||||
|
||||
|
@ -15,6 +15,7 @@ import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
|||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'page-help-contents',
|
||||
|
@ -55,13 +56,13 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
public counter = {all : 0, active : 0, inactive : 0};
|
||||
|
||||
public communities: Community[] = [];
|
||||
public communities: Portal[] = [];
|
||||
|
||||
public selectedCommunityPid: string;
|
||||
|
||||
public selectedPageId: string;
|
||||
|
||||
public community: Community;
|
||||
public community: Portal;
|
||||
|
||||
public page: Page;
|
||||
public properties:EnvProperties = null;
|
||||
|
@ -93,7 +94,8 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
constructor(private element: ElementRef, private route: ActivatedRoute,
|
||||
private title: Title,
|
||||
private router : Router, private _helpService: HelpContentService) {}
|
||||
private router : Router, private _helpService: HelpContentService,
|
||||
private _clearCacheService: ClearCacheService) {}
|
||||
|
||||
getPage(pageId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
|
@ -103,11 +105,12 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
||||
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
|
||||
page => {
|
||||
if( (this.selectedCommunityPid == 'openaire' && !page.openaire)
|
||||
|| (this.selectedCommunityPid == 'connect' && !page.connect)
|
||||
|| (this.selectedCommunityPid != 'openaire' && this.selectedCommunityPid != 'connect' && !page.communities)) {
|
||||
// if( (this.selectedCommunityPid == 'openaire' && !page.openaire)
|
||||
// || (this.selectedCommunityPid == 'connect' && !page.connect)
|
||||
// || (this.selectedCommunityPid != 'openaire' && this.selectedCommunityPid != 'connect' && !page.communities)) {
|
||||
if(this.properties.adminToolsPortalType != page.portalType) {
|
||||
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.selectedCommunityPid} });
|
||||
} else {
|
||||
this.page = page;
|
||||
|
@ -127,7 +130,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.errorMessage = "";
|
||||
|
||||
//this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.getPages(this.properties.adminToolsAPIURL, community_pid, true).subscribe(
|
||||
this._helpService.getCommunityPagesWithPositions(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
this.pages = pages;
|
||||
this.getPageHelpContents(this.selectedCommunityPid);
|
||||
|
@ -231,10 +234,11 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
this._helpService.deletePageHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.deletePageHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
|
||||
_ => {
|
||||
this.deletePageHelpContentsFromArray(this.selectedPageContents);
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("page help contents deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected page content(s)', error)
|
||||
);
|
||||
|
@ -266,7 +270,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
} else {
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
this._helpService.togglePageHelpContents(ids,status, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpService.togglePageHelpContents(ids,status, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
|
||||
() => {
|
||||
for(let id of ids) {
|
||||
let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id);
|
||||
|
@ -274,6 +278,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
this.countPageHelpContents();
|
||||
this.applyCheck(false);
|
||||
this._clearCacheService.clearCache("page help contents toggled (status: "+status+")");
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
||||
);
|
||||
|
|
|
@ -86,7 +86,7 @@ export class EditHtmlPageContentComponent implements OnInit {
|
|||
if(!Session.isLoggedIn()){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this._helpContentService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
page => {
|
||||
this.pageName = page.name;
|
||||
this.getHtmlPageContent(communityId, page.route);
|
||||
|
|
|
@ -70,23 +70,37 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group" uk-grid>
|
||||
<div [ngClass]="{'has-error':!myForm.controls.portalType.valid && myForm.controls.portalType.dirty}" class="form-group" uk-grid>
|
||||
<label class="uk-width-1-1 uk-margin-small-bottom">
|
||||
Select if this page exists in:
|
||||
Page exists in:
|
||||
</label>
|
||||
<label class="uk-width-1-1 checkbox uk-margin-large-left">
|
||||
<label class="uk-width-1-1 radio uk-margin-large-left">
|
||||
<span class="uk-margin-small-right" style="font-weight: normal;">OpenAIRE portal</span>
|
||||
<input tabindex="0" type="checkbox" formControlName="openaire">
|
||||
<!-- <input tabindex="0" type="checkbox" formControlName="openaire">-->
|
||||
<input type="radio" value="explore" formControlName="portalType">
|
||||
</label>
|
||||
<label class="uk-width-1-1 checkbox uk-margin-large-left">
|
||||
<label class="uk-width-1-1 radio uk-margin-large-left">
|
||||
<span class="uk-margin-small-right" style="font-weight: normal;">OpenAIRE Connect portal</span>
|
||||
<input tabindex="0" type="checkbox" formControlName="connect">
|
||||
<!-- <input tabindex="0" type="checkbox" formControlName="connect">-->
|
||||
<input type="radio" value="connect" formControlName="portalType">
|
||||
</label>
|
||||
<label class="uk-width-1-1 checkbox uk-margin-large-left">
|
||||
<label class="uk-width-1-1 radio uk-margin-large-left">
|
||||
<span class="uk-margin-small-right" style="font-weight: normal;">Communities' Gateway</span>
|
||||
<input tabindex="0" type="checkbox" formControlName="communities">
|
||||
<!-- <input tabindex="0" type="checkbox" formControlName="communities">-->
|
||||
<input type="radio" value="community" formControlName="portalType">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- <div *ngIf="update" class="form-group uk-disabled" uk-grid>-->
|
||||
<!-- <label class="uk-width-1-1 radio">-->
|
||||
<!-- This page exists in:-->
|
||||
<!-- <span class="uk-margin-small-left uk-text-bold">-->
|
||||
<!-- <span *ngIf="myForm.value.portalType == 'explore'">OpenAIRE portal</span>-->
|
||||
<!-- <span *ngIf="myForm.value.portalType == 'connect'">OpenAIRE Connect portal</span>-->
|
||||
<!-- <span *ngIf="myForm.value.portalType == 'community'">Communities' Gateway</span>-->
|
||||
<!-- </span>-->
|
||||
<!-- </label>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<input type="hidden" formControlName="_id">
|
||||
</form>
|
||||
|
|
|
@ -104,9 +104,7 @@ export class PageFormComponent implements OnInit{
|
|||
route : ['', Validators.required],
|
||||
name : ['', Validators.required],
|
||||
isEnabled: '',
|
||||
openaire: true,
|
||||
connect: false,
|
||||
communities: true,
|
||||
portalType: ['', Validators.required],
|
||||
top: true,
|
||||
bottom: true,
|
||||
left: true,
|
||||
|
@ -124,9 +122,7 @@ export class PageFormComponent implements OnInit{
|
|||
name : '',
|
||||
type: '',
|
||||
isEnabled: '',
|
||||
openaire: true,
|
||||
connect: false,
|
||||
communities: true,
|
||||
portalType: '',
|
||||
top: true,
|
||||
bottom: true,
|
||||
left: true,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<form target="BSFormPanel_Admin_1" class="search">
|
||||
<!-- <input [(ngModel)]="inputstring" (keyup.enter)="filterBySearch(inputstring)" placeholder="Page name..." type="text" name="searchForm" class="uk-input uk-width-medium"/>
|
||||
<button class="uk-button" type="submit">Search</button> -->
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Page name..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<input type="text" class="uk-input uk-width-medium" placeholder="Page name, portal type..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
|
||||
<button (click)="filterBySearch(keyword)" type="submit" class=" uk-button">
|
||||
<span class="uk-icon">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
|
||||
|
@ -62,6 +62,7 @@
|
|||
<th *ngIf="!pagesType">Type</th>
|
||||
<th *ngIf="!isPortalAdministrator">Related Entities</th>
|
||||
<th>Route</th>
|
||||
<th *ngIf="!selectedCommunityPid">Portal Type</th>
|
||||
<th *ngIf="isPortalAdministrator" >Actions</th>
|
||||
<th *ngIf="!isPortalAdministrator" class="uk-text-center">Page help texts</th>
|
||||
<th *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)" class="uk-text-center">Class help texts</th>
|
||||
|
@ -91,6 +92,9 @@
|
|||
<div class="route" href="#">{{check.page.route}}</div>
|
||||
</td>
|
||||
|
||||
<td *ngIf="!selectedCommunityPid">
|
||||
<div class="portalType" href="#">{{check.page.portalType}}</div>
|
||||
</td>
|
||||
<td *ngIf="isPortalAdministrator" >
|
||||
<div class="actions" href="#">
|
||||
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editPage(i)">
|
||||
|
|
|
@ -7,7 +7,7 @@ import {HelpContentService} from '../../services/help-content.service';
|
|||
import {FormGroup} from '@angular/forms';
|
||||
import {PageFormComponent} from './page-form.component';
|
||||
import {CheckPage, Page} from '../../domain/page';
|
||||
import {Community} from '../../domain/community';
|
||||
import {Portal} from '../../domain/portal';
|
||||
import {Entity} from '../../domain/entity';
|
||||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
|
@ -16,6 +16,7 @@ import {HelperFunctions} from '../../openaireLibrary/utils/HelperFunctions.class
|
|||
import {UserManagementService} from '../../openaireLibrary/services/user-management.service';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {StringUtils} from '../../openaireLibrary/utils/string-utils.class';
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
|
||||
@Component({
|
||||
selector: 'pages',
|
||||
|
@ -44,7 +45,7 @@ export class PagesComponent implements OnInit {
|
|||
private searchText: RegExp = new RegExp('');
|
||||
public keyword: string = '';
|
||||
|
||||
public communities: Community[] = [];
|
||||
public communities: Portal[] = [];
|
||||
|
||||
public selectedCommunityPid: string;
|
||||
|
||||
|
@ -60,7 +61,8 @@ export class PagesComponent implements OnInit {
|
|||
constructor(private element: ElementRef, private route: ActivatedRoute,
|
||||
private title: Title,
|
||||
private _router: Router, private _helpContentService: HelpContentService,
|
||||
private userManagementService: UserManagementService) {
|
||||
private userManagementService: UserManagementService,
|
||||
private _clearCacheService: ClearCacheService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -104,7 +106,7 @@ export class PagesComponent implements OnInit {
|
|||
parameters = '?page_type=' + this.pagesType;
|
||||
}
|
||||
if (community_pid) {
|
||||
this._helpContentService.getCommunityPages(community_pid, parameters, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getCommunityPagesByType(community_pid, this.pagesType, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
this.pagesReturned(pages);
|
||||
//if(!this.pagesType || this.pagesType == "link") {
|
||||
|
@ -116,7 +118,7 @@ export class PagesComponent implements OnInit {
|
|||
error => this.handleError('System error retrieving pages', error)
|
||||
);
|
||||
} else {
|
||||
this._helpContentService.getPagesFull(this.properties.adminToolsAPIURL, null).subscribe(
|
||||
this._helpContentService.getAllPagesFull(this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
this.pagesReturned(pages);
|
||||
this.showLoading = false;
|
||||
|
@ -131,7 +133,7 @@ export class PagesComponent implements OnInit {
|
|||
if (!Session.isLoggedIn()) {
|
||||
this._router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
|
||||
} else {
|
||||
this._helpContentService.getPagesWithDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
this._helpContentService.getPageIdsFromDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
this.pageWithDivIds = pages;
|
||||
this.showLoading = false;
|
||||
|
@ -221,6 +223,7 @@ export class PagesComponent implements OnInit {
|
|||
_ => {
|
||||
this.deletePagesFromArray(this.selectedPages);
|
||||
this.showLoading = false;
|
||||
this._clearCacheService.clearCache("pages deleted");
|
||||
},
|
||||
error => this.handleUpdateError('System error deleting the selected pages', error)
|
||||
);
|
||||
|
@ -231,6 +234,7 @@ export class PagesComponent implements OnInit {
|
|||
let page: Page = this.checkboxes[i].page;
|
||||
this.formGroup.patchValue(page);
|
||||
this.formComponent.setEntities(page.entities as Entity[]);
|
||||
this.formGroup.controls['portalType'].disable();
|
||||
|
||||
//console.info(this.formGroup.value);
|
||||
//this.updateModal.showModal();
|
||||
|
@ -239,6 +243,7 @@ export class PagesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public newPage() {
|
||||
this.formGroup.controls['portalType'].enable();
|
||||
this.formComponent.reset();
|
||||
this.modalErrorMessage = '';
|
||||
this.pagesModalOpen(this.alertModalSavePage, 'Save', 'Add a new Page');
|
||||
|
@ -268,6 +273,7 @@ export class PagesComponent implements OnInit {
|
|||
this._helpContentService.savePage(<Page>this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
|
||||
page => {
|
||||
this.pageSavedSuccessfully(page);
|
||||
this._clearCacheService.clearCache("page saved");
|
||||
},
|
||||
error => this.handleUpdateError('System error creating page', error)
|
||||
);
|
||||
|
@ -283,9 +289,11 @@ export class PagesComponent implements OnInit {
|
|||
this.pagesModalOpen(this.alertModalUpdatePage, 'Update', 'Update Page');
|
||||
this.modalErrorMessage = 'Please fill in all required fields marked with *';
|
||||
} else {
|
||||
this.formGroup.controls['portalType'].enable();
|
||||
this._helpContentService.updatePage(<Page>this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
|
||||
page => {
|
||||
this.pageUpdatedSuccessfully(page);
|
||||
this._clearCacheService.clearCache("page updated");
|
||||
},
|
||||
error => this.handleUpdateError('System error updating page', error)
|
||||
);
|
||||
|
@ -316,7 +324,7 @@ export class PagesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public filterPages(page: Page): boolean {
|
||||
let textFlag = this.searchText.toString() == '' || (page.route + ' ' + page.name).match(this.searchText) != null;
|
||||
let textFlag = this.searchText.toString() == '' || (page.route + ' ' + page.name + ' ' + page.type + ' ' + page.portalType).match(this.searchText) != null;
|
||||
return textFlag;
|
||||
}
|
||||
|
||||
|
@ -364,6 +372,7 @@ export class PagesComponent implements OnInit {
|
|||
this.checkboxes[i].page.isEnabled = status;
|
||||
}
|
||||
this.applyCheck(false);
|
||||
this._clearCacheService.clearCache("pages toggled (status: "+status+")");
|
||||
},
|
||||
error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
|
||||
);
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Component, OnInit, ElementRef} from '@angular/core';
|
|||
import {HelpContentService} from '../../services/help-content.service';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import { Community } from '../../domain/community';
|
||||
import { Portal } from '../../domain/portal';
|
||||
import {DomSanitizer, Title} from '@angular/platform-browser';
|
||||
import {TitleCasePipe} from '@angular/common';
|
||||
import {availableEntitiesMap, StatisticsDisplay, StatisticsSummary} from '../../openaireLibrary/connect/statistics/statisticsEntities';
|
||||
|
@ -25,7 +25,7 @@ export class StatsComponent implements OnInit {
|
|||
public errorMessage: string = '';
|
||||
public updateErrorMessage: string = '';
|
||||
|
||||
communities: Community[] = [];
|
||||
communities: Portal[] = [];
|
||||
communityId: string;
|
||||
communityInfo = null;
|
||||
deactivatedEntity: boolean;
|
||||
|
|
|
@ -13,7 +13,7 @@ export class ManageUserNotificationsService {
|
|||
}
|
||||
|
||||
getUserNotifications(properties: EnvProperties, pid: string, email: string) {
|
||||
let url: string = properties.adminToolsAPIURL + 'community/'+ pid + '/notifications';
|
||||
let url: string = properties.adminToolsAPIURL + properties.adminToolsPortalType + '/'+ pid + '/notifications';
|
||||
return this.http.get(url)//.map(res => <any> res.json())
|
||||
.pipe(map(res => this.parseUserNotifications(res, email)));
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export class ManageUserNotificationsService {
|
|||
//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';
|
||||
let url: string = properties.adminToolsAPIURL + properties.adminToolsPortalType + '/' + pid + '/notifications';
|
||||
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody());
|
||||
//.do(request => console.log("Insert Response:"+request.status));
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*/
|
||||
import { Injectable } from '@angular/core';
|
||||
import {HttpClient, HttpErrorResponse, HttpHeaders} from "@angular/common/http";
|
||||
import { Observable } from 'rxjs';
|
||||
import {Observable, Subscription} from 'rxjs';
|
||||
import { Page } from "../domain/page";
|
||||
import { PageHelpContent } from "../domain/page-help-content";
|
||||
import { Community } from "../domain/community";
|
||||
import { Portal } from "../domain/portal";
|
||||
import { Entity } from "../domain/entity";
|
||||
import { DivId } from "../domain/divId";
|
||||
import { DivHelpContent } from "../domain/div-help-content";
|
||||
|
@ -14,366 +14,430 @@ import {StatisticsDisplay, StatisticsSummary} from '../openaireLibrary/connect/s
|
|||
import { CustomOptions } from '../openaireLibrary/services/servicesUtils/customOptions.class';
|
||||
import {catchError, map} from "rxjs/operators";
|
||||
import {COOKIE} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {properties} from "../../environments/environment";
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class HelpContentService {
|
||||
|
||||
constructor(private http:HttpClient) {
|
||||
}
|
||||
constructor(private http:HttpClient) {
|
||||
}
|
||||
|
||||
static removeNulls(obj){
|
||||
var isArray = obj instanceof Array;
|
||||
for (var k in obj){
|
||||
if (obj[k]===null || obj[k]==='') isArray ? obj.splice(k,1) : delete obj[k];
|
||||
else if (typeof obj[k]=="object") HelpContentService.removeNulls(obj[k]);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
static removeNulls(obj){
|
||||
var isArray = obj instanceof Array;
|
||||
for (var k in obj){
|
||||
if (obj[k]===null || obj[k]==='') isArray ? obj.splice(k,1) : delete obj[k];
|
||||
else if (typeof obj[k]=="object") HelpContentService.removeNulls(obj[k]);
|
||||
}
|
||||
}
|
||||
|
||||
return this.http.get<Array<DivId>>(helpContentUrl + 'divFull'+parameters)
|
||||
//.map(res => <Array<DivId>> res.json())
|
||||
getEntities(helpContentUrl:string) {
|
||||
return this.http.get<Array<Entity>>(helpContentUrl + 'entity')
|
||||
//.map(res => <Array<Entity>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
saveEntity(entity: Entity, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(entity);
|
||||
|
||||
return this.http.post<Entity>(helpContentUrl + 'entity/save', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Entity> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updateEntity(entity: Entity, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(entity);
|
||||
|
||||
return this.http.post<Entity>(helpContentUrl + 'entity/update', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Entity> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deleteEntities(ids : string[], helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'entity/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
// toggleEntity(selectedCommunityId: string, id : string,status : boolean) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
//
|
||||
// return this.http.post(helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options)
|
||||
// .catch(this.handleError);
|
||||
// }
|
||||
|
||||
getCommunityEntities(pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<Entity>>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/entities')
|
||||
//.map(res => <Array<Entity>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
toggleEntities(pid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/'+pid+ '/entity/toggle?status='+ status.toString(),
|
||||
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
// unused
|
||||
toggleEntityOfPage(pageId: string, entityId : string,status : boolean, helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'page/'+pageId+'/entity/toggle?status='+ status.toString()+'&entityId='+entityId.toString(),
|
||||
CustomOptions.getAuthOptionsWithBody())
|
||||
.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 += "&portal="+pid;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return this.http.get<Array<DivId>>(helpContentUrl + 'div/full'+parameters)
|
||||
// //.map(res => <Array<DivId>> res.json())
|
||||
// .pipe(catchError(this.handleError));
|
||||
// }
|
||||
|
||||
// Replacing getDivIdsFull
|
||||
getAllDivIdsFull(helpContentUrl:string) {
|
||||
return this.http.get<Array<DivId>>(helpContentUrl + 'div/full')
|
||||
//.map(res => <Array<DivId>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getDivIdsFullByPortal(page_id: string, helpContentUrl:string, pid: string) {
|
||||
let parameters: string = page_id ? "?&page="+page_id : "";
|
||||
|
||||
return this.http.get<Array<DivId>>(helpContentUrl + properties.adminToolsPortalType + '/'+pid + '/div/full'+parameters)
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
// End of replacing getDivIdsFull
|
||||
|
||||
// unused
|
||||
getDivId(divId: string, helpContentUrl:string) {
|
||||
return this.http.get<DivId>(helpContentUrl + 'div/'+divId)
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
}
|
||||
|
||||
updateDivId(divId: DivId, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(divId);
|
||||
getDivIdFull(divId: string, helpContentUrl:string, pid: string) {
|
||||
return this.http.get<DivId>(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/div/'+divId+"/full")
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
return this.http.post<DivId>(helpContentUrl + 'div/update', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
updateDivId(divId: DivId, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(divId);
|
||||
|
||||
getDivId(divId: string, helpContentUrl:string) {
|
||||
return this.http.get<DivId>(helpContentUrl + 'div/'+divId)
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
return this.http.post<DivId>(helpContentUrl + 'div/update', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getDivIdFull(divId: string, helpContentUrl:string) {
|
||||
return this.http.get<DivId>(helpContentUrl + 'divFull/'+divId)
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
saveDivId(divId: DivId, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(divId);
|
||||
|
||||
saveDivId(divId: DivId, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(divId);
|
||||
return this.http.post<DivId>(helpContentUrl + 'div/save', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deleteDivIds(ids : string[], helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'div/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getPageIdsFromDivIds(pid: string, helpContentUrl:string) {
|
||||
//let parameters = (pid ? "?portal="+pid : "");
|
||||
return this.http.get<Array<string>>(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/div/pages')
|
||||
//.map(res => <Map<string, Set<string>>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
return this.http.post<DivId>(helpContentUrl + 'div/save', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <DivId> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
/*
|
||||
getCommunitiesWithDivId(helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community?div=true')
|
||||
.map(res => <Array<Community>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
getCommunitiesWithDivId(helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community?div=true')
|
||||
.map(res => <Array<Portal>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
*/
|
||||
getCommunityPagesWithDivId(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + 'community/'+community_pid+'/pages?div=true')
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunityDivHelpContents(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<DivHelpContent>>(helpContentUrl + 'divhelpcontent?community='+community_pid)
|
||||
//.map(res => <Array<DivHelpContent>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
getCommunityDivHelpContents(pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<DivHelpContent>>(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/divhelpcontent')
|
||||
//.map(res => <Array<DivHelpContent>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getDivHelpContent(id : string, helpContentUrl:string) {
|
||||
return this.http.get<DivHelpContent>(helpContentUrl + 'divhelpcontent/' + id)
|
||||
getDivHelpContent(id : string, helpContentUrl:string, pid: string) {
|
||||
return this.http.get<DivHelpContent>(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/divhelpcontent/' + id)
|
||||
//.map(res => <DivHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
// unused
|
||||
insertOrUpdateDivHelpContent(divHelpContent: DivHelpContent, helpContentUrl:string, pid: string) {
|
||||
HelpContentService.removeNulls(divHelpContent);
|
||||
|
||||
return this.http.post<DivHelpContent>(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/divhelpcontent',
|
||||
JSON.stringify(divHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <DivHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
}
|
||||
|
||||
insertOrUpdateDivHelpContent(divHelpContent: DivHelpContent, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(divHelpContent);
|
||||
saveDivHelpContent(divHelpContent: DivHelpContent, helpContentUrl:string, pid: string) {
|
||||
HelpContentService.removeNulls(divHelpContent);
|
||||
|
||||
return this.http.post<DivHelpContent>(helpContentUrl + 'divhelpcontent', JSON.stringify(divHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <DivHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
return this.http.post<DivHelpContent>(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/divhelpcontent/save',
|
||||
JSON.stringify(divHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deleteDivIds(ids : string[], helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'div/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
updateDivHelpContent(divHelpContent: DivHelpContent, helpContentUrl:string, pid: string) {
|
||||
HelpContentService.removeNulls(divHelpContent);
|
||||
|
||||
deleteDivHelpContents(ids : string[], helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
return this.http.post<DivHelpContent>(helpContentUrl + properties.adminToolsPortalType + '/' + pid +'/divhelpcontent/update',
|
||||
JSON.stringify(divHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
toggleDivHelpContents(ids : string[],status : boolean, helpContentUrl:string) {
|
||||
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getPagesWithDivIds(community_pid: string, helpContentUrl:string) {
|
||||
let parameters = (community_pid ? "?communityId="+community_pid : "");
|
||||
return this.http.get<Array<string>>(helpContentUrl + 'div/pages'+parameters)
|
||||
//.map(res => <Map<string, Set<string>>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
getPagesFull(helpContentUrl:string,pid:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + 'pageFull'+(pid?("?pid="+pid):""))
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
deleteDivHelpContents(ids : string[], helpContentUrl:string, pid: string) {
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/divhelpcontent/delete',
|
||||
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
}
|
||||
|
||||
getPage(pageId:string, helpContentUrl:string) {
|
||||
return this.http.get<Page>(helpContentUrl + 'page/'+pageId)
|
||||
//.map(res => <Page> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
toggleDivHelpContents(ids : string[],status : boolean, helpContentUrl:string, pid: string) {
|
||||
|
||||
getPageByRoute(route:string, helpContentUrl:string) {
|
||||
return this.http.get<Page>(helpContentUrl + 'page/?page_route='+route)
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/divhelpcontent/toggle?status='+ status.toString(),
|
||||
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
// unused
|
||||
getPageHelpContents(helpContentUrl:string) {
|
||||
return this.http.get<Array<PageHelpContent>>(helpContentUrl + 'pagehelpcontent')
|
||||
//.map(res => <Array<PageHelpContent>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunityPageHelpContents(pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<PageHelpContent>>(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent')
|
||||
//.map(res => <Array<PageHelpContent>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getPageHelpContent(id : string, helpContentUrl:string, pid: string) {
|
||||
return this.http.get<PageHelpContent>(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent/' + id)
|
||||
//.map(res => <PageHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
savePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string, pid: string) {
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post<PageHelpContent>(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent/save',
|
||||
JSON.stringify(pageHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <PageHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updatePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string, pid: string) {
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post<PageHelpContent>(helpContentUrl + properties.adminToolsPortalType + '/' + pid +'/pagehelpcontent/update',
|
||||
JSON.stringify(pageHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <PageHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deletePageHelpContents(ids : string[], helpContentUrl:string, pid: string) {
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent/delete',
|
||||
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
togglePageHelpContents(ids : string[],status : boolean, helpContentUrl:string, pid: string) {
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/pagehelpcontent/toggle?status='+ status.toString(),
|
||||
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunityPagesWithDivId(pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/pages?div=true')
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
// getCommunityPages(pid: string, params: string, helpContentUrl:string) {
|
||||
// return this.http.get<Array<Page>>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/pages'+params, CustomOptions.getAuthOptions())
|
||||
// //.map(res => <Array<Page>> res.json())
|
||||
// .pipe(catchError(this.handleError));
|
||||
// }
|
||||
|
||||
// Replacing getCommunityPages
|
||||
getCommunityPagesByType(pid: string, type: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/pages'
|
||||
+ (type ? '?page_type='+type : ''))
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
// End of replacing getCommunityPages
|
||||
|
||||
// Replacing part of getPages (now getAllPages)
|
||||
getCommunityPagesWithPositions(pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/pages?with_positions=true')
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
// End of replacing part of getPages (now getAllPages)
|
||||
|
||||
getAllPages(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')
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getAllPagesFull(helpContentUrl:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + 'page/full')//+(pid?("?pid="+pid):""))
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
}
|
||||
|
||||
getCommunities( helpContentUrl:string) {
|
||||
return this.http.get<Array<Community>>(helpContentUrl + 'community')
|
||||
//.map(res => <Array<Community>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
getPageByPortal(pageId:string, helpContentUrl:string, pid: string) {
|
||||
return this.http.get<Page>(helpContentUrl + properties.adminToolsPortalType + '/' + pid + '/page/'+pageId)
|
||||
//.map(res => <Page> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunity(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Community>(helpContentUrl + 'community/'+community_pid)
|
||||
//.map(res => <Community> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
getCommunityPageByRoute(route:string, helpContentUrl:string, pid: string) {
|
||||
return this.http.get<Page>(helpContentUrl + properties.adminToolsPortalType +'/' + pid + '/page/?page_route='+route)
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunitiesFull( helpContentUrl:string) {
|
||||
return this.http.get<Array<Community>>(helpContentUrl + 'communityFull')
|
||||
//.map(res => <Array<Community>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
savePage(page: Page, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
getCommunityFull(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Community>(helpContentUrl + 'communityFull/'+community_pid)
|
||||
//.map(res => <Community> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
return this.http.post<Page>(helpContentUrl + 'page/save', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Page> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
saveCommunity(community: Community, helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
updatePage(page: Page, helpContentUrl:string) {
|
||||
|
||||
HelpContentService.removeNulls(community);
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
return this.http.post<Community>(helpContentUrl + 'community/save', JSON.stringify(community), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Community> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
return this.http.post<Page>(helpContentUrl + 'page/update', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Page> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updateCommunity(community: Community, helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
togglePages(selectedPortalPid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
|
||||
HelpContentService.removeNulls(community);
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/'+selectedPortalPid+'/page/toggle?status='+ status.toString(),
|
||||
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
return this.http.post<Community>(helpContentUrl + 'community/update', JSON.stringify(community), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Community> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
deletePages(ids : string[], helpContentUrl:string) {
|
||||
|
||||
deleteCommunities(ids : string[], helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
return this.http.post(helpContentUrl + 'page/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
return this.http.post(helpContentUrl + 'community/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
// unused
|
||||
getCommunities( helpContentUrl:string) {
|
||||
return this.http.get<Array<Portal>>(helpContentUrl + properties.adminToolsPortalType)
|
||||
//.map(res => <Array<Portal>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunityPages(community_pid: string, params: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<Page>>(helpContentUrl + 'community/'+community_pid+'/pages'+params)
|
||||
//.map(res => <Array<Page>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
getCommunity(pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Portal>(helpContentUrl + properties.adminToolsPortalType + '/'+pid)
|
||||
//.map(res => <Portal> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getEntities(helpContentUrl:string) {
|
||||
return this.http.get<Array<Entity>>(helpContentUrl + 'entity')
|
||||
//.map(res => <Array<Entity>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
getCommunitiesFull( helpContentUrl:string) {
|
||||
return this.http.get<Array<Portal>>(helpContentUrl + properties.adminToolsPortalType + '/full')
|
||||
//.map(res => <Array<Portal>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunityEntities(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<Entity>>(helpContentUrl + 'community/'+community_pid+'/entities')
|
||||
//.map(res => <Array<Entity>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
getCommunityFull(portal_pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Portal>(helpContentUrl + properties.adminToolsPortalType + '/'+portal_pid+'/full')
|
||||
//.map(res => <Portal> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
saveCommunity(portal: Portal, helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
saveEntity(entity: Entity, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(entity);
|
||||
HelpContentService.removeNulls(portal);
|
||||
|
||||
return this.http.post<Entity>(helpContentUrl + 'entity/save', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Entity> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
return this.http.post<Portal>(helpContentUrl + portal.type + '/save', JSON.stringify(portal), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Portal> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updateEntity(entity: Entity, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(entity);
|
||||
updateCommunity(portal: Portal, helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post<Entity>(helpContentUrl + 'entity/update', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Entity> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
HelpContentService.removeNulls(portal);
|
||||
|
||||
// toggleEntity(selectedCommunityId: string, id : string,status : boolean) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
//
|
||||
// return this.http.post(helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options)
|
||||
// .catch(this.handleError);
|
||||
// }
|
||||
return this.http.post<Portal>(helpContentUrl + portal.type + '/update', JSON.stringify(portal), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Portal> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
toggleEntities(selectedCommunityPid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
deleteCommunities(ids : string[], helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(helpContentUrl +'community/'+selectedCommunityPid+ '/entity/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deleteEntities(ids : string[], helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'entity/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
|
||||
toggleEntityOfPage(pageId: string, entityId : string,status : boolean, helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'page/'+pageId+'/entity/toggle?status='+ status.toString()+'&entityId='+entityId.toString(), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
savePage(page: Page, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
return this.http.post<Page>(helpContentUrl + 'page/save', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Page> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updatePage(page: Page, helpContentUrl:string) {
|
||||
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
return this.http.post<Page>(helpContentUrl + 'page/update', JSON.stringify(page), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <Page> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
togglePages(selectedCommunityPid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
|
||||
return this.http.post(helpContentUrl + 'community/'+selectedCommunityPid+'/page/toggle?status='+ status.toString(),JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deletePages(ids : string[], helpContentUrl:string) {
|
||||
|
||||
return this.http.post(helpContentUrl + 'page/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getPageHelpContents(helpContentUrl:string) {
|
||||
return this.http.get<Array<PageHelpContent>>(helpContentUrl + 'pagehelpcontent')
|
||||
//.map(res => <Array<PageHelpContent>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getCommunityPageHelpContents(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get<Array<PageHelpContent>>(helpContentUrl + 'pagehelpcontent?community='+community_pid)
|
||||
//.map(res => <Array<PageHelpContent>> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
getPageHelpContent(id : string, helpContentUrl:string) {
|
||||
return this.http.get<PageHelpContent>(helpContentUrl + 'pagehelpcontent/' + id)
|
||||
//.map(res => <PageHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
savePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post<PageHelpContent>(helpContentUrl + 'pagehelpcontent/save', JSON.stringify(pageHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <PageHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
updatePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string) {
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post<PageHelpContent>(helpContentUrl + 'pagehelpcontent/update', JSON.stringify(pageHelpContent), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map(res => <PageHelpContent> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
deletePageHelpContents(ids : string[], helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/delete',JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
togglePageHelpContents(ids : string[],status : boolean, helpContentUrl:string) {
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
|
||||
//.map( res => <string[]> res.json())
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
private handleError(error: HttpErrorResponse) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.error(error);
|
||||
return Observable.throw(error.error || 'Server error');
|
||||
}
|
||||
private handleError(error: HttpErrorResponse) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.error(error);
|
||||
return Observable.throw(error.error || 'Server error');
|
||||
}
|
||||
|
||||
// getDataProviders() {
|
||||
// return this.http.get('https://beta.services.openaire.eu/search/v2/api/datasources?format=json').map(res => <any> res.json()).map(res => res.results).do(res => {console.log(res)}).catch(this.handleError);
|
||||
// }
|
||||
|
||||
getCommunityStatistics(apiUrl: string, communityId: string): Observable<StatisticsSummary> {
|
||||
const url = `${apiUrl}communities/${communityId}`;
|
||||
getCommunityStatistics(apiUrl: string, portalId: string): Observable<StatisticsSummary> {
|
||||
const url = `${apiUrl}communities/${portalId}`;
|
||||
//console.log(`getting statistics summary from: ${url}`);
|
||||
return this.http.get(url)
|
||||
//.map(res => <any>res.json())
|
||||
.pipe(map(res => res['statistics']));
|
||||
}
|
||||
|
||||
getCommunityAdminStatisticsChoices(apiUrl: string, communityId: string): Observable<StatisticsDisplay> {
|
||||
const url = `${apiUrl}statistics/${communityId}`;
|
||||
getCommunityAdminStatisticsChoices(apiUrl: string, portalId: string): Observable<StatisticsDisplay> {
|
||||
const url = `${apiUrl}statistics/${portalId}`;
|
||||
//console.log(`getting admin choices for statistics from: ${url}`);
|
||||
return this.http.get<StatisticsDisplay>(url)
|
||||
//.map(stats => <StatisticsDisplay>stats.json())
|
||||
|
@ -381,13 +445,13 @@ export class HelpContentService {
|
|||
}
|
||||
|
||||
postCommunityAdminStatisticsChoices(apiUrl: string,
|
||||
communityId: string,
|
||||
portalId: string,
|
||||
entity: string,
|
||||
chartsOrNumbers: string,
|
||||
title: string,
|
||||
status: boolean,
|
||||
monitor: boolean): Observable<any> {
|
||||
const url = `${apiUrl}statistics/${communityId}/${entity}/${chartsOrNumbers}?status=${status.toString()}&monitor=${monitor.toString()}`;
|
||||
const url = `${apiUrl}statistics/${portalId}/${entity}/${chartsOrNumbers}?status=${status.toString()}&monitor=${monitor.toString()}`;
|
||||
//console.log(`getting admin choices for statistics from: ${url}`);
|
||||
|
||||
return this.http.post(url, title, CustomOptions.getAuthOptionsWithBody())
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"environment":"development",
|
||||
"adminToolsPortalType": "community",
|
||||
"enablePiwikTrack" : false,
|
||||
"useCache" : false,
|
||||
"metricsAPIURL" : "https://beta.services.openaire.eu/usagestats/",
|
||||
|
|
|
@ -2,6 +2,7 @@ import {EnvProperties} from '../app/openaireLibrary/utils/properties/env-propert
|
|||
|
||||
export let properties: EnvProperties = {
|
||||
environment:"production",
|
||||
adminToolsPortalType: "community",
|
||||
enablePiwikTrack: false,
|
||||
useCache: false,
|
||||
metricsAPIURL: "https://services.openaire.eu/usagestats/",
|
||||
|
@ -49,6 +50,7 @@ export let properties: EnvProperties = {
|
|||
feedbackmailForMissingEntities: "feedback@openaire.eu",
|
||||
|
||||
cacheUrl:"https://explore.openaire.eu/cache/get?url=",
|
||||
deleteCacheUrl: 'https://explore.openaire.eu/cache/clear',
|
||||
|
||||
adminToolsAPIURL:"https://services.openaire.eu/uoa-admin-tools/",
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import {EnvProperties} from '../app/openaireLibrary/utils/properties/env-propert
|
|||
|
||||
export let properties: EnvProperties = {
|
||||
environment: 'development',
|
||||
adminToolsPortalType: "community",
|
||||
enablePiwikTrack: false,
|
||||
useCache: false,
|
||||
metricsAPIURL: 'https://beta.services.openaire.eu/usagestats/',
|
||||
|
@ -43,16 +44,16 @@ export let properties: EnvProperties = {
|
|||
vocabulariesAPI: 'https://beta.services.openaire.eu/provision/mvc/vocabularies/',
|
||||
|
||||
piwikBaseUrl: ' https://analytics.openaire.eu/piwik.php?idsite=6',
|
||||
loginUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login',
|
||||
userInfoUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=',
|
||||
registryUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/registry/',
|
||||
logoutUrl: 'https://openaire-dev.aai-dev.grnet.gr/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=',
|
||||
|
||||
loginUrl: "http://dl170.madgik.di.uoa.gr:8180/dnet-login/openid_connect_login",
|
||||
userInfoUrl: "http://dl170.madgik.di.uoa.gr:8180/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=",
|
||||
logoutUrl: "https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
|
||||
cookieDomain: '.di.uoa.gr',
|
||||
|
||||
feedbackmail: 'openaire.test@gmail.com',
|
||||
feedbackmailForMissingEntities: 'feedback@openaire.eu',
|
||||
cacheUrl: 'http://scoobydoo.di.uoa.gr:3000/get?url=',
|
||||
deleteCacheUrl: 'http://duffy.di.uoa.gr:3000/clear',
|
||||
|
||||
adminToolsAPIURL: 'http://duffy.di.uoa.gr:8080/uoa-admin-tools/',
|
||||
|
||||
|
|
Loading…
Reference in New Issue