diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index cd86deb8..837b0d83 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -27,7 +27,6 @@ import {DropdownFilterComponent} from "../../../utils/dropdown-filter/dropdown-f styleUrls: ['displayClaims.component.less'] }) export class DisplayClaimsComponent implements OnInit, OnDestroy { - @Input() piwikSiteId = null; @Input() pageTitle: string = ""; properties: EnvProperties; public searchTermStream = new Subject(); @@ -110,9 +109,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { this.updateTitle(this.pageTitle); this.updateDescription(description); this.updateUrl(this.url); - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.pageContents = contents; diff --git a/claims/directLinking/directLinking.component.html b/claims/directLinking/directLinking.component.html index 0679b6df..e05bc3a3 100644 --- a/claims/directLinking/directLinking.component.html +++ b/claims/directLinking/directLinking.component.html @@ -1,6 +1,6 @@ + pageTitle="Direct Linking">
diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index caa334f9..229558ea 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -18,8 +18,6 @@ import {ClaimProjectsSearchFormComponent} from "../claim-utils/claimProjectSearc templateUrl: 'directLinking.component.html' }) export class DirectLinkingComponent { - @Input() piwikSiteId = null; - @ViewChild(LinkingGenericComponent) linking: LinkingGenericComponent; results: ClaimEntity[] = []; diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index 00ef9f10..524f3566 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -22,7 +22,6 @@ import { Location } from '@angular/common'; templateUrl: 'linkingGeneric.component.html' }) export class LinkingGenericComponent { - @Input() piwikSiteId = null; @Input() pageTitle: string = "Create links between research objects"; piwiksub:any; @@ -79,9 +78,7 @@ export class LinkingGenericComponent { this.seoService.createLinkForCanonicalURL(this.url, false); - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.pageContents = contents; diff --git a/claims/myClaims/myClaims.component.ts b/claims/myClaims/myClaims.component.ts index 2252d477..5f2369df 100644 --- a/claims/myClaims/myClaims.component.ts +++ b/claims/myClaims/myClaims.component.ts @@ -19,7 +19,7 @@ import {Subscriber} from "rxjs";
+ pageTitle="My links">
@@ -30,7 +30,6 @@ import {Subscriber} from "rxjs"; export class MyClaimsComponent { @Input() claimsInfoURL: string; @Input() communityId:string; - @Input() piwikSiteId = null; @Input() userInfoURL: string; public user: User = null; diff --git a/deposit/depositFirstPage.component.ts b/deposit/depositFirstPage.component.ts index 3f88a03f..183d3fd1 100644 --- a/deposit/depositFirstPage.component.ts +++ b/deposit/depositFirstPage.component.ts @@ -152,7 +152,6 @@ export class DepositFirstPageComponent { public title: string = "Deposit or publish your research in Open Access"; @Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass(); - @Input() piwikSiteId = null; @Input() assetsPath: string = 'assets/common-assets/common'; @Input() communityId = null; @@ -201,10 +200,7 @@ export class DepositFirstPageComponent { if (!this.zenodoInformation.name) { this.zenodoInformation.name = "Zenodo"; } - - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.subscriptions.push(this._piwikService.trackView(this.properties, this.title).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.title).subscribe()); this.breadcrumbs.push({name: 'home', route: '/'}, {name: "Deposit", route: null}); } diff --git a/deposit/searchDataprovidersToDeposit.component.ts b/deposit/searchDataprovidersToDeposit.component.ts index 6269c412..79322525 100644 --- a/deposit/searchDataprovidersToDeposit.component.ts +++ b/deposit/searchDataprovidersToDeposit.component.ts @@ -53,7 +53,6 @@ import {SearchForm} from "../searchPages/searchUtils/newSearchPage.component"; export class SearchDataprovidersToDepositComponent { private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - @Input() piwikSiteId = null; @Input() searchForm: SearchForm = {class: null, dark: false}; public results =[]; public filters =[]; diff --git a/fos/fos.component.ts b/fos/fos.component.ts index 171e7ef6..90664f4b 100644 --- a/fos/fos.component.ts +++ b/fos/fos.component.ts @@ -27,8 +27,6 @@ export class FosComponent implements OnInit, OnDestroy { public url: string = null; public pageTitle: string = "OpenAIRE | Fields of Science"; public pageDescription: string = "We have integrated a Field-of-Science (FoS) taxonomy into our dataset to organize and discover research more effectively. Using the full capabilities of the OpenAIRE Graph (full-texts, citations, references, venues) we apply AI and bring forward any multidisciplinarity potential."; - @Input() piwikSiteId = null; - public fos: any[] = []; public fosOptions: string[] = []; public activeSection: string; @@ -63,9 +61,7 @@ export class FosComponent implements OnInit, OnDestroy { ) {} ngOnInit() { - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); this.url = this.properties.domain + this.properties.baseLink + this._router.url; this.seoService.createLinkForCanonicalURL(this.url); this.updateUrl(this.url); diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 5aff3613..ec9c4ad2 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -46,7 +46,6 @@ export class DataProviderComponent { @Input() type: string = "dataprovider"; private typeQueryPathParam: string = "datasources"; - @Input() piwikSiteId = null; @Input() communityId = null; public dataProviderInfo: DataProviderInfo; public datasourceId: string; @@ -407,9 +406,7 @@ export class DataProviderComponent { this.showTabs = true; this.updateTitle(this.dataProviderInfo.title.name?this.dataProviderInfo.title.name:this.dataProviderInfo.officialName); this.updateDescription((this.dataProviderInfo.description ? (this.dataProviderInfo.description.substr(0,157) + (this.dataProviderInfo.description.substr(0,157).length == 157?"...":"")) : (this.dataProviderInfo.title.name?this.dataProviderInfo.title.name:this.dataProviderInfo.officialName))); - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name).subscribe()); this.showLoading = false; diff --git a/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/landingPages/htmlProjectReport/htmlProjectReport.component.ts index 24520ba7..b17c82c5 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -54,7 +54,6 @@ declare var UIkit: any; ` }) export class HtmlProjectReportComponent { - @Input() piwikSiteId = null; @Input() communityId = null; private projectId: string; private totalResults: number = 10; @@ -170,9 +169,7 @@ export class HtmlProjectReportComponent { } else if (data.title) { this.updateTitle(data.title + " " + this.resultsType + " report"); } - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, ((data.acronym) ? data.acronym : data.title) + " " + this.resultsType + " report").subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, ((data.acronym) ? data.acronym : data.title) + " " + this.resultsType + " report").subscribe()); }, err => { this.handleError("Error getting html information for project id: " + this.projectId, err); diff --git a/landingPages/landing-utils/citeThis/citeThis.component.ts b/landingPages/landing-utils/citeThis/citeThis.component.ts index eb0480a6..0334d387 100644 --- a/landingPages/landing-utils/citeThis/citeThis.component.ts +++ b/landingPages/landing-utils/citeThis/citeThis.component.ts @@ -57,7 +57,6 @@ export class CiteThisComponent implements OnInit, OnDestroy { @Input() result: any; @Input() id: string; @Input() type: string = "article"; - @Input() piwikSiteId; public data:CitationData; public clipboard; timeout; @@ -223,9 +222,7 @@ export class CiteThisComponent implements OnInit, OnDestroy { a.click(); window.URL.revokeObjectURL(url); a.remove(); // remove the element - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.sub = this._piwikService.trackDownload(this.properties, "DownloadCitation"+this.selectedFormat, this.piwikSiteId).subscribe(); - } + this.sub = this._piwikService.trackDownload(this.properties, "DownloadCitation"+this.selectedFormat).subscribe(); } } diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 8c9a2617..c2109ef0 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -38,8 +38,6 @@ declare var ResizeObserver; export class OrganizationComponent { public referrer: string; public prevPath: string; - - @Input() piwikSiteId = null; @Input() communityId = null; public organizationInfo: OrganizationInfo; @@ -409,9 +407,7 @@ export class OrganizationComponent { (this.organizationInfo.title.name?this.organizationInfo.title.name:'No title available') + ((this.organizationInfo.title.name && this.organizationInfo.title.name != this.organizationInfo.name) ? (', ') : '') + (this.organizationInfo.name?this.organizationInfo.name:'')); - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.organizationInfo.title.name).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.organizationInfo.title.name).subscribe()); var refineFields: string [] = ["funder"]; if (typeof document !== 'undefined') { @@ -464,9 +460,7 @@ export class OrganizationComponent { a.remove(); // remove the element //window.open(window.URL.createObjectURL(data)); - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename, this.piwikSiteId).subscribe()); - } + this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename).subscribe()); }, err => { //console.log("Error downloading the file."); @@ -527,9 +521,7 @@ export class OrganizationComponent { a.click(); window.URL.revokeObjectURL(csvurl); a.remove(); // remove the element - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename, this.piwikSiteId).subscribe()); - } + this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename).subscribe()); } } else { let url: string; @@ -570,9 +562,7 @@ export class OrganizationComponent { a.click(); window.URL.revokeObjectURL(csvurl); a.remove(); // remove the element - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename, this.piwikSiteId).subscribe()); - } + this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV" + filename).subscribe()); } }, err => { diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index a860608a..34936cd8 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -44,8 +44,6 @@ declare var ResizeObserver; export class ProjectComponent { public referrer: string; public prevPath: string; - - @Input() piwikSiteId = null; @Input() communityId = null; public projectInfo: ProjectInfo; public projectId: string; @@ -525,10 +523,7 @@ export class ProjectComponent { this.updateTitle(this.projectName); // this.updateDescription(this.projectInfo.description?this.projectInfo.description: ("project" + (this.projectInfo.title?"," + this.projectInfo.title:"") + (this.projectInfo.funding && this.projectInfo.funding.funderName?", funder: " + this.projectInfo.funding.funderName:"") + (this.projectInfo.acronym?"," + this.projectInfo.acronym:""))); this.updateDescription((this.projectInfo.description ? (this.projectInfo.description.substr(0,157) + (this.projectInfo.description.substr(0,157).length == 157?"...":"")) : (this.projectInfo.title))); - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.projectName).subscribe()); - } - + this.subscriptions.push(this._piwikService.trackView(this.properties, this.projectName).subscribe()); this.project = { funderId: "", funderName: ((this.projectInfo.funding) ? this.projectInfo.funding.funderShortName: ''), @@ -593,10 +588,7 @@ export class ProjectComponent { let url = window.URL.createObjectURL(data); this.download(url, filename+".csv"); - - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV"+filename, this.piwikSiteId).subscribe()); - } + this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadCSV"+filename).subscribe()); }, error => { //console.log("Error downloading the file."); @@ -743,9 +735,7 @@ export class ProjectComponent { let url = window.URL.createObjectURL(new Blob([this.htmlResultDownload], { type: 'text/html' })); this.download(url, filename+".html"); - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadHTML"+filename, this.piwikSiteId).subscribe()); - } + this.subscriptions.push(this._piwikService.trackDownload(this.properties, "DownloadHTML"+filename).subscribe()); }, err => { this.handleError("Error getting html for id: " + this.projectId, err); diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index c54f1fbb..3615d1bb 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -781,7 +781,7 @@ + [type]="title.toLowerCase()"> @@ -1229,7 +1229,7 @@ + [type]="title.toLowerCase()"> diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 9e56449a..ecbaeca2 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -40,7 +40,7 @@ export class ResultLandingComponent { public prevPath: string; @Input() type: string = "publication"; - @Input() piwikSiteId = properties.piwikSiteId; + @Input() communityId = null; enermapsId; // @ViewChild('linkModal') linkModal; @@ -519,10 +519,7 @@ export class ResultLandingComponent { this.updateTitle(this.resultLandingInfo.title); this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description.substr(0,157) + (this.resultLandingInfo.description.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).subscribe()); - } - + this.subscriptions.push(this._piwikService.trackViewForCustomUrl(this.properties, this.resultLandingInfo.title, this.linkToLandingPage.split("?")[1] + this.id).subscribe()); let bioentitiesNum = 0; if (this.resultLandingInfo.bioentities != undefined) { this.resultLandingInfo.bioentities.forEach(function (value, key, map) { diff --git a/orcid/my-orcid-links/myOrcidLinks.component.ts b/orcid/my-orcid-links/myOrcidLinks.component.ts index 7811f1bb..09402cb8 100644 --- a/orcid/my-orcid-links/myOrcidLinks.component.ts +++ b/orcid/my-orcid-links/myOrcidLinks.component.ts @@ -103,7 +103,7 @@ export class MyOrcidLinksComponent { private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - @Input() piwikSiteId = null; + public results =[]; public currentResults = []; public totalResults:number = 0 ; @@ -186,11 +186,7 @@ export class MyOrcidLinksComponent { this.updateTitle("My ORCID Links"); this.updateDescription(description); this.updateUrl( properties.domain + properties.baseLink + this.route.url); - - if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ - this.subscriptions.push(this._piwikService.trackView(this.properties, "My ORCID links").subscribe()); - } - + this.subscriptions.push(this._piwikService.trackView(this.properties, "My ORCID links").subscribe()); this.typeQuery = "&type=results"; this.getLocalWorks(); this.getPersonalDetails(); diff --git a/orcid/recommend-orcid-links/searchRecommendedResultsForOrcid.component.ts b/orcid/recommend-orcid-links/searchRecommendedResultsForOrcid.component.ts index 911f3079..6557c5c0 100644 --- a/orcid/recommend-orcid-links/searchRecommendedResultsForOrcid.component.ts +++ b/orcid/recommend-orcid-links/searchRecommendedResultsForOrcid.component.ts @@ -65,7 +65,6 @@ import {Identifier} from "../../utils/string-utils.class"; export class SearchRecommendedResultsForOrcidComponent { private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - @Input() piwikSiteId = null; public results =[]; public totalResults:number = 0 ; public baseUrl:string; diff --git a/sdg/sdg.component.ts b/sdg/sdg.component.ts index bb581742..2c648dcb 100644 --- a/sdg/sdg.component.ts +++ b/sdg/sdg.component.ts @@ -22,7 +22,6 @@ export class SdgComponent implements OnInit, OnDestroy { public url: string = null; public pageTitle: string = "OpenAIRE | Sustainable Development Goals"; public pageDescription: string = "Laying the foundation for new approaches and solutions. We have developed a classification scheme for UN Sustainable Development Goals, to view contributions of research towards complex challenges for humanity such as climate change, biodiversity loss, pollution and poverty reduction."; - @Input() piwikSiteId = null; private sdgs: any = []; private sdgsResearchOutcomes: any = []; @@ -47,9 +46,7 @@ export class SdgComponent implements OnInit, OnDestroy { ngOnInit() { this.loading = true; - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); this.url = this.properties.domain + this.properties.baseLink + this._router.url; this.seoService.createLinkForCanonicalURL(this.url); this.updateUrl(this.url); diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index 3ee9e96e..2f594923 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -88,7 +88,7 @@ export class SearchAllComponent { @Input() logoURL; @Input() name; @Input() customFilter: SearchCustomFilter = null; - @Input() piwikSiteId = null; + @Input() formPlaceholderText = "Search in Explore" // @Input() formPlaceholderText = "Search for "+OpenaireEntities.RESULTS+", "+OpenaireEntities.PROJECTS+", "+OpenaireEntities.DATASOURCES+" & "+OpenaireEntities.ORGANIZATIONS+" in OpenAIRE"; @Input() searchForm: SearchForm = {class: 'search-form', dark: true} @@ -158,12 +158,7 @@ export class SearchAllComponent { this._meta.updateTag({content: title}, "property='og:title'"); this._meta.updateTag({content: url}, "property='og:url'"); this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url, false); - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subs.push(this._piwikService.trackView(this.properties, title).subscribe()); - - } - - + this.subs.push(this._piwikService.trackView(this.properties, title).subscribe()); if ((this.customFilter && this.customFilter.queryFieldName == "communityId") || this.properties.adminToolsCommunity) { //this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => { this.subs.push(this.config.portalAsObservable.subscribe(data => { diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 8dad1735..fcec42c9 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -32,8 +32,7 @@ import {properties} from "../../../environments/environment"; [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [openaireLink]=openaireLink - [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" - [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" + [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [hasPrefix]="hasPrefix" [searchForm]="searchForm" [entitiesSelection]="false" [showSwitchSearchLink]="showSwitchSearchLink" [filters]="filters" @@ -50,7 +49,6 @@ import {properties} from "../../../environments/environment"; export class SearchDataProvidersComponent { private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - @Input() piwikSiteId = null; @Input() customFilter:SearchCustomFilter= null; @Input() tableViewLink; @Input() searchForm: SearchForm = {class: 'search-form', dark: true}; @@ -70,7 +68,6 @@ export class SearchDataProvidersComponent { public loadPaging: boolean = true; public oldTotalResults: number = 0; public pagingLimit: number = 0; - public isPiwikEnabled; properties:EnvProperties; public openaireEntities = OpenaireEntities; @Input() type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services" = "all"; @@ -116,9 +113,7 @@ export class SearchDataProvidersComponent { } this.advancedSearchLink = this.entityType == "service" ? this.properties.searchLinkToAdvancedServices : this.properties.searchLinkToAdvancedDataProviders; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; - this.pagingLimit = properties.pagingLimit; - this.isPiwikEnabled = properties.enablePiwikTrack; - + this.pagingLimit = properties.pagingLimit; let firstLoad = true; this.subs.push(this.route.queryParams.subscribe(params => { this.loadPaging = true; diff --git a/searchPages/searchOrganizations.component.ts b/searchPages/searchOrganizations.component.ts index 74607dab..54eeff07 100644 --- a/searchPages/searchOrganizations.component.ts +++ b/searchPages/searchOrganizations.component.ts @@ -28,8 +28,7 @@ import {properties} from "../../../environments/environment"; [disableRefineForms]="disableRefineForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" - [openaireLink]=openaireLink - [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" + [openaireLink]=openaireLink [hasPrefix]="hasPrefix" [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [searchForm]="searchForm" [sort]="false" @@ -47,7 +46,6 @@ export class SearchOrganizationsComponent { private errorMessages: ErrorMessagesComponent; properties:EnvProperties; public openaireEntities = OpenaireEntities; - @Input() piwikSiteId = null; @Input() searchForm: SearchForm = {class: 'search-form', dark: true}; public results =[]; public filters =[]; @@ -63,8 +61,6 @@ export class SearchOrganizationsComponent { public loadPaging: boolean = true; public oldTotalResults: number = 0; public pagingLimit: number = 0; - public isPiwikEnabled; - @Input() customFilter:SearchCustomFilter= null; public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS; @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent; @@ -100,8 +96,6 @@ export class SearchOrganizationsComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; this.pagingLimit = properties.pagingLimit; - this.isPiwikEnabled = properties.enablePiwikTrack; - this.searchUtils.status = this.errorCodes.LOADING; var firstLoad = true; diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts index c02315e3..1ebae061 100644 --- a/searchPages/searchProjects.component.ts +++ b/searchPages/searchProjects.component.ts @@ -28,8 +28,7 @@ import {properties} from "../../../environments/environment"; [disableRefineForms]="disableRefineForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" - [openaireLink]=openaireLink - [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" + [openaireLink]=openaireLink [hasPrefix]="hasPrefix" [searchForm]="searchForm" [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [filters]="filters" @@ -46,7 +45,6 @@ import {properties} from "../../../environments/environment"; export class SearchProjectsComponent { private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - @Input() piwikSiteId = null; @Input() customFilter: SearchCustomFilter = null; @Input() searchForm: SearchForm = {class: 'search-form', dark: true}; public results = []; @@ -70,7 +68,6 @@ export class SearchProjectsComponent { public loadPaging: boolean = true; public oldTotalResults: number = 0; public pagingLimit: number = 0; - public isPiwikEnabled; public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS; @ViewChild(NewSearchPageComponent, {static: true}) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; @@ -105,8 +102,6 @@ export class SearchProjectsComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects; this.searchUtils.baseUrl = (this.simpleView) ? this.simpleSearchLink : this.advancedSearchLink; this.pagingLimit = properties.pagingLimit; - this.isPiwikEnabled = properties.enablePiwikTrack; - this.searchUtils.status = this.errorCodes.LOADING; var firstLoad = true; diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index 437eb96a..5e4e3c59 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -30,8 +30,7 @@ import {StringUtils} from "../utils/string-utils.class"; [disableRefineForms]="disableRefineForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" - [openaireLink]=openaireLink - [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" + [openaireLink]=openaireLink [hasPrefix]="hasPrefix" [searchForm]="searchForm" [filters]="filters" [quickFilter]="quickFilter" [rangeFilters]="rangeFilters" [rangeFields]="rangeFields" @@ -52,7 +51,6 @@ export class SearchResearchResultsComponent { private errorCodes: ErrorCodes; private errorMessages: ErrorMessagesComponent; - @Input() piwikSiteId = properties.piwikSiteId; @Input() hasPrefix: boolean = true; @Input() searchForm: SearchForm = {class: 'search-form', dark: true}; public results = []; @@ -75,7 +73,6 @@ export class SearchResearchResultsComponent { @Input() openaireLink: string = null; @Input() customFilter: SearchCustomFilter = null; public pagingLimit: number = 0; - public isPiwikEnabled; properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS; @@ -124,8 +121,6 @@ export class SearchResearchResultsComponent { ngOnInit() { //TODO add checks about which result types are enabled! this.pagingLimit = this.properties.pagingLimit; - this.isPiwikEnabled = this.properties.enablePiwikTrack; - if (!this.simpleSearchLink) { this.simpleSearchLink = this.properties.searchLinkToResults; } diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 09d3b471..68893685 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -318,8 +318,7 @@ + [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"> diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 56a4a839..a61b99e6 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -48,7 +48,6 @@ declare var UIkit: any; }) export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { @ViewChild('mobileFilters') mobileFilters: ElementRef; - @Input() piwikSiteId = null; @Input() hasPrefix: boolean = true; @Input() prefix: string = "OpenAIRE | "; @Input() pageTitle = ""; @@ -121,7 +120,6 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { public csvLimit: number = 0; public pagingLimit: number = 0; public resultsPerPage: number = 0; - isPiwikEnabled = false; properties: EnvProperties = properties; public pageContents = null; public divContents = null; @@ -174,10 +172,9 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { this.pagingLimit = this.properties.pagingLimit; this.resultsPerPage = this.properties.resultsPerPage; this.csvLimit = this.properties.csvLimit; - this.isPiwikEnabled = this.properties.enablePiwikTrack; this.updateUrl(this.properties.domain + this.properties.baseLink + this.router.url); this.url = this.properties.domain + this.properties.baseLink + this.router.url; - if (typeof document !== 'undefined' && this.isPiwikEnabled && !this.includeOnlyResultsAndFilter && this.piwikSiteId) { + if (!this.includeOnlyResultsAndFilter) { this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); } this.layoutService.isMobile.subscribe(isMobile => { @@ -354,9 +351,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { //console.log("In PreviousRouteRecorder : "+this.router.url ); localStorage.setItem('previousRoute', this.router.url); } - if (this.isPiwikEnabled && (typeof document !== 'undefined') && this.piwikSiteId) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); - } + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); /* End Piwik Code */ } diff --git a/searchPages/searchUtils/quick-selections.component.ts b/searchPages/searchUtils/quick-selections.component.ts index 97e83847..ee9dd8b4 100644 --- a/searchPages/searchUtils/quick-selections.component.ts +++ b/searchPages/searchUtils/quick-selections.component.ts @@ -93,7 +93,7 @@ export class QuickSelectionsComponent { //Allow all types /* if(this.properties && !this.initialized) { if(this.properties.adminToolsCommunity !== "monitor") { - this.subs.push(this.config.communityInformationState.subscribe(data => { + this.subs.push(this.config.portalAsObservable.subscribe(data => { if(data) { var showEntity = {}; for (var i = 0; i < data['entities'].length; i++) { diff --git a/searchPages/searchUtils/searchDownload.component.ts b/searchPages/searchUtils/searchDownload.component.ts index eec5fb76..820d2daf 100644 --- a/searchPages/searchUtils/searchDownload.component.ts +++ b/searchPages/searchUtils/searchDownload.component.ts @@ -14,14 +14,15 @@ import {properties} from "../../../../environments/environment"; @Component({ selector: 'search-download', template: ` - - - + + + ` }) @@ -30,29 +31,25 @@ export class SearchDownloadComponent { @Input() totalResults: number = 0; @Input() csvParams: string; @Input() type: string; - @Input() piwikSiteId = null; @ViewChild(AlertModal) alertApplyAll: AlertModal; downloadURLAPI: string; public csvLimit: number = 0; - + @ViewChild(ModalLoading) loading: ModalLoading; // Alert box when something is wrong with CSV requests @ViewChild('AlertModalCsvError') alertCsvError; - public isPiwikEnabled; public properties: EnvProperties; public errorCodes: ErrorCodes = new ErrorCodes(); subscriptions = []; + constructor(private route: ActivatedRoute, private _reportsService: ReportsService, private _piwikService: PiwikService) { } - + ngOnInit() { - - this.properties = properties; - this.csvLimit = this.properties.csvLimit; - this.downloadURLAPI = this.properties.csvAPIURL; - this.isPiwikEnabled = this.properties.enablePiwikTrack; - + this.properties = properties; + this.csvLimit = this.properties.csvLimit; + this.downloadURLAPI = this.properties.csvAPIURL; } ngOnDestroy() { @@ -62,7 +59,7 @@ export class SearchDownloadComponent { } }); } - + denialOfDownload() { this.alertApplyAll.cancelButton = true; this.alertApplyAll.okButton = false; @@ -70,11 +67,11 @@ export class SearchDownloadComponent { this.alertApplyAll.message = "Sorry, but the results are too many! Use the api instead!"; this.alertApplyAll.cancelButtonText = "Ok"; this.alertApplyAll.open(); - + console.error("Error downloading file. Results are too many!"); //this.handleError("Error downloading file. Results are too many!", err); } - + downloadfile(url: string, filename: string) { //var newWindow = window.open("", "_parent"); //var newWindow = window.open(); @@ -83,63 +80,61 @@ export class SearchDownloadComponent { this.setMessageLoading("Downloading CSV file"); this.subscriptions.push(this._reportsService.downloadCSVFile(url).subscribe( - data => { - this.closeLoading(); - //window.open(window.URL.createObjectURL(data),filename+".csv"); - //console.info("Fill window with data for csv"); - if (typeof document !== 'undefined') { - var url = window.URL.createObjectURL(data); - var a = window.document.createElement('a'); - window.document.body.appendChild(a); - a.setAttribute('style', 'display: none'); - a.href = url; - a.download = filename + ".csv"; - a.click(); - window.URL.revokeObjectURL(url); - a.remove(); // remove the element - } - //newWindow.location.assign(window.URL.createObjectURL(data)); - - //window.location.href = window.URL.createObjectURL(data); - - if (this.isPiwikEnabled && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackDownload(this.properties, "searchDownload", this.piwikSiteId).subscribe()); - } - }, - error => { - //console.error("Error downloading the file."); - this.handleError("Error downloading file: " + filename, error); - - //newWindow.close(); - this.closeLoading(); - this.confirmOpenCsvError(); - }/*, + data => { + this.closeLoading(); + //window.open(window.URL.createObjectURL(data),filename+".csv"); + //console.info("Fill window with data for csv"); + if (typeof document !== 'undefined') { + var url = window.URL.createObjectURL(data); + var a = window.document.createElement('a'); + window.document.body.appendChild(a); + a.setAttribute('style', 'display: none'); + a.href = url; + a.download = filename + ".csv"; + a.click(); + window.URL.revokeObjectURL(url); + a.remove(); // remove the element + } + //newWindow.location.assign(window.URL.createObjectURL(data)); + + //window.location.href = window.URL.createObjectURL(data); + + this.subscriptions.push(this._piwikService.trackDownload(this.properties, "searchDownload").subscribe()); + }, + error => { + //console.error("Error downloading the file."); + this.handleError("Error downloading file: " + filename, error); + + //newWindow.close(); + this.closeLoading(); + this.confirmOpenCsvError(); + }/*, () => { console.log('Completed file download.'); //setTimeout(function(){ newWindow.close(); }, 500); }*/ )); } - - + + public openLoading() { if (this.loading) { this.loading.open(); } } - + public closeLoading() { if (this.loading) { this.loading.close(); } } - + public setMessageLoading(message: string) { if (this.loading) { this.loading.message = message; } } - + public confirmOpenCsvError() { this.alertCsvError.cancelButton = false; this.alertCsvError.okButton = true; @@ -148,7 +143,7 @@ export class SearchDownloadComponent { this.alertCsvError.okButtonText = "OK"; this.alertCsvError.open(); } - + private handleError(message: string, error) { console.error("Search Download (component): " + message, error); } diff --git a/utils/configuration/configuration.service.ts b/utils/configuration/configuration.service.ts index 1d28bbef..f828d16f 100644 --- a/utils/configuration/configuration.service.ts +++ b/utils/configuration/configuration.service.ts @@ -47,10 +47,6 @@ export class ConfigurationService { return this.portal.asObservable(); } - get piwik() { - return this.portal.value?.piwik ? this.portal.value.piwik : properties.piwikSiteId; - } - async isPageEnabledAsync(properties: EnvProperties, portal: string, page_route: string) { if (!this.promise || (this.portal && this.portal.getValue() && portal !== this.portal.getValue().pid)) { this.initPortal(properties, portal); diff --git a/utils/entity-actions/entity-actions.component.ts b/utils/entity-actions/entity-actions.component.ts index dc80ae29..7f7c1a1e 100644 --- a/utils/entity-actions/entity-actions.component.ts +++ b/utils/entity-actions/entity-actions.component.ts @@ -57,7 +57,7 @@ import {EnvProperties} from "../properties/env-properties"; + [type]="getTypeName().toLowerCase()"> diff --git a/utils/piwik/piwik.service.ts b/utils/piwik/piwik.service.ts index 5d9baf48..c3bc70a0 100644 --- a/utils/piwik/piwik.service.ts +++ b/utils/piwik/piwik.service.ts @@ -3,8 +3,9 @@ import {HttpClient} from "@angular/common/http"; import {StringUtils} from '../string-utils.class'; import {EnvProperties} from '../properties/env-properties'; -import {Observable} from "rxjs"; +import {Observable, of} from "rxjs"; import {ConfigurationService} from "../configuration/configuration.service"; +import {map, take} from "rxjs/operators"; @Injectable() @@ -13,21 +14,39 @@ export class PiwikService { } trackViewForCustomUrl(properties: EnvProperties, title, pageparams): any { - let piwikId = this.configurationService.piwik; - if (typeof location !== 'undefined' && piwikId) { - return this.doTrackView(properties, title, piwikId, location.href.split("?")[0] + "?" + pageparams); + if(typeof location !== 'undefined' && properties.enablePiwikTrack) { + return this.configurationService.portalAsObservable.pipe(take(1), map(portal => { + let piwik = portal?portal.piwik:null; + return this.doTrackView(properties, title, piwik, location.href.split("?")[0] + "?" + pageparams); + })); + } else { + return of(null); } } trackView(properties: EnvProperties, title): any { - let piwikId = this.configurationService.piwik; - if (typeof location !== 'undefined' && piwikId) { - return this.doTrackView(properties, title, piwikId, location.href); + if(typeof location !== 'undefined' && properties.enablePiwikTrack) { + return this.configurationService.portalAsObservable.pipe(take(1), map(portal => { + let piwik = portal?portal.piwik:null; + return this.doTrackView(properties, title, piwik, location.href); + })); + } else { + return of(null); } } - + + trackDownload(properties: EnvProperties, type = "") { + if(typeof location !== 'undefined' && properties.enablePiwikTrack) { + return this.configurationService.portalAsObservable.pipe(take(1), map(portal => { + let piwik = portal?portal.piwik:null; + return this.doTrackDownload(properties, type, piwik); + })); + } else { + return of(null); + } + } + private doTrackView(properties: EnvProperties, title, siteId, pageURL): any { - let ua = this.getUserAgent(); let referrer = this.getReferrer(); let piwikId = ((siteId != null) ? siteId : properties.piwikSiteId); @@ -40,11 +59,11 @@ export class PiwikService { // return Observable.of(new Object()); // for testing return this.http.get(url, {responseType: 'blob'}); // .do(request => console.info("Piwik request completed" )); - + } } - - trackDownload(properties: EnvProperties, type = "", siteId = null): any { + + doTrackDownload(properties: EnvProperties, type = "", siteId): any { var ua = this.getUserAgent(); var referrer = this.getReferrer(); var url = properties.piwikBaseUrl + ((siteId != null) ? siteId : properties.piwikSiteId) + "&rec=1&url=" + StringUtils.URIEncode(location.href) + "&download=" + StringUtils.URIEncode(location.href + "#" + type) + @@ -56,7 +75,7 @@ export class PiwikService { //.do(request => console.info("Piwik request completed" )); } - + private getUserAgent() { if (typeof navigator !== 'undefined') { //console.log("navigator.userAgent:" + navigator.userAgent);