Project

General

Profile

1
import {Injectable} from '@angular/core';
2
import {HttpClient} from "@angular/common/http";
3

    
4

    
5
import {EnvProperties} from '../properties/env-properties';
6

    
7
@Injectable()
8
export class HelperService {
9
    constructor(private http: HttpClient) {}
10

    
11
    /**
12
    * @deprecated
13
    */
14
    getHelper (router: string, position: string, before: boolean, div: string, properties:EnvProperties, communityId:string ):any {
15
        //console.info("get router helpText for : "+router+" - position="+position+" - before="+before + " - div="+div);
16

    
17
        let url = properties.adminToolsAPIURL;
18
        if(div) {
19
          url += '/divhelpcontent?active=true&community='+communityId+'&page='+router+'&div=' + div;
20
        } else {
21
          url += '/pagehelpcontent?active=true&community='+communityId+'&page='+router+'&position=' + position;
22
          if(before) {
23
            url += '&before='+before;
24
          }
25
        }
26

    
27
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
28
                    //.map(res => <any> res.json());
29

    
30
    }
31

    
32
    getPageHelpContents(properties:EnvProperties, communityId:string, router: string):any {
33
      if(!communityId) {
34
        communityId = 'openaire';
35
      }
36
      let page_route: string = router.split('?')[0].substring(0);
37
      let url = properties.adminToolsAPIURL;
38
      url += '/community/' + communityId + '/pagehelpcontent?active=true&page='+page_route;
39
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
40
    }
41

    
42
    getDivHelpContents(properties:EnvProperties, communityId:string, router: string):any {
43
      if(!communityId) {
44
        communityId = 'openaire';
45
      }
46
      let page_route: string = router.split('?')[0].substring(0);
47
      let url = properties.adminToolsAPIURL;
48
      url += '/community/' + communityId + '/divhelpcontent?active=true&page='+page_route;
49
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
50
    }
51

    
52
}
(3-3/4)