diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 0e138cd..f4b8e51 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -61,7 +61,7 @@
- OpenAIRE Research Graph + OpenAIRE Graph
@@ -78,7 +78,7 @@
{{funder.name}}
{{funder.publications | number}}
- Research Outcomes Found + {{entities.RESULTS}} Found
{{(funder.openAccessPublications / funder.publications) * 100 | number : '1.0-0'}}%
@@ -120,4 +120,4 @@
- \ No newline at end of file + diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index d42718b..258869f 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -23,18 +23,18 @@ import {Numbers, NumbersComponent} from "../openaireLibrary/sharedComponents/num @Component({ selector: 'home', templateUrl: 'home.component.html', - styleUrls: ['home.component.less'] + styleUrls: ['home.component.less'] }) export class HomeComponent { - public keyword:string = ""; - public searchFields:SearchFields = new SearchFields(); - public errorCodes:ErrorCodes = new ErrorCodes(); - public routerHelper:RouterHelper = new RouterHelper(); - public numbers: Numbers = {}; + public keyword: string = ""; + public searchFields: SearchFields = new SearchFields(); + public errorCodes: ErrorCodes = new ErrorCodes(); + public routerHelper: RouterHelper = new RouterHelper(); + public numbers: Numbers = {}; properties: EnvProperties = properties; - public openaireEntities = OpenaireEntities; + public openaireEntities = OpenaireEntities; public readMore: boolean = false; - public funders = []; + public funders = []; subs: Subscription[] = []; resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = { filter: null, @@ -46,30 +46,40 @@ export class HomeComponent { disableSelect; selectedEntitySimpleUrl; selectedEntityAdvancedUrl; - resultTypes:Filter = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Result Types",filterOperator:"or"}; + resultTypes: Filter = { + values: [], + filterId: "type", + countSelectedValues: 0, + filterType: 'checkbox', + originalFilterId: "", + valueIsExact: true, + title: "Result Types", + filterOperator: "or" + }; public pageContents = null; - customFilter:SearchCustomFilter= null; + customFilter: SearchCustomFilter = null; aggregatorId; - aggregator:AggregatorInfo; - @ViewChild('numbersComponent', { static: true }) numbersComponent: NumbersComponent; - - constructor ( - private _router: Router, - private _refineFieldResultsService:RefineFieldResultsService, - private _piwikService:PiwikService, - private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService, - private helper: HelperService, - private cdr: ChangeDetectorRef + aggregator: AggregatorInfo; + entities = OpenaireEntities; + @ViewChild('numbersComponent', {static: true}) numbersComponent: NumbersComponent; + + constructor( + private _router: Router, + private _refineFieldResultsService: RefineFieldResultsService, + private _piwikService: PiwikService, + private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService, + private helper: HelperService, + private cdr: ChangeDetectorRef ) { this.aggregatorId = ConnectHelper.getCommunityFromDomain(properties.domain); - this.aggregator = PortalAggregators.getFilterInfoByMenuId(this.aggregatorId); + this.aggregator = PortalAggregators.getFilterInfoByMenuId(this.aggregatorId); this.customFilter = PortalAggregators.getSearchCustomFilterByAggregator(this.aggregator); let description = "OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide."; - let title = "OpenAIRE - Explore | " +this.aggregator.title; + let title = "OpenAIRE - Explore | " + this.aggregator.title; this._title.setTitle(title); - this._meta.updateTag({content:description},"name='description'"); - this._meta.updateTag({content:description},"property='og:description'"); - this._meta.updateTag({content:title},"property='og:title'"); + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + this._meta.updateTag({content: title}, "property='og:title'"); } private getPageContents() { @@ -83,64 +93,85 @@ export class HomeComponent { } public ngOnInit() { - this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink+this._router.url, false); + this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this._router.url, false); this.getPageContents(); - if(this.properties!=null){ - var url = this.properties.domain + this.properties.baseLink+this._router.url; - this._meta.updateTag({content:url},"property='og:url'"); - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ + if (this.properties != null) { + var url = this.properties.domain + this.properties.baseLink + this._router.url; + this._meta.updateTag({content: url}, "property='og:url'"); + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.subs.push(this._piwikService.trackView(this.properties, "OpenAIRE").subscribe()); } - if(this.numbersComponent) { - this.numbersComponent.showPublications = portalProperties.entities.publication.isEnabled; - this.numbersComponent.showDatasets = portalProperties.entities.dataset.isEnabled; - this.numbersComponent.showSoftware = portalProperties.entities.software.isEnabled; - this.numbersComponent.showOrp = portalProperties.entities.other.isEnabled; - this.numbersComponent.showOrganizations = portalProperties.entities.organization.isEnabled; - this.numbersComponent.showProjects = portalProperties.entities.project.isEnabled; - this.numbersComponent.showDataProviders = portalProperties.entities.datasource.isEnabled; - } + if (this.numbersComponent) { + this.numbersComponent.showPublications = portalProperties.entities.publication.isEnabled; + this.numbersComponent.showDatasets = portalProperties.entities.dataset.isEnabled; + this.numbersComponent.showSoftware = portalProperties.entities.software.isEnabled; + this.numbersComponent.showOrp = portalProperties.entities.other.isEnabled; + this.numbersComponent.showOrganizations = portalProperties.entities.organization.isEnabled; + this.numbersComponent.showProjects = portalProperties.entities.project.isEnabled; + this.numbersComponent.showDataProviders = portalProperties.entities.datasource.isEnabled; + } this.subs.push(this.config.communityInformationState.subscribe(data => { - if(data) { - var showEntity = {}; - for (var i = 0; i < data['entities'].length; i++) { - showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; + if (data) { + var showEntity = {}; + for (var i = 0; i < data['entities'].length; i++) { + showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; + } + if (this.numbersComponent) { + this.numbersComponent.showPublications = !!showEntity["publication"]; + this.numbersComponent.showDatasets = !!showEntity["dataset"]; + this.numbersComponent.showSoftware = !!showEntity["software"]; + this.numbersComponent.showOrp = !!showEntity["orp"]; + this.numbersComponent.showProjects = !!showEntity["project"]; + this.numbersComponent.showDataProviders = !!showEntity["datasource"]; + this.numbersComponent.showOrganizations = !!showEntity["organization"]; + } + if (this.numbersComponent && this.numbersComponent.showPublications) { + this.resultTypes.values.push({ + name: this.openaireEntities.PUBLICATIONS, + id: "publications", + selected: false, + number: 0 + }); + } + if (this.numbersComponent && this.numbersComponent.showDatasets) { + this.resultTypes.values.push({ + name: this.openaireEntities.DATASETS, + id: "datasets", + selected: false, + number: 0 + }); + } + if (this.numbersComponent && this.numbersComponent.showSoftware) { + this.resultTypes.values.push({ + name: this.openaireEntities.SOFTWARE, + id: "software", + selected: false, + number: 0 + }); + } + if (this.numbersComponent && this.numbersComponent.showOrp) { + this.resultTypes.values.push({ + name: this.openaireEntities.OTHER, + id: "other", + selected: false, + number: 0 + }); + } + if (this.numbersComponent) { + this.numbersComponent.init(false, false, this.numbersComponent.showPublications, this.numbersComponent.showDatasets, this.numbersComponent.showSoftware, this.numbersComponent.showOrp, this.numbersComponent.showProjects, this.numbersComponent.showDataProviders, this.numbersComponent.showOrganizations, + this.customFilter ? StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))) : ''); + } + this.getFunders(); } - if(this.numbersComponent) { - this.numbersComponent.showPublications = !!showEntity["publication"]; - this.numbersComponent.showDatasets = !!showEntity["dataset"]; - this.numbersComponent.showSoftware = !!showEntity["software"]; - this.numbersComponent.showOrp = !!showEntity["orp"]; - this.numbersComponent.showProjects = !!showEntity["project"]; - this.numbersComponent.showDataProviders = !!showEntity["datasource"]; - this.numbersComponent.showOrganizations = !!showEntity["organization"]; - } - if(this.numbersComponent && this.numbersComponent.showPublications){ - this.resultTypes.values.push({name: this.openaireEntities.PUBLICATIONS , id:"publications",selected:false, number:0}); - } - if(this.numbersComponent && this.numbersComponent.showDatasets){ - this.resultTypes.values.push({name: this.openaireEntities.DATASETS , id:"datasets",selected:false, number:0}); - } - if(this.numbersComponent && this.numbersComponent.showSoftware){ - this.resultTypes.values.push({name: this.openaireEntities.SOFTWARE , id:"software",selected:false, number:0}); - } - if(this.numbersComponent && this.numbersComponent.showOrp){ - this.resultTypes.values.push({name: this.openaireEntities.OTHER , id:"other",selected:false, number:0}); - } - if(this.numbersComponent) { - this.numbersComponent.init(false, false, this.numbersComponent.showPublications, this.numbersComponent.showDatasets, this.numbersComponent.showSoftware, this.numbersComponent.showOrp, this.numbersComponent.showProjects, this.numbersComponent.showDataProviders, this.numbersComponent.showOrganizations, - this.customFilter ? StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))) : ''); - } - this.getFunders(); + }, + error => { + this.handleError("Error getting community information", error); } - }, - error => { - this.handleError("Error getting community information", error); - } )); } } + public ngOnDestroy() { for (let sub of this.subs) { sub.unsubscribe(); @@ -148,26 +179,28 @@ export class HomeComponent { } private handleError(message: string, error) { - console.error("Home Page: "+message, error); + console.error("Home Page: " + message, error); } - entityChanged($event){ + + entityChanged($event) { this.selectedEntity = $event.entity; this.selectedEntitySimpleUrl = $event.simpleUrl; this.selectedEntityAdvancedUrl = $event.advancedUrl; } - goTo(simple:boolean){ - let url = (simple)?this.selectedEntitySimpleUrl:this.selectedEntityAdvancedUrl; + + goTo(simple: boolean) { + let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl; let parameterNames = []; let parameterValues = []; if (this.selectedEntity == "result") { if (this.resultTypes) { let values = []; - for(let value of this.resultTypes.values){ + for (let value of this.resultTypes.values) { if (value.selected) { values.push(value.id); } } - if (values.length > 0 && values.length !=4) { + if (values.length > 0 && values.length != 4) { parameterNames.push("type"); parameterValues.push(values.join(",")); } @@ -176,19 +209,19 @@ export class HomeComponent { parameterValues.push("" + this.resultsQuickFilter.selected); } } - }else if(this.selectedEntity == "all"){ + } else if (this.selectedEntity == "all") { if (this.resultsQuickFilter) { parameterNames.push("qf"); parameterValues.push("true"); } } - if(this.keyword.length > 0) { + if (this.keyword.length > 0) { parameterNames.push("fv0"); parameterValues.push(this.keyword); parameterNames.push("f0"); parameterValues.push("q"); } - if(this.customFilter){ + if (this.customFilter) { parameterNames.push(this.customFilter.queryFieldName); parameterValues.push(this.customFilter.valueId); parameterNames.push("cf"); @@ -196,77 +229,78 @@ export class HomeComponent { } this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)}); } - getQueryParamsForAdvancedSearch(entity){ + + getQueryParamsForAdvancedSearch(entity) { let params = {}; if (entity == "result") { if (this.resultsQuickFilter) { params["qf"] = "" + this.resultsQuickFilter.selected; } } - if(this.keyword.length > 0) { + if (this.keyword.length > 0) { params["fv0"] = "" + this.keyword; params["f0"] = "q"; } - if(this.customFilter){ - params = this.customFilter.getParameters(params); + if (this.customFilter) { + params = this.customFilter.getParameters(params); } return params; } - getFunders() { - let refineParams1 = '&fq=country%20exact%20%22CA%22'; - let refineParams2 = '&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=country%20exact%20%22CA%22%20'; - this.subs.push(zip( - this._refineFieldResultsService.getRefineFieldsResultsByEntityName(['relfunder'], 'result', this.properties, refineParams1), - this._refineFieldResultsService.getRefineFieldsResultsByEntityName(['relfunder'], 'result', this.properties, refineParams2) - ).subscribe((data: any[]) => { - let queriedFunders1 = data[0][1][0].values; - queriedFunders1.forEach(queriedFunder => { - if(queriedFunder.id.includes('nserc')) { - this.funders.push({ - "id": queriedFunder.id, - "name": queriedFunder.name, - "publications": queriedFunder.number, - "openAccessPublications": null, - "logo": 'assets/nserc_logo.png', - "params": { - relfunder: '"'+encodeURIComponent(queriedFunder.id)+'"' - } - }); - } else if(queriedFunder.id.includes('cihr')) { - this.funders.push({ - "id": queriedFunder.id, - "name": queriedFunder.name, - "publications": queriedFunder.number, - "openAccessPublications": null, - "logo": 'assets/cihr_logo.png', - "params": { - relfunder: '"'+encodeURIComponent(queriedFunder.id)+'"' - } - }); - } else if(queriedFunder.id.includes('sshrc')) { - this.funders.push({ - "id": queriedFunder.id, - "name": queriedFunder.name, - "publications": queriedFunder.number, - "openAccessPublications": null, - "logo": 'assets/sshrc_logo.png', - "params": { - relfunder: '"'+encodeURIComponent(queriedFunder.id)+'"' - } - }); - } - }); - let queriedFunders2 = data[1][1][0].values; - queriedFunders2.forEach(queriedFunder => { - for(let funder of this.funders) { - if(queriedFunder.id == funder.id) { - funder.openAccessPublications = queriedFunder.number; - } - } - }); - })); - } + getFunders() { + let refineParams1 = '&fq=country%20exact%20%22CA%22'; + let refineParams2 = '&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=country%20exact%20%22CA%22%20'; + this.subs.push(zip( + this._refineFieldResultsService.getRefineFieldsResultsByEntityName(['relfunder'], 'result', this.properties, refineParams1), + this._refineFieldResultsService.getRefineFieldsResultsByEntityName(['relfunder'], 'result', this.properties, refineParams2) + ).subscribe((data: any[]) => { + let queriedFunders1 = data[0][1][0].values; + queriedFunders1.forEach(queriedFunder => { + if (queriedFunder.id.includes('nserc')) { + this.funders.push({ + "id": queriedFunder.id, + "name": queriedFunder.name, + "publications": queriedFunder.number, + "openAccessPublications": null, + "logo": 'assets/nserc_logo.png', + "params": { + relfunder: '"' + encodeURIComponent(queriedFunder.id) + '"' + } + }); + } else if (queriedFunder.id.includes('cihr')) { + this.funders.push({ + "id": queriedFunder.id, + "name": queriedFunder.name, + "publications": queriedFunder.number, + "openAccessPublications": null, + "logo": 'assets/cihr_logo.png', + "params": { + relfunder: '"' + encodeURIComponent(queriedFunder.id) + '"' + } + }); + } else if (queriedFunder.id.includes('sshrc')) { + this.funders.push({ + "id": queriedFunder.id, + "name": queriedFunder.name, + "publications": queriedFunder.number, + "openAccessPublications": null, + "logo": 'assets/sshrc_logo.png', + "params": { + relfunder: '"' + encodeURIComponent(queriedFunder.id) + '"' + } + }); + } + }); + let queriedFunders2 = data[1][1][0].values; + queriedFunders2.forEach(queriedFunder => { + for (let funder of this.funders) { + if (queriedFunder.id == funder.id) { + funder.openAccessPublications = queriedFunder.number; + } + } + }); + })); + } isRouteAvailable(routeToCheck: string) { for (let i = 0; i < this._router.config.length; i++) { diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 2ef5d06..1ec8477 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 2ef5d069dd55b3ae366fbf8723975c98e6a8c140 +Subproject commit 1ec84770535c7f691d6eb7d2b0a99c6aec4bcd65 diff --git a/src/app/utils/aggregators.ts b/src/app/utils/aggregators.ts index e836df8..d8494db 100644 --- a/src/app/utils/aggregators.ts +++ b/src/app/utils/aggregators.ts @@ -42,7 +42,7 @@ export class PortalAggregators { Welcome to the Portal of Canadian Research Outputs. This has been developed as part of a collaboration between Canadian Association of Research Libraries (CARL) and OpenAIRE. The portal presents research results collected from Canadian institutional repositories compliant to OpenAIRE guidelines and from the OpenAIRE Research Graph. + href="https://guidelines.openaire.eu/" target="_blank">OpenAIRE guidelines and from the OpenAIRE Graph. It links them to three Canadian funders, Natural Sciences and Engineering Research Council of Canada, Canadian Institutes of Health Research and Social Sciences and Humanities Research Council. For more information, visit the