openaire-library/landingPages/result/resultLanding.component.ts

900 lines
40 KiB
TypeScript
Raw Normal View History

import {ChangeDetectorRef, Component, EventEmitter, HostListener, Input, Output, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Id, ResultLandingInfo} from '../../utils/entities/resultLandingInfo';
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';
import {Location} from "@angular/common";
import {MetricsService} from "../../services/metrics.service";
import {RelationResult, ResultPreview} from "../../utils/result-preview/result-preview";
import {IndexInfoService} from "../../utils/indexInfo.service";
import {Identifier, StringUtils} from "../../utils/string-utils.class";
import {properties} from "../../../../environments/environment";
import {ISVocabulariesService} from "../../utils/staticAutoComplete/ISVocabularies.service";
import {Subscription} from "rxjs";
import {AnnotationComponent} from "../annotation/annotation.component";
import {ParsingFunctions} from "../landing-utils/parsingFunctions.class";
import {ConnectHelper} from "../../connect/connectHelper";
import {UserManagementService} from "../../services/user-management.service";
import {OpenaireEntities} from "../../utils/properties/searchFields";
import {Option} from "../../sharedComponents/input/input.component";
declare var ResizeObserver;
@Component({
selector: 'result-landing',
templateUrl: 'resultLanding.component.html',
})
export class ResultLandingComponent {
@Input() type: string = "publication";
@Input() piwikSiteId = properties.piwikSiteId;
@Input() communityId = null;
enermapsId;
@ViewChild('linkModal') linkModal;
@ViewChild('citeModal') citeModal;
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
@ViewChild('addThisModal') addThisModal;
@ViewChild('AlertModalDeletedByInference') alertModalDeletedByInference;
@ViewChild('relationModal') relationModal;
public deleteByInferenceOpened: boolean = false;
@Input() public resultFromInput: boolean = false;
@Input() public resultLandingInfo: ResultLandingInfo;
public supplementaryResults: RelationResult[];
public relation: string = 'trust';
public id: string;
public title: string;
2021-08-13 10:43:26 +02:00
/*Show all organizations*/
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
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
// Links for SEO
public linkToLandingPage: string = null;
public canonicalUrl: string = null;
public linkToSearchPage: string = null;
2021-08-13 10:43:26 +02:00
public citeThisClicked: boolean;
2021-08-13 10:43:26 +02:00
// Metrics tab variables
public metricsClicked: boolean;
public hasAltMetrics: boolean = false;
public viewsFrameUrl: string;
public downloadsFrameUrl: string;
public totalViews: number = null;
public totalDownloads: number = null;
public pageViews: number = null;
2021-08-13 10:43:26 +02:00
// Custom tab paging variables
public referencesPage: number = 1;
public bioentitiesPage: number = 1;
public relatedPage: number = 1;
public similarPage: number = 1;
public supplementaryPage: number = 1;
public supplementedByPage: number = 1;
public organizationsPage: number = 1;
public openCitationsPage: number = 1;
public pageSize: number = 10;
2021-08-13 10:43:26 +02:00
// Map counting variables
public bioentitiesNum: number = 0;
public relatedResultsNum: number = 0;
// Message variables
public errorMessage = "";
public showLoading: boolean = true;
2021-08-13 10:43:26 +02:00
public routerHelper: RouterHelper = new RouterHelper();
public activeTab: string = null;
private reloadEnermapsDetails: boolean = true;
public enermapsDetails: any;
private doi: string;
subscriptions = [];
properties: EnvProperties = properties;
public openaireEntities = OpenaireEntities;
public indexUpdateDate: Date;
public pageContents = null;
public divContents = null;
public showFeedback: boolean = false;
public feedbackFields: string [] = [
'Title', 'Authors', 'Access rights',
'Publisher information', 'Funding Information',
'Persistent identifiers', 'Sustainable Development Goals (SDG)',
'Fields of Science and Technology (FOS)', 'Other'];
public pidsArrayString: string = "";
public identifier: Identifier;
public isLoggedIn: boolean = false;
public pid: string;
@ViewChild("annotation") annotation: AnnotationComponent;
public contextsWithLink: any;
public relatedClassFilters: Option[]=[{"label": "All relations", "value": ""}];
public relatedClassSelected: string = "";
public filteredRelatedResults: RelationResult[];
public offset: number;
[Library | new-theme]: Redesign of project landing page and small upadates on result landing and common components. 1. addThis.component.ts: Updated social icons of addThis. 2. landing-header.component.ts: Added "uk-text-small" in subtitle. 3. metrics.component.ts: Added method "clickedMetrics()" to set "metricsClicked" | Added metricsClicked and metrics.infos conditions for loading table or iframes | Added customContainerClass and customIframeClass in <i-frame>. 4. project.component: Updated project landing page according to UI redesign. 5. project.module.ts: Import LoadingModule, IconsModule, InputModule. 6. project.service.ts: Use parsingFunctions.parseDescription. 7. projectService.module.ts: iconsService.registerIcons([link, graph]). 8. resultLanding.component.html: Small fixes in ui | Added right arrow on tooltips of actions that are links to other pages | Display of description updated as innerHtml (#7345). 9. orcid-work.component.ts: Added flex=true in <icon>. 10. input.component.ts: Added disabled?: boolean in Option interface and show disabled options as muted. 11. projectInfo.ts: Updated description to be string[] instead of string. 12. iframe.component.ts: Added @Input() customContainerClass: string = ""; and @Input() customIframeClass: string = ""; 13. search-tab.component.ts: Updated according to redesign | Update "getEntityName()" to return values from OpenaireEntities. 14. tabs.component.ts: Added "uk-height-1-1" in custom tabs | In #mytabs::before set left:0.
2022-04-28 11:13:06 +02:00
public stickyHeader: boolean = false;
public graph_offset: number = 0;
public graph_height: number = 0;
@ViewChild("graph_and_feedback") graph_and_feedback;
// public shouldSticky: boolean = true;
public viewAll: string = "";
public noCommunities: boolean = false;
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
public rightSidebarOffcanvasClicked: boolean = false;
constructor(private _resultLandingService: ResultLandingService,
private _vocabulariesService: ISVocabulariesService,
private _piwikService: PiwikService,
private route: ActivatedRoute,
private router: Router,
private _meta: Meta,
private _title: Title,
private _router: Router,
private helper: HelperService,
private seoService: SEOService,
private metricsService: MetricsService,
private cdr: ChangeDetectorRef,
private _location: Location,
private indexInfoService: IndexInfoService,
private userManagementService: UserManagementService) {
}
2021-08-13 10:43:26 +02:00
ngOnInit() {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.isLoggedIn = !!user;
}, error => { this.isLoggedIn = false} ));
if (typeof document !== 'undefined') {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
[Trunk | Library]: 1. src/assets/common-assets/common/custom.css: Add 'font-display: swap;' in '@font-face' css rules - improve performance. 2. dataProvider.component.html & organizations.component.html & project.component.html & resultLanding.component.html: Add check if 'indexUpdateDate' is initialized. 3. dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts: Initialize 'indexUpdateDate' and tabs counts only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 4. resultLanding.component.ts: Get "provenanceActionVocabulary" and "altMetrics" only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 5. organization.component.ts: [Bug fix] Get 'indexUpdateDate' from service (not properties) if available. 6. project.component.ts: [Bug fix] Call 'getProjectInfo()' only once (was called twice). 7. project.service.ts: [Bug fix] Add check for rels.rel.to.class=="hasParticipant" (when not array). 8. metrics.component.ts: Get metrics if "typeof document !== 'undefined'" (javascript is enabled) | Show charts only if user clicked on metrics badge | Do not set "width" for <i-frame> elements. 9. iframe.component.ts: Add case when only height is sent as input. 10. searchDataProviders.component.ts & searchOrganizations.component.ts: [Bug fix] Set "firstLoad" to false after getting results (was asking refine filters in paging too). 11. search-tab.component.ts: [Bug fix]: In method "getEntityName()" add cases when 'entityType == "project"' and 'entityType == "dataprovider"' and fix case when 'entityType == "result"'. 12. navigationBar.component.ts: [Bug fix] Do not initialize navbar inside route.queryParams subscription - !!! check it carefully when deployed in all portals !!! . git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58874 d315682c-612b-4755-9ff5-7f18f6832af3
2020-06-10 13:05:59 +02:00
}
}));
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this.stickyHeader = false;
if (data['articleId']) {
this.id = data['articleId'];
this.initMetaAndLinks("publication");
} else if (data['datasetId']) {
this.id = data['datasetId'];
this.initMetaAndLinks("dataset");
} else if (data['softwareId']) {
this.id = data['softwareId'];
this.initMetaAndLinks("software");
} else if (data['orpId']) {
this.id = data['orpId'];
this.initMetaAndLinks("orp");
} else if (data["id"]) {
this.id = data["id"];
this.initMetaAndLinks("result");
} else if (data["pid"]) {
this.identifier = Identifier.getIdentifierFromString(decodeURIComponent(data["pid"]),false);
if(!this.type) {
this.type = "result";
}
this.initMetaAndLinks(this.type);
}
this.updateDescription("");
this.metricsClicked = false;
if(this.resultFromInput){
this.id = this.resultLandingInfo.objIdentifier;
this.type="publication";
}
if ((this.id && StringUtils.isOpenAIREID(this.id)) || (this.identifier)) {
this.getProvenanceVocabularyAndResultLandingInfo();
} else {
this.showLoading = false;
this._router.navigate([this.properties.errorLink], {
queryParams: {
"page": this._location.path(true),
"page_type": this.type
}
});
}
this.scroll();
}));
}
ngAfterViewInit() {
if (typeof document !== 'undefined') {
this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height'));
// 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);
// }
if(this.graph_and_feedback) {
this.observeGraphAndFeedback();
}
}
}
ngAfterContentChecked() {
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
if(this.graph_and_feedback && window) {
this.graph_offset = this.calcGraphOffset(this.graph_and_feedback.nativeElement);
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +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;
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
}
private initMetaAndLinks(type: string) {
if (type == "publication") {
this.type = "publication";
this.updateTitle(this.openaireEntities.PUBLICATION);
this.linkToLandingPage = this.properties.searchLinkToPublication;
this.linkToSearchPage = this.properties.searchLinkToPublications;
this.title = this.openaireEntities.PUBLICATION;
} else if (type == "dataset") {
this.updateTitle(this.openaireEntities.DATASET);
this.type = "dataset";
this.linkToLandingPage = this.properties.searchLinkToDataset;
this.linkToSearchPage = this.properties.searchLinkToDatasets;
this.title = this.openaireEntities.DATASET;
} else if (type == "software") {
this.updateTitle(this.openaireEntities.SOFTWARE_SINGULAR);
this.type = "software";
this.linkToLandingPage = this.properties.searchLinkToSoftwareLanding;
this.linkToSearchPage = this.properties.searchLinkToSoftware;
this.title = this.openaireEntities.SOFTWARE_SINGULAR;
} else if (type == "orp") {
this.type = "orp";
this.updateTitle(this.openaireEntities.OTHER_SINGULAR);
this.linkToLandingPage = this.properties.searchLinkToOrp;
this.linkToSearchPage = this.properties.searchLinkToOrps;
this.title = this.openaireEntities.OTHER_SINGULAR;
} else if (type == "result") {
this.type = "result";
this.updateTitle(this.openaireEntities.RESULT);
this.linkToLandingPage = this.properties.searchLinkToResult;
this.linkToSearchPage = this.properties.searchLinkToResults;
this.title = this.openaireEntities.RESULT;
}
}
private getPageContents() {
if (this.communityId) {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
}));
}
}
2021-08-13 10:43:26 +02:00
private getDivContents() {
if (this.communityId) {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
}));
}
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscription) {
subscription.unsubscribe();
} else if (subscription instanceof Function) {
subscription();
} else if (subscription instanceof (ResizeObserver || IntersectionObserver)) {
subscription.disconnect();
}
});
this._vocabulariesService.clearSubscriptions();
}
2021-08-13 10:43:26 +02:00
public pidInit(event) {
this.pid = event;
this.cdr.detectChanges();
}
2021-08-13 10:43:26 +02:00
public getTypeName(): string {
if (this.type === "dataset") {
return this.openaireEntities.DATASET;
} else if (this.type === "orp" || this.type === "other") {
return this.openaireEntities.OTHER_SINGULAR;
} else if(this.type === "publication") {
return this.openaireEntities.PUBLICATION;
} else if(this.type === "software") {
return this.openaireEntities.SOFTWARE_SINGULAR;
}
}
2021-08-13 10:43:26 +02: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
public removeDuplicates(array: string[]): string[] {
let type = this.getTypeName();
return array.filter(value => value.toLowerCase() !== type);
}
2021-08-13 10:43:26 +02:00
private getOpenCitations() {
this.subscriptions.push(this._resultLandingService.getOpenCitations(this.id, this.properties).subscribe(
data => {
this.resultLandingInfo.openCitations = data[1];
},
err => {
this.handleError("Error getting open citation for " + this.type + " with id: " + this.id, err);
}
));
}
2021-08-13 10:43:26 +02:00
private getProvenanceVocabularyAndResultLandingInfo() {
this.errorMessage = '';
this.showLoading = true;
[Trunk | Library]: 1. src/assets/common-assets/common/custom.css: Add 'font-display: swap;' in '@font-face' css rules - improve performance. 2. dataProvider.component.html & organizations.component.html & project.component.html & resultLanding.component.html: Add check if 'indexUpdateDate' is initialized. 3. dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts: Initialize 'indexUpdateDate' and tabs counts only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 4. resultLanding.component.ts: Get "provenanceActionVocabulary" and "altMetrics" only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 5. organization.component.ts: [Bug fix] Get 'indexUpdateDate' from service (not properties) if available. 6. project.component.ts: [Bug fix] Call 'getProjectInfo()' only once (was called twice). 7. project.service.ts: [Bug fix] Add check for rels.rel.to.class=="hasParticipant" (when not array). 8. metrics.component.ts: Get metrics if "typeof document !== 'undefined'" (javascript is enabled) | Show charts only if user clicked on metrics badge | Do not set "width" for <i-frame> elements. 9. iframe.component.ts: Add case when only height is sent as input. 10. searchDataProviders.component.ts & searchOrganizations.component.ts: [Bug fix] Set "firstLoad" to false after getting results (was asking refine filters in paging too). 11. search-tab.component.ts: [Bug fix]: In method "getEntityName()" add cases when 'entityType == "project"' and 'entityType == "dataprovider"' and fix case when 'entityType == "result"'. 12. navigationBar.component.ts: [Bug fix] Do not initialize navbar inside route.queryParams subscription - !!! check it carefully when deployed in all portals !!! . git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58874 d315682c-612b-4755-9ff5-7f18f6832af3
2020-06-10 13:05:59 +02:00
if (typeof document !== 'undefined') {
this.subscriptions.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe(
[Trunk | Library]: 1. src/assets/common-assets/common/custom.css: Add 'font-display: swap;' in '@font-face' css rules - improve performance. 2. dataProvider.component.html & organizations.component.html & project.component.html & resultLanding.component.html: Add check if 'indexUpdateDate' is initialized. 3. dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts: Initialize 'indexUpdateDate' and tabs counts only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 4. resultLanding.component.ts: Get "provenanceActionVocabulary" and "altMetrics" only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 5. organization.component.ts: [Bug fix] Get 'indexUpdateDate' from service (not properties) if available. 6. project.component.ts: [Bug fix] Call 'getProjectInfo()' only once (was called twice). 7. project.service.ts: [Bug fix] Add check for rels.rel.to.class=="hasParticipant" (when not array). 8. metrics.component.ts: Get metrics if "typeof document !== 'undefined'" (javascript is enabled) | Show charts only if user clicked on metrics badge | Do not set "width" for <i-frame> elements. 9. iframe.component.ts: Add case when only height is sent as input. 10. searchDataProviders.component.ts & searchOrganizations.component.ts: [Bug fix] Set "firstLoad" to false after getting results (was asking refine filters in paging too). 11. search-tab.component.ts: [Bug fix]: In method "getEntityName()" add cases when 'entityType == "project"' and 'entityType == "dataprovider"' and fix case when 'entityType == "result"'. 12. navigationBar.component.ts: [Bug fix] Do not initialize navbar inside route.queryParams subscription - !!! check it carefully when deployed in all portals !!! . git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58874 d315682c-612b-4755-9ff5-7f18f6832af3
2020-06-10 13:05:59 +02:00
provenanceActionVocabulary => {
this.getResultLandingInfo(provenanceActionVocabulary);
}, err => {
this.getResultLandingInfo(null);
this.handleError("Error getting provenance action vocabulary for " + this.type, err);
[Trunk | Library]: 1. src/assets/common-assets/common/custom.css: Add 'font-display: swap;' in '@font-face' css rules - improve performance. 2. dataProvider.component.html & organizations.component.html & project.component.html & resultLanding.component.html: Add check if 'indexUpdateDate' is initialized. 3. dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts: Initialize 'indexUpdateDate' and tabs counts only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 4. resultLanding.component.ts: Get "provenanceActionVocabulary" and "altMetrics" only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 5. organization.component.ts: [Bug fix] Get 'indexUpdateDate' from service (not properties) if available. 6. project.component.ts: [Bug fix] Call 'getProjectInfo()' only once (was called twice). 7. project.service.ts: [Bug fix] Add check for rels.rel.to.class=="hasParticipant" (when not array). 8. metrics.component.ts: Get metrics if "typeof document !== 'undefined'" (javascript is enabled) | Show charts only if user clicked on metrics badge | Do not set "width" for <i-frame> elements. 9. iframe.component.ts: Add case when only height is sent as input. 10. searchDataProviders.component.ts & searchOrganizations.component.ts: [Bug fix] Set "firstLoad" to false after getting results (was asking refine filters in paging too). 11. search-tab.component.ts: [Bug fix]: In method "getEntityName()" add cases when 'entityType == "project"' and 'entityType == "dataprovider"' and fix case when 'entityType == "result"'. 12. navigationBar.component.ts: [Bug fix] Do not initialize navbar inside route.queryParams subscription - !!! check it carefully when deployed in all portals !!! . git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58874 d315682c-612b-4755-9ff5-7f18f6832af3
2020-06-10 13:05:59 +02:00
}
));
[Trunk | Library]: 1. src/assets/common-assets/common/custom.css: Add 'font-display: swap;' in '@font-face' css rules - improve performance. 2. dataProvider.component.html & organizations.component.html & project.component.html & resultLanding.component.html: Add check if 'indexUpdateDate' is initialized. 3. dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts: Initialize 'indexUpdateDate' and tabs counts only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 4. resultLanding.component.ts: Get "provenanceActionVocabulary" and "altMetrics" only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 5. organization.component.ts: [Bug fix] Get 'indexUpdateDate' from service (not properties) if available. 6. project.component.ts: [Bug fix] Call 'getProjectInfo()' only once (was called twice). 7. project.service.ts: [Bug fix] Add check for rels.rel.to.class=="hasParticipant" (when not array). 8. metrics.component.ts: Get metrics if "typeof document !== 'undefined'" (javascript is enabled) | Show charts only if user clicked on metrics badge | Do not set "width" for <i-frame> elements. 9. iframe.component.ts: Add case when only height is sent as input. 10. searchDataProviders.component.ts & searchOrganizations.component.ts: [Bug fix] Set "firstLoad" to false after getting results (was asking refine filters in paging too). 11. search-tab.component.ts: [Bug fix]: In method "getEntityName()" add cases when 'entityType == "project"' and 'entityType == "dataprovider"' and fix case when 'entityType == "result"'. 12. navigationBar.component.ts: [Bug fix] Do not initialize navbar inside route.queryParams subscription - !!! check it carefully when deployed in all portals !!! . git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58874 d315682c-612b-4755-9ff5-7f18f6832af3
2020-06-10 13:05:59 +02:00
} else {
this.getResultLandingInfo(null);
}
2021-08-13 10:43:26 +02:00
}
2021-08-13 10:43:26 +02:00
private setActiveTab() {
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
if (this.hasPrimaryInfo) {
this.activeTab = 'summary';
} else if (this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) {
this.activeTab = 'references';
// } 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";
} else if (this.resultLandingInfo.bioentities && this.bioentitiesNum > 0) {
this.activeTab = 'bioentities';
} else if(this.enermapsId && this.properties.enermapsURL) {
this.activeTab = "enermaps";
}
}
2021-08-13 10:43:26 +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
private getResultLandingInfo(provenanceActionVocabulary: any) {
if(this.resultFromInput && this.resultLandingInfo){
this.showLoading = false;
return;
}
this.resultLandingInfo = null;
this.hasAltMetrics = false;
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe(
data => {
this.resultLandingInfo = data;
this.id = this.resultLandingInfo.objIdentifier;
//old
// 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';
//new
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":""}}}');
let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.resultLandingInfo.identifiers);
if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType
this.updateUrlWithType(pid);
}
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);
this.updateUrl(this.canonicalUrl);
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
// this.getOpenCitations();
}
this.addNoIndexFilter();
if (this.resultLandingInfo.title) {
this.updateTitle(this.resultLandingInfo.title);
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)));
}
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackViewForCustomUrl(this.properties, this.resultLandingInfo.title, this.linkToLandingPage.split("?")[1] + this.id ,this.piwikSiteId).subscribe());
}
2021-08-13 10:43:26 +02:00
let bioentitiesNum = 0;
if (this.resultLandingInfo.bioentities != undefined) {
this.resultLandingInfo.bioentities.forEach(function (value, key, map) {
bioentitiesNum += value.size;
});
}
this.bioentitiesNum = bioentitiesNum;
if (typeof document !== 'undefined') {
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;
}));
}
[Trunk | Library]: 1. src/assets/common-assets/common/custom.css: Add 'font-display: swap;' in '@font-face' css rules - improve performance. 2. dataProvider.component.html & organizations.component.html & project.component.html & resultLanding.component.html: Add check if 'indexUpdateDate' is initialized. 3. dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts: Initialize 'indexUpdateDate' and tabs counts only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 4. resultLanding.component.ts: Get "provenanceActionVocabulary" and "altMetrics" only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance. 5. organization.component.ts: [Bug fix] Get 'indexUpdateDate' from service (not properties) if available. 6. project.component.ts: [Bug fix] Call 'getProjectInfo()' only once (was called twice). 7. project.service.ts: [Bug fix] Add check for rels.rel.to.class=="hasParticipant" (when not array). 8. metrics.component.ts: Get metrics if "typeof document !== 'undefined'" (javascript is enabled) | Show charts only if user clicked on metrics badge | Do not set "width" for <i-frame> elements. 9. iframe.component.ts: Add case when only height is sent as input. 10. searchDataProviders.component.ts & searchOrganizations.component.ts: [Bug fix] Set "firstLoad" to false after getting results (was asking refine filters in paging too). 11. search-tab.component.ts: [Bug fix]: In method "getEntityName()" add cases when 'entityType == "project"' and 'entityType == "dataprovider"' and fix case when 'entityType == "result"'. 12. navigationBar.component.ts: [Bug fix] Do not initialize navbar inside route.queryParams subscription - !!! check it carefully when deployed in all portals !!! . git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58874 d315682c-612b-4755-9ff5-7f18f6832af3
2020-06-10 13:05:59 +02:00
}
}
if(this.communityId && this.communityId == "enermaps" && properties.enermapsURL){
this.enermapsId = ParsingFunctions.getEnermapsConceptId(this.resultLandingInfo.contexts);
}
if(this.resultLandingInfo.relatedClassFilters.size > 1) {
for (let relClass of this.resultLandingInfo.relatedClassFilters) {
this.relatedClassFilters.push({"label": relClass, "value": relClass});
}
} else {
this.relatedClassFilters.pop();
}
this.relatedClassSelected = "";
this.filteredRelatedResults = this.resultLandingInfo.relatedResults;
this.showLoading = false;
this.setActiveTab();
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
this.cdr.detectChanges();
},
err => {
this.handleError("Error getting " + this.type + " for " + (this.id ? ("id: " + this.id) : ("pid: " + this.identifier.id + " ("+this.identifier.class+")")), err);
if (err.status == 404) {
this._router.navigate([this.properties.errorLink], {queryParams: {"page": this._location.path(true), "page_type": this.type}});
}else if(err.name == "TimeoutError"){
this.errorMessage = 'An error occurred please try again later';
}else{
if (this.type == "publication") {
this.errorMessage = "No "+ this.openaireEntities.PUBLICATIONS +" found";
} else if (this.type == "software") {
this.errorMessage = 'No ' + this.openaireEntities.SOFTWARE + ' found';
} else if (this.type == "dataset") {
this.errorMessage += "No "+this.openaireEntities.DATASETS+" found";
} else if (this.type == "orp") {
this.errorMessage += "No "+this.openaireEntities.OTHER+" found";
}
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToSearchPage);
}
this.showLoading = false;
}
));
}
2021-08-13 10:43:26 +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
public get hasPrimaryInfo(): boolean {
return !!this.resultLandingInfo && (
(!!this.resultLandingInfo.description && this.resultLandingInfo.description.length > 0)
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
|| !!this.resultLandingInfo.subjects
|| (!!this.resultLandingInfo.organizations && this.resultLandingInfo.organizations.length > 0));
}
2021-08-13 10:43:26 +02:00
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
public get hasRightSidebarInfo(): boolean {
return (this.resultLandingInfo.eoscSubjects && this.resultLandingInfo.eoscSubjects.length
&& (properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'eosc'))
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
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)
||
(this.resultLandingInfo.hostedBy_collectedFrom && this.resultLandingInfo.hostedBy_collectedFrom.length > 0);
}
2021-08-13 10:43:26 +02:00
public get metricsCalculated(): boolean {
return this.totalViews != null || this.totalDownloads != null || this.pageViews != null;
}
public get hasMetrics(): boolean {
// 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);
}
2021-08-13 10:43:26 +02:00
private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'");
}
2021-08-13 10:43:26 +02:00
private updateTitle(title: string) {
var _prefix = "";
// 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'");
}
2021-08-13 10:43:26 +02:00
private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'");
}
2021-08-13 10:43:26 +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
public updateReferencesPage($event) {
this.referencesPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public updateBioentitiesPage($event) {
this.bioentitiesPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public updateRelatedPage($event) {
this.relatedPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public updateSimilarPage($event) {
this.similarPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public updateSupplementaryPage($event) {
this.supplementaryPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public updateSupplementedByPage($event) {
this.supplementedByPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public updateOrganizationsPage($event) {
this.organizationsPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public updateOpenCitationsPage($event) {
this.openCitationsPage = $event.value;
}
2021-08-13 10:43:26 +02:00
public accessClass(accessMode: string): string {
if (accessMode.toLowerCase().indexOf('open') !== -1) {
return 'open';
} else if (accessMode.toLowerCase() === 'not available') {
return 'unknown';
} else {
return 'closed';
}
}
2021-08-13 10:43:26 +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
public getKeys(map) {
return Array.from(map.keys());
}
2021-08-13 10:43:26 +02:00
public scroll() {
HelperFunctions.scroll();
}
2021-08-13 10:43:26 +02:00
private handleError(message: string, error) {
if (this.type == "publication") {
console.error(this.openaireEntities.PUBLICATION+" Landing Page: " + message, error);
} else if (this.type == "dataset") {
console.error(this.openaireEntities.DATASET+" Landing Page: " + message, error);
} else if (this.type == "software") {
console.error(this.openaireEntities.SOFTWARE_SINGULAR+" Landing Page: " + message, error);
} else if (this.type == "orp") {
console.error(this.openaireEntities.OTHER_SINGULAR+" Landing Page: " + message, error);
} else {
console.error(this.openaireEntities.RESULT+" Landing Page: " + message, error);
}
}
2021-08-13 10:43:26 +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
openDeletedByInference() {
this.deleteByInferenceOpened = true;
this.alertModalDeletedByInference.cancelButton = false;
this.alertModalDeletedByInference.okButton = false;
this.alertModalDeletedByInference.alertTitle = "Other versions";
this.alertModalDeletedByInference.open();
}
2021-08-13 10:43:26 +02:00
public getResultPreview(result: RelationResult): ResultPreview {
return ResultPreview.relationResultConvert(result);
}
2021-08-13 10:43:26 +02:00
updateUrlWithType(pid) {
this.type = this.resultLandingInfo.resultType;
if (this.type == "publication") {
this.linkToLandingPage = this.properties.searchLinkToPublication;
this.linkToSearchPage = this.properties.searchLinkToPublications;
} else if (this.type == "dataset") {
this.linkToLandingPage = this.properties.searchLinkToDataset;
this.linkToSearchPage = this.properties.searchLinkToDatasets;
} else if (this.type == "software") {
this.linkToLandingPage = this.properties.searchLinkToSoftwareLanding;
this.linkToSearchPage = this.properties.searchLinkToSoftware;
} else if (this.type == "other") {
this.type = "orp";
this.linkToLandingPage = this.properties.searchLinkToOrp;
this.linkToSearchPage = this.properties.searchLinkToOrps;
}
if(!this.identifier) {
this._location.go(( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + pid.id):
(this.linkToLandingPage + this.id)));
}
// else {
// this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id);
// }
}
2021-08-13 10:43:26 +02:00
public getReferenceUrl(id: Id): string {
if (id.type === "doi") {
return this.properties.doiURL + id.value;
} else if (id.type === "pmc") {
return this.properties.pmcURL + id.value;
} else if (id.type === "pmid") {
return this.properties.pmidURL + id.value;
} else if (id.type === "handle") {
return this.properties.handleURL + id.value;
} else {
return null;
}
}
2021-08-13 10:43:26 +02:00
public getReferenceIdName(id: Id): string {
if (id.type === "doi") {
return 'DOI'
} else if (id.type === "pmc") {
return 'Europe PMC'
} else if (id.type === "pmid") {
return 'PubMed';
} else if (id.type === "handle") {
return 'Handle.NET';
} else {
return null;
}
}
2021-08-13 10:43:26 +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
public openCiteModal() {
this.citeThisClicked = true;
this.citeModal.cancelButton = false;
this.citeModal.okButton = false;
this.citeModal.alertTitle = "Cite this " + this.getTypeName();
this.citeModal.open();
}
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
public openAddThisModal() {
this.addThisModal.cancelButton = false;
this.addThisModal.okButton = false;
this.addThisModal.alertTitle = "Share this " + this.getTypeName() + " in your social networks";
this.addThisModal.open();
}
private addNoIndexFilter() {
let allow = this.checkIfAllowed(this.resultLandingInfo);
if(!allow) {
// console.log("no index");
this._meta.updateTag({content: 'noindex'}, "name='robots'");
}
}
checkIfAllowed(resultLandingInfo: ResultLandingInfo) {
let publicCommunities: string[] = [ "covid-19" ];
try {
if(!(this.properties.environment == "production" || this.properties.environment == "development") ) {
return true;
}else {
let allow = !!(
// !resultLandingInfo.underCurationMessage &&
((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)
|| (resultLandingInfo.organizations && resultLandingInfo.organizations.length > 0)
|| resultLandingInfo.bioentities || (resultLandingInfo.references && resultLandingInfo.references.length > 0)
// || (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)
)
//&& (resultLandingInfo.description && resultLandingInfo.description[0] && resultLandingInfo.description[0].length >=50 && resultLandingInfo.description[0].length <=5000)
);
// 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"];
let abstract_words = ["operacao-feliz-natal.blogspot.com", "moviedouban.site", "hack-expert-solution.link"];
allow = allow && !(
(this.hasKeyword(resultLandingInfo.title,title_authors_words) || (resultLandingInfo.authors && this.hasKeyword(resultLandingInfo.authors.map(o => o.fullName).join(" "),title_authors_words))
|| (resultLandingInfo.description && resultLandingInfo.description[0] && this.hasKeyword(resultLandingInfo.description[0],abstract_words))
) &&
((resultLandingInfo.publisher && resultLandingInfo.publisher.toLowerCase() == "zenodo") ||
resultLandingInfo.hostedBy_collectedFrom.filter(value => {
return value.downloadNames && value.downloadNames.filter(name => {return name && name.toLowerCase().indexOf("zenodo") != 1}).length > 0
}).length > 0));
// console.log("spam content " + allow)
//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 && !(
this.isKeyword(resultLandingInfo.title,common_titles) || (resultLandingInfo.description && resultLandingInfo.description[0] && this.isKeyword(resultLandingInfo.description[0],common_abstract)) ||
(resultLandingInfo.authors && this.hasKeyword("_"+resultLandingInfo.authors.map(o => o.fullName).join("_")+"_",common_authors, "_"))
);
// console.log("common content " + allow)
//community filter
allow = allow && ((properties.adminToolsPortalType == 'explore' &&
(!resultLandingInfo.contexts || resultLandingInfo.contexts.length == 0 ||
resultLandingInfo.contexts.filter( context => { return publicCommunities.includes(context.idContext) }).length == 0)) ||
(properties.adminToolsPortalType != 'explore' && properties.adminToolsPortalType != 'community') ||
(properties.adminToolsPortalType == 'community' && (!!resultLandingInfo.contexts &&
resultLandingInfo.contexts.filter( context => { return ConnectHelper.getCommunityFromDomain(properties.domain) == context.idContext }).length > 0)
)
);
// console.log("community " + allow )
return allow;
}
} catch (e) {
console.error("Error in passNoIndexFilter()", resultLandingInfo.relcanId, e);
return false;
}
}
private hasKeyword(value:string, words:string[], wordSuffix = ""){
return value?words.filter( word => { return value.toLowerCase().indexOf(wordSuffix + word + wordSuffix)!=-1}).length > 0:0;
}
private isKeyword(value:string, words:string[]){
return value?words.filter( word => { return value.toLowerCase() == word}).length > 0:0;
}
public onSelectActiveTab(activeTabId) {
if (this.activeTab != activeTabId) { // tab really changed
this.activeTab = activeTabId;
if (activeTabId == 'enermaps' && this.properties.enermapsURL) {
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);
}
))
}
}
public enrichContexts(contextsWithLink: any) {
this.contextsWithLink = contextsWithLink;
}
public relatedClassChanged() {
this.relatedPage = 1;
this.filteredRelatedResults = this.resultLandingInfo.relatedResults.filter(result => !this.relatedClassSelected || result.relationName.toLowerCase() == this.relatedClassSelected.toLowerCase());
}
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
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();
}
}
public openOrganizationsModal() {
this.organizationsModal.cancelButton = false;
this.organizationsModal.okButton = false;
this.organizationsModal.alertTitle = "Related "+this.openaireEntities.ORGANIZATIONS;
[Explore & Library & Common Assets | new-theme]: Updates related to result landing redesign. 1. fos.component.css: Removed rule "mark.highlighted" and ".custom-bottom-border" updated with variables. 2. feedback.component.html: Updated width of email input for small screens. 3. parsingFunctions.class.ts: In "parseAllSubjects()" method, comment otherSubjects and push them in subjects. 4. showIdentifiers.component.ts: Updated classes in <modal-alert>. 5. showSubjects.component.ts: "Subjects by Vocabulary" and "Subjects" separated & view more functionality added in "Subjects". 6. resultLanding.component: a. Added button and modal for <addThis> (share in social media). b. View more functionality for related organizations. c. Graph and feedback section sticky. d. Added checks for summary tab and right sidebar. e. In small screens made right sidebar offcanvas. 7. resultLanding.module.ts: Updated iconsService.registerIcons to register link, graph, quotes. 8. orcid-work.component.ts: Added visually-hidden in icon buttons for landing | Updated classes in <modal-alert> and use buttons of alert instead of custom. 9. no-load-paging.component.ts: Use new component <results-and-pages> for results and pages number and set uk-flex-right in <paging-no-load> (default is center). 10. cookie-law.css: In ".cookie-law-wrapper" increased z-index from 100 to 1000. 11. showAuthors.component.ts: Removed shadow from search button | Updated classes in <modal-alert>. 12. icons.ts: Added "quotes" svg. 13. alert.ts: Updated modal to have header - body - footer (theme was updated too) | classTitle input set default to "uk-background-primary-opacity" | @Input() overflowBody: boolean = true; added to add overflow in body. 14. paging.module.ts: Added ResultsAndPagesNumComponent in declarations and exports. 15. pagingFormatter.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them. 16. pagingFormatterNoLoad.component.ts: Add "uk-invisible" to previous and next buttons instead of hiding them | Set customClasses default to "uk-flex-center". 17. tabs.component.ts: Updated margins/ paddings | Added @Input() offsetForSticky:number=0; to compare with the top distance for isSticky. 18. resultsAndPagesNum.component.ts: [NEW] Component to show number of results, number of pages and current page (used in paging). 19. landing-utils.css: a. Moved variables in .landing instead of :root. b. Added variable --landing-light-color-rgb: var(--light-color-rgb); c. Added glass filter in #graph_and_feedback. d. Set z-index of #main-tabs-div and #graph_and_feedback to 979 (default 980 caused problems with metrics box). e. Added padding-bottom: 80px and margin-top: 80px in .landing-sections. f. Added top rule for #right-sidebar-switcher. g. Added custom width rules for .landing-left-sidebar-width. 20. css-rules.txt: Added cookie-law-wrapper: 1000 info for z-index 21. explore-custom.css: Added variable --background-primary-rgb: var(--explore-color-rgb);
2022-04-20 16:40:18 +02:00
this.organizationsModal.open();
}
}