2018-02-05 14:14:59 +01:00
|
|
|
import {Injectable, Inject} from '@angular/core';
|
2017-12-19 13:53:46 +01:00
|
|
|
import {Http, Response} from '@angular/http';
|
|
|
|
import {Observable} from 'rxjs/Observable';
|
|
|
|
import 'rxjs/add/observable/of';
|
|
|
|
import 'rxjs/add/operator/do';
|
|
|
|
import 'rxjs/add/operator/share';
|
2018-02-05 14:14:59 +01:00
|
|
|
import{EnvProperties} from '../properties/env-properties';
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class HelperService {
|
2018-02-05 14:14:59 +01:00
|
|
|
constructor(private http: Http) {}
|
2018-02-13 15:52:23 +01:00
|
|
|
|
2018-03-29 10:23:36 +02:00
|
|
|
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties,communityId:string ):any {
|
2018-02-13 15:52:23 +01:00
|
|
|
console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
|
|
|
|
|
|
|
|
let url = properties.adminToolsAPIURL;
|
|
|
|
if(div) {
|
2018-03-29 10:23:36 +02:00
|
|
|
url += '/divhelpcontent?active=true&community='+communityId+'&page='+router+'&div=' + div;
|
2018-02-13 15:52:23 +01:00
|
|
|
} else {
|
2018-03-29 10:23:36 +02:00
|
|
|
url += '/pagehelpcontent?active=true&community='+communityId+'&page='+router+'&position=' + position;
|
2018-02-13 15:52:23 +01:00
|
|
|
if(before) {
|
|
|
|
url += '&before='+before;
|
|
|
|
}
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
2017-12-19 13:53:46 +01:00
|
|
|
.map(res => <any> res.json());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|