Adding piwik service, track all pages requests, in search pages and advanced track also when the query changes, record previous url in local storage

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@48631 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-07-19 15:00:39 +00:00
parent 8232aa4943
commit a655fdae10
72 changed files with 418 additions and 123 deletions

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard'; import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import { ClaimsAdminComponent } from './claimsAdmin.component'; import { ClaimsAdminComponent } from './claimsAdmin.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: ClaimsAdminComponent, canActivate: [AdminLoginGuard]}, { path: '', component: ClaimsAdminComponent, canActivate: [AdminLoginGuard],canDeactivate: [PreviousRouteRecorder]},
]) ])
] ]

View File

@ -6,6 +6,7 @@ import { ClaimsAdminRoutingModule } from './claimsAdmin-routing.module';
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module'; // import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module'; import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard'; import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -15,7 +16,7 @@ import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
DisplayClaimsModule DisplayClaimsModule
], ],
providers:[AdminLoginGuard], providers:[AdminLoginGuard, PreviousRouteRecorder],
declarations: [ declarations: [
ClaimsAdminComponent ClaimsAdminComponent
] ]

View File

@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard'; import { LoginGuard} from'../../login/loginGuard.guard';
import { ClaimsByTokenComponent } from './claimsByToken.component'; import { ClaimsByTokenComponent } from './claimsByToken.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: ClaimsByTokenComponent, canActivate: [LoginGuard]} { path: '', component: ClaimsByTokenComponent, canActivate: [LoginGuard],canDeactivate: [PreviousRouteRecorder]}
]) ])
] ]

View File

@ -17,6 +17,7 @@ import {LoginGuard} from'../../login/loginGuard.guard';
import {PagingModule} from '../../utils/paging.module'; import {PagingModule} from '../../utils/paging.module';
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe'; import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
@ -35,7 +36,7 @@ import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
], ],
providers:[ providers:[
ClaimsByTokenService, ClaimsByTokenService,
LoginGuard LoginGuard, PreviousRouteRecorder
], ],
declarations: [ declarations: [
ClaimsByTokenComponent, ClaimsDatatablePipe ClaimsByTokenComponent, ClaimsDatatablePipe

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard'; import { LoginGuard} from'../../login/loginGuard.guard';
import { DirectLinkingComponent } from './directLinking.component'; import { DirectLinkingComponent } from './directLinking.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: DirectLinkingComponent, canActivate: [LoginGuard]}, { path: '', component: DirectLinkingComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
]) ])
] ]

View File

@ -14,6 +14,7 @@ import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entity
import {PublicationsServiceModule} from '../../services/publicationsService.module'; import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module'; import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {LoginGuard} from'../../login/loginGuard.guard'; import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@ -25,7 +26,7 @@ import {LoginGuard} from'../../login/loginGuard.guard';
], ],
providers:[LoginGuard], providers:[LoginGuard, PreviousRouteRecorder],
declarations: [ declarations: [
DirectLinkingComponent DirectLinkingComponent
], exports:[DirectLinkingComponent] ], exports:[DirectLinkingComponent]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard'; import { LoginGuard} from'../../login/loginGuard.guard';
import { LinkingGenericComponent } from './linkingGeneric.component'; import { LinkingGenericComponent } from './linkingGeneric.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: LinkingGenericComponent, canActivate: [LoginGuard]}, { path: '', component: LinkingGenericComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
]) ])
] ]

View File

@ -12,6 +12,7 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module';
import { LinkingRoutingModule } from './linking-routing.module'; import { LinkingRoutingModule } from './linking-routing.module';
import {StartOverModule} from '../claim-utils/startOver.module'; import {StartOverModule} from '../claim-utils/startOver.module';
import {LoginGuard} from'../../login/loginGuard.guard'; import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -20,7 +21,7 @@ import {LoginGuard} from'../../login/loginGuard.guard';
InsertClaimsModule, InsertClaimsModule,
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule, EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule,
], ],
providers:[LoginGuard], providers:[LoginGuard, PreviousRouteRecorder],
declarations: [ declarations: [
LinkingGenericComponent LinkingGenericComponent
], exports:[ ], exports:[

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard'; import { LoginGuard} from'../../login/loginGuard.guard';
import { MyClaimsComponent } from './myClaims.component'; import { MyClaimsComponent } from './myClaims.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: MyClaimsComponent, canActivate: [LoginGuard]}, { path: '', component: MyClaimsComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
]) ])
] ]

View File

@ -6,6 +6,7 @@ import { MyClaimsRoutingModule } from './myClaims-routing.module';
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module'; // import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module'; import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import {LoginGuard} from'../../login/loginGuard.guard'; import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -15,7 +16,7 @@ import {LoginGuard} from'../../login/loginGuard.guard';
DisplayClaimsModule DisplayClaimsModule
], ],
providers:[LoginGuard], providers:[LoginGuard, PreviousRouteRecorder],
declarations: [ declarations: [
MyClaimsComponent MyClaimsComponent
] ]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component'; import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard] } { path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -10,6 +10,7 @@ import {OrganizationService} from '../../services/organization.service';
import { Meta} from '../../../angular2-meta'; import { Meta} from '../../../angular2-meta';
import {RouterHelper} from '../../utils/routerHelper.class'; import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'deposit-by-subject-result', selector: 'deposit-by-subject-result',
@ -94,6 +95,7 @@ export class DepositBySubjectResultComponent {
sub: any; sub: any;
subDataproviders: any; subDataproviders: any;
piwiksub: any;
public fetchDataproviders : FetchDataproviders; public fetchDataproviders : FetchDataproviders;
public routerHelper:RouterHelper = new RouterHelper(); public routerHelper:RouterHelper = new RouterHelper();
@ -107,7 +109,7 @@ export class DepositBySubjectResultComponent {
constructor (private _router: Router, constructor (private _router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService, private _meta: Meta) { private _searchDataprovidersService: SearchDataprovidersService, private _meta: Meta, private _piwikService:PiwikService) {
this.zenodo = OpenaireProperties.getZenodoURL(); this.zenodo = OpenaireProperties.getZenodoURL();
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
@ -116,6 +118,9 @@ export class DepositBySubjectResultComponent {
this.updateTitle("Deposit "+this.requestFor); this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor); this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor);
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
}
} }
updateDescription(description:string){ updateDescription(description:string){
this._meta.updateMeta("description", description); this._meta.updateMeta("description", description);
@ -141,6 +146,7 @@ export class DepositBySubjectResultComponent {
this.searchDataproviders(); this.searchDataproviders();
}); });
} }
totalPages(): number { totalPages(): number {
let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size); let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
if(!(Number.isInteger(totalPages))) { if(!(Number.isInteger(totalPages))) {
@ -161,6 +167,9 @@ export class DepositBySubjectResultComponent {
if(this.subDataproviders != undefined) { if(this.subDataproviders != undefined) {
this.subDataproviders.unsubscribe(); this.subDataproviders.unsubscribe();
} }
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
public searchDataproviders() { public searchDataproviders() {

View File

@ -7,16 +7,12 @@ import { DepositBySubjectResultComponent } from './depositBySubjectResult.compon
import {DepositBySubjectResultsRoutingModule} from './depositBySubjectResult-routing.module'; import {DepositBySubjectResultsRoutingModule} from './depositBySubjectResult-routing.module';
import {DepoditModule} from '../deposit.module'; import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {PagingModule } from '../../utils/paging.module'; import {PagingModule } from '../../utils/paging.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module'; import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module'; import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
@ -31,6 +27,6 @@ import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.
exports: [ exports: [
DepositBySubjectResultComponent, DepositBySubjectResultComponent,
], ],
providers: [FreeGuard ] providers: [FreeGuard,PreviousRouteRecorder ]
}) })
export class DepositBySubjectResultsModule { } export class DepositBySubjectResultsModule { }

View File

@ -10,7 +10,7 @@ import { DepositDatasetsResultComponent } from './depositDatasetsResult.componen
import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module'; import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module';
import {DepoditModule} from '../deposit.module'; import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
@ -25,7 +25,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
exports: [ exports: [
DepositDatasetsComponent, DepositDatasetsComponent,
], ],
providers: [FreeGuard providers: [FreeGuard,PreviousRouteRecorder
] ]
}) })
export class DepositDatasetsModule { } export class DepositDatasetsModule { }

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component'; import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard] } { path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard] ,canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -7,6 +7,7 @@ import { DepositDatasetsResultComponent } from './depositDatasetsResult.componen
import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-routing.module'; import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-routing.module';
import {DepoditModule} from '../deposit.module'; import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -22,7 +23,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
exports: [ exports: [
DepositDatasetsResultComponent, DepositDatasetsResultComponent,
], ],
providers: [FreeGuard providers: [FreeGuard,PreviousRouteRecorder
] ]
}) })
export class DepositDatasetsResultsModule { } export class DepositDatasetsResultsModule { }

View File

@ -3,6 +3,7 @@ import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties'; import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import { Meta} from '../../angular2-meta'; import { Meta} from '../../angular2-meta';
import {PiwikService} from '../utils/piwik/piwik.service';
@Component({ @Component({
@ -65,8 +66,9 @@ export class DepositComponent {
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes:ErrorCodes = new ErrorCodes();
public selectedId: string = ""; public selectedId: string = "";
public warningMessage: string = ""; public warningMessage: string = "";
piwiksub:any;
constructor (private _router: Router, private _meta: Meta) { constructor (private _router: Router, private _meta: Meta, private _piwikService:PiwikService) {
this.openAccess = OpenaireProperties.getOpenAccess(); this.openAccess = OpenaireProperties.getOpenAccess();
this.openAccessRepo = OpenaireProperties.getOpenAccessRepo(); this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
@ -77,6 +79,12 @@ export class DepositComponent {
this.updateTitle("Deposit "+this.requestFor); this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor); this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor);
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
updateDescription(description:string){ updateDescription(description:string){
this._meta.updateMeta("description", description); this._meta.updateMeta("description", description);

View File

@ -11,6 +11,8 @@ import {EntitiesAutocompleteModule} from '../utils/entitiesAutoComplete/entities
import {DataProvidersServiceModule} from '../services/dataProvidersService.module'; import {DataProvidersServiceModule} from '../services/dataProvidersService.module';
import {OrganizationServiceModule} from '../services/organizationService.module'; import {OrganizationServiceModule} from '../services/organizationService.module';
import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module'; import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module';
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
@NgModule({ @NgModule({
@ -20,7 +22,8 @@ import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.mod
EntitiesAutocompleteModule, EntitiesAutocompleteModule,
DataProvidersServiceModule, DataProvidersServiceModule,
OrganizationServiceModule, OrganizationServiceModule,
SearchResultsModule SearchResultsModule,
PiwikServiceModule
], ],
declarations: [ declarations: [
DepositComponent, DepositComponent,

View File

@ -10,6 +10,7 @@ import {OrganizationService} from '../services/organization.service';
import { Meta} from '../../angular2-meta'; import { Meta} from '../../angular2-meta';
import {RouterHelper} from '../utils/routerHelper.class'; import {RouterHelper} from '../utils/routerHelper.class';
import {PiwikService} from '../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'deposit-result', selector: 'deposit-result',
@ -132,7 +133,7 @@ export class DepositResultComponent {
public status: number; public status: number;
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes:ErrorCodes = new ErrorCodes();
sub: any; sub: any; piwiksub: any;
subDataproviders: any; subDataproviders: any;
public routerHelper:RouterHelper = new RouterHelper(); public routerHelper:RouterHelper = new RouterHelper();
@ -145,7 +146,7 @@ export class DepositResultComponent {
constructor (private _router: Router, constructor (private _router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService, private _searchDataprovidersService: SearchDataprovidersService,
private _organizationService: OrganizationService, private _meta: Meta) { private _organizationService: OrganizationService, private _meta: Meta, private _piwikService:PiwikService) {
this.zenodo = OpenaireProperties.getZenodoURL(); this.zenodo = OpenaireProperties.getZenodoURL();
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
@ -154,6 +155,7 @@ export class DepositResultComponent {
this.updateTitle("Deposit "+this.requestFor); this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor); this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor);
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
} }
updateDescription(description:string){ updateDescription(description:string){
this._meta.updateMeta("description", description); this._meta.updateMeta("description", description);
@ -192,6 +194,9 @@ export class DepositResultComponent {
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
if(this.subDataproviders != undefined) { if(this.subDataproviders != undefined) {
this.subDataproviders.unsubscribe(); this.subDataproviders.unsubscribe();
} }

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsComponent } from './depositPublications.component'; import { DepositPublicationsComponent } from './depositPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard] } { path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -8,6 +8,7 @@ import {DepositPublicationsRoutingModule} from './depositPublications-routing.mo
import {DepoditModule} from '../deposit.module'; import {DepoditModule} from '../deposit.module';
import {IFrameModule} from '../../utils/iframe.module'; import {IFrameModule} from '../../utils/iframe.module';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -23,7 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
exports: [ exports: [
DepositPublicationsComponent, DepositPublicationsComponent,
], ],
providers: [FreeGuard providers: [FreeGuard,PreviousRouteRecorder
] ]
}) })
export class DepositPublicationsModule { } export class DepositPublicationsModule { }

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component'; import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard] } { path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard] ,canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -7,6 +7,7 @@ import { DepositPublicationsResultComponent } from './depositPublicationsResult.
import {DepositPublicationsResultRoutingModule} from './depositPublicationsResult-routing.module'; import {DepositPublicationsResultRoutingModule} from './depositPublicationsResult-routing.module';
import {DepoditModule} from '../deposit.module'; import {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -22,7 +23,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
exports: [ exports: [
DepositPublicationsResultComponent, DepositPublicationsResultComponent,
], ],
providers: [FreeGuard providers: [FreeGuard,PreviousRouteRecorder
] ]
}) })
export class DepositPublicationsResultsModule { } export class DepositPublicationsResultsModule { }

View File

@ -2,12 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { ErrorPageComponent } from './errorPage.component'; import { ErrorPageComponent } from './errorPage.component';
import {PreviousRouteRecorder} from'../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: 'error', component: ErrorPageComponent}, { path: 'error', component: ErrorPageComponent,canDeactivate: [PreviousRouteRecorder] },
{ path: '**', component: ErrorPageComponent}, { path: '**', component: ErrorPageComponent,canDeactivate: [PreviousRouteRecorder] },
]) ])
] ]

View File

@ -4,13 +4,14 @@ import { FormsModule } from '@angular/forms';
import { ErrorPageComponent } from './errorPage.component'; import { ErrorPageComponent } from './errorPage.component';
import { ErrorRoutingModule } from './error-routing.module'; import { ErrorRoutingModule } from './error-routing.module';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
ErrorRoutingModule ErrorRoutingModule
], ],providers:[PreviousRouteRecorder],
declarations: [ declarations: [
ErrorPageComponent ErrorPageComponent

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { DataProviderComponent } from './dataProvider.component'; import { DataProviderComponent } from './dataProvider.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: DataProviderComponent, canActivate: [FreeGuard] } { path: '', component: DataProviderComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]
}) })

View File

@ -14,6 +14,8 @@ import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDatapr
import { SearchDataprovidersService } from '../../services/searchDataproviders.service'; import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class'; import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'dataprovider', selector: 'dataprovider',
templateUrl: 'dataProvider.component.html', templateUrl: 'dataProvider.component.html',
@ -22,6 +24,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
export class DataProviderComponent { export class DataProviderComponent {
sub: any; sub: any;
piwiksub: any;
datasourceId: string; datasourceId: string;
public dataProviderInfo: DataProviderInfo; public dataProviderInfo: DataProviderInfo;
@ -77,6 +80,7 @@ export class DataProviderComponent {
constructor (private element: ElementRef, constructor (private element: ElementRef,
private _dataproviderService: DataProviderService, private _dataproviderService: DataProviderService,
private _piwikService:PiwikService,
private route: ActivatedRoute, private route: ActivatedRoute,
private _meta: Meta, private _meta: Meta,
private _router: Router, private _router: Router,
@ -112,6 +116,9 @@ export class DataProviderComponent {
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
getDataProviderInfo(id:string) { getDataProviderInfo(id:string) {
this.warningMessage = ''; this.warningMessage = '';
@ -130,6 +137,9 @@ export class DataProviderComponent {
this.showTabs = true ; this.showTabs = true ;
this.updateTitle(this.dataProviderInfo.title.name); this.updateTitle(this.dataProviderInfo.title.name);
this.updateDescription("Data provider, search, repositories, open access,"+this.dataProviderInfo.title.name); this.updateDescription("Data provider, search, repositories, open access,"+this.dataProviderInfo.title.name);
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.dataProviderInfo.title.name).subscribe();
}
this.showLoading = false; this.showLoading = false;

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { DatasetComponent } from './dataset.component'; import { DatasetComponent } from './dataset.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: DatasetComponent, canActivate: [FreeGuard] } { path: '', component: DatasetComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]
}) })

View File

@ -6,6 +6,7 @@ import {ActivatedRoute, Router} from '@angular/router';
import {OpenaireProperties} from '../../utils/properties/openaireProperties' import {OpenaireProperties} from '../../utils/properties/openaireProperties'
import {RouterHelper} from '../../utils/routerHelper.class'; import {RouterHelper} from '../../utils/routerHelper.class';
import { Meta} from '../../../angular2-meta'; import { Meta} from '../../../angular2-meta';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'dataset', selector: 'dataset',
@ -27,7 +28,7 @@ export class DatasetComponent {
private showAllBioentities: boolean = false; private showAllBioentities: boolean = false;
private datasetId : string ; private datasetId : string ;
private result ; private result ;
sub: any; sub: any; piwiksub: any;
private activeTab: string = "Related Research Results"; private activeTab: string = "Related Research Results";
private metricsClicked: boolean; private metricsClicked: boolean;
@ -47,6 +48,7 @@ export class DatasetComponent {
constructor (private element: ElementRef, constructor (private element: ElementRef,
private _datasetService: DatasetService, private _datasetService: DatasetService,
private _piwikService:PiwikService,
private route: ActivatedRoute, private route: ActivatedRoute,
private _meta: Meta, private _meta: Meta,
private _router: Router) { private _router: Router) {
@ -87,6 +89,9 @@ export class DatasetComponent {
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
getDatasetInfo(id:string) { getDatasetInfo(id:string) {
@ -99,6 +104,10 @@ export class DatasetComponent {
this.datasetInfo = data; this.datasetInfo = data;
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(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.datasetInfo.title.name).subscribe();
}
this.result = [] this.result = []
this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.title.accessMode, embargoEndDate: ''}; this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.title.accessMode, embargoEndDate: ''};

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { HtmlProjectReportComponent } from './htmlProjectReport.component'; import { HtmlProjectReportComponent } from './htmlProjectReport.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: HtmlProjectReportComponent , canActivate: [FreeGuard]} { path: '', component: HtmlProjectReportComponent , canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder]}
]) ])
] ]
}) })

View File

@ -6,6 +6,7 @@ import {HtmlProjectReportService} from './htmlProjectReport.service';
import {ProjectService} from '../project/project.service'; import {ProjectService} from '../project/project.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import { Meta} from '../../../angular2-meta'; import { Meta} from '../../../angular2-meta';
import {PiwikService} from '../../utils/piwik/piwik.service';
declare var UIkit: any; declare var UIkit: any;
@ -50,7 +51,7 @@ export class HtmlProjectReportComponent{
public header2: string = ""; public header2: string = "";
public htmlResult: string = ""; public htmlResult: string = "";
public sub; public sub; piwiksub: any;
public subHTML; public subHTML;
public subHTMLInfo; public subHTMLInfo;
@ -60,6 +61,7 @@ export class HtmlProjectReportComponent{
constructor ( private route: ActivatedRoute, constructor ( private route: ActivatedRoute,
private htmlService: HtmlProjectReportService, private htmlService: HtmlProjectReportService,
private _piwikService:PiwikService,
private _projectService: ProjectService, private _projectService: ProjectService,
private _meta: Meta, private _router: Router) { private _meta: Meta, private _router: Router) {
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
@ -97,7 +99,11 @@ export class HtmlProjectReportComponent{
}); });
} }
ngOnDestroy() {} ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
createHeaders() { createHeaders() {
this._projectService.getHTMLInfo(this.projectId).subscribe( this._projectService.getHTMLInfo(this.projectId).subscribe(
@ -108,6 +114,9 @@ export class HtmlProjectReportComponent{
} else if(data.title){ } else if(data.title){
this.updateTitle(data.title+" "+this.resultsType+" report"); this.updateTitle(data.title+" "+this.resultsType+" report");
} }
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(((data.acronym)?data.acronym:data.title)+" "+this.resultsType+" report").subscribe();
}
}, },
err => { err => {
console.log(err); console.log(err);

View File

@ -7,15 +7,18 @@ import { FormsModule } from '@angular/forms';
import {TabPagingComponent} from './tabPaging.component'; import {TabPagingComponent} from './tabPaging.component';
import {ShowTitleComponent} from './showTitle.component'; import {ShowTitleComponent} from './showTitle.component';
import {AddThisComponent} from './addThis.component'; import {AddThisComponent} from './addThis.component';
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from'../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule CommonModule, FormsModule, PiwikServiceModule
], ],
declarations: [ declarations: [
TabPagingComponent, ShowTitleComponent, AddThisComponent TabPagingComponent, ShowTitleComponent, AddThisComponent
], ],
providers:[ providers:[
PreviousRouteRecorder
], ],
exports: [ exports: [
TabPagingComponent, ShowTitleComponent, AddThisComponent TabPagingComponent, ShowTitleComponent, AddThisComponent

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { OrganizationComponent } from './organization.component'; import { OrganizationComponent } from './organization.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OrganizationComponent, canActivate: [FreeGuard] } { path: '', component: OrganizationComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]
}) })

View File

@ -18,6 +18,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
import {ModalLoading} from '../../utils/modal/loading.component'; import {ModalLoading} from '../../utils/modal/loading.component';
import {AlertModal} from '../../utils/modal/alert'; import {AlertModal} from '../../utils/modal/alert';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'organization', selector: 'organization',
@ -42,6 +43,7 @@ export class OrganizationComponent {
public csvParamsTail: string; public csvParamsTail: string;
sub: any; sub: any;
piwiksub: any;
public activeTab: string = "Publications"; public activeTab: string = "Publications";
public reloadDataproviders: boolean = true; public reloadDataproviders: boolean = true;
@ -69,6 +71,7 @@ export class OrganizationComponent {
constructor (private element: ElementRef, constructor (private element: ElementRef,
private _organizationService: OrganizationService, private _organizationService: OrganizationService,
private _piwikService:PiwikService,
private route: ActivatedRoute, private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService, private _searchDataprovidersService: SearchDataprovidersService,
private _reportsService: ReportsService, private _reportsService: ReportsService,
@ -116,6 +119,9 @@ export class OrganizationComponent {
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
private getOrganizationInfo () { private getOrganizationInfo () {
@ -133,7 +139,9 @@ export class OrganizationComponent {
this.organizationInfo = data; this.organizationInfo = data;
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(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.organizationInfo.title.name).subscribe();
}
var refineFields:string [] = ["funder"]; var refineFields:string [] = ["funder"];
this.searchPublications(); this.searchPublications();
@ -242,6 +250,9 @@ export class OrganizationComponent {
data => { data => {
this.closeLoading(); this.closeLoading();
window.open(window.URL.createObjectURL(data)); window.open(window.URL.createObjectURL(data));
// if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
// this._piwikService.trackDownload(url).subscribe();
// }
}, },
error => { error => {
console.log("Error downloading the file."); console.log("Error downloading the file.");
@ -290,6 +301,9 @@ export class OrganizationComponent {
} }
this.closeLoading(); this.closeLoading();
window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' }))); window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })));
// if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
// this._piwikService.trackDownload(url).subscribe();
// }
} }
} else { } else {
title = true; title = true;
@ -308,6 +322,9 @@ export class OrganizationComponent {
} }
this.closeLoading(); this.closeLoading();
window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' }))); window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })));
// if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
// this._piwikService.trackDownload(url).subscribe();
// }
} }
}, },
error => { error => {

View File

@ -2,11 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { ProjectComponent } from './project.component'; import { ProjectComponent } from './project.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: ProjectComponent } { path: '', component: ProjectComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]
}) })

View File

@ -16,6 +16,7 @@ import {ReportsService} from '../../services/reports.service';
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import { Meta} from '../../../angular2-meta'; import { Meta} from '../../../angular2-meta';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'project', selector: 'project',
@ -50,7 +51,7 @@ export class ProjectComponent{
public errorMessage = ""; public errorMessage = "";
public showLoading: boolean = true; public showLoading: boolean = true;
sub: any; sub: any;piwiksub: any;
public activeTab: string = "Publications"; public activeTab: string = "Publications";
public reloadDatasets: boolean = true; public reloadDatasets: boolean = true;
@ -66,6 +67,7 @@ export class ProjectComponent{
constructor ( private element: ElementRef, constructor ( private element: ElementRef,
private _projectService: ProjectService, private _projectService: ProjectService,
private _piwikService:PiwikService,
private route: ActivatedRoute, private route: ActivatedRoute,
private _searchPublicationsService: SearchPublicationsService, private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService, private _searchDatasetsService: SearchDatasetsService,
@ -78,7 +80,6 @@ export class ProjectComponent{
this.sub = this.route.queryParams.subscribe(params => { this.sub = this.route.queryParams.subscribe(params => {
this.metricsClicked = false; this.metricsClicked = false;
this.statsClicked = false; this.statsClicked = false;
this.fetchPublications = new FetchPublications( this._searchPublicationsService); this.fetchPublications = new FetchPublications( this._searchPublicationsService);
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
@ -130,6 +131,9 @@ export class ProjectComponent{
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
createClipboard() { createClipboard() {
@ -186,6 +190,10 @@ console.info(this.projectInfo.title);
} }
this.updateTitle(this.projectName); this.updateTitle(this.projectName);
this.updateDescription("project, funding, open access, publications, datasets, "+this.projectName+ ","+this.projectInfo.funder); this.updateDescription("project, funding, open access, publications, datasets, "+this.projectName+ ","+this.projectInfo.funder);
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.projectName).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 };
this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&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(124, 181, 236, 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.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&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(124, 181, 236, 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';

View File

@ -17,6 +17,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
import {DatasetsServiceModule} from '../../services/datasetsService.module'; import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module'; import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import { LandingModule } from '../landing.module'; import { LandingModule } from '../landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -30,6 +31,7 @@ import { LandingModule } from '../landing.module';
providers:[ providers:[
// ProjectService, // ProjectService,
// HtmlProgressReportService // HtmlProgressReportService
FreeGuard
], ],
exports: [ exports: [
ProjectComponent ProjectComponent

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { PublicationComponent } from './publication.component'; import { PublicationComponent } from './publication.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: PublicationComponent, canActivate: [FreeGuard] } { path: '', component: PublicationComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]
}) })

View File

@ -5,6 +5,8 @@ import {PublicationInfo} from '../../utils/entities/publicationInfo';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class'; import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
import { Meta} from '../../../angular2-meta'; import { Meta} from '../../../angular2-meta';
@ -22,7 +24,7 @@ export class PublicationComponent {
public showAllFundedBy: boolean = false; public showAllFundedBy: boolean = false;
public showAllPublishedIn: boolean = false; public showAllPublishedIn: boolean = false;
sub: any; sub: any;piwiksub: any;
articleId: string; articleId: string;
public publicationInfo: PublicationInfo; public publicationInfo: PublicationInfo;
private metricsClicked: boolean; private metricsClicked: boolean;
@ -64,6 +66,7 @@ export class PublicationComponent {
constructor ( private element: ElementRef, constructor ( private element: ElementRef,
private _publicationService: PublicationService, private _publicationService: PublicationService,
private _piwikService:PiwikService,
private route: ActivatedRoute, private _meta: Meta, private route: ActivatedRoute, private _meta: Meta,
private _router: Router) { private _router: Router) {
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
@ -107,6 +110,9 @@ export class PublicationComponent {
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
getPublicationInfo(id:string) { getPublicationInfo(id:string) {
@ -122,6 +128,9 @@ export class PublicationComponent {
// this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''}; // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''};
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(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.publicationInfo.title.name).subscribe();
}
let bioentitiesNum = 0; let bioentitiesNum = 0;
if(this.publicationInfo.bioentities != undefined) { if(this.publicationInfo.bioentities != undefined) {

View File

@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { UserComponent } from './user.component'; import { UserComponent } from './user.component';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: UserComponent}, { path: '', component: UserComponent, canDeactivate: [PreviousRouteRecorder]},
]) ])
] ]

View File

@ -4,6 +4,8 @@ import { FormsModule } from '@angular/forms';
import {UserComponent } from './user.component'; import {UserComponent } from './user.component';
import { UserRoutingModule } from './user-routing.module'; import { UserRoutingModule } from './user-routing.module';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
// import {LoginService} from './login.service'; // import {LoginService} from './login.service';
@NgModule({ @NgModule({
imports: [ imports: [
@ -11,7 +13,7 @@ import { UserRoutingModule } from './user-routing.module';
UserRoutingModule UserRoutingModule
], ],
// providers:[LoginService], providers:[PreviousRouteRecorder],
declarations: [ declarations: [
UserComponent UserComponent

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component'; import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard] } { path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component'; import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard] } { path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component'; import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard]} { path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder]}
]) ])
] ]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component'; import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard] } { path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component'; import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard] } { path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import{SearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component'; import{SearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard] } { path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component'; import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard] } { path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchEntityRegistriesComponent} from './entityRegistries.component'; import{SearchEntityRegistriesComponent} from './entityRegistries.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard] } { path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component'; import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard] } { path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchJournalsComponent} from './journals.component'; import{SearchJournalsComponent} from './journals.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchJournalsComponent, canActivate: [FreeGuard] } { path: '', component: SearchJournalsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchJournalsTableComponent} from './journalsTable.component'; import{SearchJournalsTableComponent} from './journalsTable.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard] } { path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import{SearchComponent} from './search.component'; import{SearchComponent} from './search.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchComponent, canActivate: [FreeGuard] } { path: '', component: SearchComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -17,19 +17,21 @@ import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
import {SearchFormModule} from '../searchUtils/searchForm.module'; import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module'; //import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule,
PublicationsServiceModule, OrganizationsServiceModule, PublicationsServiceModule, OrganizationsServiceModule,
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule//, SearchFilterModalModule BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule, PiwikServiceModule//, SearchFilterModalModule
], ],
declarations: [ declarations: [
SearchComponent SearchComponent
], ],
providers:[FreeGuard providers:[FreeGuard, PreviousRouteRecorder
], ],
exports: [ exports: [
SearchComponent SearchComponent

View File

@ -23,6 +23,7 @@ import {ErrorCodes} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class'; import {RouterHelper} from '../../utils/routerHelper.class';
import {NumberUtils} from '../../utils/number-utils.class'; import {NumberUtils} from '../../utils/number-utils.class';
import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
changeDetection: ChangeDetectionStrategy.Default, changeDetection: ChangeDetectionStrategy.Default,
@ -309,7 +310,7 @@ import {RefineFieldResultsService} from '../../services/refineFieldResults.servi
` `
}) })
export class SearchComponent { export class SearchComponent {
public sub: any; public sub: any; piwiksub: any;
public subfunders: any; public subfunders: any;
public reloadPublications: boolean; public reloadPublications: boolean;
public reloadDatasets: boolean; public reloadDatasets: boolean;
@ -358,7 +359,7 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
private _searchDatasetsService: SearchDatasetsService, private _searchDatasetsService: SearchDatasetsService,
private _searchOrganizationsService: SearchOrganizationsService, private _searchOrganizationsService: SearchOrganizationsService,
private _refineFieldResultsService:RefineFieldResultsService, private _refineFieldResultsService:RefineFieldResultsService,
private location: Location, private _meta: Meta ) { private location: Location, private _meta: Meta,private _piwikService:PiwikService ) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService); this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchProjects = new FetchProjects(this._searchProjectsService); this.fetchProjects = new FetchProjects(this._searchProjectsService);
@ -374,6 +375,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
this._meta.updateProperty("og:title", title); this._meta.updateProperty("og:title", title);
this._meta.updateProperty("og:url", url); this._meta.updateProperty("og:url", url);
this.getNumbers(); this.getNumbers();
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView("Search publications, datasets, projects... | OpenAIRE").subscribe();
}
} }
@ -392,6 +396,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
public ngOnDestroy() { public ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
this.subfunders.unsubscribe(); this.subfunders.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
if(this.keyword !=null && this.keyword.length > 0){ if(this.keyword !=null && this.keyword.length > 0){
if(this.subPub){ if(this.subPub){
this.subPub.unsubscribe(); this.subPub.unsubscribe();

View File

@ -1,6 +1,7 @@
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core'; import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Location} from '@angular/common'; import {Location} from '@angular/common';
import { Router} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult'; import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields} from '../../utils/properties/searchFields'; import {SearchFields} from '../../utils/properties/searchFields';
@ -9,6 +10,7 @@ import {ModalLoading} from '../../utils/modal/loading.component';
import {StringUtils, Dates} from '../../utils/string-utils.class'; import {StringUtils, Dates} from '../../utils/string-utils.class';
import { Meta} from '../../../angular2-meta'; import { Meta} from '../../../angular2-meta';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'advanced-search-page', selector: 'advanced-search-page',
@ -67,7 +69,7 @@ export class AdvancedSearchPageComponent {
@Input() csvPath: string; @Input() csvPath: string;
@Input() simpleSearchLink: string = ""; @Input() simpleSearchLink: string = "";
@Input() disableForms:boolean = false; @Input() disableForms:boolean = false;
piwiksub: any;
public parameterNames:string[] =[]; public parameterNames:string[] =[];
public parameterValues:string[] =[]; public parameterValues:string[] =[];
@ -75,7 +77,7 @@ export class AdvancedSearchPageComponent {
public baseURLWithParameters:string = ''; public baseURLWithParameters:string = '';
@Output() queryChange = new EventEmitter(); @Output() queryChange = new EventEmitter();
constructor (private location: Location, private _meta: Meta) { constructor (private location: Location, private _meta: Meta, private _piwikService:PiwikService, private router: Router) {
} }
ngOnInit() { ngOnInit() {
@ -88,6 +90,15 @@ export class AdvancedSearchPageComponent {
this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl; this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
this.updateBaseUrlWithParameters(); this.updateBaseUrlWithParameters();
this.defineUrlParam(); this.defineUrlParam();
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
}
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
updateDescription(description:string){ updateDescription(description:string){
this._meta.updateMeta("description", description); this._meta.updateMeta("description", description);
@ -249,7 +260,15 @@ export class AdvancedSearchPageComponent {
this.queryChange.emit({ this.queryChange.emit({
value: queryParameters value: queryParameters
}); });
/* Code For Piwik*/
if (typeof localStorage !== 'undefined') {
console.log("In PreviousRouteRecorder : "+this.router.url );
localStorage.setItem('previousRoute', this.router.url);
}
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
}
/* End Piwik Code */
} }
queryChanged($event) { queryChanged($event) {

View File

@ -11,16 +11,19 @@ import {SearchDownloadModule} from './searchDownload.module';
import{SearchPagingModule} from './searchPaging.module'; import{SearchPagingModule} from './searchPaging.module';
import {AdvancedSearchFormModule} from '../searchUtils/advancedSearchForm.module'; import {AdvancedSearchFormModule} from '../searchUtils/advancedSearchForm.module';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, SearchResultsModule, LoadingModalModule, ReportsServiceModule, SearchPagingModule, AdvancedSearchFormModule, SearchDownloadModule CommonModule, FormsModule, RouterModule, SearchResultsModule, LoadingModalModule, ReportsServiceModule, SearchPagingModule, AdvancedSearchFormModule, SearchDownloadModule, PiwikServiceModule
], ],
declarations: [ declarations: [
AdvancedSearchPageComponent, AdvancedSearchPageComponent,
], ],
providers:[ providers:[
PreviousRouteRecorder
], ],
exports: [ exports: [
AdvancedSearchPageComponent, AdvancedSearchPageComponent,

View File

@ -1,6 +1,8 @@
import {Component, Input, ViewChild, Output, EventEmitter,ElementRef} from '@angular/core'; import {Component, Input, ViewChild, Output, EventEmitter,ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Location} from '@angular/common'; import {Location} from '@angular/common';
import { Router} from '@angular/router';
import { Filter, Value} from './searchHelperClasses.class'; import { Filter, Value} from './searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult'; import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields} from '../../utils/properties/searchFields'; import {SearchFields} from '../../utils/properties/searchFields';
@ -12,6 +14,7 @@ import{SearchFilterComponent} from './searchFilter.component';
import {SearchFilterModalComponent} from './searchFilterModal.component'; import {SearchFilterModalComponent} from './searchFilterModal.component';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import { ErrorCodes} from '../../utils/properties/openaireProperties'; import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
@ -136,13 +139,12 @@ export class SearchPageComponent {
@Input() disableForms: boolean = false; @Input() disableForms: boolean = false;
@Input() tableView: boolean = false; @Input() tableView: boolean = false;
@Input() searchFormClass: string = "searchForm"; @Input() searchFormClass: string = "searchForm";
@ViewChild (ModalLoading) loading : ModalLoading ; @ViewChild (ModalLoading) loading : ModalLoading ;
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }}; public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
private searchFieldsHelper:SearchFields = new SearchFields(); private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>(); private queryParameters: Map<string, string> = new Map<string,string>();
private baseURLWithParameters:string = ''; private baseURLWithParameters:string = '';
private sub: any; private sub: any; piwiksub: any;
public countFilters= 0; public countFilters= 0;
public urlParam: string; public urlParam: string;
public parameterNames:string[] =[]; public parameterNames:string[] =[];
@ -151,7 +153,7 @@ export class SearchPageComponent {
//@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ; //@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
public currentFilter: Filter; public currentFilter: Filter;
constructor (private location: Location , private _meta: Meta,private element: ElementRef) { constructor (private location: Location , private _meta: Meta,private element: ElementRef,private _piwikService:PiwikService, private router: Router) {
} }
ngOnInit() { ngOnInit() {
@ -165,12 +167,19 @@ export class SearchPageComponent {
if(typeof window !== 'undefined') { if(typeof window !== 'undefined') {
this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname); this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname);
} }
if(typeof document !== 'undefined' && OpenaireProperties.isPiwikTrackEnabled()){
this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
}
// console.info(this.entityType + " " + this.urlParam + this.type); // console.info(this.entityType + " " + this.urlParam + this.type);
} }
ngAfterViewChecked(){ ngAfterViewChecked(){
} }
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
toggleModal($event) { toggleModal($event) {
this.currentFilter = $event.value; this.currentFilter = $event.value;
//this.searchFilterModal.open(); //this.searchFilterModal.open();
@ -337,6 +346,7 @@ export class SearchPageComponent {
*/ */
public updateBaseUrlWithParameters(filters:Filter[]){ public updateBaseUrlWithParameters(filters:Filter[]){
this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(filters,false); this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(filters,false);
} }
/* /*
* *
@ -509,7 +519,15 @@ export class SearchPageComponent {
var indexQuery = this.createIndexQueryParameters(this.filters); var indexQuery = this.createIndexQueryParameters(this.filters);
this.location.go(location.pathname,urlParameters); this.location.go(location.pathname,urlParameters);
/* Code For Piwik*/
if (typeof localStorage !== 'undefined') {
console.log("In PreviousRouteRecorder : "+this.router.url );
localStorage.setItem('previousRoute', this.router.url);
}
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
}
/* End Piwik Code */
this.queryChange.emit({ this.queryChange.emit({
value: queryParameters, value: queryParameters,
index:indexQuery index:indexQuery

View File

@ -15,27 +15,25 @@ import {ReportsServiceModule} from '../../services/reportsService.module';
import{SearchPagingModule} from './searchPaging.module'; import{SearchPagingModule} from './searchPaging.module';
import {SearchDownloadModule} from './searchDownload.module'; import {SearchDownloadModule} from './searchDownload.module';
import {ModalModule} from '../../utils/modal/modal.module'; import {ModalModule} from '../../utils/modal/modal.module';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule,
/*DatasourceTableViewModule,*/ LoadingModalModule, ReportsServiceModule, LoadingModalModule, ReportsServiceModule,
SearchPagingModule, SearchDownloadModule, ModalModule, SearchFilterModule SearchPagingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule
], ],
declarations: [ declarations: [
SearchPageComponent//, SearchPageComponent
//SearchFilterComponent,
//SearchFilterModalComponent
,
], ],
providers:[ providers:[
PreviousRouteRecorder
], ],
exports: [ exports: [
SearchPageComponent//, SearchPageComponent
//SearchFilterComponent,
//SearchFilterModalComponent
] ]
}) })
export class SearchPageModule { } export class SearchPageModule { }

View File

@ -13,6 +13,7 @@ import {SearchFilterModalComponent} from './searchFilterModal.component';
import { ErrorCodes} from '../../utils/properties/openaireProperties'; import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe'; import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'search-page-table', selector: 'search-page-table',
@ -178,8 +179,8 @@ export class SearchPageTableViewComponent {
@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ; @ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
public currentFilter: Filter; public currentFilter: Filter;
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes:ErrorCodes = new ErrorCodes();
piwiksub: any;
constructor (private location: Location , private _meta: Meta) { constructor (private location: Location , private _meta: Meta, private _piwikService:PiwikService) {
} }
ngOnInit() { ngOnInit() {
@ -188,8 +189,15 @@ export class SearchPageTableViewComponent {
if(typeof window !== 'undefined') { if(typeof window !== 'undefined') {
this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname); this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname);
} }
if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
}
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
} }
public sortByOrganization = (dataprovider: any) => { public sortByOrganization = (dataprovider: any) => {
if(dataprovider.organizations && dataprovider.organizations.length > 0) { if(dataprovider.organizations && dataprovider.organizations.length > 0) {
return dataprovider.organizations[0].name.toUpperCase(); return dataprovider.organizations[0].name.toUpperCase();

View File

@ -19,11 +19,13 @@ import {PagingModule} from '../../utils/paging.module';
import {DataTableModule} from "angular2-datatable"; import {DataTableModule} from "angular2-datatable";
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe'; import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, /*DatasourceTableViewModule,*/ LoadingModalModule, CommonModule, FormsModule,RouterModule, SearchFormModule, SearchResultsModule, /*DatasourceTableViewModule,*/ LoadingModalModule,
ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, DataTableModule, SearchFilterModule ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, DataTableModule, SearchFilterModule, PiwikServiceModule
], ],
declarations: [ declarations: [
SearchPageTableViewComponent//, SearchPageTableViewComponent//,
@ -34,6 +36,7 @@ import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersD
], ],
providers:[ providers:[
PreviousRouteRecorder
], ],
exports: [ exports: [
SearchPageTableViewComponent//, SearchPageTableViewComponent//,

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchDataprovidersComponent} from './searchDataproviders.component'; import{SearchDataprovidersComponent} from './searchDataproviders.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard] } { path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchDatasetsComponent} from './searchDatasets.component'; import{SearchDatasetsComponent} from './searchDatasets.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard] } { path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchOrganizationsComponent} from './searchOrganizations.component'; import{SearchOrganizationsComponent} from './searchOrganizations.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard] } { path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchProjectsComponent} from './searchProjects.component'; import{SearchProjectsComponent} from './searchProjects.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchProjectsComponent, canActivate: [FreeGuard] } { path: '', component: SearchProjectsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchPublicationsComponent} from './searchPublications.component'; import{SearchPublicationsComponent} from './searchPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard'; import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard] } { path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
]) ])
] ]

View File

@ -25,7 +25,7 @@ export class FeedbackComponent {
constructor(private route: ActivatedRoute) {} constructor(private route: ActivatedRoute) {}
ngOnInit() { ngOnInit() {
this.feedbackmail = OpenaireProperties.getFeedbackMail(); // this.feedbackmail = OpenaireProperties.getFeedbackMail();
this.initialize(); this.initialize();
this.sub = this.route.queryParams.subscribe(params => { this.sub = this.route.queryParams.subscribe(params => {
this.initialize(); this.initialize();

View File

@ -11,6 +11,7 @@ import {FeedbackComponent} from './feedback/feedback.component';
import {UserMiniComponent} from '../login/userMini.component'; import {UserMiniComponent} from '../login/userMini.component';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,

View File

@ -0,0 +1,70 @@
import {Injectable} from '@angular/core';
import {Http, Response, Headers, RequestOptions, URLSearchParams} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import {Location} from '@angular/common';
import {OpenaireProperties} from '../properties/openaireProperties';
import {StringUtils} from '../string-utils.class';
@Injectable()
export class PiwikService {
private piwikbaseUrl:string = "";
constructor(private http: Http, private location: Location ) {}
trackView (title):any {
var ua = this.getUserAgent();
var referrer = this.getReferrer();
if(typeof location !== 'undefined'){
var url = OpenaireProperties.getPiwikBaseURL()+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+
((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+
((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):'');
console.log("Piwik - trackDownload: " + url);
return this.http.get( url);
// .do(request => console.info("Piwik request completed" ));
}
}
trackDownload (downloadURL):any {
var ua = this.getUserAgent();
var referrer = this.getReferrer();
var url = OpenaireProperties.getPiwikBaseURL()+"&rec=1&url="+StringUtils.URIEncode(downloadURL)+"&download="+StringUtils.URIEncode(downloadURL)+
((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+
((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):'');
console.log("Piwik - trackDownload: "+url);
return this.http.get( url)
.do(request => console.info("Piwik request completed" ));
}
private getUserAgent(){
if (typeof navigator !== 'undefined') {
console.log("navigator.userAgent:" + navigator.userAgent);
return navigator.userAgent;
}else{
return null;
}
}
private getReferrer(){
var referrer = "";
if (typeof document !== 'undefined') {
console.log("document.referrer:" + document.referrer);
referrer = document.referrer;
}
if((referrer == null || referrer.length == 0)&&typeof localStorage !== 'undefined'){
referrer =localStorage.getItem('previousRoute');
}
return referrer;
}
parse(data:any){
}
}

View File

@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {PiwikService} from './piwik.service';
@NgModule({
imports: [
CommonModule, FormsModule,
],
declarations: [
],
providers: [ PiwikService ],
exports: [
]
})
export class PiwikServiceModule{ }

View File

@ -0,0 +1,17 @@
import { Injectable } from '@angular/core';
import { CanDeactivate, Router} from '@angular/router';
import {Observable} from 'rxjs/Observable';
@Injectable() // do not forget to register this class as a provider
export class PreviousRouteRecorder implements CanDeactivate<any> {
constructor(private router: Router) {
}
canDeactivate(component: any): Observable<boolean> | boolean {
if (typeof localStorage !== 'undefined') {
console.log("In PreviousRouteRecorder : "+this.router.url );
localStorage.setItem('previousRoute', this.router.url);
}
return true;
}
}

View File

@ -90,6 +90,9 @@ export class OpenaireProperties {
private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/"; private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
private static piwikBaseUrl =" https://analytics.openaire.eu/piwik.php?idsite=6";
private static enablePiwikTrack:boolean = false;
private static loginUrl ="http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/openid_connect_login"; private static loginUrl ="http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/openid_connect_login";
private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login"; private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login";
@ -312,12 +315,17 @@ export class OpenaireProperties {
}else{ }else{
return this.uploadService; return this.uploadService;
} }
// return this.uploadService;
} }
//vocabularies API //vocabularies API
public static getVocabulariesAPI():string{ public static getVocabulariesAPI():string{
return this.vocabulariesAPI; return this.vocabulariesAPI;
} }
public static getPiwikBaseURL():string{
return this.piwikBaseUrl;
}
public static isPiwikTrackEnabled():boolean{
return this.enablePiwikTrack;
}
public static getLoginURL():string{ public static getLoginURL():string{
if(this.productionMode){ if(this.productionMode){
return this.loginUrl_pm; return this.loginUrl_pm;