add piwikSiteId in properties | pass it as input in all components | in piwik service use it either from parameter pass if available or from properties

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51746 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-04-11 08:59:01 +00:00
parent 8f08e6a5b8
commit 46a7803fd9
28 changed files with 87 additions and 49 deletions

View File

@ -1,6 +1,9 @@
import {Component, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router'; import { Router, ActivatedRoute} from '@angular/router';
import {PiwikService} from '../../utils/piwik/piwik.service';
import{EnvProperties} from '../../utils/properties/env-properties';
import { Meta} from '../../sharedComponents/metaService';
@ -24,9 +27,26 @@ import { Router } from '@angular/router';
export class DepositBySubjectComponent { export class DepositBySubjectComponent {
@Input() subjectKeyword: string=''; @Input() subjectKeyword: string='';
@Input() piwikSiteId = null;
properties:EnvProperties;
constructor (private _router: Router,private route: ActivatedRoute, private _meta: Meta, private _piwikService:PiwikService) { }
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
constructor (private _router: Router) { } this._meta.setTitle("Deposit by Subjects" );
this._meta.updateProperty("og:title","Deposit by subjects");
this._meta.updateProperty("og:url", data.envSpecific.baseLink+this._router.url);
this._meta.updateMeta("description", "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject");
this._meta.updateProperty("og:description", "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject");
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this._piwikService.trackView(this.properties, "Deposit by subjects" , this.piwikSiteId).subscribe();
}
});
}
public search() { public search() {
this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "subject": this.subjectKeyword } } ); this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "subject": this.subjectKeyword } } );
} }

View File

@ -24,7 +24,7 @@ export class DepositBySubjectResultComponent {
// Type of entity: Publication or Research Data // Type of entity: Publication or Research Data
@Input() requestFor: string = "Research Data"; @Input() requestFor: string = "Research Data";
@Input() subject: string = ""; @Input() subject: string = "";
@Input() piwikSiteId = null;
public newSubject: string= ""; public newSubject: string= "";
public fetchDataproviders : FetchDataproviders; public fetchDataproviders : FetchDataproviders;
@ -65,7 +65,7 @@ export class DepositBySubjectResultComponent {
this.updateUrl(data.envSpecific.baseLink+this._router.url); this.updateUrl(data.envSpecific.baseLink+this._router.url);
this.zenodo = this.properties.zenodo; this.zenodo = this.properties.zenodo;
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor, this.piwikSiteId).subscribe();
} }
}); });

View File

@ -15,7 +15,7 @@ export class DepositComponent {
@Input() compatibility: string = ''; @Input() compatibility: string = '';
@Input() mapUrl: string = null; // optional in case i-frame is needed @Input() mapUrl: string = null; // optional in case i-frame is needed
@Input() searchBySubjects: boolean = false; // optional: in case search by subjects is needed @Input() searchBySubjects: boolean = false; // optional: in case search by subjects is needed
@Input() piwikSiteId = null;
public status: number; public status: number;
@ -56,7 +56,7 @@ export class DepositComponent {
this.updateUrl(data.envSpecific.baseLink+this._router.url); this.updateUrl(data.envSpecific.baseLink+this._router.url);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor, this.piwikSiteId).subscribe();
} }
}); });
} }

View File

@ -131,7 +131,7 @@ import{EnvProperties} from '../utils/properties/env-properties';
export class DepositResultComponent { export class DepositResultComponent {
@Input() compatibility: string = ''; @Input() compatibility: string = '';
@Input() piwikSiteId = null;
// Type of entity: Publication or Research Data // Type of entity: Publication or Research Data
@Input() requestFor: string = "Publications"; @Input() requestFor: string = "Publications";
@ -177,7 +177,7 @@ export class DepositResultComponent {
this.updateUrl(data.envSpecific.baseLink+this._router.url); this.updateUrl(data.envSpecific.baseLink+this._router.url);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, "Deposit "+this.requestFor, this.piwikSiteId).subscribe();
} }
}); });

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component, ViewChild, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {DataProviderService} from './dataProvider.service'; import {DataProviderService} from './dataProvider.service';
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
@ -27,6 +27,7 @@ import 'rxjs/add/operator/switchMap';
}) })
export class DataProviderComponent { export class DataProviderComponent {
@Input() piwikSiteId = null;
public dataProviderInfo: DataProviderInfo; public dataProviderInfo: DataProviderInfo;
public datasourceId: string; public datasourceId: string;
@ -157,7 +158,7 @@ export class DataProviderComponent {
this.updateTitle(this.dataProviderInfo.title.name); this.updateTitle(this.dataProviderInfo.title.name);
this.updateDescription("Content provider, search, repositories, open access,"+this.dataProviderInfo.title.name); this.updateDescription("Content provider, search, repositories, open access,"+this.dataProviderInfo.title.name);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe();
} }
this.showLoading = false; this.showLoading = false;

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component, ViewChild, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {DatasetService} from './dataset.service'; import {DatasetService} from './dataset.service';
import {DatasetInfo} from '../../utils/entities/datasetInfo'; import {DatasetInfo} from '../../utils/entities/datasetInfo';
@ -14,6 +14,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class DatasetComponent { export class DatasetComponent {
@Input() piwikSiteId = null;
public datasetInfo: DatasetInfo; public datasetInfo: DatasetInfo;
public datasetId : string ; public datasetId : string ;
@ -114,7 +115,7 @@ export class DatasetComponent {
this.updateTitle(this.datasetInfo.title.name); this.updateTitle(this.datasetInfo.title.name);
this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name); this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.datasetInfo.title.name).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.datasetInfo.title.name, this.piwikSiteId).subscribe();
} }
this.result = [] this.result = []

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core'; import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Params, Router} from '@angular/router'; import {ActivatedRoute, Params, Router} from '@angular/router';
import {HtmlProjectReportService} from './htmlProjectReport.service'; import {HtmlProjectReportService} from './htmlProjectReport.service';
@ -42,6 +42,7 @@ declare var UIkit: any;
` `
}) })
export class HtmlProjectReportComponent{ export class HtmlProjectReportComponent{
@Input() piwikSiteId = null;
private projectId: string; private projectId: string;
private totalResults: number = 10; private totalResults: number = 10;
private resultsType: string = "publication"; private resultsType: string = "publication";
@ -134,7 +135,7 @@ export class HtmlProjectReportComponent{
this.updateTitle(data.title+" "+this.resultsType+" report"); this.updateTitle(data.title+" "+this.resultsType+" report");
} }
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, ((data.acronym)?data.acronym:data.title)+" "+this.resultsType+" report").subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, ((data.acronym)?data.acronym:data.title)+" "+this.resultsType+" report", this.piwikSiteId).subscribe();
} }
}, },
err => { err => {

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component, ViewChild, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject'; import {Subject} from 'rxjs/Subject';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
@ -29,6 +29,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class OrganizationComponent { export class OrganizationComponent {
@Input() piwikSiteId = null;
public organizationInfo: OrganizationInfo; public organizationInfo: OrganizationInfo;
public organizationId: string; public organizationId: string;
@ -188,7 +189,7 @@ export class OrganizationComponent {
this.updateTitle(this.organizationInfo.title.name); this.updateTitle(this.organizationInfo.title.name);
this.updateDescription("Organization, country, projects, search, repositories, open access"+this.organizationInfo.title.name); this.updateDescription("Organization, country, projects, search, repositories, open access"+this.organizationInfo.title.name);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.organizationInfo.title.name).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.organizationInfo.title.name, this.piwikSiteId).subscribe();
} }
var refineFields:string [] = ["funder"]; var refineFields:string [] = ["funder"];
@ -288,7 +289,7 @@ export class OrganizationComponent {
this.closeLoading(); this.closeLoading();
window.open(window.URL.createObjectURL(data)); window.open(window.URL.createObjectURL(data));
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url).subscribe(); this.downloadFilePiwikSub = this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe();
} }
}, },
err => { err => {

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component, ViewChild, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Params, Router} from '@angular/router'; import {ActivatedRoute, Params, Router} from '@angular/router';
import {ProjectService} from './project.service'; import {ProjectService} from './project.service';
@ -26,6 +26,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
templateUrl: 'project.component.html', templateUrl: 'project.component.html',
}) })
export class ProjectComponent{ export class ProjectComponent{
@Input() piwikSiteId = null;
public projectInfo: ProjectInfo; public projectInfo: ProjectInfo;
public projectId : string ; public projectId : string ;
public projectName: string; public projectName: string;
@ -294,7 +295,7 @@ actionsAfterGettingProjectInfo(){
this.updateTitle(this.projectName); this.updateTitle(this.projectName);
this.updateDescription("project, funding, open access, publications, research data, "+this.projectName+ ","+this.projectInfo.funder); this.updateDescription("project, funding, open access, publications, research data, "+this.projectName+ ","+this.projectInfo.funder);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.projectName).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.projectName, this.piwikSiteId).subscribe();
} }
this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate }; this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate };

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component, ViewChild, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {PublicationService} from './publication.service'; import {PublicationService} from './publication.service';
import {PublicationInfo} from '../../utils/entities/publicationInfo'; import {PublicationInfo} from '../../utils/entities/publicationInfo';
@ -18,6 +18,7 @@ import { Meta} from '../../sharedComponents/metaService';
}) })
export class PublicationComponent { export class PublicationComponent {
@Input() piwikSiteId = null;
public publicationInfo: PublicationInfo; public publicationInfo: PublicationInfo;
public articleId: string; public articleId: string;
@ -132,7 +133,7 @@ export class PublicationComponent {
this.updateTitle(this.publicationInfo.title.name); this.updateTitle(this.publicationInfo.title.name);
this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name); this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.publicationInfo.title.name).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.publicationInfo.title.name, this.piwikSiteId).subscribe();
} }
let bioentitiesNum = 0; let bioentitiesNum = 0;

View File

@ -1,4 +1,4 @@
import {Component, ViewChild, ElementRef} from '@angular/core'; import {Component, ViewChild, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {SoftwareService} from './software.service'; import {SoftwareService} from './software.service';
import {SoftwareInfo} from '../../utils/entities/softwareInfo'; import {SoftwareInfo} from '../../utils/entities/softwareInfo';
@ -14,6 +14,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class SoftwareComponent { export class SoftwareComponent {
@Input() piwikSiteId = null;
public softwareInfo: SoftwareInfo; public softwareInfo: SoftwareInfo;
public softwareId : string ; public softwareId : string ;
@ -114,7 +115,7 @@ export class SoftwareComponent {
this.updateTitle(this.softwareInfo.title.name); this.updateTitle(this.softwareInfo.title.name);
this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name); this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name);
if( this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if( this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.softwareInfo.title.name).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.softwareInfo.title.name, this.piwikSiteId).subscribe();
} }
this.result = [] this.result = []

View File

@ -24,7 +24,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="datasources" simpleSearchLink="/search/find/dataproviders" [csvParams]="csvParams" csvPath="datasources" simpleSearchLink="/search/find/dataproviders"
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"> [oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId>
</advanced-search-page> </advanced-search-page>
` `
@ -32,7 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchDataProvidersComponent { export class AdvancedSearchDataProvidersComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); public searchUtils:SearchUtilsClass = new SearchUtilsClass();

View File

@ -23,7 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="datasets" simpleSearchLink="/search/find/datasets" [csvParams]="csvParams" csvPath="datasets" simpleSearchLink="/search/find/datasets"
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"> [oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId >
</advanced-search-page> </advanced-search-page>
` `
@ -32,7 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchDatasetsComponent { export class AdvancedSearchDatasetsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
properties:EnvProperties; properties:EnvProperties;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];

View File

@ -23,7 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="organizations" simpleSearchLink="/search/find/organizations" [csvParams]="csvParams" csvPath="organizations" simpleSearchLink="/search/find/organizations"
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"> [oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId>
</advanced-search-page> </advanced-search-page>
` `
@ -32,7 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchOrganizationsComponent { export class AdvancedSearchOrganizationsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
properties:EnvProperties; properties:EnvProperties;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); public searchUtils:SearchUtilsClass = new SearchUtilsClass();

View File

@ -22,7 +22,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="projects" simpleSearchLink="/search/find/projects" [csvParams]="csvParams" csvPath="projects" simpleSearchLink="/search/find/projects"
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"> [oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId>
</advanced-search-page> </advanced-search-page>
` `
@ -30,7 +30,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchProjectsComponent { export class AdvancedSearchProjectsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];

View File

@ -25,14 +25,14 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [oldTotalResults]="oldTotalResults"
[(openaireLink)]=openaireLink [(openaireLink)]=openaireLink
[(connectCommunityId)]=connectCommunityId> [(connectCommunityId)]=connectCommunityId [piwikSiteId]=piwikSiteId>
</advanced-search-page> </advanced-search-page>
` `
}) })
export class AdvancedSearchPublicationsComponent { export class AdvancedSearchPublicationsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];

View File

@ -23,7 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="software" simpleSearchLink="/search/find/software" [csvParams]="csvParams" csvPath="software" simpleSearchLink="/search/find/software"
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"> [oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId>
</advanced-search-page> </advanced-search-page>
` `
@ -31,7 +31,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchSoftwareComponent { export class AdvancedSearchSoftwareComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];

View File

@ -17,6 +17,7 @@ import { Meta} from '../../sharedComponents/metaService';
templateUrl: 'advancedSearchPage.component.html' templateUrl: 'advancedSearchPage.component.html'
}) })
export class AdvancedSearchPageComponent { export class AdvancedSearchPageComponent {
@Input() piwikSiteId = null;
@Input() pageTitle = ""; @Input() pageTitle = "";
@Input() results = []; @Input() results = [];
@Input() type; @Input() type;
@ -63,7 +64,7 @@ export class AdvancedSearchPageComponent {
this.updateUrl(data.envSpecific.baseLink+location.pathname); this.updateUrl(data.envSpecific.baseLink+location.pathname);
} }
if(typeof document !== 'undefined' && this.isPiwikEnabled){ if(typeof document !== 'undefined' && this.isPiwikEnabled){
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
} }
}); });
@ -239,7 +240,7 @@ export class AdvancedSearchPageComponent {
localStorage.setItem('previousRoute', this.router.url); localStorage.setItem('previousRoute', this.router.url);
} }
if(this.isPiwikEnabled && (typeof document !== 'undefined')){ if(this.isPiwikEnabled && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
} }
/* End Piwik Code */ /* End Piwik Code */
} }

View File

@ -23,6 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class SearchPageComponent { export class SearchPageComponent {
@Input() piwikSiteId = null;
@Input() pageTitle = ""; @Input() pageTitle = "";
@Input() formPlaceholderText = "Type Keywords..."; @Input() formPlaceholderText = "Type Keywords...";
@Input() results = []; @Input() results = [];
@ -81,7 +82,7 @@ export class SearchPageComponent {
this.updateUrl(data.envSpecific.baseLink+location.pathname); this.updateUrl(data.envSpecific.baseLink+location.pathname);
} }
if(typeof document !== 'undefined' && this.isPiwikEnabled){ if(typeof document !== 'undefined' && this.isPiwikEnabled){
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
} }
}); });
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
@ -483,7 +484,7 @@ export class SearchPageComponent {
localStorage.setItem('previousRoute', this.router.url); localStorage.setItem('previousRoute', this.router.url);
} }
if(this.isPiwikEnabled && (typeof document !== 'undefined')){ if(this.isPiwikEnabled && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle).subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
} }
/* End Piwik Code */ /* End Piwik Code */
this.queryChange.emit({ this.queryChange.emit({

View File

@ -32,6 +32,7 @@ import {EnvProperties} from '../../utils/properties/env-properties';
}) })
export class SearchPageTableViewComponent implements OnInit, AfterViewInit { export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
@Input() piwikSiteId = null;
@Input() pageTitle = ""; @Input() pageTitle = "";
@Input() results; @Input() results;
@Input() filters = []; @Input() filters = [];
@ -80,7 +81,7 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit {
this.updateUrl(data.envSpecific.baseLink+location.pathname); this.updateUrl(data.envSpecific.baseLink+location.pathname);
} }
if(typeof document !== 'undefined' && this.isPiwikEnabled){ if(typeof document !== 'undefined' && this.isPiwikEnabled){
this.piwiksub = this._piwikService.trackView(data.envSpecific, this.pageTitle).subscribe(); this.piwiksub = this._piwikService.trackView(data.envSpecific, this.pageTitle, this.piwikSiteId).subscribe();
} }
}); });
this.dtOptions = { this.dtOptions = {

View File

@ -23,6 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [oldTotalResults]="oldTotalResults"
[piwikSiteId]=piwikSiteId
searchFormClass="datasourcesSearchForm"> searchFormClass="datasourcesSearchForm">
</search-page> </search-page>
@ -30,7 +31,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class SearchDataprovidersComponent { export class SearchDataprovidersComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];
public totalResults:number = 0 ; public totalResults:number = 0 ;

View File

@ -28,6 +28,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
searchFormClass="datasetsSearchForm" searchFormClass="datasetsSearchForm"
[(openaireLink)]=openaireLink [(openaireLink)]=openaireLink
[(advancedSearchParameters)]=advancedSearchParameters [(advancedSearchParameters)]=advancedSearchParameters
[piwikSiteId]=piwikSiteId
[(connectCommunityId)]=connectCommunityId > [(connectCommunityId)]=connectCommunityId >
</search-page> </search-page>
` `
@ -35,7 +36,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class SearchDatasetsComponent { export class SearchDatasetsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters: Filter[] =[]; public filters: Filter[] =[];
// public totalResults:number = 0 ; // public totalResults:number = 0 ;

View File

@ -23,6 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [oldTotalResults]="oldTotalResults"
[piwikSiteId]=piwikSiteId
searchFormClass="organizationsSearchForm"> searchFormClass="organizationsSearchForm">
</search-page> </search-page>
@ -31,7 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class SearchOrganizationsComponent { export class SearchOrganizationsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];
public baseUrl:string; public baseUrl:string;

View File

@ -23,6 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [oldTotalResults]="oldTotalResults"
[piwikSiteId]=piwikSiteId
searchFormClass="projectsSearchForm"> searchFormClass="projectsSearchForm">
</search-page> </search-page>
` `
@ -30,7 +31,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class SearchProjectsComponent { export class SearchProjectsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters: Filter[] =[]; public filters: Filter[] =[];
public baseUrl:string; public baseUrl:string;

View File

@ -31,6 +31,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
searchFormClass="publicationsSearchForm" searchFormClass="publicationsSearchForm"
[(openaireLink)]=openaireLink [(openaireLink)]=openaireLink
[(advancedSearchParameters)]=advancedSearchParameters [(advancedSearchParameters)]=advancedSearchParameters
[piwikSiteId]=piwikSiteId
[(connectCommunityId)]=connectCommunityId [(connectCommunityId)]=connectCommunityId
> >
</search-page> </search-page>
@ -40,7 +41,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class SearchPublicationsComponent { export class SearchPublicationsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters =[]; public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); public searchUtils:SearchUtilsClass = new SearchUtilsClass();

View File

@ -28,6 +28,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
searchFormClass="softwareSearchForm" searchFormClass="softwareSearchForm"
[(openaireLink)]=openaireLink [(openaireLink)]=openaireLink
[(advancedSearchParameters)]=advancedSearchParameters [(advancedSearchParameters)]=advancedSearchParameters
[piwikSiteId]=piwikSiteId
[(connectCommunityId)]=connectCommunityId > [(connectCommunityId)]=connectCommunityId >
</search-page> </search-page>
` `
@ -38,6 +39,7 @@ export class SearchSoftwareComponent {
@Input() openaireLink: string ; @Input() openaireLink: string ;
@Input() connectCommunityId: string; @Input() connectCommunityId: string;
@Input() advancedSearchParameters ; @Input() advancedSearchParameters ;
@Input() piwikSiteId = null;
public results =[]; public results =[];
public filters: Filter[] =[]; public filters: Filter[] =[];
// public totalResults:number = 0 ; // public totalResults:number = 0 ;

View File

@ -15,12 +15,12 @@ export class PiwikService {
private piwikbaseUrl:string = ""; private piwikbaseUrl:string = "";
constructor(private http: Http, private location: Location ) {} constructor(private http: Http, private location: Location ) {}
trackView (properties:EnvProperties, title):any { trackView (properties:EnvProperties, title, siteId = null):any {
var ua = this.getUserAgent(); var ua = this.getUserAgent();
var referrer = this.getReferrer(); var referrer = this.getReferrer();
if(typeof location !== 'undefined'){ if(typeof location !== 'undefined'){
var url = properties.piwikBaseUrl+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+ var url = properties.piwikBaseUrl+((siteId!=null)?siteId:properties.piwikSiteId)+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+
((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+ ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+
((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):''); ((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):'');
console.log("Piwik - View: " + url); console.log("Piwik - View: " + url);
@ -30,10 +30,10 @@ export class PiwikService {
} }
} }
trackDownload (properties:EnvProperties, downloadURL):any { trackDownload (properties:EnvProperties, downloadURL, siteId = null):any {
var ua = this.getUserAgent(); var ua = this.getUserAgent();
var referrer = this.getReferrer(); var referrer = this.getReferrer();
var url = properties.piwikBaseUrl+"&rec=1&url="+StringUtils.URIEncode(downloadURL)+"&download="+StringUtils.URIEncode(downloadURL)+ var url = properties.piwikBaseUrl+((siteId!=null)?siteId:properties.piwikSiteId)+"&rec=1&url="+StringUtils.URIEncode(downloadURL)+"&download="+StringUtils.URIEncode(downloadURL)+
((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+ ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+
((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):''); ((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):'');
console.log("Piwik - trackDownload: "+url); console.log("Piwik - trackDownload: "+url);

View File

@ -56,6 +56,7 @@ export class EnvProperties {
vocabulariesAPI; vocabulariesAPI;
piwikBaseUrl; piwikBaseUrl;
piwikSiteId;
loginUrl; loginUrl;