51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
import {Injectable} from '@angular/core';
|
|
import {HttpClient} from "@angular/common/http";
|
|
|
|
|
|
|
|
import{EnvProperties} from '../properties/env-properties';
|
|
|
|
@Injectable()
|
|
export class HelperService {
|
|
constructor(private http: HttpClient) {}
|
|
|
|
getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties, communityId:string ):any {
|
|
//console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
|
|
|
|
let url = properties.adminToolsAPIURL;
|
|
if(div) {
|
|
url += '/divhelpcontent?active=true&community='+communityId+'&page='+router+'&div=' + div;
|
|
} else {
|
|
url += '/pagehelpcontent?active=true&community='+communityId+'&page='+router+'&position=' + position;
|
|
if(before) {
|
|
url += '&before='+before;
|
|
}
|
|
}
|
|
|
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
|
|
//.map(res => <any> res.json());
|
|
|
|
}
|
|
|
|
getPageHelpContents(router: string, properties:EnvProperties, communityId:string ):any {
|
|
if(!communityId) {
|
|
communityId = 'openaire';
|
|
}
|
|
router = router.split('?')[0].substring(0);
|
|
let url = properties.adminToolsAPIURL;
|
|
url += '/community/' + communityId + '/pagehelpcontent?active=true&page='+router;
|
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
|
|
}
|
|
|
|
getDivHelpContents(router: string, properties:EnvProperties, communityId:string ):any {
|
|
if(!communityId) {
|
|
communityId = 'openaire';
|
|
}
|
|
router = router.split('?')[0].substring(0);
|
|
let url = properties.adminToolsAPIURL;
|
|
url += '/community/' + communityId + '/divhelpcontent?active=true&page='+router;
|
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
|
|
}
|
|
|
|
}
|