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 { ClaimsAdminComponent } from './claimsAdmin.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
@ -15,7 +16,7 @@ import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
DisplayClaimsModule
],
providers:[AdminLoginGuard],
providers:[AdminLoginGuard, PreviousRouteRecorder],
declarations: [
ClaimsAdminComponent
]

View File

@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { ClaimsByTokenComponent } from './claimsByToken.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
@ -35,7 +36,7 @@ import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
],
providers:[
ClaimsByTokenService,
LoginGuard
LoginGuard, PreviousRouteRecorder
],
declarations: [
ClaimsByTokenComponent, ClaimsDatatablePipe

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { DirectLinkingComponent } from './directLinking.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {DatasetsServiceModule} from '../../services/datasetsService.module';
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: [
DirectLinkingComponent
], exports:[DirectLinkingComponent]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { LinkingGenericComponent } from './linkingGeneric.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {StartOverModule} from '../claim-utils/startOver.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
@ -20,7 +21,7 @@ import {LoginGuard} from'../../login/loginGuard.guard';
InsertClaimsModule,
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, LinkingRoutingModule, StartOverModule,
],
providers:[LoginGuard],
providers:[LoginGuard, PreviousRouteRecorder],
declarations: [
LinkingGenericComponent
], exports:[

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { LoginGuard} from'../../login/loginGuard.guard';
import { MyClaimsComponent } from './myClaims.component';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
@ -15,7 +16,7 @@ import {LoginGuard} from'../../login/loginGuard.guard';
DisplayClaimsModule
],
providers:[LoginGuard],
providers:[LoginGuard, PreviousRouteRecorder],
declarations: [
MyClaimsComponent
]

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'deposit-by-subject-result',
@ -94,6 +95,7 @@ export class DepositBySubjectResultComponent {
sub: any;
subDataproviders: any;
piwiksub: any;
public fetchDataproviders : FetchDataproviders;
public routerHelper:RouterHelper = new RouterHelper();
@ -107,7 +109,7 @@ export class DepositBySubjectResultComponent {
constructor (private _router: Router,
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService, private _meta: Meta) {
private _searchDataprovidersService: SearchDataprovidersService, private _meta: Meta, private _piwikService:PiwikService) {
this.zenodo = OpenaireProperties.getZenodoURL();
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
@ -116,6 +118,9 @@ export class DepositBySubjectResultComponent {
this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor);
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){
this._meta.updateMeta("description", description);
@ -141,6 +146,7 @@ export class DepositBySubjectResultComponent {
this.searchDataproviders();
});
}
totalPages(): number {
let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
@ -161,6 +167,9 @@ export class DepositBySubjectResultComponent {
if(this.subDataproviders != undefined) {
this.subDataproviders.unsubscribe();
}
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
public searchDataproviders() {

View File

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

View File

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

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
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 {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
@ -22,7 +23,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
exports: [
DepositDatasetsResultComponent,
],
providers: [FreeGuard
providers: [FreeGuard,PreviousRouteRecorder
]
})
export class DepositDatasetsResultsModule { }

View File

@ -3,6 +3,7 @@ import {Observable} from 'rxjs/Observable';
import { Router } from '@angular/router';
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
import { Meta} from '../../angular2-meta';
import {PiwikService} from '../utils/piwik/piwik.service';
@Component({
@ -65,8 +66,9 @@ export class DepositComponent {
public errorCodes:ErrorCodes = new ErrorCodes();
public selectedId: 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.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
@ -77,6 +79,12 @@ export class DepositComponent {
this.updateTitle("Deposit "+this.requestFor);
this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor);
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){
this._meta.updateMeta("description", description);

View File

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

View File

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

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsComponent } from './depositPublications.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
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 {IFrameModule} from '../../utils/iframe.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
@ -23,7 +24,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
exports: [
DepositPublicationsComponent,
],
providers: [FreeGuard
providers: [FreeGuard,PreviousRouteRecorder
]
})
export class DepositPublicationsModule { }

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
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 {DepoditModule} from '../deposit.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
@ -22,7 +23,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
exports: [
DepositPublicationsResultComponent,
],
providers: [FreeGuard
providers: [FreeGuard,PreviousRouteRecorder
]
})
export class DepositPublicationsResultsModule { }

View File

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

View File

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

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { DataProviderComponent } from './dataProvider.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'dataprovider',
templateUrl: 'dataProvider.component.html',
@ -22,6 +24,7 @@ import {RouterHelper} from '../../utils/routerHelper.class';
export class DataProviderComponent {
sub: any;
piwiksub: any;
datasourceId: string;
public dataProviderInfo: DataProviderInfo;
@ -77,6 +80,7 @@ export class DataProviderComponent {
constructor (private element: ElementRef,
private _dataproviderService: DataProviderService,
private _piwikService:PiwikService,
private route: ActivatedRoute,
private _meta: Meta,
private _router: Router,
@ -112,6 +116,9 @@ export class DataProviderComponent {
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
getDataProviderInfo(id:string) {
this.warningMessage = '';
@ -130,6 +137,9 @@ export class DataProviderComponent {
this.showTabs = true ;
this.updateTitle(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;

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { DatasetComponent } from './dataset.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {RouterHelper} from '../../utils/routerHelper.class';
import { Meta} from '../../../angular2-meta';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'dataset',
@ -27,7 +28,7 @@ export class DatasetComponent {
private showAllBioentities: boolean = false;
private datasetId : string ;
private result ;
sub: any;
sub: any; piwiksub: any;
private activeTab: string = "Related Research Results";
private metricsClicked: boolean;
@ -47,6 +48,7 @@ export class DatasetComponent {
constructor (private element: ElementRef,
private _datasetService: DatasetService,
private _piwikService:PiwikService,
private route: ActivatedRoute,
private _meta: Meta,
private _router: Router) {
@ -87,6 +89,9 @@ export class DatasetComponent {
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
getDatasetInfo(id:string) {
@ -99,6 +104,10 @@ export class DatasetComponent {
this.datasetInfo = data;
this.updateTitle(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 = {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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {OpenaireProperties} from '../../utils/properties/openaireProperties';
import { Meta} from '../../../angular2-meta';
import {PiwikService} from '../../utils/piwik/piwik.service';
declare var UIkit: any;
@ -38,7 +39,7 @@ declare var UIkit: any;
</div>
</div>
</div>
`
})
export class HtmlProjectReportComponent{
@ -50,7 +51,7 @@ export class HtmlProjectReportComponent{
public header2: string = "";
public htmlResult: string = "";
public sub;
public sub; piwiksub: any;
public subHTML;
public subHTMLInfo;
@ -60,6 +61,7 @@ export class HtmlProjectReportComponent{
constructor ( private route: ActivatedRoute,
private htmlService: HtmlProjectReportService,
private _piwikService:PiwikService,
private _projectService: ProjectService,
private _meta: Meta, private _router: Router) {
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
@ -97,7 +99,11 @@ export class HtmlProjectReportComponent{
});
}
ngOnDestroy() {}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
createHeaders() {
this._projectService.getHTMLInfo(this.projectId).subscribe(
@ -108,6 +114,9 @@ export class HtmlProjectReportComponent{
} else if(data.title){
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 => {
console.log(err);

View File

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

View File

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

View File

@ -2,11 +2,13 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { ProjectComponent } from './project.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 { Meta} from '../../../angular2-meta';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'project',
@ -50,7 +51,7 @@ export class ProjectComponent{
public errorMessage = "";
public showLoading: boolean = true;
sub: any;
sub: any;piwiksub: any;
public activeTab: string = "Publications";
public reloadDatasets: boolean = true;
@ -66,6 +67,7 @@ export class ProjectComponent{
constructor ( private element: ElementRef,
private _projectService: ProjectService,
private _piwikService:PiwikService,
private route: ActivatedRoute,
private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService,
@ -78,7 +80,6 @@ export class ProjectComponent{
this.sub = this.route.queryParams.subscribe(params => {
this.metricsClicked = false;
this.statsClicked = false;
this.fetchPublications = new FetchPublications( this._searchPublicationsService);
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
@ -130,6 +131,9 @@ export class ProjectComponent{
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
createClipboard() {
@ -186,6 +190,10 @@ console.info(this.projectInfo.title);
}
this.updateTitle(this.projectName);
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.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 {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import { LandingModule } from '../landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
@ -30,6 +31,7 @@ import { LandingModule } from '../landing.module';
providers:[
// ProjectService,
// HtmlProgressReportService
FreeGuard
],
exports: [
ProjectComponent

View File

@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
import { PublicationComponent } from './publication.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
import { Meta} from '../../../angular2-meta';
@ -22,7 +24,7 @@ export class PublicationComponent {
public showAllFundedBy: boolean = false;
public showAllPublishedIn: boolean = false;
sub: any;
sub: any;piwiksub: any;
articleId: string;
public publicationInfo: PublicationInfo;
private metricsClicked: boolean;
@ -64,6 +66,7 @@ export class PublicationComponent {
constructor ( private element: ElementRef,
private _publicationService: PublicationService,
private _piwikService:PiwikService,
private route: ActivatedRoute, private _meta: Meta,
private _router: Router) {
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
@ -107,6 +110,9 @@ export class PublicationComponent {
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
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.updateTitle(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;
if(this.publicationInfo.bioentities != undefined) {

View File

@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { UserComponent } from './user.component';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 { UserRoutingModule } from './user-routing.module';
import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard';
// import {LoginService} from './login.service';
@NgModule({
imports: [
@ -11,7 +13,7 @@ import { UserRoutingModule } from './user-routing.module';
UserRoutingModule
],
// providers:[LoginService],
providers:[PreviousRouteRecorder],
declarations: [
UserComponent

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule,
PublicationsServiceModule, OrganizationsServiceModule,
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule//, SearchFilterModalModule
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule, PiwikServiceModule//, SearchFilterModalModule
],
declarations: [
SearchComponent
],
providers:[FreeGuard
providers:[FreeGuard, PreviousRouteRecorder
],
exports: [
SearchComponent

View File

@ -23,6 +23,7 @@ import {ErrorCodes} from '../../utils/properties/openaireProperties';
import {RouterHelper} from '../../utils/routerHelper.class';
import {NumberUtils} from '../../utils/number-utils.class';
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
changeDetection: ChangeDetectionStrategy.Default,
@ -309,7 +310,7 @@ import {RefineFieldResultsService} from '../../services/refineFieldResults.servi
`
})
export class SearchComponent {
public sub: any;
public sub: any; piwiksub: any;
public subfunders: any;
public reloadPublications: boolean;
public reloadDatasets: boolean;
@ -358,22 +359,25 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
private _searchDatasetsService: SearchDatasetsService,
private _searchOrganizationsService: SearchOrganizationsService,
private _refineFieldResultsService:RefineFieldResultsService,
private location: Location, private _meta: Meta ) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService);
private location: Location, private _meta: Meta,private _piwikService:PiwikService ) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService);
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
var title = "Search publications, datasets, projects... | OpenAIRE";
var url = OpenaireProperties.getBaseLink()+this._router.url;
this._meta.setTitle(title);
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
this._meta.updateProperty("og:title", title);
this._meta.updateProperty("og:url", url);
this.getNumbers();
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
var title = "Search publications, datasets, projects... | OpenAIRE";
var url = OpenaireProperties.getBaseLink()+this._router.url;
this._meta.setTitle(title);
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
this._meta.updateProperty("og:title", title);
this._meta.updateProperty("og:url", url);
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() {
this.sub.unsubscribe();
this.subfunders.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
if(this.keyword !=null && this.keyword.length > 0){
if(this.subPub){
this.subPub.unsubscribe();

View File

@ -1,6 +1,7 @@
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Location} from '@angular/common';
import { Router} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult';
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 { Meta} from '../../../angular2-meta';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'advanced-search-page',
@ -67,7 +69,7 @@ export class AdvancedSearchPageComponent {
@Input() csvPath: string;
@Input() simpleSearchLink: string = "";
@Input() disableForms:boolean = false;
piwiksub: any;
public parameterNames:string[] =[];
public parameterValues:string[] =[];
@ -75,7 +77,7 @@ export class AdvancedSearchPageComponent {
public baseURLWithParameters:string = '';
@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() {
@ -88,6 +90,15 @@ export class AdvancedSearchPageComponent {
this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
this.updateBaseUrlWithParameters();
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){
this._meta.updateMeta("description", description);
@ -249,7 +260,15 @@ export class AdvancedSearchPageComponent {
this.queryChange.emit({
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) {

View File

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

View File

@ -1,6 +1,8 @@
import {Component, Input, ViewChild, Output, EventEmitter,ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Location} from '@angular/common';
import { Router} from '@angular/router';
import { Filter, Value} from './searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields} from '../../utils/properties/searchFields';
@ -12,6 +14,7 @@ import{SearchFilterComponent} from './searchFilter.component';
import {SearchFilterModalComponent} from './searchFilterModal.component';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
import { ErrorCodes} from '../../utils/properties/openaireProperties';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
@ -136,13 +139,12 @@ export class SearchPageComponent {
@Input() disableForms: boolean = false;
@Input() tableView: boolean = false;
@Input() searchFormClass: string = "searchForm";
@ViewChild (ModalLoading) loading : ModalLoading ;
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>();
private baseURLWithParameters:string = '';
private sub: any;
private sub: any; piwiksub: any;
public countFilters= 0;
public urlParam: string;
public parameterNames:string[] =[];
@ -151,7 +153,7 @@ export class SearchPageComponent {
//@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
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() {
@ -165,12 +167,19 @@ export class SearchPageComponent {
if(typeof window !== 'undefined') {
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);
}
ngAfterViewChecked(){
}
ngOnDestroy() {
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
}
toggleModal($event) {
this.currentFilter = $event.value;
//this.searchFilterModal.open();
@ -337,6 +346,7 @@ export class SearchPageComponent {
*/
public updateBaseUrlWithParameters(filters:Filter[]){
this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(filters,false);
}
/*
*
@ -509,7 +519,15 @@ export class SearchPageComponent {
var indexQuery = this.createIndexQueryParameters(this.filters);
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({
value: queryParameters,
index:indexQuery

View File

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

View File

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

View File

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

View File

@ -3,11 +3,11 @@ import { RouterModule } from '@angular/router';
import{SearchDataprovidersComponent} from './searchDataproviders.component';
import {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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 {FreeGuard} from'../../login/freeGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
@NgModule({
imports: [
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) {}
ngOnInit() {
this.feedbackmail = OpenaireProperties.getFeedbackMail();
// this.feedbackmail = OpenaireProperties.getFeedbackMail();
this.initialize();
this.sub = this.route.queryParams.subscribe(params => {
this.initialize();

View File

@ -11,6 +11,7 @@ import {FeedbackComponent} from './feedback/feedback.component';
import {UserMiniComponent} from '../login/userMini.component';
@NgModule({
imports: [
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 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_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login";
@ -312,12 +315,17 @@ export class OpenaireProperties {
}else{
return this.uploadService;
}
// return this.uploadService;
}
//vocabularies API
public static getVocabulariesAPI():string{
return this.vocabulariesAPI;
}
public static getPiwikBaseURL():string{
return this.piwikBaseUrl;
}
public static isPiwikTrackEnabled():boolean{
return this.enablePiwikTrack;
}
public static getLoginURL():string{
if(this.productionMode){
return this.loginUrl_pm;