Project

General

Profile

« Previous | Next » 

Revision 59464

[use-UoaAdminToolsLibrary | Library]: Merge trunk into branch.

View differences:

reload.component.ts
4 4
import {HelperFunctions} from "../utils/HelperFunctions.class";
5 5

  
6 6
@Component({
7
    selector: 'reload',
8
    template: `
9
    <div id="tm-main" class=" uk-section  uk-margin-small-top tm-middle"   >
7
  selector: 'reload',
8
  template: `
9
    <div id="tm-main" class=" uk-section  uk-margin-small-top tm-middle">
10 10
      <div uk-grid uk-grid>
11
       <div class="tm-main uk-width-1-1@s uk-width-1-1@m  uk-width-1-1@l uk-row-first ">
11
        <div class="tm-main uk-width-1-1@s uk-width-1-1@m  uk-width-1-1@l uk-row-first ">
12 12
          <div class="uk-container uk-margin-top publication">
13 13
            Go to initial page....
14 14
          </div>
15 15
        </div>
16 16
      </div>
17 17
    </div>
18
     `
18
  `
19 19
})
20 20
export class ReloadComponent {
21

  
22
  constructor (private route: ActivatedRoute, private _router: Router) {}
23

  
21
  
22
  constructor(private route: ActivatedRoute, private _router: Router) {
23
  }
24
  
24 25
  public ngOnInit() {
25
      HelperFunctions.scroll();
26

  
27
      var URL = Session.getReloadUrl();
28

  
29
        if(URL && URL["path"] && URL["path"] != null && URL["path"] != ""){
30
          var url = URL["path"];
31
          var host = URL["host"];
32
          var paramsObject = ((URL["params"] && URL["params"] != null)? Session.getParamsObj(URL["params"]):null);
33
          if(host == (location.protocol+"//"+location.host)){
34
            let baseUrl = (document && document.getElementsByTagName('base'))?document.getElementsByTagName('base')[0].href.split(document.location.host)[1]:"/";
35
            url = (baseUrl.length>1 && url.indexOf(baseUrl)!=-1 )?("/"+url.split(baseUrl)[1]):url;
36
            if(paramsObject &&  paramsObject != null){
37
              Session.setReloadUrl("","","")
38
              this._router.navigate([url],{ queryParams: paramsObject});
39
            }else{
40
              Session.setReloadUrl("","","")
41
              this._router.navigate([url]);
42
            }
43
          }else{
44
            Session.setReloadUrl("","","")
45
            window.location.href = host+url+((URL["params"] && URL["params"] !=null)?((URL["params"].indexOf("?")==-1?"?":"")+URL["params"]):"");
46
          }
47

  
48
        }else{
49
          Session.setReloadUrl("","","")
50
          this._router.navigate(['/']);
51

  
26
    HelperFunctions.scroll();
27
    var URL = Session.getReloadUrl();
28
    if (URL && URL["path"] && URL["path"] != null && URL["path"] != "") {
29
      var url = URL["path"];
30
      var host = URL["host"];
31
      var paramsObject = ((URL["params"] && URL["params"] != null) ? Session.getParamsObj(URL["params"]) : null);
32
      if (host == (location.protocol + "//" + location.host)) {
33
        let baseUrl = (document && document.getElementsByTagName('base')) ? document.getElementsByTagName('base')[0].href.split(document.location.host)[1] : "/";
34
        url = (baseUrl.length > 1 && url.indexOf(baseUrl) != -1) ? ("/" + url.split(baseUrl)[1]) : url;
35
        if (paramsObject) {
36
          Session.setReloadUrl("", "", "")
37
          this._router.navigate([url], {queryParams: paramsObject});
38
        } else {
39
          Session.setReloadUrl("", "", "")
40
          this._router.navigate([url]);
52 41
        }
42
      } else {
43
        Session.setReloadUrl("", "", "")
44
        window.location.href = host + url + ((URL["params"] && URL["params"] != null) ? ((URL["params"].indexOf("?") == -1 ? "?" : "") + URL["params"]) : "");
45
      }
46
      
47
    } else {
48
      Session.setReloadUrl("", "", "")
49
      this._router.navigate(['/']);
50
      
51
    }
53 52
  }
54

  
53
  
55 54
}

Also available in: Unified diff