Project

General

Profile

1 56071 argiro.kok
import {Component} from '@angular/core';
2
import {ActivatedRoute} from '@angular/router';
3
import {PiwikHelper} from '../../utils/piwikHelper';
4
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
5
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
6 52831 sofia.balt
7
@Component({
8 56071 argiro.kok
  selector: 'openaire-search-other',
9 57028 konstantin
  template: `
10
    <search-research-results openaireLink="https://beta.explore.openaire.eu/search/find/other"
11
                             [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false"
12
                             resultType="other">
13
    </search-research-results>
14 56071 argiro.kok
  `
15 52831 sofia.balt
16
})
17
export class OpenaireSearchOrpsComponent {
18
19 56071 argiro.kok
  advancedSearchParameters: any;
20
  connectCommunityId: string;
21 52831 sofia.balt
  piwikSiteId = null;
22 56071 argiro.kok
  customFilter: SearchCustomFilter = null;
23
24
  constructor(private  route: ActivatedRoute) {
25 52831 sofia.balt
  }
26 56071 argiro.kok
27 52831 sofia.balt
  ngOnInit() {
28 54949 argiro.kok
29
    this.route.data
30 56071 argiro.kok
      .subscribe((data: { envSpecific: any }) => {
31 54949 argiro.kok
32 56071 argiro.kok
        var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
33
        if (communityId) {
34
          this.connectCommunityId = communityId
35 56841 konstantin
          this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,data.envSpecific.environment);
36 56071 argiro.kok
          this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
37 54949 argiro.kok
38 56071 argiro.kok
        } else {
39 56841 konstantin
          this.route.queryParams.subscribe(params => {
40
            if (params['communityId'] && params['communityId'] != "") {
41
              this.connectCommunityId = params['communityId'];
42
              this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId,data.envSpecific.environment);
43 56071 argiro.kok
              this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
44 54949 argiro.kok
45 56071 argiro.kok
            }
46
          });
47
        }
48
49
      });
50
51 52831 sofia.balt
  }
52
}