Project

General

Profile

« Previous | Next » 

Revision 53927

Search results:
add properly the piwik id
Search/find
pass communityId to filter the results
and piwik id

View differences:

modules/uoa-connect-portal/trunk/src/app/searchPages/find/search.component.ts
1 1
import {Component, ViewChild, ElementRef} from '@angular/core';
2
import {ActivatedRoute} from '@angular/router';
3
import {PiwikHelper} from '../../utils/piwikHelper';
4
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
2 5

  
3 6
@Component({
4 7
    selector: 'openaire-search-find',
5
    template: ` 
6
    <search-find></search-find>
8
    template: `
9
    <search-find  [(connectCommunityId)]=connectCommunityId [piwikSiteId]="piwikSiteId"></search-find>
7 10
    `,
8 11
 })
9 12
export class OpenaireSearchComponent{
10
  constructor (  ) {
11

  
13
  connectCommunityId:string;
14
  piwikSiteId = null;
15
  constructor ( private  route: ActivatedRoute) {
12 16
  }
13

  
14 17
  ngOnInit() {
15
}
18
    var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
19
    if(communityId){
20
      this.connectCommunityId = communityId
21
      this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
22
    }else{
23
      this.route.queryParams.subscribe(data => {
24
        if(data['communityId'] && data['communityId']!=""){
25
          this.connectCommunityId = data['communityId'];
26
          this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
27
        }
28
      });
29
    }
30
  }
16 31

  
17 32

  
18

  
19 33
}
modules/uoa-connect-portal/trunk/src/app/searchPages/simple/searchDatasets.component.ts
9 9

  
10 10
    <search-datasets
11 11
    openaireLink="https://beta.explore.openaire.eu/search/find/datasets"
12
                [(connectCommunityId)]=connectCommunityId>
12
                [(connectCommunityId)]=connectCommunityId  [piwikSiteId]="piwikSiteId">
13 13
    </search-datasets>
14 14
    `
15 15
})
......
22 22
  }
23 23
  ngOnInit() {
24 24
    var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
25
    this.piwikSiteId = PiwikHelper.siteIDs[communityId];
26 25
    if(communityId){
27 26
      this.connectCommunityId = communityId
27
      this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
28 28
    }else{
29 29
      this.route.queryParams.subscribe(data => {
30

  
31 30
        if(data['communityId'] && data['communityId']!=""){
32 31
          this.connectCommunityId = data['communityId'];
32
          this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
33 33
        }
34 34
      });
35 35
    }
modules/uoa-connect-portal/trunk/src/app/searchPages/simple/searchOrps.component.ts
9 9

  
10 10
    <search-orps  openaireLink="https://beta.explore.openaire.eu/search/find/other"
11 11

  
12
                 [(connectCommunityId)]=connectCommunityId>
12
                 [(connectCommunityId)]=connectCommunityId  [piwikSiteId]="piwikSiteId">
13 13
    </search-orps>
14 14

  
15 15
    `
......
24 24
  }
25 25
  ngOnInit() {
26 26
    var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
27
    this.piwikSiteId = PiwikHelper.siteIDs[communityId];
28 27
    if(communityId){
29 28
      this.connectCommunityId = communityId
29
      this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
30 30
    }else{
31 31
      this.route.queryParams.subscribe(data => {
32 32
        if(data['communityId'] && data['communityId']!=""){
33 33
          this.connectCommunityId = data['communityId'];
34
          this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
34 35
        }
35 36
      });
36 37
    }
modules/uoa-connect-portal/trunk/src/app/searchPages/simple/searchSoftware.component.ts
9 9

  
10 10
    <search-software
11 11
    openaireLink="https://beta.explore.openaire.eu/search/find/software"
12
                [(connectCommunityId)]=connectCommunityId>
12
                [(connectCommunityId)]=connectCommunityId  [piwikSiteId]="piwikSiteId">
13 13
    </search-software>
14 14
    `
15 15
})
......
22 22
  }
23 23
  ngOnInit() {
24 24
    var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
25
    this.piwikSiteId = PiwikHelper.siteIDs[communityId];
26 25
    if(communityId){
27
       this.connectCommunityId = communityId
26
      this.connectCommunityId = communityId
27
      this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
28 28
    }else{
29 29
      this.route.queryParams.subscribe(data => {
30

  
31 30
        if(data['communityId'] && data['communityId']!=""){
32
           this.connectCommunityId = data['communityId'];
31
          this.connectCommunityId = data['communityId'];
32
          this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
33 33
        }
34 34
      });
35 35
    }
modules/uoa-connect-portal/trunk/src/app/searchPages/simple/searchPublications.component.ts
9 9

  
10 10
    <search-publications  openaireLink="https://beta.explore.openaire.eu/search/find/publications"
11 11

  
12
                 [(connectCommunityId)]=connectCommunityId>
12
                 [(connectCommunityId)]=connectCommunityId [piwikSiteId]="piwikSiteId">
13 13
    </search-publications>
14 14

  
15 15
    `
......
24 24
  }
25 25
  ngOnInit() {
26 26
    var communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
27
    this.piwikSiteId = PiwikHelper.siteIDs[communityId];
28 27
    if(communityId){
29 28
      this.connectCommunityId = communityId
29
      this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
30 30
    }else{
31 31
      this.route.queryParams.subscribe(data => {
32 32
        if(data['communityId'] && data['communityId']!=""){
33 33
          this.connectCommunityId = data['communityId'];
34
          this.piwikSiteId = PiwikHelper.siteIDs[this.connectCommunityId];
34 35
        }
35 36
      });
36 37
    }

Also available in: Unified diff