1
|
import {Injectable, Inject} from '@angular/core';
|
2
|
import {Http, Response} from '@angular/http';
|
3
|
import {Observable} from 'rxjs/Observable';
|
4
|
import 'rxjs/add/observable/of';
|
5
|
import 'rxjs/add/operator/do';
|
6
|
import 'rxjs/add/operator/share';
|
7
|
import{EnvProperties} from '../properties/env-properties';
|
8
|
|
9
|
@Injectable()
|
10
|
export class HelperService {
|
11
|
constructor(private http: Http) {}
|
12
|
|
13
|
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties):any {
|
14
|
console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
|
15
|
|
16
|
let url = properties.adminToolsAPIURL;
|
17
|
if(div) {
|
18
|
url += '/divhelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&div=' + div;
|
19
|
} else {
|
20
|
url += '/pagehelpcontent?active=true&community='+properties.adminToolsCommunity+'&page='+router+'&position=' + position;
|
21
|
if(before) {
|
22
|
url += '&before='+before;
|
23
|
}
|
24
|
}
|
25
|
|
26
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
27
|
.map(res => <any> res.json());
|
28
|
|
29
|
}
|
30
|
|
31
|
|
32
|
|
33
|
}
|