2023-07-04 10:53:08 +02:00
import { ChangeDetectorRef , Component , ElementRef , 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" ;
2023-07-04 10:53:08 +02:00
import { Subscription } from "rxjs" ;
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" ;
2022-04-12 14:15:04 +02:00
import { UserManagementService } from "../../services/user-management.service" ;
import { OpenaireEntities } from "../../utils/properties/searchFields" ;
2022-05-04 12:57:13 +02:00
import { Option } from "../../sharedComponents/input/input.component" ;
2023-02-13 14:51:15 +01:00
import { NumberUtils } from '../../utils/number-utils.class' ;
2023-02-20 16:56:02 +01:00
import { FullScreenModalComponent } from "../../utils/modal/full-screen-modal/full-screen-modal.component" ;
2023-02-17 18:08:44 +01:00
import { SdgFosSuggestComponent } from '../landing-utils/sdg-fos-suggest/sdg-fos-suggest.component' ;
2023-02-20 16:56:02 +01:00
import { LayoutService } from "../../dashboard/sharedComponents/sidebar/layout.service" ;
2023-07-28 15:04:14 +02:00
import { ContextsService } from "../../claims/claim-utils/service/contexts.service" ;
2019-09-05 10:49:33 +02:00
2022-05-05 19:54:01 +02:00
declare var ResizeObserver ;
2019-09-05 10:49:33 +02:00
@Component ( {
selector : 'result-landing' ,
templateUrl : 'resultLanding.component.html' ,
} )
export class ResultLandingComponent {
2023-04-20 19:06:53 +02:00
public referrer : string ;
public prevPath : string ;
2019-09-05 10:49:33 +02:00
@Input ( ) type : string = "publication" ;
2023-07-12 14:05:25 +02:00
2019-09-05 10:49:33 +02:00
@Input ( ) communityId = null ;
2021-04-02 11:17:00 +02:00
enermapsId ;
2022-11-28 18:22:01 +01:00
// @ViewChild('linkModal') linkModal;
2020-05-20 14:56:21 +02:00
@ViewChild ( 'citeModal' ) citeModal ;
2023-02-21 15:10:21 +01:00
@ViewChild ( 'citeFsModal' ) citeFsModal ;
2022-04-20 16:40:18 +02:00
@ViewChild ( 'addThisModal' ) addThisModal ;
2023-02-21 15:10:21 +01:00
@ViewChild ( 'addThisFsModal' ) addThisFsModal ;
2019-09-05 10:49:33 +02:00
@ViewChild ( 'AlertModalDeletedByInference' ) alertModalDeletedByInference ;
2023-02-21 15:10:21 +01:00
@ViewChild ( 'AlertModalDeletedByInferenceFS' ) alertModalDeletedByInferenceFS ;
2022-11-28 18:22:01 +01:00
// @ViewChild('relationModal') relationModal;
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 ;
2023-09-04 11:48:17 +02:00
public belongsInEOSC : boolean = false ;
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*/
2022-04-20 16:40:18 +02:00
public viewAllOrganizations : boolean = false ;
public lessBtnOrganizations : boolean = false ;
public thresholdOrganizations : number = 5 ;
@ViewChild ( 'organizationsModal' ) organizationsModal ;
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 ;
2024-02-28 16:42:58 +01:00
public addThisClicked : boolean ;
public descriptionClicked : 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 ;
2023-05-19 13:37:23 +02:00
/** @deprecated*/
2022-04-04 11:14:54 +02:00
public totalViews : number = null ;
2023-05-19 13:37:23 +02:00
/** @deprecated*/
2022-04-04 11:14:54 +02:00
public totalDownloads : number = null ;
2023-05-19 13:37:23 +02:00
public hasViews : boolean = false ;
public hasDownloads : boolean = false ;
2022-04-04 11:14:54 +02:00
public pageViews : number = null ;
2023-02-08 10:21:16 +01:00
public bipFrameUrl : string ;
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 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 ;
2022-04-12 14:15:04 +02:00
public openaireEntities = OpenaireEntities ;
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 ;
2022-06-09 15:45:39 +02:00
public feedbackPreSelectedField : string = "" ;
2020-03-16 14:09:46 +01:00
public feedbackFields : string [ ] = [
'Title' , 'Authors' , 'Access rights' ,
'Publisher information' , 'Funding Information' ,
2022-06-09 15:45:39 +02:00
'Persistent identifiers' , 'Sustainable Development Goals (SDGs)' ,
2023-02-20 19:54:26 +01:00
'Fields of Science (FoS)' , 'Other' ] ;
2021-02-10 10:05:37 +01:00
2021-01-13 12:58:06 +01:00
public pidsArrayString : string = "" ;
public identifier : Identifier ;
2022-04-12 14:15:04 +02:00
public isLoggedIn : boolean = false ;
2021-01-05 14:25:02 +01:00
public pid : string ;
2021-11-08 16:24:32 +01:00
public contextsWithLink : any ;
2021-01-13 12:58:06 +01:00
2022-05-04 12:57:13 +02:00
public relatedClassFilters : Option [ ] = [ { "label" : "All relations" , "value" : "" } ] ;
2022-01-07 11:16:23 +01:00
public relatedClassSelected : string = "" ;
public filteredRelatedResults : RelationResult [ ] ;
2022-09-06 15:28:51 +02:00
public provenanceActionVocabulary = null ;
public relationsVocabulary = null ;
2022-04-04 11:14:54 +02:00
public offset : number ;
2022-04-28 11:13:06 +02:00
public stickyHeader : boolean = false ;
2022-05-03 10:52:07 +02:00
public graph_offset : number = 0 ;
2022-05-05 19:54:01 +02:00
public graph_height : number = 0 ;
2022-05-03 10:52:07 +02:00
@ViewChild ( "graph_and_feedback" ) graph_and_feedback ;
2022-04-12 14:15:04 +02:00
2022-09-21 12:32:21 +02:00
@ViewChild ( "descriptionDiv" ) descriptionDiv : ElementRef ;
@ViewChild ( 'descriptionModal' ) descriptionModal ;
2022-05-06 15:31:40 +02:00
// public shouldSticky: boolean = true;
2022-05-04 17:09:35 +02:00
2023-02-21 15:10:21 +01:00
public mobileContent : "info" | "metrics" | "actions" = "info" ;
2023-02-20 16:56:02 +01:00
public tabMobile : string = "" ;
public viewAllMobile : string = "" ;
2022-04-12 14:15:04 +02:00
public viewAll : string = "" ;
2023-02-17 18:08:44 +01:00
@ViewChild ( "sdgFosSuggest" ) sdgFosSuggest : SdgFosSuggestComponent ;
2023-02-16 11:59:18 +01:00
2023-02-20 16:56:02 +01:00
public isMobile : boolean = false ;
// Full screen modals for small screens (mobile)
@ViewChild ( 'summaryFsModal' ) summaryFsModal : FullScreenModalComponent ;
2023-04-06 11:46:50 +02:00
@ViewChild ( 'subjectsFsModal' ) subjectsFsModal : FullScreenModalComponent ;
2023-02-20 16:56:02 +01:00
@ViewChild ( 'referencesFsModal' ) referencesFsModal : FullScreenModalComponent ;
@ViewChild ( 'relatedResearchFsModal' ) relatedResearchFsModal : FullScreenModalComponent ;
@ViewChild ( 'bioentitiesFsModal' ) bioentitiesFsModal : FullScreenModalComponent ;
@ViewChild ( 'compatibleEOSCFsModal' ) compatibleEOSCFsModal : FullScreenModalComponent ;
@ViewChild ( 'fundedByFsModal' ) fundedByFsModal : FullScreenModalComponent ;
@ViewChild ( 'relatedCommunitiesFsModal' ) relatedCommunitiesFsModal : FullScreenModalComponent ;
@ViewChild ( 'enermapsToolFsModal' ) enermapsToolFsModal : FullScreenModalComponent ;
@ViewChild ( 'sdgsFsModal' ) sdgsFsModal : FullScreenModalComponent ;
@ViewChild ( 'fosFsModal' ) fosFsModal : FullScreenModalComponent ;
2022-04-12 14:15:04 +02:00
public noCommunities : boolean = false ;
2023-07-28 15:04:14 +02:00
private promise : Promise < void > = null ;
private publicCommunities : string [ ] = [ ] ;
2022-04-12 14:15:04 +02:00
2022-04-20 16:40:18 +02:00
public rightSidebarOffcanvasClicked : boolean = false ;
2022-05-18 12:30:00 +02:00
public egiTransferModalOpen = false ;
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 ,
2022-04-12 14:15:04 +02:00
private indexInfoService : IndexInfoService ,
2023-02-20 16:56:02 +01:00
private userManagementService : UserManagementService ,
2023-07-28 15:04:14 +02:00
private layoutService : LayoutService ,
private _contextService : ContextsService ) {
2024-03-04 10:17:50 +01:00
if ( route . snapshot . data && route . snapshot . data [ 'type' ] ) {
this . type = route . snapshot . data [ 'type' ] ;
}
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() {
2023-02-20 16:56:02 +01:00
this . subscriptions . push ( this . layoutService . isMobile . subscribe ( isMobile = > {
this . isMobile = isMobile ;
} ) ) ;
2022-04-12 14:15:04 +02:00
this . subscriptions . push ( this . userManagementService . getUserInfo ( ) . subscribe ( user = > {
this . isLoggedIn = ! ! user ;
} , error = > { this . isLoggedIn = false } ) ) ;
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
}
2024-02-08 13:19:26 +01:00
if ( properties . adminToolsPortalType !== "explore" ) {
//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 = > {
2022-05-04 12:57:13 +02:00
this . stickyHeader = false ;
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
}
2022-05-18 12:30:00 +02:00
if ( data [ "egiTransfer" ] && data [ "egiTransfer" ] == 't' ) {
2023-07-20 16:06:46 +02:00
this . mobileContent = 'actions' ;
2022-05-18 12:30:00 +02:00
this . egiTransferModalOpen = true ;
}
2020-06-29 15:15:52 +02:00
this . updateDescription ( "" ) ;
2023-05-25 17:10:58 +02:00
if ( data [ "return_path" ] ) {
this . prevPath = data [ "return_path" ] + ( data [ "search_params" ] ? ( "?" + data [ "search_params" ] ) : "" ) ;
2023-04-20 19:06:53 +02:00
}
if ( ( typeof document !== 'undefined' ) && document . referrer ) {
this . referrer = document . referrer ;
}
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 ) ) {
2023-07-28 15:04:14 +02:00
this . getPublicCommunities ( ) ;
2022-06-09 15:45:39 +02:00
this . getVocabulariesAndResultLandingInfo ( ) ;
2020-06-29 15:15:52 +02:00
} else {
this . showLoading = false ;
2021-01-13 12:58:06 +01:00
2022-05-11 11:55:14 +02:00
this . _router . navigate ( [ this . properties . errorLink ] , {
2020-06-29 15:15:52 +02:00
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-05-03 10:52:07 +02:00
}
2022-04-04 11:14:54 +02:00
2022-05-03 10:52:07 +02:00
ngAfterViewInit() {
if ( typeof document !== 'undefined' ) {
2023-03-16 16:53:28 +01:00
// if(properties.adminToolsPortalType !== 'eosc') {
if ( document . getElementById ( "main-menu" ) ) {
this . offset = Number . parseInt ( getComputedStyle ( document . documentElement ) . getPropertyValue ( '--header-height' ) ) ;
} else {
this . offset = 0 ;
}
2022-05-06 15:31:40 +02:00
// let bottom = document.getElementById('bottom');
// if(bottom) {
// let observer = new IntersectionObserver(entries => {
// entries.forEach(entry => {
// this.shouldSticky = !entry.isIntersecting;
// })
// });
// this.subscriptions.push(observer);
// observer.observe(bottom);
// }
2022-05-05 19:54:01 +02:00
if ( this . graph_and_feedback ) {
this . observeGraphAndFeedback ( ) ;
2022-05-04 17:09:35 +02:00
}
2022-05-03 10:52:07 +02:00
}
2019-09-05 10:49:33 +02:00
}
2021-01-13 12:58:06 +01:00
2022-05-03 10:52:07 +02:00
ngAfterContentChecked() {
2022-05-16 23:31:28 +02:00
if ( this . graph_and_feedback && typeof document !== 'undefined' ) {
2022-05-05 19:54:01 +02:00
this . graph_offset = this . calcGraphOffset ( this . graph_and_feedback . nativeElement ) ;
2022-04-20 16:40:18 +02:00
}
2022-05-03 10:52:07 +02:00
}
2022-05-05 19:54:01 +02:00
2022-09-21 12:32:21 +02:00
get showViewMoreButton ( ) : boolean {
return ! ! this . descriptionDiv && ( this . descriptionDiv . nativeElement . clientHeight >= 10 * 21 ) ;
}
2022-05-05 19:54:01 +02:00
public observeGraphAndFeedback() {
let resizeObs = new ResizeObserver ( entries = > {
entries . forEach ( entry = > {
setTimeout ( ( ) = > {
// console.log(entry);
this . graph_offset = this . calcGraphOffset ( entry . target ) ;
this . cdr . detectChanges ( ) ;
} ) ;
} )
} ) ;
this . subscriptions . push ( resizeObs ) ;
resizeObs . observe ( this . graph_and_feedback . nativeElement ) ;
}
calcGraphOffset ( element ) {
this . graph_height = element . offsetHeight ;
return window . innerHeight - this . graph_height ;
2022-04-20 16:40:18 +02:00
}
2021-01-13 12:58:06 +01:00
private initMetaAndLinks ( type : string ) {
if ( type == "publication" ) {
this . type = "publication" ;
2022-05-04 12:57:13 +02:00
this . updateTitle ( this . openaireEntities . PUBLICATION ) ;
2021-01-13 12:58:06 +01:00
this . linkToLandingPage = this . properties . searchLinkToPublication ;
this . linkToSearchPage = this . properties . searchLinkToPublications ;
2022-05-04 12:57:13 +02:00
this . title = this . openaireEntities . PUBLICATION ;
2021-01-13 12:58:06 +01:00
} else if ( type == "dataset" ) {
2022-05-04 12:57:13 +02:00
this . updateTitle ( this . openaireEntities . DATASET ) ;
2021-01-13 12:58:06 +01:00
this . type = "dataset" ;
this . linkToLandingPage = this . properties . searchLinkToDataset ;
this . linkToSearchPage = this . properties . searchLinkToDatasets ;
2022-05-04 12:57:13 +02:00
this . title = this . openaireEntities . DATASET ;
2021-01-13 12:58:06 +01:00
} else if ( type == "software" ) {
2022-05-04 12:57:13 +02:00
this . updateTitle ( this . openaireEntities . SOFTWARE_SINGULAR ) ;
2021-01-13 12:58:06 +01:00
this . type = "software" ;
this . linkToLandingPage = this . properties . searchLinkToSoftwareLanding ;
this . linkToSearchPage = this . properties . searchLinkToSoftware ;
2022-05-04 12:57:13 +02:00
this . title = this . openaireEntities . SOFTWARE_SINGULAR ;
2021-01-13 12:58:06 +01:00
} else if ( type == "orp" ) {
this . type = "orp" ;
2022-05-04 12:57:13 +02:00
this . updateTitle ( this . openaireEntities . OTHER_SINGULAR ) ;
2021-01-13 12:58:06 +01:00
this . linkToLandingPage = this . properties . searchLinkToOrp ;
this . linkToSearchPage = this . properties . searchLinkToOrps ;
2022-05-04 12:57:13 +02:00
this . title = this . openaireEntities . OTHER_SINGULAR ;
2021-01-13 12:58:06 +01:00
} else if ( type == "result" ) {
this . type = "result" ;
2022-05-04 12:57:13 +02:00
this . updateTitle ( this . openaireEntities . RESULT ) ;
2021-01-13 12:58:06 +01:00
this . linkToLandingPage = this . properties . searchLinkToResult ;
this . linkToSearchPage = this . properties . searchLinkToResults ;
2022-05-04 12:57:13 +02:00
this . title = this . openaireEntities . RESULT ;
2021-01-13 12:58:06 +01:00
}
}
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 ( ) ;
2023-07-04 10:53:08 +02:00
} else if ( ( typeof ResizeObserver != 'undefined' && subscription instanceof ResizeObserver ) ||
( typeof IntersectionObserver != 'undefined' && subscription instanceof IntersectionObserver ) ) {
2022-05-05 19:54:01 +02:00
subscription . disconnect ( ) ;
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 {
2022-06-03 12:01:55 +02:00
return StringUtils . getEntityName ( this . type , false ) ;
2020-03-16 14:09:46 +01:00
}
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
2022-06-09 15:45:39 +02:00
private getVocabulariesAndResultLandingInfo() {
2019-09-05 10:49:33 +02:00
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' ) {
2022-09-06 15:28:51 +02:00
this . subscriptions . push ( this . _vocabulariesService . getProvenanceActionVocabulary ( this . properties ) . subscribe (
data = > {
this . provenanceActionVocabulary = data ;
} , error = > {
this . handleError ( "Error getting provenance action vocabulary for " + this . type , error ) ;
}
) ) ;
this . subscriptions . push ( this . _vocabulariesService . getSubjectsVocabulary ( this . properties ) . subscribe (
data = > {
this . getResultLandingInfo ( data ) ;
} , error = > {
this . getResultLandingInfo ( null ) ;
this . handleError ( "Error getting subjects vocabulary for " + this . type , error ) ;
}
) ) ;
this . subscriptions . push ( this . _vocabulariesService . getRelationsVocabulary ( this . properties ) . subscribe (
data = > {
this . relationsVocabulary = data ;
} , error = > {
this . handleError ( "Error getting relations vocabulary for " + this . type , error ) ;
}
) ) ;
}
else {
this . getResultLandingInfo ( null ) ;
}
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() {
2022-04-20 16:40:18 +02:00
if ( this . hasPrimaryInfo ) {
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
2022-09-06 15:28:51 +02:00
private getResultLandingInfo ( subjectsVocabulary? : 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 ;
2022-09-06 15:28:51 +02:00
this . subscriptions . push ( this . _resultLandingService . getResultLandingInfo ( this . id , this . identifier , this . type , subjectsVocabulary , this . properties ) . subscribe (
2023-07-28 15:04:14 +02:00
async data = > {
let contexts = data . contexts ;
data . contexts = [ ] ;
2019-09-05 10:49:33 +02:00
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
2023-07-28 15:04:14 +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=' +
2021-09-08 14:21:30 +02:00
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":""}}}' ) ;
2023-07-28 15:04:14 +02:00
this . bipFrameUrl = this . properties . bipFrameAPIURL + this . id + ( properties . environment == "beta" ? "&src=beta" : "" ) ;
let pid : Identifier = Identifier . getPIDFromIdentifiers ( 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
}
2023-07-28 15:04:14 +02:00
this . canonicalUrl = this . properties . domain + properties . baseLink + ( pid ? ( this . linkToLandingPage . split ( "?" ) [ 0 ] + "?pid=" + encodeURIComponent ( pid . id ) ) :
2021-04-13 14:52:58 +02:00
( this . linkToLandingPage + this . resultLandingInfo . relcanId ) ) ;
this . seoService . createLinkForCanonicalURL ( this . canonicalUrl ) ;
2021-04-28 17:54:30 +02:00
this . updateUrl ( this . canonicalUrl ) ;
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 ) ;
2023-07-28 15:04:14 +02:00
this . updateDescription ( ( this . resultLandingInfo . description ? ( this . resultLandingInfo . description . substr ( 0 , 157 ) + ( this . resultLandingInfo . description . substr ( 0 , 157 ) . length == 157 ? "..." : "" ) ) : ( this . resultLandingInfo . title ) ) ) ;
2019-09-05 10:49:33 +02:00
}
2023-07-12 14:05:25 +02:00
this . subscriptions . push ( this . _piwikService . trackViewForCustomUrl ( this . properties , this . resultLandingInfo . title , this . linkToLandingPage . split ( "?" ) [ 1 ] + this . id ) . subscribe ( ) ) ;
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' ) {
2023-07-28 15:04:14 +02:00
if ( this . resultLandingInfo . identifiers ) {
2021-01-13 12:58:06 +01:00
let pidsArray : string [ ] = [ ] ;
2023-07-28 15:04:14 +02:00
for ( let key of Array . from ( this . resultLandingInfo . identifiers . keys ( ) ) ) {
2021-01-13 12:58:06 +01:00
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
}
2023-05-12 13:00:34 +02:00
this . relatedClassFilters = [ { "label" : "All relations" , "value" : "" } ] ;
2023-07-28 15:04:14 +02:00
if ( this . resultLandingInfo . relatedClassFilters . size > 1 ) {
2022-05-04 12:57:13 +02:00
for ( let relClass of this . resultLandingInfo . relatedClassFilters ) {
2023-07-28 15:04:14 +02:00
this . relatedClassFilters . push ( {
"label" : HelperFunctions . getVocabularyLabel ( relClass , this . relationsVocabulary ) ,
"value" : relClass
} ) ;
2022-05-04 12:57:13 +02:00
}
} else {
this . relatedClassFilters . pop ( ) ;
}
2022-01-07 11:16:23 +01:00
this . relatedClassSelected = "" ;
this . filteredRelatedResults = this . resultLandingInfo . relatedResults ;
2023-05-19 13:37:23 +02:00
this . hasViews = false ;
this . hasDownloads = false ;
2023-07-28 15:04:14 +02:00
if ( this . resultLandingInfo . measure && this . resultLandingInfo . measure . counts ) {
2023-05-19 13:37:23 +02:00
this . resultLandingInfo . measure . counts . forEach ( measure = > {
2023-07-28 15:04:14 +02:00
if ( measure . name == "views" && measure . value > 0 ) {
2023-05-19 13:37:23 +02:00
this . hasViews = true ;
}
2023-07-28 15:04:14 +02:00
if ( measure . name == "downloads" && measure . value > 0 ) {
2023-05-19 13:37:23 +02:00
this . hasDownloads = true ;
}
} )
}
2019-09-05 10:49:33 +02:00
this . showLoading = false ;
2020-05-25 20:58:13 +02:00
this . setActiveTab ( ) ;
2022-04-20 16:40:18 +02:00
this . cdr . detectChanges ( ) ;
2023-07-28 15:04:14 +02:00
if ( contexts ) {
2023-11-15 16:34:15 +01:00
if ( this . communityId && this . communityId == "enermaps" && properties . enermapsURL ) {
this . enermapsId = ParsingFunctions . getEnermapsConceptId ( contexts ) ;
}
2023-07-28 15:04:14 +02:00
await this . promise ;
if ( this . publicCommunities && this . publicCommunities . length > 0 ) {
2023-09-04 11:48:17 +02:00
this . resultLandingInfo . contexts = contexts . filter ( context = > {
if ( context . idContext == "eosc" ) {
this . belongsInEOSC = true ;
}
return this . publicCommunities . includes ( context . idContext )
} ) ;
2023-07-28 15:04:14 +02:00
this . cdr . detectChanges ( ) ;
}
}
2019-09-05 10:49:33 +02:00
} ,
err = > {
2023-10-30 09:53:19 +01:00
this . handleError ( "Error getting " + this . type + " for " + ( this . id ? ( "id: " + this . id ) : ( "pid: " + this . identifier . id ) ) , err ) ;
2020-05-21 16:18:52 +02:00
if ( err . status == 404 ) {
2022-05-11 11:55:14 +02:00
this . _router . navigate ( [ this . properties . errorLink ] , { 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 {
2022-06-03 12:01:55 +02:00
this . errorMessage = "No " + this . getTypeName ( ) + " found" ;
2021-12-17 14:39:32 +01:00
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
2023-07-28 15:04:14 +02:00
public getPublicCommunities() {
this . promise = new Promise < void > ( resolve = > {
this . _contextService . getPublicCommunitiesByState ( ) . subscribe (
data = > {
this . publicCommunities = data . map ( value = > value . id ) ;
// this.publicCommunities = data;
resolve ( ) ;
} ,
error = > {
this . handleError ( "Error getting communities status" , error ) ;
resolve ( ) ;
} ) ;
} ) ;
}
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 . organizations && this . resultLandingInfo . organizations . length > 0 ) ) ;
2020-05-21 16:18:52 +02:00
}
2021-08-13 10:43:26 +02:00
2022-04-20 16:40:18 +02:00
public get hasRightSidebarInfo ( ) : boolean {
2022-05-16 16:14:50 +02:00
return ( this . resultLandingInfo . eoscSubjects && this . resultLandingInfo . eoscSubjects . length
2023-04-10 13:06:37 +02:00
&& properties . adminToolsPortalType == 'eosc' )
2022-04-20 16:40:18 +02:00
||
( this . resultLandingInfo . sdg && this . resultLandingInfo . sdg . length > 0 )
||
( this . resultLandingInfo . fos && this . resultLandingInfo . fos . length > 0 )
||
( this . resultLandingInfo . fundedByProjects && this . resultLandingInfo . fundedByProjects . length > 0 )
||
( this . resultLandingInfo . contexts && this . resultLandingInfo . contexts . length > 0 && ! this . noCommunities )
2023-01-13 14:57:26 +01:00
||
( this . resultLandingInfo . measure && Object . keys ( this . resultLandingInfo . measure ) . length > 0 ) ;
// ||
// (this.resultLandingInfo.hostedBy_collectedFrom && this.resultLandingInfo.hostedBy_collectedFrom.length > 0);
2020-05-21 16:18:52 +02:00
}
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 ;
2022-06-16 18:37:31 +02:00
this . scrollToTabTop ( 'references' ) ;
2019-09-05 10:49:33 +02:00
}
2021-08-13 10:43:26 +02:00
2020-03-16 14:09:46 +01:00
public updateBioentitiesPage ( $event ) {
this . bioentitiesPage = $event . value ;
2022-06-16 18:37:31 +02:00
this . scrollToTabTop ( 'bioentities' ) ;
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 updateRelatedPage ( $event ) {
this . relatedPage = $event . value ;
2022-06-16 09:56:09 +02:00
this . scrollToTabTop ( 'all_related' ) ;
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
2022-06-16 09:56:09 +02:00
scrollToTabTop ( tabId :string ) {
setTimeout ( ( ) = > {
window . scrollTo ( {
top : document.getElementById ( tabId ) ? document . getElementById ( tabId ) . offsetTop - 250 : 250 ,
behavior : 'smooth'
} ) ;
} , 200 ) ;
}
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 ) {
2022-06-03 12:01:55 +02:00
console . error ( this . getTypeName ( ) + " Landing Page: " + message , error ) ;
2019-09-05 10:49:33 +02:00
}
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 ;
2022-05-06 15:31:40 +02:00
this . alertModalDeletedByInference . alertTitle = "Other versions" ;
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 ) :
2023-05-25 17:10:58 +02:00
( this . linkToLandingPage + this . id ) ) + this . getEoscParams ( ) ) ;
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 ;
2023-10-06 11:22:00 +02:00
} else if ( id . type === "swhid" ) {
return this . properties . swhURL + id . value ;
2020-03-20 13:01:55 +01:00
} 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' ;
2023-10-06 11:22:00 +02:00
} else if ( id . type == "swhid" ) {
return 'Software Heritage' ;
2020-03-20 13:01:55 +01:00
} 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
2022-11-28 18:22:01 +01: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 ( ) ;
}
2022-04-20 16:40:18 +02:00
public openAddThisModal() {
2024-02-28 16:42:58 +01:00
this . addThisClicked = true ;
2022-04-20 16:40:18 +02:00
this . addThisModal . cancelButton = false ;
this . addThisModal . okButton = false ;
this . addThisModal . alertTitle = "Share this " + this . getTypeName ( ) + " in your social networks" ;
this . addThisModal . 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
2022-12-05 11:36:53 +01:00
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" ,
"protocolo raikov" , "top gun maverick streaming vf" , "expensive candy full movie" , "sigma game download" , "阿凡達2線上看" , "lack adam torrent magnet" ,
"원피스 필름 레드 다시보기" , "원피스 필름 레드 자막 다시보기" , "gtatogel" , "gta to gel" ] ;
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-11-28 18:22:01 +01:00
|| ( resultLandingInfo . description && this . hasKeyword ( resultLandingInfo . description , 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-08-09 11:31:57 +02:00
( resultLandingInfo . hostedBy_collectedFrom && resultLandingInfo . hostedBy_collectedFrom . filter ( value = > {
2022-01-07 11:01:22 +01:00
return value . downloadNames && value . downloadNames . filter ( name = > { return name && name . toLowerCase ( ) . indexOf ( "zenodo" ) != 1 } ) . length > 0
2022-08-09 11:31:57 +02:00
} ) . 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-11-28 18:22:01 +01:00
this . isKeyword ( resultLandingInfo . title , common_titles ) || ( resultLandingInfo . description && this . isKeyword ( resultLandingInfo . description , 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 ( ) ) ;
}
2022-04-20 16:40:18 +02:00
public viewAllOrganizationsClick() {
this . viewAllOrganizations = true ;
if ( this . resultLandingInfo . organizations . length <= this . thresholdOrganizations * 2 ) {
this . lessBtnOrganizations = true ;
} else {
this . openOrganizationsModal ( ) ;
}
}
2023-04-06 11:46:50 +02:00
public viewAllSubjectsMobileClicked ( event ) {
this . subjectsFsModal . title += " - " + event [ 'subtitle' ] ;
this . subjectsFsModal . back = true ;
2023-02-20 16:56:02 +01:00
this . viewAllMobile = event [ 'id' ] ;
}
public viewAllOrganizationsMobileClicked() {
this . summaryFsModal . title += " - Related " + this . openaireEntities . ORGANIZATIONS ;
this . summaryFsModal . back = true ;
this . lessBtnOrganizations = true ;
this . viewAllMobile = "organizations" ;
}
public cancelSummaryClicked() {
this . summaryFsModal . title = "Summary" ;
this . summaryFsModal . back = false ;
this . lessBtnOrganizations = false ;
this . viewAllMobile = "" ;
}
2023-04-06 11:46:50 +02:00
public cancelSubjectsClicked() {
this . subjectsFsModal . title = "Subjects" ;
this . subjectsFsModal . back = false ;
this . viewAllMobile = "" ;
}
2023-02-20 16:56:02 +01:00
2022-04-20 16:40:18 +02:00
public openOrganizationsModal() {
this . organizationsModal . cancelButton = false ;
this . organizationsModal . okButton = false ;
2022-05-04 12:57:13 +02:00
this . organizationsModal . alertTitle = "Related " + this . openaireEntities . ORGANIZATIONS ;
2022-04-20 16:40:18 +02:00
this . organizationsModal . open ( ) ;
}
2022-06-09 15:45:39 +02:00
public feedbackClicked ( preSelectedField : string = "" ) {
this . feedbackPreSelectedField = preSelectedField ;
this . showFeedback = true ;
this . scroll ( ) ;
this . viewAll = "" ;
}
2022-09-21 12:32:21 +02:00
2023-02-20 16:56:02 +01:00
public sdgsFsModalCancelled() {
if ( this . viewAllMobile == "sdg" ) {
this . viewAllMobile = "" ;
} else {
this . viewAllMobile = "sdg" ;
}
}
public fosFsModalCancelled() {
if ( this . viewAllMobile == "fos" ) {
this . viewAllMobile = "" ;
} else {
this . viewAllMobile = "fos" ;
}
}
public suggestMobileClicked ( value : string ) {
if ( this . viewAllMobile == 'sdg' || this . viewAllMobile == 'fos' ) {
this . sdgsFsModal . title += " - Suggest" ;
this . sdgsFsModal . back = true ;
this . sdgFosSuggest . subjects = this . resultLandingInfo . sdg ;
this . sdgFosSuggest . subjectType = "sdg" ;
this . viewAllMobile = "sdgSuggest" ;
}
if ( value == 'sdg' ) {
this . sdgFosSuggest . subjects = this . resultLandingInfo . sdg ;
this . sdgFosSuggest . subjectType = "sdg" ;
} else if ( value == 'fos' ) {
this . sdgFosSuggest . subjects = this . resultLandingInfo . fos ;
this . sdgFosSuggest . subjectType = "fos" ;
}
}
2023-02-17 18:08:44 +01:00
public suggestClicked ( value : string ) {
if ( value == 'sdg' ) {
2023-02-18 09:52:24 +01:00
this . sdgFosSuggest . subjects = this . resultLandingInfo . sdg ;
this . sdgFosSuggest . subjectType = "sdg" ;
2023-02-17 18:08:44 +01:00
} else if ( value == 'fos' ) {
2023-02-18 09:52:24 +01:00
this . sdgFosSuggest . subjects = this . resultLandingInfo . fos ;
this . sdgFosSuggest . subjectType = "fos" ;
2023-02-17 18:08:44 +01:00
}
2023-02-20 19:54:26 +01:00
this . cdr . detectChanges ( ) ;
2024-02-28 16:42:58 +01:00
this . sdgFosSuggest . isOpen = true ;
2023-02-18 09:52:24 +01:00
this . sdgFosSuggest . openSelectionModal ( ) ;
}
2023-02-17 18:08:44 +01:00
2023-02-20 16:56:02 +01:00
public viewAllDescriptionClicked() {
if ( this . isMobile ) {
this . summaryFsModal . title += " - Abstract" ;
this . summaryFsModal . back = true ;
this . viewAllMobile = "description" ;
} else {
this . openDescriptionModal ( ) ;
}
}
2022-09-21 12:32:21 +02:00
public openDescriptionModal() {
2024-02-28 16:42:58 +01:00
this . descriptionClicked = true ;
2022-09-21 12:32:21 +02:00
this . descriptionModal . alertFooter = false ;
this . descriptionModal . alertTitle = "Abstract" ;
this . descriptionModal . open ( ) ;
}
2023-04-20 19:06:53 +02:00
2023-02-13 14:51:15 +01:00
public clickedUsageMetrics() {
setTimeout ( ( ) = > {
this . metricsClicked = true ;
} ) ;
}
public formatNumber ( num : number | string ) {
let formatted = NumberUtils . roundNumber ( + num ) ;
return formatted . number + formatted . size ;
}
2023-02-16 11:59:18 +01:00
2023-02-18 09:52:24 +01:00
// private openSdgSelectionModal() {
// this.sdgSelectionModal.cancelButton = false;
// this.sdgSelectionModal.alertTitle = "Please select SDGs that are the most relevant for this publication.";
// this.sdgSelectionModal.okButtonText = "Next";
// this.sdgSelectionModal.stayOpen = true;
// this.sdgSelectionModal.open();
// }
2023-02-16 11:59:18 +01:00
2023-02-20 16:56:02 +01:00
public openFsModal ( fsModal : FullScreenModalComponent , title : string ) {
fsModal . title = title ;
fsModal . okButton = false ;
fsModal . stayOpenInBack = true ;
fsModal . open ( ) ;
this . tabMobile = title ;
}
2023-02-20 15:59:07 +01:00
/ * p r i v a t e o p e n F o s S e l e c t i o n M o d a l ( ) {
2023-02-16 11:59:18 +01:00
this . fosSelectionModal . cancelButton = false ;
this . fosSelectionModal . alertTitle = "Please select FOS that are the most relevant for this publication." ;
this . fosSelectionModal . open ( ) ;
}
2023-02-17 18:08:44 +01:00
public sdgModalOutput() {
this . sdgFosSuggest . sdgModalOutput ( ) ;
2023-02-20 15:59:07 +01:00
} * /
2023-02-20 16:56:02 +01:00
public closeFsModal ( fsModal : FullScreenModalComponent ) {
fsModal . cancel ( ) ;
}
2023-02-20 18:29:21 +01:00
2023-02-21 18:13:15 +01:00
public getMetricsTooltip ( value : string , compact : boolean ) {
if ( compact ) {
if ( value == 'citations' ) {
return "<div>This is an alternative to the \"Influence\" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).</div>" ;
} else if ( value == 'popularity' ) {
return "<div>This indicator reflects the \"current\" impact/attention (the \"hype\") of an article in the research community at large, based on the underlying citation network.</div>" ;
} else if ( value == 'influence' ) {
return "<div>This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).</div>" ;
} else if ( value == 'impulse' ) {
return "<div>This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.</div>" ;
}
} else {
if ( value == 'citations' ) {
2023-03-27 15:32:41 +02:00
return "<div>This is an alternative to the \"Influence\" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).</div><div class='uk-flex uk-margin-top'><a href='https://bip.imsi.athenarc.gr/' target='_blank'><img class='uk-margin-small-right' src='assets/common-assets/bip-minimal.svg' loading='lazy' alt='BIP!' style='width: 40px;'></a><span class='uk-text-uppercase'>Citations provided by <a href='https://bip.imsi.athenarc.gr/' target='_blank' class='uk-link-reset'><strong>BIP!</strong></a></div>" ;
2023-02-21 18:13:15 +01:00
} else if ( value == 'popularity' ) {
2023-03-27 15:32:41 +02:00
return "<div>This indicator reflects the \"current\" impact/attention (the \"hype\") of an article in the research community at large, based on the underlying citation network.</div><div class='uk-flex uk-margin-top'><a href='https://bip.imsi.athenarc.gr/' target='_blank'><img class='uk-margin-small-right' src='assets/common-assets/bip-minimal.svg' loading='lazy' alt='BIP!' style='width: 40px;'></a><span class='uk-text-uppercase'>Popularity provided by <a href='https://bip.imsi.athenarc.gr/' target='_blank' class='uk-link-reset'><strong>BIP!</strong></a></div>" ;
2023-02-21 18:13:15 +01:00
} else if ( value == 'influence' ) {
2023-03-27 15:32:41 +02:00
return "<div>This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).</div><div class='uk-flex uk-margin-top'><a href='https://bip.imsi.athenarc.gr/' target='_blank'><img class='uk-margin-small-right' src='assets/common-assets/bip-minimal.svg' loading='lazy' alt='BIP!' style='width: 40px;'></a><span class='uk-text-uppercase'>Influence provided by <a href='https://bip.imsi.athenarc.gr/' target='_blank' class='uk-link-reset'><strong>BIP!</strong></a></div>" ;
2023-05-04 10:58:11 +02:00
} else if ( value == 'impulse' ) {
return "<div>This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.</div><div class='uk-flex uk-margin-top'><a href='https://bip.imsi.athenarc.gr/' target='_blank'><img class='uk-margin-small-right' src='assets/common-assets/bip-minimal.svg' loading='lazy' alt='BIP!' style='width: 40px;'></a><span class='uk-text-uppercase'>Impulse provided by <a href='https://bip.imsi.athenarc.gr/' target='_blank' class='uk-link-reset'><strong>BIP!</strong></a></div>" ;
} else if ( value == 'downloads' ) {
2023-03-27 15:32:41 +02:00
return "<div class='uk-flex uk-flex-middle'><a href='https://usagecounts.openaire.eu/' target='_blank'><img src='assets/common-assets/logo-small-usage-counts.png' loading='lazy' alt='OpenAIRE UsageCounts'></a><span class='uk-text-uppercase uk-margin-small-left'>Downloads provided by <a href='https://usagecounts.openaire.eu/' target='_blank' class='uk-link-reset'><strong>UsageCounts</strong></a></div>" ;
2023-02-21 18:13:15 +01:00
} else if ( value == 'views' ) {
2023-03-27 15:32:41 +02:00
return "<div class='uk-flex uk-flex-middle'><a href='https://usagecounts.openaire.eu/' target='_blank'><img src='assets/common-assets/logo-small-usage-counts.png' loading='lazy' alt='OpenAIRE UsageCounts'></a><span class='uk-text-uppercase uk-margin-small-left'>Views provided by <a href='https://usagecounts.openaire.eu/' target='_blank' class='uk-link-reset'><strong>UsageCounts</strong></a></div>" ;
2023-02-21 18:13:15 +01:00
}
}
2023-02-20 18:29:21 +01:00
}
2023-05-04 10:58:11 +02:00
public isNumber ( value ) : boolean {
return typeof value === 'number' ;
}
2023-05-08 15:41:42 +02:00
public getAccessLabel ( accessRight ) : string {
2023-07-05 10:40:43 +02:00
if ( accessRight ) {
2023-05-08 15:41:42 +02:00
return ( accessRight + ( accessRight . toLowerCase ( ) . endsWith ( " access" ) ? "" : " access" ) ) ;
}
return "Not available access" ;
}
2023-05-09 18:04:06 +02:00
2024-01-25 11:31:14 +01:00
public get hasSubjects ( ) : boolean {
return ! ! ( this . resultLandingInfo . subjects || this . resultLandingInfo . otherSubjects || ( this . resultLandingInfo . classifiedSubjects && this . properties . environment == 'production' ) || this . resultLandingInfo . eoscSubjects ) ;
}
2023-05-25 17:10:58 +02:00
public getEoscParams() {
let params = "" ;
if ( this . prevPath ) {
let splitted : string [ ] = this . prevPath . split ( "?" ) ;
params = "&return_path=" + StringUtils . URIEncode ( splitted [ 0 ] ) ;
if ( splitted . length > 0 ) {
params += "&search_params=" + StringUtils . URIEncode ( splitted [ 1 ] ) ;
}
}
return params ;
}
2023-04-20 19:06:53 +02:00
public addEoscPrevInParams ( obj ) {
if ( properties . adminToolsPortalType == "eosc" && this . prevPath ) {
2023-05-25 17:10:58 +02:00
let splitted : string [ ] = this . prevPath . split ( "?" ) ;
obj = this . routerHelper . addQueryParam ( "return_path" , splitted [ 0 ] , obj ) ;
if ( splitted . length > 0 ) {
obj = this . routerHelper . addQueryParam ( "search_params" , splitted [ 1 ] , obj ) ;
}
2023-04-20 19:06:53 +02:00
}
return obj ;
}
public get eoscBackLink() {
if ( this . prevPath && this . referrer && ( ( this . referrer == "https://eosc-search-service.grid.cyfronet.pl/" ) || ( this . referrer == "https://beta.search.marketplace.eosc-portal.eu/" ) || ( this . referrer == "https://search.marketplace.eosc-portal.eu/" ) ) ) {
2023-04-21 18:56:19 +02:00
return this . referrer + this . prevPath ;
2023-04-20 19:06:53 +02:00
} else {
2023-04-20 19:48:12 +02:00
return "https://" + ( this . properties . environment == "beta" ? "beta." : "" ) + "search.marketplace.eosc-portal.eu/" ;
2023-04-20 19:06:53 +02:00
}
}
2019-09-05 10:49:33 +02:00
}