Admin Portal configured according to OpenAIRE

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@50117 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2017-12-13 11:15:19 +00:00
parent b4b4c6eb89
commit 944dc71ab8
31 changed files with 983 additions and 96 deletions

View File

@ -1,9 +1,11 @@
<div id="wrapper">
<div id="sidebar-default" class="main-sidebar">
<div class="current-user">
<a class="name" href="http://www.openminted.eu">
<!--a class="name" href="http://www.openminted.eu">
<img width="100%" src="http://openminted.eu/wp-content/uploads/2016/02/OpenMINTED_Tag_Color.png" alt="OpenMinted">
</a>
</a-->
<a class="name" href="http://connect.openaire.eu">
<img width="100%" src="imgs/OA CONNECT_B.png" alt="OpenAIRE"></a>
</div>
<div class="menu-section">
<h3>General</h3>
@ -16,7 +18,7 @@
</li>
</ul>
</div>
<div class="menu-section">
<!-- <div class="menu-section">
<h3>FAQs</h3>
<ul>
<li>
@ -32,10 +34,22 @@
</a>
</li>
</ul>
</div> -->
<div class="menu-section">
<h3>Manage Entities</h3>
<ul>
<li>
<a routerLink="/selectEntities" routerLinkActive="active">
<i class="fa fa-cog"></i>
<span>Select entities</span>
</a>
</li>
</ul>
</div>
<div class="menu-section">
<h3>Help Content</h3>
<ul>
<li>
<a routerLink="/pages" routerLinkActive="active">
<i class="fa fa-globe"></i>
@ -52,4 +66,4 @@
</div>
</div>
<router-outlet></router-outlet>
</div>
</div>

View File

@ -11,6 +11,8 @@ import { TopicsComponent } from "./pages/faq/topics.components";
import { QuestionsComponent } from "./pages/faq/questions.component";
import { FAQService } from "./services/faq.service";
import { ModalModule } from 'ngx-bootstrap';
import { CollapseModule } from 'ngx-bootstrap';
import { AccordionModule } from 'ngx-bootstrap';
import { TopicsFormComponent } from "./pages/faq/topics-form.component";
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ModalFormComponent } from "./pages/modal-form.component";
@ -25,6 +27,8 @@ import { NewPageHelpContentComponent } from "./pages/helpcontent/new-page-help-c
import { CKEditorModule } from 'ng2-ckeditor';
import { PageContentFormComponent } from "./pages/helpcontent/page-help-content-form.component";
import { EditPageHelpContentComponent } from "./pages/helpcontent/edit-page-help-content.component";
import { SelectEntitiesComponent } from "./pages/helpcontent/selectEntities.component";
import { EntityFormComponent } from "./pages/helpcontent/entity-form.component";
@NgModule({
imports: [
@ -33,6 +37,8 @@ import { EditPageHelpContentComponent } from "./pages/helpcontent/edit-page-help
HttpModule,
JsonpModule,
ModalModule.forRoot(),
CollapseModule.forRoot(),
AccordionModule.forRoot(),
FormsModule,
ReactiveFormsModule,
JWBootstrapSwitchModule,
@ -52,7 +58,9 @@ import { EditPageHelpContentComponent } from "./pages/helpcontent/edit-page-help
PageHelpContentsComponent,
NewPageHelpContentComponent,
PageContentFormComponent,
EditPageHelpContentComponent
EditPageHelpContentComponent,
SelectEntitiesComponent,
EntityFormComponent
],
providers: [
FAQService,
@ -62,4 +70,4 @@ import { EditPageHelpContentComponent } from "./pages/helpcontent/edit-page-help
bootstrap: [ AppComponent ]
})
export class AppModule { }
export class AppModule { }

View File

@ -7,6 +7,7 @@ import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from "./dashboard.component";
import { TopicsComponent } from "./pages/faq/topics.components";
import { QuestionsComponent } from "./pages/faq/questions.component";
import { SelectEntitiesComponent } from "./pages/helpcontent/selectEntities.component";
import { PagesComponent } from "./pages/helpcontent/pages.component";
import { PageHelpContentsComponent } from "./pages/helpcontent/page-help-contents.component";
import { NewPageHelpContentComponent } from "./pages/helpcontent/new-page-help-content.component";
@ -30,6 +31,10 @@ const appRoutes: Routes = [
path: 'questions',
component: QuestionsComponent,
},
{
path: 'selectEntities',
component: SelectEntitiesComponent,
},
{
path: 'pages',
component: PagesComponent,
@ -43,7 +48,8 @@ const appRoutes: Routes = [
component: NewPageHelpContentComponent,
},
{
path: 'pageContents/edit/:id',
//path: 'pageContents/edit/:id',
path: 'pageContents/edit',
component: EditPageHelpContentComponent,
}
];
@ -51,4 +57,4 @@ const appRoutes: Routes = [
export const appRoutingProviders: any[] = [
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);

View File

@ -5,12 +5,12 @@
<i class="ion-navicon"></i>
</div>
<div class="page-title">Dashboard</div>
<div class="page-title">Research Community Administration Dashboard</div>
</div>
<div class="content-wrapper">
<p>
A list of tools to help the administrator of the OpenMinTeD to manage FAQs, help texts, etc...
A list of tools to help the administrator of the OpenAIRE-Connect to manage FAQs, help texts, etc...
</p>
</div>
</div>

13
app/domain/community.ts Normal file
View File

@ -0,0 +1,13 @@
import {Page} from './page';
export interface Community {
_id: string;
name: string;
entities: string[];
pages: Page[];
}
// export interface CheckCommunity {
// community : Community;
// checked : boolean;
// }

10
app/domain/entity.ts Normal file
View File

@ -0,0 +1,10 @@
export class Entity {
_id: string;
name: string;
isEnabled :boolean;
}
export interface CheckEntity {
entity : Entity;
checked : boolean;
}

View File

@ -2,10 +2,12 @@
* Created by stefania on 7/13/17.
*/
import { Page } from "./page";
import { Community } from "./community";
export interface PageHelpContent {
_id: string;
page: Page | string;
community: Community | string;
placement : string;
order: number;
content: string;
@ -21,4 +23,4 @@ export interface PageHelpContentFilterOptions {
id : string;
active : Boolean;
text : RegExp;
}
}

View File

@ -1,13 +1,14 @@
/**
* Created by stefania on 7/13/17.
*/
import { Entity } from './entity';
export interface Page {
_id: string;
route: string;
name: string;
isEnabled :boolean;
entities: Entity[];// | string[];
}
export interface CheckPage {
page : Page;
checked : boolean;
}
}

View File

@ -12,7 +12,7 @@
<div>
<div *ngIf="errorMessage" class="alert alert-danger">{{errorMessage}}</div>
<page-content-form [group]="formGroup"></page-content-form>
<page-content-form [communityId]="communityId" [group]="formGroup"></page-content-form>
<a (click)="saveCustom()" class="btn btn-success"><i></i>Update page content</a>
</div>
</div>

View File

@ -18,6 +18,8 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
@ViewChild(PageContentFormComponent)
public formComponent : PageContentFormComponent;
private communityId: string;
private sub: Subscription;
private pageHelpContent: PageHelpContent;
@ -31,9 +33,11 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
ngOnInit() {
this.sub = this.route.params.subscribe(params => {
let id = params['id'];
this._helpContentService.getPageHelpContent(id as string).subscribe(
this.sub = this.route.queryParams.subscribe(params => {
//let id = params['id'];
let pageContentId = params['pageContentId'];
this.communityId = params['communityId'];
this._helpContentService.getPageHelpContent(pageContentId as string).subscribe(
pageHelpContent => this.updateForm(pageHelpContent),
error => this.handleError('System error retrieving page help content', error));
});
@ -65,4 +69,4 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
}
}
}
}

View File

@ -0,0 +1,32 @@
<form [formGroup]="myForm">
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.name.dirty}">
<label for="entityNameTag">Entity Name</label>
<input type="text" class="form-control" formControlName="name" id="entityNameTag" placeholder="Entity Name">
</div>
<!--
<div ngModelGroup="phoneNumbers">
<h3>Phone numbers</h3>
<div *ngFor="let phoneId of phoneNumberIds; let i=index;">
<label>Phone number {{i + 1}}</label>
<input type="text" name="phoneNumber[{{phoneId}}]" #phoneNumber="ngModel" ngModel/>
<button type="button" (click)="remove(i); myForm.control.markAsTouched()">remove</button>
</div>
<button type="button" (click)="add(); myForm.control.markAsTouched()">Add phone number</button>
</div>
-->
<!-- <div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.entities.dirty}">
<div *ngFor="let entity of entities; let i=index;">
<label>Entity {{i + 1}}</label>
<input type="text" name="entities[{{entity}}]" class="form-control" formControlName="entity"/>
</div>
</div> -->
<input type="hidden" formControlName="_id">
</form>
<!--<pre>-->
<!--{{myForm.value | json}}-->
<!--</pre>-->

View File

@ -0,0 +1,34 @@
import {Component, OnInit, Input} from '@angular/core';
import {FormGroup, FormBuilder, Validators} from "@angular/forms";
@Component({
selector: 'entity-form',
templateUrl: './entity-form.component.html',
})
export class EntityFormComponent implements OnInit{
@Input('group')
myForm: FormGroup;
constructor(private _fb: FormBuilder){}
ngOnInit(): void {
}
public get form() {
return this._fb.group({
name : ['', Validators.required],
_id : ''
});
}
public reset() {
this.myForm.patchValue({
name : '',
_id : ''
});
}
}

View File

@ -12,7 +12,7 @@
<div>
<div *ngIf="errorMessage" class="alert alert-danger">{{errorMessage}}</div>
<page-content-form [group]="formGroup"></page-content-form>
<page-content-form [communityId]="communityId" [group]="formGroup"></page-content-form>
<a (click)="saveCustom()" class="btn btn-success"><i></i>Save page content</a>
</div>
</div>

View File

@ -19,15 +19,23 @@ export class NewPageHelpContentComponent {
private errorMessage : string = null;
private communityId: string;
constructor(
private route: ActivatedRoute,
private router: Router,
private _helpContentService: HelpContentService) {}
ngOnInit() {
this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
});
}
private saveCustom() {
this.errorMessage = null;
if(this.formComponent.myForm.valid) {
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
@ -43,4 +51,4 @@ export class NewPageHelpContentComponent {
this.errorMessage = message + ' (Server responded: ' + error + ')';
}
}
}

View File

@ -7,8 +7,106 @@
<label for="pageNameTag">Page Name</label>
<input type="text" class="form-control" formControlName="name" id="pageNameTag" placeholder="Page Name">
</div>
<!--div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.entities.dirty}"-->
<!--label for="pageEntitiesTag">Entities</label>
<span type="text" class="form-array" formArrayName="entities" id="pageEntitiesTag" placeholder="Entities">
<input *ngFor="let entity of myForm.value.entities" type="text" class="form-control">
</span-->
<!--select>
<option [value]="">--add entities--</option>
<option *ngFor="let entity of myForm.value.entities" [value]="entity._id">{{entity.name}}</option>
</select-->
<!--button type="button" (click)="isCollapsed = !isCollapsed">Toggle collapse</button>
<div [collapse]="isCollapsed" class="card card-block card-header">
<div class="well well-lg">
<div *ngFor="let entity of myForm.value.entities" class="row user form-control" formControlName="entities" id="pageEntitiesTag" >
<button value="{{entity._id}}" type="button">ADD</button>{{entity.name}}
</div>
</div>
</div-->
<!--span class="col-sm-1 avatar">
<input id="{{entity._id}}" class="checkBox" type="checkbox" name="" value="{{entity._id}}">
</span-->
<!--div formArrayName="entities">
<div *ngFor="let entity of entities.controls; let i=index" [formGroupName]="i" >
<div class="form-group">
<label class="center-block">Name:</label>
<input class="form-control" formControlName="name"
<span><button class="col-sm-2" value="{{entity.value._id}}" type="button">ADD</button><label class="form-control col-sm-10">{{entity.value.name}}</label></span>
</div>
<br>
</div>
<button (click)="addEntity()" type="button">Add an Entity</button>
</div-->
<!-- <div formArrayName="entities">
<div *ngFor="let entity of entities.controls; let i=index" [formGroupName]="i" >
<div class="form-group">
<label class="center-block">Name:</label>
<span><button class="col-sm-2" value="{{entity.value._id}}" type="button">ADD</button><label class="form-control col-sm-10">{{entity.value.name}}</label></span>
</div>
</div>
</div> -->
<div formArrayName="entities" class="form-group">
<label for="entityNameTag">Entity Name</label>
<div id="entityNameTag">
<!-- <label class="form-control">
<span *ngFor="let entity of entities.controls; let i=index">{{entity.value.name}}<span *ngIf="i<(entities.controls.length-1)">, </span></span>
</label> -->
<pre class="card card-block card-header"><span *ngFor="let entity of myForm.value.entities; let i=index">{{entity.name}}<span *ngIf="i<(myForm.value.entities.length-1)">, </span></span></pre>
<button type="button" (click)="toggle()">Add / Remove entities</button>
<div [collapse]="myForm.value.isCollapsed" *ngFor="let entity of getKeys(allEntities)">
<span><!--button type="button">ADD</button-->
<span *ngIf="allEntities.get(entity)" class="activated" >
<input (click)="toggleEntity(false,[entity._id], entity)" class="deactivate" src="imgs/delete-icon.png" title="Disable" width="20" type="image" height="20">
</span>
<span *ngIf="!allEntities.get(entity)" class="deactivated" >
<input (click)="toggleEntity(true,[entity._id], entity)" class="deactivate" src="imgs/add-icon.png" title="Enable" width="20" type="image" height="20">
</span>
{{entity.name}}
</span>
</div>
</div>
</div>
<!-- <p>myForm value: {{ myForm.value | json}}</p> -->
<!--/div-->
<!--
<div ngModelGroup="phoneNumbers">
<h3>Phone numbers</h3>
<div *ngFor="let phoneId of phoneNumberIds; let i=index;">
<label>Phone number {{i + 1}}</label>
<input type="text" name="phoneNumber[{{phoneId}}]" #phoneNumber="ngModel" ngModel/>
<button type="button" (click)="remove(i); myForm.control".markAsTouched()">remove</button>
</div>
<button type="button" (click)="add(); myForm.control.markAsTouched()">Add phone number</button>
</div>
-->
<!-- <div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.entities.dirty}">
<div *ngFor="let entity of entities; let i=index;">
<label>Entity {{i + 1}}</label>
<input type="text" name="entities[{{entity}}]" class="form-control" formControlName="entity"/>
</div>
</div> -->
<input type="hidden" formControlName="_id">
</form>
<!--<pre>-->
<!--{{myForm.value | json}}-->
<!--</pre>-->
<!--</pre>-->

View File

@ -2,8 +2,11 @@
* Created by stefania on 7/13/17.
*/
import {Component, OnInit, Input} from '@angular/core';
import {FormGroup, FormBuilder, Validators} from "@angular/forms";
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
import { CollapseDirective } from 'ngx-bootstrap/collapse';
//import { AccordionDirective } from 'ngx-bootstrap/accordion';
import {Entity} from '../../domain/entity';
import { HelpContentService } from "../../services/help-content.service";
@Component({
selector: 'page-form',
@ -14,17 +17,73 @@ export class PageFormComponent implements OnInit{
@Input('group')
myForm: FormGroup;
@Input('selectedCommunityId')
public selectedCommunityId: string;
constructor(private _fb: FormBuilder){}
public errorMessage: string;
ngOnInit(): void {
public allEntities: Map<Entity, boolean> = new Map<Entity, boolean>();
private gotEntities: boolean = false;
constructor(public _fb: FormBuilder, private _helpContentService: HelpContentService){}
ngOnInit(): void {}
public toggle() {
this.myForm.value.isCollapsed = !this.myForm.value.isCollapsed;
if(!this.myForm.value.isCollapsed) {
let includedEntities: Set<String> = new Set<String>();
for(let entityName of this.myForm.value.entities) {
includedEntities.add(entityName._id);
}
let allEntities = this.allEntities;
let self = this;
allEntities.forEach(function (status, entity, map) {
if(includedEntities.has(entity._id)) {
self.allEntities.set(entity, true);
} else {
self.allEntities.set(entity, false);
}
});
if(!this.gotEntities) {
this.gotEntities = true;
this.getEntities(includedEntities);
}
}
}
public getEntities(includedEntities: Set<String>) {
let self = this;
this._helpContentService.getEntities().subscribe(
entities => {
for(let entity of entities) {
if(includedEntities.has(entity._id)) {
self.allEntities.set(entity, true);
} else {
self.allEntities.set(entity, false);
}
}
},
error => this.handleError('System error retrieving community entities', error));
}
public getKeys( map) {
return Array.from(map.keys());
}
public get form() {
return this._fb.group({
route : ['', Validators.required],
name : ['', Validators.required],
_id : ''
//isEnabled: ['', Validators.required],
entities: this._fb.array([]),
_id : '',
isCollapsed: [true]
});
}
@ -32,8 +91,64 @@ export class PageFormComponent implements OnInit{
this.myForm.patchValue({
route : '',
name : '',
_id : ''
//isEnabled: '',
//entities: this._fb.array([]),
_id : '',
isCollapsed: [true]
});
this.setEntities([]);
}
}
public get entities(): FormArray {
return this.myForm.get('entities') as FormArray;
};
setEntities(entities: Entity[]) {
const entityFGs = entities.map(entity => this._fb.group(entity));
const entityFormArray = this._fb.array(entityFGs);
this.myForm.setControl('entities', entityFormArray);
}
addEntity() {
this.myForm.value.entities.push(this._fb.group(new Entity()));
}
public toggleEntity(status : boolean, id : string, entity: Entity) {
let index: number = -1;
for(let i=0; i<this.myForm.get('entities').value.length; i++) {
if(this.myForm.get('entities').value[i]._id == entity._id) {
index = i;
break;
}
}
console.info("status: "+status + " index: "+index);
this.allEntities.set(entity, status);
if(status && index<0) {
this.myForm.value.entities.push(entity);
console.info("push : "+this.myForm.value.entities.length);
} else if(!status){
if(index >= 0) {
this.myForm.value.entities.splice(index, 1);
console.info("delete : "+this.myForm.value.entities.length);
}
}
/*
this._helpContentService.toggleEntityOfPage(this.myForm.value._id,id,status).subscribe(
() => {
},
error => this.handleError('System error changing the status of the enity of page', error)
);
*/
}
handleError(message: string, error) {
if(error == null) {
this.reset();
}
this.errorMessage = message + ' (Server responded: ' + error + ')';
}
}

View File

@ -16,6 +16,8 @@ export class PageContentFormComponent implements OnInit{
@Input('group')
myForm: FormGroup;
@Input('communityId')
communityId: string;
private availablePages : Page[] = [];
private errorMessage: string;
@ -26,7 +28,7 @@ export class PageContentFormComponent implements OnInit{
ngOnInit() {
this.myForm = this.form;
this._helpContentService.getPages().subscribe(
this._helpContentService.getCommunityPages(this.communityId).subscribe(
pages => this.availablePages = pages,
error => this.handleError('System error retrieving pages', error));
}
@ -34,6 +36,7 @@ export class PageContentFormComponent implements OnInit{
public get form() {
return this._fb.group({
page : ['',Validators.required],
community : this.communityId,
placement : ['', Validators.required],
content : ['', Validators.required],
order : ['1', Validators.required],
@ -45,6 +48,7 @@ export class PageContentFormComponent implements OnInit{
public reset() {
this.myForm.patchValue({
page : '',
community : this.communityId,
placement : '',
content : [''],
order : '1',
@ -57,4 +61,4 @@ export class PageContentFormComponent implements OnInit{
handleError(message: string, error) {
this.errorMessage = message + ' (Server responded: ' + error + ')';
}
}
}

View File

@ -11,7 +11,8 @@
<input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Search page content (content)..." type="text"/>
<input class="btn" type="submit">
</form>
<a routerLink="/pageContents/new" class="btn btn-success pull-right"><i></i> New Page Content </a>
<!--[queryParams]="{organizationId: organization.id}" routerLinkActive="router-link-active" routerLink="/search/organization"-->
<a [queryParams]="{communityId: selectedCommunityId}" routerLink="/pageContents/new" class="btn btn-success pull-right"><i></i> New Page Content </a>
</div>
<div class="content-wrapper" id="contentWrapper">
@ -23,15 +24,29 @@
<span></span><span></span><span></span></div>
<div class="alert" style="display: none;" aria-hidden="true"><span></span><span></span><span></span></div>
<div class="row page-controls">
<!-- <div class="filters marginBottom20">
<div class="links form-group form-inline">
</div>
</div> -->
<div class="col-md-12 filters marginBottom20">
<div class="links form-group form-inline">
<div class="gwt-Label filterLabel">Filter by page:</div>
<select class="input-xxlarge form-control" (change)="filterByPage($event)">
<option value="">-- none selected --</option>
<option *ngFor="let page of pages" value="{{page._id}}">{{page.name}}</option>
</select>
<div class="gwt-Label filterLabel">Filter by community:</div>
<select class="input-xxlarge form-control" (change)="filterByCommunity($event)">
<!--option value=""> none selected </option-->
<option *ngFor="let community of communities" value="{{community._id}}">{{community.name}}</option>
</select>
</div>
</div>
<div class="col-md-12 filters marginBottom20">
<div class="links form-group form-inline">
<div class="gwt-Label filterLabel">Filter by page:</div>
<select class="input-xxlarge form-control" (change)="filterByPage($event)">
<option value="">-- none selected --</option>
<option *ngFor="let page of pages" value="{{page._id}}">{{page.name}}</option>
</select>
</div>
</div>
<div class="col-md-12 filters">
<div class="links">
<div class="gwt-Label filterLabel">Filter page contents:</div>
@ -66,10 +81,11 @@
<div class="col-sm-1 header select-users"><input id="allPageHelpContentsCheckbox" [checked]="checkboxAll" type="checkbox" (change)="toggleCheckBoxes($event)">
</div>
<div class="col-sm-2 header hidden-xs"><label><a href="#">Page</a></label></div>
<div class="col-sm-1 header hidden-xs"><label><a href="#">Community</a></label></div>
<div class="col-sm-1 header hidden-xs"><label><a href="#">Placement</a></label></div>
<div class="col-sm-1 header hidden-xs"><label><a href="#">Order</a></label></div>
<div class="col-sm-1 header hidden-xs"><label><a href="#">Active</a></label></div>
<div class="col-sm-5 header hidden-xs"><label><a href="#">Content</a></label></div>
<div class="col-sm-4 header hidden-xs"><label><a href="#">Content</a></label></div>
<div class="col-sm-1 header hidden-xs"><label><a href="#">Actions</a></label></div>
</div>
@ -81,6 +97,9 @@
<div class="col-sm-2">
<div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
</div>
<div class="col-sm-1">
<div class="community" href="#">{{check.pageHelpContent.community.name}}</div>
</div>
<div class="col-sm-1">
<div class="placement" href="#">{{check.pageHelpContent.placement}}</div>
</div>
@ -92,11 +111,11 @@
<div *ngIf="check.pageHelpContent.isActive" class="activated" >
<input (click)="togglePageHelpContents(false,[check.pageHelpContent._id])" class="deactivate" src="imgs/check-icon.png" title="Deactivate" width="20" type="image" height="20">
</div>
<div *ngIf="!check.pageHelpContent.isActive" class="activated" >
<input (click)="togglePageHelpContents(true,[check.pageHelpContent._id])" class="deactivate" src="imgs/x-icon.png" title="Activate" width="20" type="image" height="20">
<div *ngIf="!check.pageHelpContent.isActive" class="deactivated" >
<input (click)="togglePageHelpContents(true,[check.pageHelpContent._id])" class="activate" src="imgs/x-icon.png" title="Activate" width="20" type="image" height="20">
</div>
</div>
<div class="col-sm-5">
<div class="col-sm-4">
<div class="content" href="#">{{check.pageHelpContent.content}}
</div>
</div>
@ -124,4 +143,3 @@
<delete-confirmation-dialog #deleteConfirmationModal [isModalShown]="isModalShown" (emmitObject)="confirmedDeletePageHelpContents($event)">
Are you sure you want to delete the selected page content(s)?
</delete-confirmation-dialog>

View File

@ -8,6 +8,7 @@ import { HelpContentService } from "../../services/help-content.service";
import { PageHelpContent, CheckPageHelpContent, PageHelpContentFilterOptions } from "../../domain/page-help-content";
import { Page } from "../../domain/page";
import {Router} from "@angular/router";
import { Community } from "../../domain/community";
@Component({
selector: 'page-help-contents',
@ -45,16 +46,31 @@ export class PageHelpContentsComponent implements OnInit {
public counter = {all : 0, active : 0, inactive : 0};
public communities: Community[] = [];
public selectedCommunityId: string;
ngOnInit() {
this.getPages();
this.getPageHelpContents();
this.getCommunities();
// this.formGroup = this.formComponent.form;
}
constructor(private _helpService: HelpContentService, private router : Router) {}
getPages() {
this._helpService.getPages().subscribe(
getCommunities() {
let self = this;
this._helpService.getCommunities().subscribe(
communities => {
self.communities = communities;
self.selectedCommunityId = self.communities[0]._id;
this.getPages(self.selectedCommunityId);
this.getPageHelpContents(self.selectedCommunityId);
},
error => this.handleError('System error retrieving communities', error));
}
getPages(community_id: string) {
this._helpService.getCommunityPages(community_id).subscribe(
pages => this.pages = pages,
error => this.handleError('System error retrieving pages', error));
}
@ -72,12 +88,13 @@ export class PageHelpContentsComponent implements OnInit {
this.counter.all = this.counter.active + this.counter.inactive;
}
getPageHelpContents() {
getPageHelpContents(community_id: string) {
let self = this;
this._helpService.getPageHelpContents().subscribe(
this._helpService.getCommunityPageHelpContents(community_id).subscribe(
pageHelpContents => {
self.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
self.counter.all = self.pageHelpContents.length;
self.pageHelpContentsCheckboxes = [];
self.pageHelpContents.forEach(_ => {
self.pageHelpContentsCheckboxes.push(<CheckPageHelpContent>{pageHelpContent : _, checked : false});
});
@ -132,14 +149,16 @@ export class PageHelpContentsComponent implements OnInit {
}
public editPageHelpContent(_id : string) {
this.router.navigate(['/pageContents/edit/', _id]);
//this.router.navigate(['/pageContents/edit/', _id]);
this.router.navigate( ['/pageContents/edit/'], { queryParams: { "pageContentId": _id, "communityId": this.selectedCommunityId } } );
}
public togglePageHelpContents(status : boolean, ids : string[]) {
this._helpService.togglePageHelpContents(ids,status).subscribe(
ret => {
for(let id of ret) {
() => {
for(let id of ids) {
let i = this.pageHelpContentsCheckboxes.findIndex(_ => _.pageHelpContent._id == id);
console.info(i);
this.pageHelpContentsCheckboxes[i].pageHelpContent.isActive=status;
}
this.countPageHelpContents();
@ -219,4 +238,14 @@ export class PageHelpContentsComponent implements OnInit {
}
this.errorMessage = message + ' (Server responded: ' + error + ')';
}
}
public filterByCommunity(event: any) {
this.selectedCommunityId = event.target.value;
this.applyCommunityFilter(this.selectedCommunityId);
}
public applyCommunityFilter(community_id: string) {
this.getPages(community_id);
this.getPageHelpContents(community_id);
}
}

View File

@ -38,11 +38,24 @@
<div class="gwt-HTML">
<div class="row users-list">
<div class="col-md-12">
<div class="filters marginBottom20">
<div class="links form-group form-inline">
<div class="gwt-Label filterLabel">Filter by community:</div>
<select class="input-xxlarge form-control" (change)="filterByCommunity($event)">
<!--option value=""> none selected </option-->
<option *ngFor="let community of communities" value="{{community._id}}">{{community.name}}</option>
</select>
</div>
</div>
<div class="row headers">
<div class="col-sm-1 header select-users"><input id="allPageCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)">
</div>
<div class="col-sm-4 header hidden-xs"><label><a href="#">Route</a></label></div>
<div class="col-sm-6 header hidden-xs"><label><a href="#">Name</a></label></div>
<div class="col-sm-3 header hidden-xs"><label><a href="#">Route</a></label></div>
<div class="col-sm-2 header hidden-xs"><label><a href="#">Name</a></label></div>
<div class="col-sm-2 header hidden-xs"><label><a href="#">State</a></label></div>
<div class="col-sm-3 header hidden-xs"><label><a href="#">Related Entities</a></label></div>
<div class="col-sm-1 header hidden-xs"><label><a href="#">Actions</a></label></div>
</div>
@ -51,12 +64,26 @@
<div class="col-sm-1 avatar"><input id="{{check.page._id}}" class="checkBox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="route" href="#">{{check.page.route}}</div>
</div>
<div class="col-sm-6">
<div class="col-sm-2">
<div class="name" href="#">{{check.page.name}}</div>
</div>
<div class="col-sm-2">
<!-- <div class="state" href="#">{{(check.page.isEnabled) ? 'Enabled' : 'Disabled'}}</div> -->
<div *ngIf="check.page.isEnabled" class="activated" >
<input (click)="togglePage(false,[check.page._id])" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div>
<div *ngIf="!check.page.isEnabled" class="deactivated" >
<input (click)="togglePage(true,[check.page._id])" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
</div>
</div>
<div class="col-sm-3">
<div class="entities" href="#">
<span *ngFor="let entity of check.page.entities let i=index">{{entity.name}}<span *ngIf="i<(check.page.entities.length-1)">, </span></span>
</div>
</div>
<div class="col-sm-1">
<div class="actions" href="#">
<input title="Edit" src="imgs/icn_edit.png" class="edit" type="image" (click)="editPage(i)">
@ -78,13 +105,15 @@
</div>
</div>
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Page'" [formGroup]="formGroup" [type]="'page'"
[isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleError($event)">
<page-form [group]="formGroup"></page-form>
[isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleError($event)"
[selectedCommunityId]="selectedCommunityId">
<page-form [group]="formGroup" [selectedCommunityId]="selectedCommunityId"></page-form>
</modal-form>
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'" s
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleError($event)">
<page-form [group]="formGroup"></page-form>
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'"
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
[selectedCommunityId]="selectedCommunityId">
<page-form [group]="formGroup" [selectedCommunityId]="selectedCommunityId"></page-form>
</modal-form>
<delete-confirmation-dialog #deleteConfirmationModal [isModalShown]="isModalShown" (emmitObject)="confirmedDeletePages($event)">

View File

@ -8,6 +8,7 @@ import { ModalFormComponent } from "../modal-form.component";
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
import { PageFormComponent } from "./page-form.component";
import { CheckPage, Page } from "../../domain/page";
import { Community } from "../../domain/community";
@Component({
selector: 'pages',
@ -39,18 +40,25 @@ export class PagesComponent implements OnInit {
private searchText : RegExp = new RegExp('');
public communities: Community[] = [];
public selectedCommunityId: string;
ngOnInit() {
this.getPages();
this.getCommunities();
this.formGroup = this.formComponent.form;
}
constructor(private _helpContentService: HelpContentService) {}
getPages() {
getPages(community_id: string) {
let self = this;
this._helpContentService.getPages().subscribe(
this._helpContentService.getCommunityPages(community_id).subscribe(
pages => {
self.pages = pages;
self.pagesCheckboxes = [];
pages.forEach(_ => {
self.pagesCheckboxes.push(<CheckPage>{page : _, checked : false});
});
@ -58,6 +66,17 @@ export class PagesComponent implements OnInit {
error => this.handleError('System error retrieving pages', error));
}
getCommunities() {
let self = this;
this._helpContentService.getCommunities().subscribe(
communities => {
self.communities = communities;
self.getPages(self.communities[0]._id);
self.selectedCommunityId = self.communities[0]._id;
},
error => this.handleError('System error retrieving communities', error));
}
public showModal():void {
this.modal.showModal();
}
@ -67,6 +86,7 @@ export class PagesComponent implements OnInit {
}
public applyCheck(flag : boolean) {
console.info("applyCheck "+flag);
this.pagesCheckboxes.forEach(_ => _.checked = flag);
}
@ -101,15 +121,23 @@ export class PagesComponent implements OnInit {
public editPage(i : number) {
let page : Page = this.pagesCheckboxes[i].page;
this.formGroup.patchValue(page);
const entityFGs = page.entities.map(entity => this.formComponent._fb.group(entity));
const entityFormArray = this.formComponent._fb.array(entityFGs);
this.formGroup.setControl('entities', entityFormArray);
console.info(this.formGroup.value);
this.updateModal.showModal();
}
public pageSavedSuccessfully(page: Page) {
this.pagesCheckboxes.push(<CheckPage>{page : page, checked : false});
console.info("checkboxes length: "+this.pagesCheckboxes.length);
this.applyCheck(false);
}
public pageUpdatedSuccessfully(page : Page) {
console.info(page._id);
console.info(this.pagesCheckboxes.find(checkItem => (checkItem.page._id == page._id)));
console.info(page.entities);
this.pagesCheckboxes.find(checkItem => checkItem.page._id==page._id).page = page;
this.applyCheck(false);
}
@ -137,4 +165,33 @@ export class PagesComponent implements OnInit {
}
this.errorMessage = message + ' (Server responded: ' + error + ')';
}
}
public filterByCommunity(event: any) {
this.selectedCommunityId = event.target.value;
this.applyCommunityFilter(this.selectedCommunityId);
}
public applyCommunityFilter(community_id: string) {
this.getPages(community_id);
}
public togglePage(status : boolean, id : string) {
this._helpContentService.togglePage(this.selectedCommunityId,id,status).subscribe(
() => {
// for(let id of ret) {
// let i = this.pagesCheckboxes.findIndex(_ => _.page._id == id);
// this.pagesCheckboxes[i].page.isEnabled=status;
// }
//this.countPageHelpContents();
let i = this.pagesCheckboxes.findIndex(_ => _.page._id == id);
this.pagesCheckboxes[i].page.isEnabled=status;
this.applyCheck(false);
},
error => this.handleError('System error changing the status of the selected page(s)', error)
);
}
}

View File

@ -0,0 +1,97 @@
<div id="entities">
<div id="content">
<div class="menubar fixed">
<div class="sidebar-toggler visible-xs">
<i class="ion-navicon"></i>
</div>
<div class="entity-title">Entities</div>
<form target="BSFormPanel_Admin_1" class="search">
<input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Search entities (name)..." type="text"/>
<input class="btn" type="submit">
</form>
<a (click)="showModal()" class="btn btn-success pull-right"><i></i> New Entity </a>
</div>
<div class="content-wrapper" id="contentWrapper">
<div>
<div class="contentPanel">
<div class="alert alert-danger" style="display: none;" aria-hidden="true">
<span></span><span></span><span></span></div>
<div class="alert alert-success" style="display: none;" aria-hidden="true">
<span></span><span></span><span></span></div>
<div class="alert" style="display: none;" aria-hidden="true"><span></span><span></span><span></span></div>
<div>
<div class="gwt-HTML">
<div class="row users-list">
<div class="col-md-12">
<div class="filters marginBottom20">
<div class="links form-group form-inline">
<div class="gwt-Label filterLabel">Filter by community:</div>
<select class="input-xxlarge form-control" (change)="filterByCommunity($event)">
<!--option value="">-- none selected --</option-->
<option *ngFor="let community of communities" value="{{community._id}}">{{community.name}}</option>
</select>
</div>
</div>
<div class="row headers">
<div class="col-sm-1 header select-users"><input id="allEntityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)">
</div>
<div class="col-sm-5 header hidden-xs"><label><a href="#">Name</a></label></div>
<div class="col-sm-5 header hidden-xs"><label><a href="#">State</a></label></div>
<div class="col-sm-1 header hidden-xs"><label><a href="#">Actions</a></label></div>
</div>
<template [ngIf]="entitiesCheckboxes && entitiesCheckboxes.length>0">
<div *ngFor="let check of entitiesCheckboxes; let i=index" class="row user">
<div class="col-sm-1 avatar"><input id="{{check.entity._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.entity._id}}" [(ngModel)]="check.checked">
</div>
<div class="col-sm-5">
<div class="name" href="#">{{check.entity.name}}</div>
</div>
<div class="col-sm-5">
<div *ngIf="check.entity.isEnabled" class="activated" >
<input (click)="toggleEntity(false,[check.entity._id])" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div>
<div *ngIf="!check.entity.isEnabled" class="deactivated" >
<input (click)="toggleEntity(true,[check.entity._id])" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
</div>
</div>
<div class="col-sm-1">
<div class="actions" href="#">
<input title="Edit" src="imgs/icn_edit.png" class="edit" type="image" (click)="editEntity(i)">
<input title="Delete" src="imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeleteEntity(check.entity._id)">
</div>
</div>
</div>
</template>
<div *ngIf="entitiesCheckboxes.length==0" class="col-md-12">
<div class="alert alert-warning">No entities found</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Entity'" [formGroup]="formGroup" [type]="'entity'"
[isModalShown]="isModalShown" (emmitObject)="entitySavedSuccessfully($event)" (emmitError)="handleError($event)"
[selectedCommunityId]="selectedCommunityId">
<entity-form [group]="formGroup"></entity-form>
</modal-form>
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Entity'" [formGroup]="formGroup" [type]="'entity'"
[isModalShown]="isModalShown" (emmitObject)="entityUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
[selectedCommunityId]="selectedCommunityId">
<entity-form [group]="formGroup"></entity-form>
</modal-form>
<delete-confirmation-dialog #deleteConfirmationModal [isModalShown]="isModalShown" (emmitObject)="confirmedDeleteEntities($event)">
Are you sure you want to delete the selected entity(-ies)?
</delete-confirmation-dialog>

View File

@ -0,0 +1,180 @@
import { Component, ViewChild, OnInit } from '@angular/core';
import { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms";
import { ModalFormComponent } from "../modal-form.component";
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
import { EntityFormComponent } from "./entity-form.component";
import { CheckEntity, Entity } from "../../domain/entity";
import { Community } from "../../domain/community";
@Component({
selector: 'selectEntities',
templateUrl: './selectEntities.component.html',
})
export class SelectEntitiesComponent implements OnInit {
// @ViewChild(ModalFormComponent)
@ViewChild('saveModal')
public modal:ModalFormComponent;
@ViewChild('updateModal')
public updateModal:ModalFormComponent;
@ViewChild('deleteConfirmationModal')
public deleteConfirmationModal : DeleteConfirmationDialogComponent;
@ViewChild(EntityFormComponent)
public formComponent : EntityFormComponent;
public entitiesCheckboxes : CheckEntity[] = [];
public entities : Entity[] = [];
public errorMessage: string;
public formGroup : FormGroup;
private searchText : RegExp = new RegExp('');
public communities: Community[] = [];
public selectedCommunityId: string;
ngOnInit() {
this.getCommunities();
this.formGroup = this.formComponent.form;
}
constructor(private _helpContentService: HelpContentService) {}
getCommunities() {
let self = this;
this._helpContentService.getCommunities().subscribe(
communities => {
self.communities = communities;
self.getEntities(self.communities[0]._id);
self.selectedCommunityId = self.communities[0]._id;
},
error => this.handleError('System error retrieving communities', error));
}
getEntities(community_id: string) {
let self = this;
this._helpContentService.getCommunityEntities(community_id).subscribe(
entities => {
self.entities = entities;
self.entitiesCheckboxes = [];
entities.forEach(_ => {
self.entitiesCheckboxes.push(<CheckEntity>{entity : _, checked : false});
});
},
error => this.handleError('System error retrieving entities', error));
}
public showModal():void {
this.modal.showModal();
}
public toggleCheckBoxes(event) {
this.entitiesCheckboxes.forEach(_ => _.checked = event.target.checked);
}
public applyCheck(flag : boolean) {
console.info("applyCheck "+flag);
this.entitiesCheckboxes.forEach(_ => _.checked = flag);
}
public getSelectedEntities() : string[] {
return this.entitiesCheckboxes.filter(entity => entity.checked == true).map(checkedEntity => checkedEntity.entity).map(res => res._id);
}
private deleteEntitiesFromArray(ids : string[]) : void {
for(let id of ids) {
let i = this.entitiesCheckboxes.findIndex(_ => _.entity._id == id);
this.entitiesCheckboxes.splice(i, 1);
}
}
public confirmDeleteEntity(id : string) {
this.deleteConfirmationModal.ids = [id];
this.deleteConfirmationModal.showModal();
}
public confirmDeleteSelectedEntities() {
this.deleteConfirmationModal.ids = this.getSelectedEntities();
this.deleteConfirmationModal.showModal();
}
public confirmedDeleteEntities(ids : string[]) {
this._helpContentService.deleteEntities(ids).subscribe(
_ => this.deleteEntitiesFromArray(ids),
error => this.handleError('System error deleting the selected entities', error)
);
}
public editEntity(i : number) {
let entity : Entity = this.entitiesCheckboxes[i].entity;
this.formGroup.patchValue(entity);
this.updateModal.showModal();
}
public entitySavedSuccessfully(entity: Entity) {
this.entitiesCheckboxes.push(<CheckEntity>{entity : entity, checked : false});
this.applyCheck(false);
}
public entityUpdatedSuccessfully(entity : Entity) {
this.entitiesCheckboxes.find(checkItem => checkItem.entity._id==entity._id).entity = entity;
this.applyCheck(false);
}
public filterBySearch(text : string) {
this.searchText = new RegExp(text,'i');
this.applyFilter();
}
public applyFilter() {
this.entitiesCheckboxes = [];
this.entities.filter(item => this.filterEntities(item)).forEach(
_ => this.entitiesCheckboxes.push(<CheckEntity>{entity: _, checked: false})
);
}
public filterEntities(entity : Entity) : boolean {
let textFlag = this.searchText.toString() == '' || (entity.name).match(this.searchText) != null;
return textFlag;
}
handleError(message: string, error) {
if(error == null) {
this.formComponent.reset();
}
this.errorMessage = message + ' (Server responded: ' + error + ')';
}
public filterByCommunity(event: any) {
this.selectedCommunityId = event.target.value;
this.applyCommunityFilter(this.selectedCommunityId);
}
public applyCommunityFilter(community_id: string) {
this.getEntities(community_id);
}
public toggleEntity(status : boolean, id : string) {
this._helpContentService.toggleEntity(this.selectedCommunityId,id,status).subscribe(
() => {
let i = this.entitiesCheckboxes.findIndex(_ => _.entity._id == id);
this.entitiesCheckboxes[i].entity.isEnabled=status;
this.applyCheck(false);
},
error => this.handleError('System error changing the status of the selected entity(-ies)', error)
);
}
}

View File

@ -19,4 +19,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -9,6 +9,7 @@ import { Topic } from "../domain/topic";
import { Question } from "../domain/question";
import { HelpContentService } from "../services/help-content.service";
import { Page } from "../domain/page";
import { Entity } from "../domain/entity";
@Component({
selector: 'modal-form',
@ -37,6 +38,9 @@ export class ModalFormComponent {
@Input()
public type : string = 'topic';
@Input()
public selectedCommunityId: string;
public errorMessage : string = null;
@Output() emmitObject: EventEmitter<any> = new EventEmitter();
@ -56,7 +60,7 @@ export class ModalFormComponent {
this.emmitError.emit(null);
this.errorMessage = null;
}
public saveCustom(obj : any) {
if(!this.formGroup.valid) {
this.errorMessage = "Please fill in all required fields marked with *"
@ -73,13 +77,31 @@ export class ModalFormComponent {
error => this.emmitError.emit(error)
);
} else if (this.type == 'page') {
this._helpService.savePage(<Page> obj).subscribe(
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
);
if(this.saveText == 'Update') {
this._helpService.updatePage(<Page> obj).subscribe(
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
);
} else if(this.saveText == 'Save') {
this._helpService.savePage(<Page> obj).subscribe(
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
);
}
} else if (this.type == 'entity') {
if(this.saveText == 'Update') {
this._helpService.updateEntity(<Entity> obj).subscribe(
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
);
} else if(this.saveText == 'Save') {
this._helpService.saveEntity(<Entity> obj).subscribe(
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
);
}
}
this.hideModal();
}
}
}

View File

@ -5,7 +5,10 @@ import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { Page } from "../domain/page";
import {PageHelpContent} from "../domain/page-help-content";
import { PageHelpContent } from "../domain/page-help-content";
import { Community } from "../domain/community";
import { Entity } from "../domain/entity";
@Injectable()
export class HelpContentService {
@ -29,14 +32,86 @@ export class HelpContentService {
.catch(this.handleError);
}
getCommunities() {
return this.http.get(this._helpContentUrl + 'community')
.map(res => <Array<Community>> res.json())
.catch(this.handleError);
}
getCommunityPages(community_id: string) {
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/pages')
.map(res => <Array<Page>> res.json())
.catch(this.handleError);
}
getEntities() {
return this.http.get(this._helpContentUrl + 'entity')
.map(res => <Array<Entity>> res.json())
.catch(this.handleError);
}
getCommunityEntities(community_id: string) {
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/entities')
.map(res => <Array<Entity>> res.json())
.catch(this.handleError);
}
saveEntity(entity: Entity) {
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
HelpContentService.removeNulls(entity);
return this.http.post(this._helpContentUrl + 'entity/save', JSON.stringify(entity), options)
.map(res => <Entity> res.json())
.catch(this.handleError);
}
updateEntity(entity: Entity) {
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
HelpContentService.removeNulls(entity);
return this.http.post(this._helpContentUrl + 'entity/update', JSON.stringify(entity), options)
.map(res => <Entity> res.json())
.catch(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(this._helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options)
.catch(this.handleError);
}
deleteEntities(ids : string[]) {
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
return this.http.post(this._helpContentUrl + 'entity/delete',JSON.stringify(ids), options)
.catch(this.handleError);
}
toggleEntityOfPage(pageId: string, entityId : string,status : boolean) {
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
return this.http.post(this._helpContentUrl + 'page/'+pageId+'/entity/toggle?status='+ status.toString()+'&entityId='+entityId.toString(), options)
.catch(this.handleError);
}
savePage(page: Page) {
console.log("savePage",page);
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
HelpContentService.removeNulls(page);
return this.http.post(this._helpContentUrl + 'page', JSON.stringify(page), options)
return this.http.post(this._helpContentUrl + 'page/save', JSON.stringify(page), options)
.map(res => <Page> res.json())
.catch(this.handleError);
}
@ -47,11 +122,20 @@ export class HelpContentService {
HelpContentService.removeNulls(page);
return this.http.put(this._helpContentUrl + 'page', JSON.stringify(page), options)
return this.http.post(this._helpContentUrl + 'page/update', JSON.stringify(page), options)
.map(res => <Page> res.json())
.catch(this.handleError);
}
togglePage(selectedCommunityId: string, id : string,status : boolean) {
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityId+'/page/toggle?status='+ status.toString()+'&pageId='+id.toString(), options)
.catch(this.handleError);
}
deletePages(ids : string[]) {
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
@ -66,6 +150,12 @@ export class HelpContentService {
.catch(this.handleError);
}
getCommunityPageHelpContents(community_id: string) {
return this.http.get(this._helpContentUrl + 'pagehelpcontent/community/'+community_id)
.map(res => <Array<PageHelpContent>> res.json())
.catch(this.handleError);
}
getPageHelpContent(id : string) {
return this.http.get(this._helpContentUrl + 'pagehelpcontent/' + id)
.map(res => <PageHelpContent> res.json())
@ -108,7 +198,7 @@ export class HelpContentService {
let options = new RequestOptions({headers: headers});
return this.http.post(this._helpContentUrl + 'pagehelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), options)
.map( res => <string[]> res.json())
//.map( res => <string[]> res.json())
.catch(this.handleError);
}
@ -118,5 +208,5 @@ export class HelpContentService {
console.error(error);
return Observable.throw(error.json().error || 'Server error');
}
}
}

BIN
imgs/OA CONNECT_A.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
imgs/OA CONNECT_B.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
imgs/add-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
imgs/delete-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -8,8 +8,10 @@
}
#sidebar-default {
background: #00b9b4 none repeat scroll 0 0;
border-right: 1px solid #18aba6;
/*background: #00b9b4 none repeat scroll 0 0;*/
background: #00a0de none repeat scroll 0 0;
/*border-right: 1px solid #18aba6;*/
border-right: 1px solid #008ec5;
position: fixed;
width: 260px;
}
@ -22,12 +24,15 @@
}
#sidebar-default .menu-section ul li a:hover, #sidebar-default .menu-section ul li a.toggled {
background: #18aba6 none repeat scroll 0 0;
/*background: #18aba6 none repeat scroll 0 0;*/
background: #008ec5 none repeat scroll 0 0;
}
#sidebar-default .menu-section ul li a.active {
/*background: #ff6600 none repeat scroll 0 0;*/
background: #003f3c none repeat scroll 0 0;
/*background: #003f3c none repeat scroll 0 0;*/
/*background: #05007A none repeat scroll 0 0;*/
background: #e2d442 none repeat scroll 0 0;
}
#sidebar-default .menu-section h3 {
@ -120,8 +125,10 @@
/***********************************************/
.btn-primary {
background-color: #00b9b4;
border-color: #18aba6;
/*background-color: #00b9b4;*/
background-color: #00a0de;
/*border-color: #18aba6;*/
border-color: #008ec5;
color: #fff;
}
@ -741,7 +748,8 @@ a {
#faqTopics #content .page-title,
#faqQuestions #content .page-title,
#pages #content .page-title,
#pageContents #content .page-title {
#pageContents #content .page-title,
#entities #content .entity-title {
border-right: 1px solid #e6e6e6;
bottom: 0;
color: #7e7e7e;
@ -774,7 +782,8 @@ a {
#faqQuestions #content .content-wrapper .contentPanel .alert,
#harvestHistory #content .content-wrapper .contentPanel .alert,
#pages #content .content-wrapper .contentPanel .alert,
#pageContents #content .content-wrapper .contentPanel .alert {
#pageContents #content .content-wrapper .contentPanel .alert,
#entities #content .content-wrapper .contentPanel .alert {
margin-left: -10px;
margin-right: -10px;
}
@ -975,6 +984,14 @@ a {
width: 360px;
}
#entities #content form.search {
float: left;
margin-left: 150px;
position: relative;
top: -2px;
width: 360px;
}
#dataProviders #content form.search {
float: left;
margin-left: 220px;
@ -990,7 +1007,8 @@ a {
#faqTopics #content form.search input[type="text"],
#faqQuestions #content form.search input[type="text"],
#pages #content form.search input[type="text"],
#pageContents #content form.search input[type="text"] {
#pageContents #content form.search input[type="text"],
#entities #content form.search input[type="text"]{
border: 0 none;
border-radius: 3px;
padding: 6px 15px 6px 37px;
@ -1010,7 +1028,8 @@ a {
#faqTopics #content form.search input[type="submit"],
#faqQuestions #content form.search input[type="submit"],
#pages #content form.search input[type="submit"],
#pageContents #content form.search input[type="submit"] {
#pageContents #content form.search input[type="submit"],
#entities #content form.search input[type="submit"] {
position: absolute;
visibility: hidden;
}
@ -1040,8 +1059,8 @@ a {
#pageContents #content .content-wrapper .page-controls .filters .links,
#harvestHistory #content .content-wrapper .page-controls .filters .links,
#harvest #content .content-wrapper .page-controls .filters .links {
float: left;
margin-left: -5px;
/*float: left;
margin-left: -5px;*/
}
#users #content .content-wrapper .page-controls .filters .links .filterLabel,
@ -1502,6 +1521,3 @@ table.dataTable td input.edit {
content:"*";
color:red;
}