2020-03-16 14:09:46 +01:00
import { ChangeDetectorRef , Component , Input , ViewChild } from '@angular/core' ;
2019-09-05 10:49:33 +02:00
import { ActivatedRoute , Router } from '@angular/router' ;
import { Meta , Title } from '@angular/platform-browser' ;
import { EnvProperties } from '../../utils/properties/env-properties' ;
2020-03-20 13:01:55 +01:00
import { Id , ResultLandingInfo } from '../../utils/entities/resultLandingInfo' ;
2019-09-05 10:49:33 +02:00
import { RouterHelper } from '../../utils/routerHelper.class' ;
import { PiwikService } from '../../utils/piwik/piwik.service' ;
import { ResultLandingService } from './resultLanding.service' ;
import { SEOService } from '../../sharedComponents/SEO/SEO.service' ;
import { HelperFunctions } from '../../utils/HelperFunctions.class' ;
import { HelperService } from '../../utils/helper/helper.service' ;
2019-11-07 10:51:09 +01:00
import { Location } from "@angular/common" ;
2020-03-16 14:09:46 +01:00
import { MetricsService } from "../../services/metrics.service" ;
2020-05-25 20:58:13 +02:00
import { RelationResult , ResultPreview } from "../../utils/result-preview/result-preview" ;
2020-05-19 17:33:47 +02:00
import { IndexInfoService } from "../../utils/indexInfo.service" ;
2021-01-13 12:58:06 +01:00
import { Identifier , StringUtils } from "../../utils/string-utils.class" ;
2020-06-29 15:15:52 +02:00
import { properties } from "../../../../environments/environment" ;
2020-07-13 00:10:43 +02:00
import { ISVocabulariesService } from "../../utils/staticAutoComplete/ISVocabularies.service" ;
2022-04-04 11:14:54 +02:00
import { Subscriber , Subscription } from "rxjs" ;
2021-01-13 12:58:06 +01:00
import { Session } from "../../login/utils/helper.class" ;
2021-01-05 14:25:02 +01:00
import { AnnotationComponent } from "../annotation/annotation.component" ;
2021-04-02 11:17:00 +02:00
import { ParsingFunctions } from "../landing-utils/parsingFunctions.class" ;
2021-07-26 12:05:36 +02:00
import { ConnectHelper } from "../../connect/connectHelper" ;
2019-09-05 10:49:33 +02:00
2022-04-04 11:14:54 +02:00
declare var UIkit ;
2019-09-05 10:49:33 +02:00
@Component ( {
selector : 'result-landing' ,
templateUrl : 'resultLanding.component.html' ,
} )
export class ResultLandingComponent {
@Input ( ) type : string = "publication" ;
2020-06-29 15:15:52 +02:00
@Input ( ) piwikSiteId = properties . piwikSiteId ;
2019-09-05 10:49:33 +02:00
@Input ( ) communityId = null ;
2021-04-02 11:17:00 +02:00
enermapsId ;
2020-05-20 14:56:21 +02:00
@ViewChild ( 'linkModal' ) linkModal ;
@ViewChild ( 'citeModal' ) citeModal ;
2019-09-05 10:49:33 +02:00
@ViewChild ( 'AlertModalDeletedByInference' ) alertModalDeletedByInference ;
2020-03-16 14:09:46 +01:00
@ViewChild ( 'relationModal' ) relationModal ;
@ViewChild ( 'organizationModal' ) organizationModal ;
2019-09-30 13:02:06 +02:00
public deleteByInferenceOpened : boolean = false ;
2021-04-16 11:59:54 +02:00
@Input ( ) public resultFromInput : boolean = false ;
@Input ( ) public resultLandingInfo : ResultLandingInfo ;
2020-05-22 16:51:28 +02:00
public supplementaryResults : RelationResult [ ] ;
2020-03-16 14:09:46 +01:00
public relation : string = 'trust' ;
2019-09-05 10:49:33 +02:00
public id : string ;
public title : string ;
2021-08-13 10:43:26 +02:00
2020-05-27 16:32:25 +02:00
/*Show all organizations*/
public showAll : boolean = false ;
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
// Links for SEO
public linkToLandingPage : string = null ;
2021-04-13 14:52:58 +02:00
public canonicalUrl : string = null ;
2019-09-05 10:49:33 +02:00
public linkToSearchPage : string = null ;
2021-08-13 10:43:26 +02:00
2020-06-17 12:32:32 +02:00
public citeThisClicked : boolean ;
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
// Metrics tab variables
public metricsClicked : boolean ;
2020-03-16 14:09:46 +01:00
public hasAltMetrics : boolean = false ;
2019-09-05 10:49:33 +02:00
public viewsFrameUrl : string ;
public downloadsFrameUrl : string ;
2022-04-04 11:14:54 +02:00
public totalViews : number = null ;
public totalDownloads : number = null ;
public pageViews : number = null ;
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
// Custom tab paging variables
public referencesPage : number = 1 ;
2020-03-16 14:09:46 +01:00
public bioentitiesPage : number = 1 ;
2020-05-22 16:51:28 +02:00
public relatedPage : number = 1 ;
public similarPage : number = 1 ;
public supplementaryPage : number = 1 ;
public supplementedByPage : number = 1 ;
2019-09-05 10:49:33 +02:00
public organizationsPage : number = 1 ;
public openCitationsPage : number = 1 ;
public pageSize : number = 10 ;
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
// Map counting variables
public bioentitiesNum : number = 0 ;
2020-05-22 16:51:28 +02:00
public relatedResultsNum : number = 0 ;
2020-11-11 15:43:13 +01:00
2019-09-05 10:49:33 +02:00
// Message variables
public warningMessage = "" ;
public errorMessage = "" ;
public showLoading : boolean = true ;
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public routerHelper : RouterHelper = new RouterHelper ( ) ;
2020-05-25 20:58:13 +02:00
public activeTab : string = null ;
2021-05-19 11:36:09 +02:00
private reloadEnermapsDetails : boolean = true ;
public enermapsDetails : any ;
2019-09-05 10:49:33 +02:00
private doi : string ;
2020-11-11 15:43:13 +01:00
subscriptions = [ ] ;
2020-06-29 15:15:52 +02:00
properties : EnvProperties = properties ;
2020-03-16 14:09:46 +01:00
public indexUpdateDate : Date ;
2019-09-05 10:49:33 +02:00
public pageContents = null ;
public divContents = null ;
2020-03-16 14:09:46 +01:00
public showFeedback : boolean = false ;
public feedbackFields : string [ ] = [
'Title' , 'Authors' , 'Access rights' ,
'Publisher information' , 'Funding Information' ,
2022-02-04 12:01:54 +01:00
'Persistent identifiers' , 'Sustainable Development Goals (SDG)' ,
'Fields of Science and Technology (FOS)' , 'Other' ] ;
2021-02-10 10:05:37 +01:00
2021-01-13 12:58:06 +01:00
public pidsArrayString : string = "" ;
public identifier : Identifier ;
2021-01-13 14:03:06 +01:00
public isLoggedIn : boolean = Session . isLoggedIn ( ) ;
2021-01-05 14:25:02 +01:00
public pid : string ;
@ViewChild ( "annotation" ) annotation : AnnotationComponent ;
2021-11-08 16:24:32 +01:00
public contextsWithLink : any ;
2021-01-13 12:58:06 +01:00
2022-01-07 11:16:23 +01:00
public relatedClassSelected : string = "" ;
public filteredRelatedResults : RelationResult [ ] ;
2022-04-04 11:14:54 +02:00
public offset : number ;
fakeArray = new Array ( 100 ) ;
2021-01-13 12:58:06 +01:00
constructor ( private _resultLandingService : ResultLandingService ,
2020-07-13 00:10:43 +02:00
private _vocabulariesService : ISVocabulariesService ,
2019-09-05 10:49:33 +02:00
private _piwikService : PiwikService ,
private route : ActivatedRoute ,
private router : Router ,
private _meta : Meta ,
private _title : Title ,
private _router : Router ,
private helper : HelperService ,
2019-10-17 15:24:09 +02:00
private seoService : SEOService ,
2020-03-16 14:09:46 +01:00
private metricsService : MetricsService ,
private cdr : ChangeDetectorRef ,
2020-05-19 17:33:47 +02:00
private _location : Location ,
2021-01-05 14:25:02 +01:00
private indexInfoService : IndexInfoService ) {
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
ngOnInit() {
2020-06-29 15:15:52 +02:00
if ( typeof document !== 'undefined' ) {
2020-11-11 15:43:13 +01:00
this . subscriptions . push ( this . indexInfoService . getLastIndexDate ( this . properties ) . subscribe ( lastIndexUpdate = > {
2020-06-29 15:15:52 +02:00
if ( lastIndexUpdate ) {
this . indexUpdateDate = new Date ( lastIndexUpdate ) ;
2020-06-10 13:05:59 +02:00
}
2020-11-11 15:43:13 +01:00
} ) ) ;
2020-06-29 15:15:52 +02:00
}
//this.getDivContents();
this . getPageContents ( ) ;
2020-09-18 09:57:42 +02:00
this . updateUrl ( this . properties . domain + this . properties . baseLink + this . _router . url ) ;
2021-12-17 14:39:32 +01:00
this . seoService . createLinkForCanonicalURL ( this . properties . domain + this . properties . baseLink + this . _router . url ) ;
2021-02-10 10:05:37 +01:00
this . subscriptions . push ( this . route . queryParams . subscribe ( data = > {
2020-07-01 11:11:58 +02:00
if ( data [ 'articleId' ] ) {
2020-06-29 15:15:52 +02:00
this . id = data [ 'articleId' ] ;
2021-01-13 12:58:06 +01:00
this . initMetaAndLinks ( "publication" ) ;
2020-07-01 11:11:58 +02:00
} else if ( data [ 'datasetId' ] ) {
2020-06-29 15:15:52 +02:00
this . id = data [ 'datasetId' ] ;
2021-01-13 12:58:06 +01:00
this . initMetaAndLinks ( "dataset" ) ;
2020-07-01 11:11:58 +02:00
} else if ( data [ 'softwareId' ] ) {
2020-06-29 15:15:52 +02:00
this . id = data [ 'softwareId' ] ;
2021-01-13 12:58:06 +01:00
this . initMetaAndLinks ( "software" ) ;
2020-07-01 11:11:58 +02:00
} else if ( data [ 'orpId' ] ) {
2020-06-29 15:15:52 +02:00
this . id = data [ 'orpId' ] ;
2021-01-13 12:58:06 +01:00
this . initMetaAndLinks ( "orp" ) ;
} else if ( data [ "id" ] ) {
2020-06-29 15:15:52 +02:00
this . id = data [ "id" ] ;
2021-01-13 12:58:06 +01:00
this . initMetaAndLinks ( "result" ) ;
} else if ( data [ "pid" ] ) {
2021-04-26 11:42:41 +02:00
this . identifier = Identifier . getIdentifierFromString ( decodeURIComponent ( data [ "pid" ] ) , false ) ;
2021-01-13 12:58:06 +01:00
if ( ! this . type ) {
this . type = "result" ;
}
this . initMetaAndLinks ( this . type ) ;
2020-06-29 15:15:52 +02:00
}
this . updateDescription ( "" ) ;
2021-01-13 12:58:06 +01:00
2020-06-29 15:15:52 +02:00
this . metricsClicked = false ;
2021-04-16 11:59:54 +02:00
if ( this . resultFromInput ) {
this . id = this . resultLandingInfo . objIdentifier ;
this . type = "publication" ;
}
2021-01-13 12:58:06 +01:00
if ( ( this . id && StringUtils . isOpenAIREID ( this . id ) ) || ( this . identifier ) ) {
2020-06-29 15:15:52 +02:00
this . getProvenanceVocabularyAndResultLandingInfo ( ) ;
} else {
this . showLoading = false ;
2021-01-13 12:58:06 +01:00
2020-06-29 15:15:52 +02:00
this . _router . navigate ( [ '/error' ] , {
queryParams : {
"page" : this . _location . path ( true ) ,
"page_type" : this . type
2019-09-05 10:49:33 +02:00
}
} ) ;
2020-06-29 15:15:52 +02:00
}
2021-01-13 12:58:06 +01:00
2020-06-29 15:15:52 +02:00
this . scroll ( ) ;
2020-11-11 15:43:13 +01:00
} ) ) ;
2022-04-04 11:14:54 +02:00
this . offset = Number . parseInt ( getComputedStyle ( document . documentElement ) . getPropertyValue ( '--navbar-height' ) ) ;
console . log ( this . offset ) ;
2019-09-05 10:49:33 +02:00
}
2021-01-13 12:58:06 +01:00
private initMetaAndLinks ( type : string ) {
if ( type == "publication" ) {
this . type = "publication" ;
this . updateTitle ( "Publication" ) ;
this . linkToLandingPage = this . properties . searchLinkToPublication ;
this . linkToSearchPage = this . properties . searchLinkToPublications ;
this . title = "Publication" ;
} else if ( type == "dataset" ) {
this . updateTitle ( "Dataset" ) ;
this . type = "dataset" ;
this . linkToLandingPage = this . properties . searchLinkToDataset ;
this . linkToSearchPage = this . properties . searchLinkToDatasets ;
this . title = "Research Data" ;
} else if ( type == "software" ) {
this . updateTitle ( "Software" ) ;
this . type = "software" ;
this . linkToLandingPage = this . properties . searchLinkToSoftwareLanding ;
this . linkToSearchPage = this . properties . searchLinkToSoftware ;
this . title = "Software" ;
} else if ( type == "orp" ) {
this . type = "orp" ;
this . updateTitle ( "Other Research Product" ) ;
this . linkToLandingPage = this . properties . searchLinkToOrp ;
this . linkToSearchPage = this . properties . searchLinkToOrps ;
this . title = "Other Research Product" ;
} else if ( type == "result" ) {
this . type = "result" ;
this . updateTitle ( "Research Result" ) ;
this . linkToLandingPage = this . properties . searchLinkToResult ;
this . linkToSearchPage = this . properties . searchLinkToResults ;
this . title = "Research Result" ;
}
}
2019-09-05 10:49:33 +02:00
private getPageContents() {
2020-06-29 15:15:52 +02:00
if ( this . communityId ) {
2020-11-11 15:43:13 +01:00
this . subscriptions . push ( this . helper . getPageHelpContents ( this . properties , this . communityId , this . _router . url ) . subscribe ( contents = > {
2020-06-29 15:15:52 +02:00
this . pageContents = contents ;
2020-11-11 15:43:13 +01:00
} ) ) ;
2020-06-29 15:15:52 +02:00
}
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
private getDivContents() {
2020-06-29 15:15:52 +02:00
if ( this . communityId ) {
2020-11-11 15:43:13 +01:00
this . subscriptions . push ( this . helper . getDivHelpContents ( this . properties , this . communityId , this . _router . url ) . subscribe ( contents = > {
2020-06-29 15:15:52 +02:00
this . divContents = contents ;
2020-11-11 15:43:13 +01:00
} ) ) ;
2020-06-29 15:15:52 +02:00
}
2019-09-05 10:49:33 +02:00
}
2020-11-11 15:43:13 +01:00
2019-09-05 10:49:33 +02:00
ngOnDestroy() {
2020-11-11 15:43:13 +01:00
this . subscriptions . forEach ( subscription = > {
2022-04-04 11:14:54 +02:00
if ( subscription instanceof Subscription ) {
2020-11-11 15:43:13 +01:00
subscription . unsubscribe ( ) ;
2022-04-04 11:14:54 +02:00
} else if ( subscription instanceof Function ) {
subscription ( ) ;
2020-11-11 15:43:13 +01:00
}
} ) ;
this . _vocabulariesService . clearSubscriptions ( ) ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2021-01-05 14:25:02 +01:00
public pidInit ( event ) {
this . pid = event ;
this . cdr . detectChanges ( ) ;
}
2021-08-13 10:43:26 +02:00
2020-03-16 14:09:46 +01:00
public getTypeName ( ) : string {
if ( this . type === "dataset" ) {
return "research data" ;
} else if ( this . type === "orp" || this . type === "other" ) {
2020-05-28 17:51:56 +02:00
return "research product" ;
2020-03-16 14:09:46 +01:00
} else {
return this . type ;
}
}
2021-08-13 10:43:26 +02:00
2020-03-16 14:09:46 +01:00
public removeUnknown ( array : string [ ] , type : boolean = false ) : string [ ] {
if ( type ) {
return this . removeDuplicates ( array ) . filter ( value = > value . toLowerCase ( ) !== 'unknown' ) ;
} else {
return array . filter ( value = > value . toLowerCase ( ) !== 'unknown' ) ;
}
}
2021-08-13 10:43:26 +02:00
2020-03-16 14:09:46 +01:00
public removeDuplicates ( array : string [ ] ) : string [ ] {
let type = this . getTypeName ( ) ;
return array . filter ( value = > value . toLowerCase ( ) !== type ) ;
}
2021-08-13 10:43:26 +02:00
2020-03-16 14:09:46 +01:00
private getOpenCitations() {
2021-01-13 12:58:06 +01:00
this . subscriptions . push ( this . _resultLandingService . getOpenCitations ( this . id , this . properties ) . subscribe (
2019-09-05 10:49:33 +02:00
data = > {
this . resultLandingInfo . openCitations = data [ 1 ] ;
} ,
err = > {
2020-05-21 16:18:52 +02:00
this . handleError ( "Error getting open citation for " + this . type + " with id: " + this . id , err ) ;
2019-09-05 10:49:33 +02:00
}
2020-11-11 15:43:13 +01:00
) ) ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-10-09 15:28:23 +02:00
private getProvenanceVocabularyAndResultLandingInfo() {
2019-09-05 10:49:33 +02:00
this . warningMessage = '' ;
this . errorMessage = '' ;
this . showLoading = true ;
2021-04-16 11:59:54 +02:00
2020-06-10 13:05:59 +02:00
if ( typeof document !== 'undefined' ) {
2020-11-11 15:43:13 +01:00
this . subscriptions . push ( this . _vocabulariesService . getProvenanceActionVocabulary ( this . properties ) . subscribe (
2020-06-10 13:05:59 +02:00
provenanceActionVocabulary = > {
this . getResultLandingInfo ( provenanceActionVocabulary ) ;
} , err = > {
this . getResultLandingInfo ( null ) ;
2021-01-13 12:58:06 +01:00
this . handleError ( "Error getting provenance action vocabulary for " + this . type , err ) ;
2020-06-10 13:05:59 +02:00
}
2020-11-11 15:43:13 +01:00
) ) ;
2020-06-10 13:05:59 +02:00
} else {
this . getResultLandingInfo ( null ) ;
}
2021-08-13 10:43:26 +02:00
2019-10-09 15:28:23 +02:00
}
2021-08-13 10:43:26 +02:00
2020-05-25 20:58:13 +02:00
private setActiveTab() {
2020-06-29 15:15:52 +02:00
if ( this . hasPrimaryInfo || this . hasSecondaryInfo ) {
2020-05-25 20:58:13 +02:00
this . activeTab = 'summary' ;
2020-06-29 15:15:52 +02:00
} else if ( this . resultLandingInfo . references && this . resultLandingInfo . references . length > 0 ) {
2020-05-25 20:58:13 +02:00
this . activeTab = 'references' ;
2022-01-07 11:16:23 +01:00
// } else if ((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) ||
// (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) {
// this.activeTab = 'supplementary';
// } else if ((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) ||
// (this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) {
// this.activeTab = 'related';
} else if ( this . resultLandingInfo . relatedResults && this . resultLandingInfo . relatedResults . length > 0 ) {
this . activeTab = "all_related" ;
2020-06-29 15:15:52 +02:00
} else if ( this . resultLandingInfo . bioentities && this . bioentitiesNum > 0 ) {
2020-05-25 20:58:13 +02:00
this . activeTab = 'bioentities' ;
2021-06-16 10:19:16 +02:00
} else if ( this . enermapsId && this . properties . enermapsURL ) {
2021-05-19 11:36:09 +02:00
this . activeTab = "enermaps" ;
2020-05-25 20:58:13 +02:00
}
}
2021-08-13 10:43:26 +02:00
2020-05-29 16:15:35 +02:00
// private get numberOfTabs(): number {
// let numberOfTabs = 0;
// if(this.hasPrimaryInfo || this.hasSecondaryInfo) {
// numberOfTabs++;
// }
// if(this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) {
// numberOfTabs++;
// }
// if((this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) ||
// (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)) {
// numberOfTabs++;
// }
// if((this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) ||
// (this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)) {
// numberOfTabs++;
// }
// if(this.resultLandingInfo.bioentities && this.bioentitiesNum > 0) {
// numberOfTabs++;
// }
// return numberOfTabs;
// }
2021-08-13 10:43:26 +02:00
2019-10-09 15:28:23 +02:00
private getResultLandingInfo ( provenanceActionVocabulary : any ) {
2021-04-16 11:59:54 +02:00
if ( this . resultFromInput && this . resultLandingInfo ) {
this . showLoading = false ;
return ;
}
this . resultLandingInfo = null ;
2022-01-07 11:01:22 +01:00
this . hasAltMetrics = false ;
2021-01-13 12:58:06 +01:00
this . subscriptions . push ( this . _resultLandingService . getResultLandingInfo ( this . id , this . identifier , this . type , provenanceActionVocabulary , this . properties ) . subscribe (
2019-09-05 10:49:33 +02:00
data = > {
this . resultLandingInfo = data ;
2021-03-08 15:42:26 +01:00
this . id = this . resultLandingInfo . objIdentifier ;
2021-08-10 12:46:33 +02:00
//old
2021-09-08 14:21:30 +02:00
// this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
// this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
2021-08-10 12:46:33 +02:00
//new
2021-09-08 14:21:30 +02:00
this . viewsFrameUrl = this . properties . statisticsFrameNewAPIURL + 'chart?json=' + encodeURIComponent ( '{"library":"HighCharts","chartDescription":{"queries":[{"name":"Monthly views","type":"column","query":{"name":"usagestats.results.views.monthly", "parameters":["' + this . id + '"], "profile":"OpenAIRE All-inclusive" }}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Monthly views"},"subtitle":{},"yAxis":{"title":{"text":""}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false},"credits":{"href":null,"enabled":true,"text":""}}}' ) ;
this . downloadsFrameUrl = this . properties . statisticsFrameNewAPIURL + 'chart?json=' +
encodeURIComponent ( '{"library":"HighCharts","chartDescription":{"queries":[{"name":"Monthly downloads","type":"column","query":{"name":"usagestats.results.downloads.monthly", "parameters":["' + this . id + '"], "profile":"OpenAIRE All-inclusive" }}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Monthly downloads"},"subtitle":{},"yAxis":{"title":{"text":""}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false},"credits":{"href":null,"enabled":true,"text":""}}}' ) ;
2021-03-08 15:42:26 +01:00
let pid :Identifier = Identifier . getResultPIDFromIdentifiers ( this . resultLandingInfo . identifiers ) ;
2020-05-21 16:18:52 +02:00
if ( this . type == "result" ) { // no type was specified - update URL based this.resultLandingInfo.resultType
2021-03-08 15:42:26 +01:00
this . updateUrlWithType ( pid ) ;
2020-03-04 15:29:50 +01:00
}
2021-04-13 14:52:58 +02:00
this . canonicalUrl = this . properties . domain + properties . baseLink + ( pid ? ( this . linkToLandingPage . split ( "?" ) [ 0 ] + "?pid=" + encodeURIComponent ( pid . id ) ) :
( this . linkToLandingPage + this . resultLandingInfo . relcanId ) ) ;
this . seoService . createLinkForCanonicalURL ( this . canonicalUrl ) ;
2021-04-28 17:54:30 +02:00
this . updateUrl ( this . canonicalUrl ) ;
2019-09-05 10:49:33 +02:00
if ( ( this . type == "publication" ) && ( this . properties . environment == "beta" || this . properties . environment == "development" ) && ( typeof document !== 'undefined' ) ) {
2022-03-15 22:31:10 +01:00
// this.getOpenCitations();
2019-09-05 10:49:33 +02:00
}
2020-12-17 12:54:38 +01:00
this . addNoIndexFilter ( ) ;
2019-09-05 10:49:33 +02:00
if ( this . resultLandingInfo . title ) {
this . updateTitle ( this . resultLandingInfo . title ) ;
2022-02-14 16:04:09 +01:00
this . updateDescription ( ( this . resultLandingInfo . description && this . resultLandingInfo . description [ 0 ] ? ( this . resultLandingInfo . description [ 0 ] . substr ( 0 , 157 ) + ( this . resultLandingInfo . description [ 0 ] . substr ( 0 , 157 ) . length == 157 ? "..." : "" ) ) : ( this . resultLandingInfo . title ) ) ) ;
2019-09-05 10:49:33 +02:00
}
if ( this . properties . enablePiwikTrack && ( typeof document !== 'undefined' ) ) {
2021-03-11 14:27:30 +01:00
this . subscriptions . push ( this . _piwikService . trackViewForCustomUrl ( this . properties , this . resultLandingInfo . title , this . linkToLandingPage . split ( "?" ) [ 1 ] + this . id , this . piwikSiteId ) . subscribe ( ) ) ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
let bioentitiesNum = 0 ;
if ( this . resultLandingInfo . bioentities != undefined ) {
this . resultLandingInfo . bioentities . forEach ( function ( value , key , map ) {
bioentitiesNum += value . size ;
} ) ;
}
this . bioentitiesNum = bioentitiesNum ;
2020-06-29 15:15:52 +02:00
if ( typeof document !== 'undefined' ) {
2021-01-13 12:58:06 +01:00
if ( this . resultLandingInfo . identifiers ) {
let pidsArray : string [ ] = [ ] ;
for ( let key of Array . from ( this . resultLandingInfo . identifiers . keys ( ) ) ) {
pidsArray = pidsArray . concat ( this . resultLandingInfo . identifiers . get ( key ) ) ;
this . pidsArrayString = pidsArray . join ( ) ;
}
if ( this . resultLandingInfo . identifiers . has ( 'doi' ) ) {
this . doi = this . resultLandingInfo . identifiers . get ( 'doi' ) [ 0 ] ;
this . subscriptions . push ( this . metricsService . hasAltMetrics ( this . properties . altMetricsAPIURL , this . doi ) . subscribe ( hasAltMetrics = > {
this . hasAltMetrics = hasAltMetrics ;
} , error = > {
this . hasAltMetrics = false ;
} ) ) ;
}
2020-06-10 13:05:59 +02:00
}
2019-09-05 10:49:33 +02:00
}
2021-04-02 11:17:00 +02:00
if ( this . communityId && this . communityId == "enermaps" && properties . enermapsURL ) {
this . enermapsId = ParsingFunctions . getEnermapsConceptId ( this . resultLandingInfo . contexts ) ;
}
2022-01-07 11:16:23 +01:00
this . relatedClassSelected = "" ;
this . filteredRelatedResults = this . resultLandingInfo . relatedResults ;
2019-09-05 10:49:33 +02:00
this . showLoading = false ;
2020-05-25 20:58:13 +02:00
this . setActiveTab ( ) ;
2019-09-05 10:49:33 +02:00
} ,
err = > {
2021-01-13 12:58:06 +01:00
this . handleError ( "Error getting " + this . type + " for " + ( this . id ? ( "id: " + this . id ) : ( "pid: " + this . identifier . id + " (" + this . identifier . class + ")" ) ) , err ) ;
2020-05-21 16:18:52 +02:00
if ( err . status == 404 ) {
2019-11-07 10:51:09 +01:00
this . _router . navigate ( [ '/error' ] , { queryParams : { "page" : this . _location . path ( true ) , "page_type" : this . type } } ) ;
2021-12-17 14:39:32 +01:00
} else if ( err . name == "TimeoutError" ) {
this . errorMessage = 'An error occurred please try again later' ;
} else {
if ( this . type == "publication" || this . type == "software" ) {
this . errorMessage = 'No ' + this . type + ' found' ;
} else if ( this . type == "dataset" ) {
this . errorMessage += "No research data found" ;
} else if ( this . type == "orp" ) {
this . errorMessage += "No research product found" ;
}
this . seoService . createLinkForCanonicalURL ( this . properties . domain + properties . baseLink + this . linkToSearchPage ) ;
2019-09-05 10:49:33 +02:00
}
this . showLoading = false ;
}
2020-11-11 15:43:13 +01:00
) ) ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public metricsResults ( $event ) {
this . totalViews = $event . totalViews ;
this . totalDownloads = $event . totalDownloads ;
this . pageViews = $event . pageViews ;
}
2021-08-13 10:43:26 +02:00
2020-05-21 16:18:52 +02:00
public get hasPrimaryInfo ( ) : boolean {
2022-03-15 22:31:10 +01:00
return ! ! this . resultLandingInfo && (
( ! ! this . resultLandingInfo . description && this . resultLandingInfo . description . length > 0 )
|| ! ! this . resultLandingInfo . identifiers || ! ! this . resultLandingInfo . subjects
|| ( ! ! this . resultLandingInfo . organizations && this . resultLandingInfo . organizations . length > 0 ) ) ;
2020-05-21 16:18:52 +02:00
}
2021-08-13 10:43:26 +02:00
2020-05-21 16:18:52 +02:00
public get hasSecondaryInfo ( ) : boolean {
return ( this . resultLandingInfo . fundedByProjects && this . resultLandingInfo . fundedByProjects . length > 0 ) ||
( this . resultLandingInfo . contexts && this . resultLandingInfo . contexts . length > 0 ) ||
( this . resultLandingInfo . hostedBy_collectedFrom && this . resultLandingInfo . hostedBy_collectedFrom . length > 0 ) ;
}
2021-08-13 10:43:26 +02:00
2022-04-04 11:14:54 +02:00
public get metricsCalculated ( ) : boolean {
return this . totalViews != null || this . totalDownloads != null || this . pageViews != null ;
}
2020-05-05 12:37:36 +02:00
public get hasMetrics ( ) : boolean {
2022-04-04 11:14:54 +02:00
// return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0;
return ! ( this . totalViews != null && this . totalDownloads != null && this . pageViews != null ) || this . totalViews > 0 || this . totalDownloads > 0 || this . pageViews > 0 ;
// return (this.totalViews == null || this.totalViews > 0) || (this.totalDownloads && this.totalDownloads > 0) || (this.pageViews && this.pageViews > 0);
2020-05-05 12:37:36 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
private updateDescription ( description : string ) {
2022-02-14 16:04:09 +01:00
this . _meta . updateTag ( { content : description } , "name='description'" ) ;
this . _meta . updateTag ( { content : description } , "property='og:description'" ) ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
private updateTitle ( title : string ) {
var _prefix = "" ;
2019-12-05 17:07:07 +01:00
// if(!this.communityId) {
// _prefix = "OpenAIRE | ";
// }
// var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
this . _title . setTitle ( title ) ;
this . _meta . updateTag ( { content : title } , "property='og:title'" ) ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
private updateUrl ( url : string ) {
this . _meta . updateTag ( { content : url } , "property='og:url'" ) ;
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public totalPages ( totalResults : number ) : number {
let totalPages : any = totalResults / this . pageSize ;
if ( ! ( Number . isInteger ( totalPages ) ) ) {
totalPages = ( parseInt ( totalPages , this . pageSize ) + 1 ) ;
}
return totalPages ;
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public updateReferencesPage ( $event ) {
this . referencesPage = $event . value ;
}
2021-08-13 10:43:26 +02:00
2020-03-16 14:09:46 +01:00
public updateBioentitiesPage ( $event ) {
this . bioentitiesPage = $event . value ;
}
2021-08-13 10:43:26 +02:00
2020-05-22 16:51:28 +02:00
public updateRelatedPage ( $event ) {
this . relatedPage = $event . value ;
2020-03-16 14:09:46 +01:00
}
2021-08-13 10:43:26 +02:00
2020-05-22 16:51:28 +02:00
public updateSimilarPage ( $event ) {
this . similarPage = $event . value ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2020-05-22 16:51:28 +02:00
public updateSupplementaryPage ( $event ) {
this . supplementaryPage = $event . value ;
}
2021-08-13 10:43:26 +02:00
2020-05-22 16:51:28 +02:00
public updateSupplementedByPage ( $event ) {
this . supplementedByPage = $event . value ;
}
2021-08-13 10:43:26 +02:00
2020-05-22 16:51:28 +02:00
public updateOrganizationsPage ( $event ) {
this . organizationsPage = $event . value ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public updateOpenCitationsPage ( $event ) {
this . openCitationsPage = $event . value ;
}
2021-08-13 10:43:26 +02:00
2020-02-07 14:05:07 +01:00
public accessClass ( accessMode : string ) : string {
2020-05-21 16:18:52 +02:00
if ( accessMode . toLowerCase ( ) . indexOf ( 'open' ) !== - 1 ) {
2020-02-07 14:05:07 +01:00
return 'open' ;
2020-05-21 16:18:52 +02:00
} else if ( accessMode . toLowerCase ( ) === 'not available' ) {
2020-02-07 14:05:07 +01:00
return 'unknown' ;
} else {
return 'closed' ;
}
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public keysToArray ( bioentities : Map < string , string > ) : string [ ] {
let keys : string [ ] = [ ] ;
bioentities . forEach ( function ( value , key , map ) {
keys . push ( key ) ;
} ) ;
return keys ;
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public getKeys ( map ) {
return Array . from ( map . keys ( ) ) ;
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
public scroll() {
HelperFunctions . scroll ( ) ;
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
private handleError ( message : string , error ) {
2020-05-21 16:18:52 +02:00
if ( this . type == "publication" ) {
2019-09-05 10:49:33 +02:00
console . error ( "Publication Landing Page: " + message , error ) ;
2020-05-21 16:18:52 +02:00
} else if ( this . type == "dataset" ) {
2019-09-05 10:49:33 +02:00
console . error ( "Research Data Landing Page: " + message , error ) ;
2020-05-21 16:18:52 +02:00
} else if ( this . type == "software" ) {
2019-09-05 10:49:33 +02:00
console . error ( "Software Landing Page: " + message , error ) ;
2020-05-21 16:18:52 +02:00
} else if ( this . type == "orp" ) {
2019-09-05 10:49:33 +02:00
console . error ( "Other Research Product Landing Page: " + message , error ) ;
} else {
console . error ( "Landing Page: " + message , error ) ;
}
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
isRouteAvailable ( routeToCheck : string ) {
for ( let i = 0 ; i < this . router . config . length ; i ++ ) {
let routePath : string = this . router . config [ i ] . path ;
if ( routePath == routeToCheck ) {
return true ;
}
}
return false ;
}
2021-08-13 10:43:26 +02:00
2019-09-05 10:49:33 +02:00
openDeletedByInference() {
2019-09-30 13:02:06 +02:00
this . deleteByInferenceOpened = true ;
2019-09-05 10:49:33 +02:00
this . alertModalDeletedByInference . cancelButton = false ;
this . alertModalDeletedByInference . okButton = false ;
2020-03-16 14:09:46 +01:00
this . alertModalDeletedByInference . alertTitle = "Other versions of" ;
2019-09-05 10:49:33 +02:00
this . alertModalDeletedByInference . open ( ) ;
}
2021-08-13 10:43:26 +02:00
2020-03-16 14:09:46 +01:00
public getResultPreview ( result : RelationResult ) : ResultPreview {
2022-01-07 11:16:23 +01:00
return ResultPreview . relationResultConvert ( result ) ;
2020-03-16 14:09:46 +01:00
}
2021-08-13 10:43:26 +02:00
2021-03-08 15:42:26 +01:00
updateUrlWithType ( pid ) {
2020-03-04 15:29:50 +01:00
this . type = this . resultLandingInfo . resultType ;
2021-01-13 12:58:06 +01:00
2020-05-21 16:18:52 +02:00
if ( this . type == "publication" ) {
2020-03-04 15:29:50 +01:00
this . linkToLandingPage = this . properties . searchLinkToPublication ;
this . linkToSearchPage = this . properties . searchLinkToPublications ;
2020-05-21 16:18:52 +02:00
} else if ( this . type == "dataset" ) {
2020-03-04 15:29:50 +01:00
this . linkToLandingPage = this . properties . searchLinkToDataset ;
this . linkToSearchPage = this . properties . searchLinkToDatasets ;
2020-05-21 16:18:52 +02:00
} else if ( this . type == "software" ) {
2020-04-03 18:00:19 +02:00
this . linkToLandingPage = this . properties . searchLinkToSoftwareLanding ;
this . linkToSearchPage = this . properties . searchLinkToSoftware ;
2020-05-21 16:18:52 +02:00
} else if ( this . type == "other" ) {
this . type = "orp" ;
2020-03-04 15:29:50 +01:00
this . linkToLandingPage = this . properties . searchLinkToOrp ;
this . linkToSearchPage = this . properties . searchLinkToOrps ;
}
2021-01-13 12:58:06 +01:00
if ( ! this . identifier ) {
2021-03-08 15:42:26 +01:00
this . _location . go ( ( pid ? ( this . linkToLandingPage . split ( "?" ) [ 0 ] + "?pid=" + pid . id ) :
( this . linkToLandingPage + this . id ) ) ) ;
2021-01-13 12:58:06 +01:00
}
// else {
// this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id);
// }
2020-03-04 15:29:50 +01:00
}
2021-08-13 10:43:26 +02:00
2020-03-20 13:01:55 +01:00
public getReferenceUrl ( id : Id ) : string {
2020-05-21 16:18:52 +02:00
if ( id . type === "doi" ) {
2020-03-20 13:01:55 +01:00
return this . properties . doiURL + id . value ;
2020-05-21 16:18:52 +02:00
} else if ( id . type === "pmc" ) {
2020-03-20 13:01:55 +01:00
return this . properties . pmcURL + id . value ;
2020-05-21 16:18:52 +02:00
} else if ( id . type === "pmid" ) {
2020-03-20 13:01:55 +01:00
return this . properties . pmidURL + id . value ;
2020-05-21 16:18:52 +02:00
} else if ( id . type === "handle" ) {
2020-03-20 13:01:55 +01:00
return this . properties . handleURL + id . value ;
} else {
2020-05-21 16:18:52 +02:00
return null ;
2020-03-20 13:01:55 +01:00
}
}
2021-08-13 10:43:26 +02:00
2020-03-20 13:01:55 +01:00
public getReferenceIdName ( id : Id ) : string {
2020-05-21 16:18:52 +02:00
if ( id . type === "doi" ) {
2020-03-20 13:01:55 +01:00
return 'DOI'
2020-05-21 16:18:52 +02:00
} else if ( id . type === "pmc" ) {
2020-03-20 13:01:55 +01:00
return 'Europe PMC'
2020-05-21 16:18:52 +02:00
} else if ( id . type === "pmid" ) {
2020-03-20 13:01:55 +01:00
return 'PubMed' ;
2020-05-21 16:18:52 +02:00
} else if ( id . type === "handle" ) {
2020-03-20 13:01:55 +01:00
return 'Handle.NET' ;
} else {
2020-05-21 16:18:52 +02:00
return null ;
2020-03-20 13:01:55 +01:00
}
}
2021-08-13 10:43:26 +02:00
2020-05-20 14:56:21 +02:00
public openLinkModal() {
this . linkModal . cancelButton = false ;
this . linkModal . okButton = false ;
this . linkModal . alertTitle = "Link this " + this . getTypeName ( ) + " to" ;
this . linkModal . open ( ) ;
}
2021-08-13 10:43:26 +02:00
2020-05-20 14:56:21 +02:00
public openCiteModal() {
2020-06-17 12:32:32 +02:00
this . citeThisClicked = true ;
2020-05-20 14:56:21 +02:00
this . citeModal . cancelButton = false ;
this . citeModal . okButton = false ;
2020-12-23 16:25:11 +01:00
this . citeModal . alertTitle = "Cite this " + this . getTypeName ( ) ;
2020-05-20 14:56:21 +02:00
this . citeModal . open ( ) ;
}
2021-03-08 15:42:26 +01:00
private addNoIndexFilter() {
2021-08-06 13:10:42 +02:00
let allow = this . checkIfAllowed ( this . resultLandingInfo ) ;
if ( ! allow ) {
// console.log("no index");
this . _meta . updateTag ( { content : 'noindex' } , "name='robots'" ) ;
}
}
checkIfAllowed ( resultLandingInfo : ResultLandingInfo ) {
2021-08-10 11:49:23 +02:00
let publicCommunities : string [ ] = [ "covid-19" ] ;
2020-12-17 12:54:38 +01:00
try {
2020-12-23 16:25:11 +01:00
if ( ! ( this . properties . environment == "production" || this . properties . environment == "development" ) ) {
2021-08-06 13:10:42 +02:00
return true ;
2020-12-17 12:54:38 +01:00
} else {
2021-12-17 13:35:18 +01:00
let allow = ! ! (
// !resultLandingInfo.underCurationMessage &&
2021-08-06 13:10:42 +02:00
( ( resultLandingInfo . fundedByProjects && resultLandingInfo . fundedByProjects . length > 0 )
|| resultLandingInfo . journal
|| ( resultLandingInfo . classifiedSubjects && resultLandingInfo . classifiedSubjects . size > 0 )
//allow free text keywords
|| ( resultLandingInfo . otherSubjects && resultLandingInfo . otherSubjects . size > 0 )
|| ( resultLandingInfo . subjects && resultLandingInfo . subjects . length > 0 )
2021-02-15 10:23:36 +01:00
2021-08-06 13:10:42 +02:00
|| ( resultLandingInfo . organizations && resultLandingInfo . organizations . length > 0 )
|| resultLandingInfo . bioentities || ( resultLandingInfo . references && resultLandingInfo . references . length > 0 )
2022-01-07 11:16:23 +01:00
// || (resultLandingInfo.relatedResearchResults && resultLandingInfo.relatedResearchResults.length > 0)
// || (resultLandingInfo.similarResearchResults && resultLandingInfo.similarResearchResults.length > 0)
// || (resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0)
// || (resultLandingInfo.supplementedByResearchResults &&
|| ( resultLandingInfo . relatedResults && resultLandingInfo . relatedResults . length > 0 )
2022-02-14 16:04:09 +01:00
)
//&& (resultLandingInfo.description && resultLandingInfo.description[0] && resultLandingInfo.description[0].length >=50 && resultLandingInfo.description[0].length <=5000)
2021-10-04 12:20:18 +02:00
) ;
2021-08-06 13:10:42 +02:00
// console.log("rich content " + allow)
2021-08-13 10:43:26 +02:00
//spam words to exclude - need to be in lower case
let title_authors_words = [ "movie" , "hd" , "film" , "kimetsu" , "1080p" , "4k" , "call of duty" , "mobile hack" , "tubydi" , "电影" , "電影" , "download ebook" , "download [ebook]" , "düşük hapı " , "düşük hapi" ] ;
2021-03-18 16:19:22 +01:00
let abstract_words = [ "operacao-feliz-natal.blogspot.com" , "moviedouban.site" , "hack-expert-solution.link" ] ;
2021-03-08 15:42:26 +01:00
allow = allow && ! (
2021-08-06 13:10:42 +02:00
( this . hasKeyword ( resultLandingInfo . title , title_authors_words ) || ( resultLandingInfo . authors && this . hasKeyword ( resultLandingInfo . authors . map ( o = > o . fullName ) . join ( " " ) , title_authors_words ) )
2022-02-14 16:04:09 +01:00
|| ( resultLandingInfo . description && resultLandingInfo . description [ 0 ] && this . hasKeyword ( resultLandingInfo . description [ 0 ] , abstract_words ) )
2021-03-18 16:19:22 +01:00
) &&
2021-08-06 13:10:42 +02:00
( ( resultLandingInfo . publisher && resultLandingInfo . publisher . toLowerCase ( ) == "zenodo" ) ||
2022-01-07 11:01:22 +01:00
resultLandingInfo . hostedBy_collectedFrom . filter ( value = > {
return value . downloadNames && value . downloadNames . filter ( name = > { return name && name . toLowerCase ( ) . indexOf ( "zenodo" ) != 1 } ) . length > 0
} ) . length > 0 ) ) ;
2021-04-13 16:37:28 +02:00
// console.log("spam content " + allow)
2021-03-30 13:50:15 +02:00
//common titles/ description / authors
let common_titles = [ "introduction" , "editorial" , "book reviews" , "preface" , "reviews" , "none" , "book review" , "foreword" , "conclusion" , "review" , "reply" , "einleitung" , "short notices" , "erratum" , "discussion" , "letters to the editor" , "letter to the editor" , "reviews of books" , ":{unav)" , "editorial board" ] ;
let common_abstract = [ "international audience" , "n/a" , "peer reviewed" , "national audience" , "info:eu-repo/semantics/published" , "-" , "." , "graphical abstract" , "met lit. opg" , "international audience; no abstract" , '<jats:p>.</jats:p>' , "politics" , "info:eu-repo/semantics/publishedversion" , "copia digital. madrid : ministerio de educación, cultura y deporte, 2016" , '<jats:p />' , "peer-reviewed" , "copia digital. madrid : ministerio de educación, cultura y deporte. subdirección general de coordinación bibliotecaria, 2015" , "<jats:p>-</jats:p>" , "imperial users only" , "yüksek lisans" ] ;
let common_authors = [ "[s.n.]" , "null &na;" , "nn" , "(:unap)" , "(:null)" , "null anonymous" , "anonymous" ] ;
allow = allow && ! (
2022-02-14 16:04:09 +01:00
this . isKeyword ( resultLandingInfo . title , common_titles ) || ( resultLandingInfo . description && resultLandingInfo . description [ 0 ] && this . isKeyword ( resultLandingInfo . description [ 0 ] , common_abstract ) ) ||
2021-08-06 13:10:42 +02:00
( resultLandingInfo . authors && this . hasKeyword ( "_" + resultLandingInfo . authors . map ( o = > o . fullName ) . join ( "_" ) + "_" , common_authors , "_" ) )
2021-03-30 13:50:15 +02:00
) ;
2021-04-13 16:37:28 +02:00
// console.log("common content " + allow)
2021-07-26 12:05:36 +02:00
//community filter
2021-08-06 13:10:42 +02:00
allow = allow && ( ( properties . adminToolsPortalType == 'explore' &&
( ! resultLandingInfo . contexts || resultLandingInfo . contexts . length == 0 ||
resultLandingInfo . contexts . filter ( context = > { return publicCommunities . includes ( context . idContext ) } ) . length == 0 ) ) ||
2021-07-26 12:05:36 +02:00
( properties . adminToolsPortalType != 'explore' && properties . adminToolsPortalType != 'community' ) ||
2021-08-06 13:10:42 +02:00
( properties . adminToolsPortalType == 'community' && ( ! ! resultLandingInfo . contexts &&
resultLandingInfo . contexts . filter ( context = > { return ConnectHelper . getCommunityFromDomain ( properties . domain ) == context . idContext } ) . length > 0 )
2021-07-26 12:05:36 +02:00
)
) ;
// console.log("community " + allow )
2021-08-06 13:10:42 +02:00
return allow ;
2020-12-17 12:54:38 +01:00
}
} catch ( e ) {
2021-08-06 13:10:42 +02:00
console . error ( "Error in passNoIndexFilter()" , resultLandingInfo . relcanId , e ) ;
2020-12-17 12:54:38 +01:00
return false ;
}
}
2021-08-06 13:10:42 +02:00
2021-05-13 11:51:46 +02:00
private hasKeyword ( value :string , words :string [ ] , wordSuffix = "" ) {
return value ? words . filter ( word = > { return value . toLowerCase ( ) . indexOf ( wordSuffix + word + wordSuffix ) != - 1 } ) . length > 0 :0 ;
2021-03-30 13:50:15 +02:00
}
private isKeyword ( value :string , words :string [ ] ) {
2021-04-12 17:38:21 +02:00
return value ? words . filter ( word = > { return value . toLowerCase ( ) == word } ) . length > 0 :0 ;
2021-03-08 15:42:26 +01:00
}
2021-05-19 11:36:09 +02:00
public onSelectActiveTab ( activeTabId ) {
if ( this . activeTab != activeTabId ) { // tab really changed
this . activeTab = activeTabId ;
2021-06-16 10:19:16 +02:00
if ( activeTabId == 'enermaps' && this . properties . enermapsURL ) {
2021-05-19 11:36:09 +02:00
this . getEnermapsDetails ( this . enermapsId ) ;
}
}
}
private getEnermapsDetails ( id : string ) {
if ( this . reloadEnermapsDetails ) {
this . subscriptions . push ( this . _resultLandingService . getEnermapsDetails ( id ) . subscribe (
data = > {
this . enermapsDetails = data ;
this . reloadEnermapsDetails = false ;
} ,
error = > {
console . error ( "Error in fetching enermaps details " , error ) ;
}
) )
}
}
2021-11-08 16:24:32 +01:00
public enrichContexts ( contextsWithLink : any ) {
this . contextsWithLink = contextsWithLink ;
}
2022-01-07 11:16:23 +01:00
public relatedClassChanged() {
this . relatedPage = 1 ;
this . filteredRelatedResults = this . resultLandingInfo . relatedResults . filter ( result = > ! this . relatedClassSelected || result . relationName . toLowerCase ( ) == this . relatedClassSelected . toLowerCase ( ) ) ;
}
2019-09-05 10:49:33 +02:00
}