52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
|
import {Component, Input, ViewChild} from '@angular/core';
|
||
|
import {SearchCustomFilter} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||
|
import {ActivatedRoute} from "@angular/router";
|
||
|
import {ConnectHelper} from "../../openaireLibrary/connect/connectHelper";
|
||
|
import {PiwikHelper} from "../../utils/piwikHelper";
|
||
|
|
||
|
|
||
|
@Component({
|
||
|
selector: 'openaire-advanced-search-organizations',
|
||
|
template: `
|
||
|
<search-organizations [simpleView]="false" [customFilter]=customFilter [piwikSiteId]="piwikSiteId" [hasPrefix]="false" [showBreadcrumb]="true" [showSwitchSearchLink]="false">
|
||
|
</search-organizations>
|
||
|
|
||
|
`
|
||
|
})
|
||
|
|
||
|
export class OpenaireAdvancedSearchOrganizationsComponent {
|
||
|
connectCommunityId:string;
|
||
|
piwikSiteId = null;
|
||
|
customFilter: SearchCustomFilter = null;
|
||
|
constructor ( private route: ActivatedRoute) {
|
||
|
}
|
||
|
ngOnInit() {
|
||
|
this.route.data
|
||
|
.subscribe((data: { envSpecific: any }) => {
|
||
|
|
||
|
var communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
|
||
|
|
||
|
this.piwikSiteId = PiwikHelper.getSiteId(communityId, data.envSpecific.environment);
|
||
|
|
||
|
if(communityId){
|
||
|
this.connectCommunityId = communityId;
|
||
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
|
||
|
this.customFilter.isHiddenFilter = false;
|
||
|
|
||
|
} else{
|
||
|
this.route.queryParams.subscribe(params => {
|
||
|
|
||
|
if(params['communityId'] && params['communityId']!=""){
|
||
|
this.connectCommunityId = params['communityId'];
|
||
|
this.piwikSiteId = PiwikHelper.getSiteId(this.connectCommunityId, data.envSpecific.environment);
|
||
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.connectCommunityId, "");
|
||
|
this.customFilter.isHiddenFilter = false;
|
||
|
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|