@ -9,7 +9,7 @@ import {
ViewChild ,
ViewChildren
} from '@angular/core' ;
import { Observable , of , Subscriber , zip } from 'rxjs' ;
import { of , Subscriber , zip } from 'rxjs' ;
import { ActivatedRoute , Router } from '@angular/router' ;
import { Location } from '@angular/common' ;
import { Meta , Title } from '@angular/platform-browser' ;
@ -31,14 +31,14 @@ import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperCla
import { properties } from "../../environments/environment" ;
import { Numbers , NumbersComponent } from "../openaireLibrary/sharedComponents/numbers/numbers.component" ;
import { StringUtils } from "../openaireLibrary/utils/string-utils.class" ;
import { NumberUtils } from '../openaireLibrary/utils/number-utils.class' ;
import { NumberUtils } from '../openaireLibrary/utils/number-utils.class' ;
@Component ( {
selector : 'home' ,
templateUrl : 'home.component.html' ,
styleUrls : [ 'home.component.css' ]
styleUrls : [ 'home.component.css' ]
} )
export class HomeComponent implements OnInit , OnDestroy , AfterViewInit {
export class HomeComponent implements OnInit , OnDestroy , AfterViewInit {
// MAX 12 logos in every slide
public logos = {
"publication" : [
@ -100,10 +100,10 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
"logo-orcid.png" ,
"logo-opendoar.png" ,
"logo-grid.png" ,
"logo-fairsharing.png" ,
"logo-ror.png" ,
"logo-datacite.png" ,
"logo-crossref.png"
"logo-fairsharing.png" ,
"logo-ror.png" ,
"logo-datacite.png" ,
"logo-crossref.png"
]
] ,
"funder" : [
@ -136,7 +136,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
showDataProviders : boolean = false ;
showOrganizations : boolean = false ;
properties : EnvProperties = properties ;
public openaireEntities = OpenaireEntities ;
public openaireEntities = OpenaireEntities ;
public readMore : boolean = false ;
subscriptions : any [ ] = [ ] ;
@ -162,7 +162,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
filterOperator : "or"
} ;
public pageContents = null ;
@ViewChild ( "numbersComponent" , { static : true } ) numbersComponent : NumbersComponent ;
@ViewChild ( "numbersComponent" , { static : true } ) numbersComponent : NumbersComponent ;
specialSubjects = [
{ value : "Physics::Atomic Physics" , label : "Atomic Physics" } ,
{ value : "Mathematics::Combinatorics" , label : "Mathematics Combinatorics" } ,
@ -172,13 +172,13 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
{ value : "lcsh:Chemistry" , label : "Chemistry" } ,
{ value : "lcsh:Engineering (General). Civil engineering (General)" , label : "Civil engineering" } ,
{ value : "lcsh:Technology" , label : "Technology" } ,
/ * " M a t h e m a t i c s : : C o m b i n a t o r i c s " ,
"lcsh:Medicine" ,
"lcsh:Science" ,
"lcsh:Biology (General)" ,
"lcsh:Chemistry" ,
"lcsh:Engineering (General). Civil engineering (General)" ,
"lcsh:Technology" * /
/ * " M a t h e m a t i c s : : C o m b i n a t o r i c s " ,
"lcsh:Medicine" ,
"lcsh:Science" ,
"lcsh:Biology (General)" ,
"lcsh:Chemistry" ,
"lcsh:Engineering (General). Civil engineering (General)" ,
"lcsh:Technology" * /
] ;
stringUtils = new StringUtils ( ) ;
disableSelect : boolean = true ;
@ -195,7 +195,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
private location : Location , private _piwikService : PiwikService ,
private config : ConfigurationService , private _meta : Meta , private _title : Title , private seoService : SEOService ,
private helper : HelperService ,
private cdr : ChangeDetectorRef
private cdr : ChangeDetectorRef
) {
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 | Find and Share research" ;
@ -261,13 +261,28 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
this . showDataProviders = ! ! showEntity [ "datasource" ] ;
this . showOrganizations = ! ! showEntity [ "organization" ] ;
if ( this . showPublications ) {
this . resultTypes . values . push ( { name : this.openaireEntities.PUBLICATIONS , id : "publications" , selected : false , number : 0 } ) ;
this . resultTypes . values . push ( {
name : this.openaireEntities.PUBLICATIONS ,
id : "publications" ,
selected : false ,
number : 0
} ) ;
}
if ( this . showDatasets ) {
this . resultTypes . values . push ( { name : this.openaireEntities.DATASETS , id : "datasets" , selected : false , number : 0 } ) ;
this . resultTypes . values . push ( {
name : this.openaireEntities.DATASETS ,
id : "datasets" ,
selected : false ,
number : 0
} ) ;
}
if ( this . showSoftware ) {
this . resultTypes . values . push ( { name : this.openaireEntities.SOFTWARE , id : "software" , selected : false , number : 0 } ) ;
this . resultTypes . values . push ( {
name : this.openaireEntities.SOFTWARE ,
id : "software" ,
selected : false ,
number : 0
} ) ;
}
if ( this . showOrp ) {
this . resultTypes . values . push ( { name : this.openaireEntities.OTHER , id : "other" , selected : false , number : 0 } ) ;
@ -281,15 +296,14 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
) ) ;
}
}
public ngOnDestroy() {
this . clear ( ) ;
}
ngAfterViewInit() {
if ( typeof window !== "undefined" ) {
if ( typeof window !== "undefined" ) {
this . createObserver ( ) ;
}
}
@ -344,13 +358,13 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
}
if ( this . resultsQuickFilter && this . resultsQuickFilter . selected ) {
parameterNames . push ( this . resultsQuickFilter . filterId ) ;
parameterValues . push ( '"' + encodeURIComponent ( this . resultsQuickFilter . value ) + '"' ) ;
parameterValues . push ( '"' + encodeURIComponent ( this . resultsQuickFilter . value ) + '"' ) ;
}
}
} else if ( this . selectedEntity == "all" ) {
if ( this . resultsQuickFilter && this . resultsQuickFilter . selected ) {
parameterNames . push ( this . resultsQuickFilter . filterId ) ;
parameterValues . push ( '"' + encodeURIComponent ( this . resultsQuickFilter . value ) + '"' ) ;
parameterValues . push ( '"' + encodeURIComponent ( this . resultsQuickFilter . value ) + '"' ) ;
}
}
if ( this . keyword . length > 0 ) {
@ -361,66 +375,67 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit{
}
this . _router . navigate ( [ url ] , { queryParams : this.routerHelper.createQueryParams ( parameterNames , parameterValues ) } ) ;
}
getSubjectParameter ( param ) {
return { 'f0' : 'resultsubject' , 'fv0' : '"' + ( param ) + '"' , size :50 } ;
getSubjectParameter ( param ) {
return { 'f0' : 'resultsubject' , 'fv0' : '"' + ( param ) + '"' , size : 50 } ;
}
init ( getDatasetsLinked = false , getSoftwareLinked = false , getPublications = true , getDatasets = true ,
getSoftware = true , getOther = true , getProjects = true , getDataProviders = true , getOrganizations = true , refineValue : string = null ) {
this . subscriptions . push ( zip (
( getPublications ) ? this . searchResearchResultsService . numOfSearchResults ( 'publication' , '' , this . properties , null ) : of ( 0 ) ,
( getDatasets ) ? this . searchResearchResultsService . numOfSearchResults ( 'dataset' , '' , this . properties , null ) : of ( 0 ) ,
( getDatasetsLinked ) ? this . searchResearchResultsService . numOfSearchResultsLinkedToPub ( "dataset" , this . properties ) : of ( 0 ) ,
( getSoftware ) ? this . searchResearchResultsService . numOfSearchResults ( 'software' , '' , this . properties , null ) : of ( 0 ) ,
( getSoftwareLinked ) ? this . searchResearchResultsService . numOfSearchResultsLinkedToPub ( "software" , this . properties ) : of ( 0 ) ,
( getOther ) ? this . searchResearchResultsService . numOfSearchResults ( 'other' , '' , this . properties , null ) : of ( 0 ) ,
( getProjects ) ? this . refineFieldResultsService . getRefineFieldsResultsByEntityName ( [ 'funder' ] , 'project' , this . properties , null ) : of ( 0 ) ,
( getDataProviders ) ? this . searchDataprovidersService . numOfSearchDataproviders ( '' , this . properties , null ) : of ( 0 ) ,
( getOrganizations ) ? this . searchOrganizationsService . numOfSearchOrganizations2 ( '' , this . properties , null ) : of ( 0 )
) . subscribe ( ( data : any [ ] ) = > {
if ( data [ 0 ] && data [ 0 ] > 0 ) {
this . numbers . publicationsSize = NumberUtils . roundNumber ( data [ 0 ] ) ;
}
if ( data [ 1 ] && data [ 1 ] > 0 ) {
this . numbers . datasetsSize = NumberUtils . roundNumber ( data [ 1 ] ) ;
}
if ( data [ 2 ] && data [ 2 ] > 0 ) {
this . numbers . datasetsLinkedSize = NumberUtils . roundNumber ( data [ 2 ] ) ;
}
if ( data [ 3 ] && data [ 3 ] > 0 ) {
this . numbers . softwareSize = NumberUtils . roundNumber ( data [ 3 ] ) ;
}
if ( data [ 4 ] && data [ 4 ] > 0 ) {
this . numbers . softwareLinkedSize = NumberUtils . roundNumber ( data [ 4 ] ) ;
}
if ( data [ 5 ] && data [ 5 ] > 0 ) {
this . numbers . otherSize = NumberUtils . roundNumber ( data [ 5 ] ) ;
}
if ( data [ 6 ] [ 0 ] && data [ 6 ] [ 0 ] > 0 ) {
this . numbers . projectsSize = NumberUtils . roundNumber ( data [ 6 ] [ 0 ] ) ;
}
if ( data [ 6 ] [ 1 ] && data [ 6 ] [ 1 ] . length > 0 && data [ 6 ] [ 1 ] [ 0 ] . filterId == 'funder' && data [ 6 ] [ 1 ] [ 0 ] . values ) {
this . numbers . fundersSize = NumberUtils . roundNumber ( data [ 6 ] [ 1 ] [ 0 ] . values . length ) ;
}
if ( data [ 7 ] && data [ 7 ] > 0 ) {
this . numbers . datasourcesSize = NumberUtils . roundNumber ( data [ 7 ] ) ;
}
if ( data [ 8 ] && data [ 8 ] > 0 ) {
this . numbers . organizationsSize = NumberUtils . roundNumber ( data [ 8 ] ) ;
}
} , err = > {
this . handleError ( 'Error getting numbers' , err ) ;
} ) ) ;
}
disableSelectChange ( event : boolean ) {
this . disableSelect = event ;
this . cdr . detectChanges ( ) ;
}
public get showContentWithNumbers() {
if ( this . numbers && this . numbers . publicationsSize && this . numbers . datasetsSize && this . numbers . softwareSize && this . numbers . datasourcesSize && this . numbers . projectsSize && this . numbers . organizationsSize ) {
return true ;
}
}
init ( getDatasetsLinked = false , getSoftwareLinked = false , getPublications = true , getDatasets = true ,
getSoftware = true , getOther = true , getProjects = true , getDataProviders = true , getOrganizations = true , refineValue : string = null ) {
this . subscriptions . push ( zip (
( getPublications ) ? this . searchResearchResultsService . numOfSearchResults ( 'publication' , '' , this . properties , null ) : of ( 0 ) ,
( getDatasets ) ? this . searchResearchResultsService . numOfSearchResults ( 'dataset' , '' , this . properties , null ) : of ( 0 ) ,
( getDatasetsLinked ) ? this . searchResearchResultsService . numOfSearchResultsLinkedToPub ( "dataset" , this . properties ) : of ( 0 ) ,
( getSoftware ) ? this . searchResearchResultsService . numOfSearchResults ( 'software' , '' , this . properties , null ) : of ( 0 ) ,
( getSoftwareLinked ) ? this . searchResearchResultsService . numOfSearchResultsLinkedToPub ( "software" , this . properties ) : of ( 0 ) ,
( getOther ) ? this . searchResearchResultsService . numOfSearchResults ( 'other' , '' , this . properties , null ) : of ( 0 ) ,
( getProjects ) ? this . refineFieldResultsService . getRefineFieldsResultsByEntityName ( [ 'funder' ] , 'project' , this . properties , null ) : of ( 0 ) ,
( getDataProviders ) ? this . searchDataprovidersService . numOfSearchDataproviders ( '' , this . properties , null ) : of ( 0 ) ,
( getOrganizations ) ? this . searchOrganizationsService . numOfSearchOrganizations2 ( '' , this . properties , null ) : of ( 0 )
) . subscribe ( ( data : any [ ] ) = > {
if ( data [ 0 ] && data [ 0 ] > 0 ) {
this . numbers . publicationsSize = NumberUtils . roundNumber ( data [ 0 ] ) ;
}
if ( data [ 1 ] && data [ 1 ] > 0 ) {
this . numbers . datasetsSize = NumberUtils . roundNumber ( data [ 1 ] ) ;
}
if ( data [ 2 ] && data [ 2 ] > 0 ) {
this . numbers . datasetsLinkedSize = NumberUtils . roundNumber ( data [ 2 ] ) ;
}
if ( data [ 3 ] && data [ 3 ] > 0 ) {
this . numbers . softwareSize = NumberUtils . roundNumber ( data [ 3 ] ) ;
}
if ( data [ 4 ] && data [ 4 ] > 0 ) {
this . numbers . softwareLinkedSize = NumberUtils . roundNumber ( data [ 4 ] ) ;
}
if ( data [ 5 ] && data [ 5 ] > 0 ) {
this . numbers . otherSize = NumberUtils . roundNumber ( data [ 5 ] ) ;
}
if ( data [ 6 ] [ 0 ] && data [ 6 ] [ 0 ] > 0 ) {
this . numbers . projectsSize = NumberUtils . roundNumber ( data [ 6 ] [ 0 ] ) ;
}
if ( data [ 6 ] [ 1 ] && data [ 6 ] [ 1 ] . length > 0 && data [ 6 ] [ 1 ] [ 0 ] . filterId == 'funder' && data [ 6 ] [ 1 ] [ 0 ] . values ) {
this . numbers . fundersSize = NumberUtils . roundNumber ( data [ 6 ] [ 1 ] [ 0 ] . values . length ) ;
}
if ( data [ 7 ] && data [ 7 ] > 0 ) {
this . numbers . datasourcesSize = NumberUtils . roundNumber ( data [ 7 ] ) ;
}
if ( data [ 8 ] && data [ 8 ] > 0 ) {
this . numbers . organizationsSize = NumberUtils . roundNumber ( data [ 8 ] ) ;
}
} , err = > {
this . handleError ( 'Error getting numbers' , err ) ;
} ) ) ;
}
disableSelectChange ( event : boolean ) {
this . disableSelect = event ;
this . cdr . detectChanges ( ) ;
}
public get showContentWithNumbers() {
if ( this . numbers && this . numbers . publicationsSize && this . numbers . datasetsSize && this . numbers . softwareSize && this . numbers . datasourcesSize && this . numbers . projectsSize && this . numbers . organizationsSize ) {
return true ;
}
}
}