Project

General

Profile

« Previous | Next » 

Revision 48631

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

View differences:

modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchDataProviders-routing.module.ts
3 3

  
4 4
import{SearchDataprovidersComponent} from './searchDataproviders.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchDatasets-routing.module.ts
3 3

  
4 4
import{SearchDatasetsComponent} from './searchDatasets.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/deposit.module.ts
11 11
import {DataProvidersServiceModule} from '../services/dataProvidersService.module';
12 12
import {OrganizationServiceModule} from '../services/organizationService.module';
13 13
import {SearchResultsModule } from '../searchPages/searchUtils/searchResults.module';
14
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
14 15

  
15 16

  
17

  
16 18
 @NgModule({
17 19
  imports: [
18 20
    CommonModule, FormsModule,
......
20 22
    EntitiesAutocompleteModule,
21 23
    DataProvidersServiceModule,
22 24
    OrganizationServiceModule,
23
    SearchResultsModule
25
    SearchResultsModule,
26
    PiwikServiceModule
24 27
  ],
25 28
  declarations: [
26 29
    DepositComponent,
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositDatasetsResults.module.ts
7 7
import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-routing.module';
8 8
import {DepoditModule} from '../deposit.module';
9 9
import {FreeGuard} from'../../login/freeGuard.guard';
10
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
10 11

  
11 12
@NgModule({
12 13
  imports: [
......
22 23
  exports: [
23 24
    DepositDatasetsResultComponent,
24 25
   ],
25
  providers:    [FreeGuard
26
  providers:    [FreeGuard,PreviousRouteRecorder
26 27
  ]
27 28
})
28 29
export class DepositDatasetsResultsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublicationsResults.module.ts
7 7
import {DepositPublicationsResultRoutingModule} from './depositPublicationsResult-routing.module';
8 8
import {DepoditModule} from '../deposit.module';
9 9
import {FreeGuard} from'../../login/freeGuard.guard';
10
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
10 11

  
11 12
@NgModule({
12 13
  imports: [
......
22 23
  exports: [
23 24
    DepositPublicationsResultComponent,
24 25
   ],
25
  providers:    [FreeGuard
26
  providers:    [FreeGuard,PreviousRouteRecorder
26 27
  ]
27 28
})
28 29
export class DepositPublicationsResultsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublications.module.ts
8 8
import {DepoditModule} from '../deposit.module';
9 9
import {IFrameModule} from '../../utils/iframe.module';
10 10
import {FreeGuard} from'../../login/freeGuard.guard';
11
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
23 24
  exports: [
24 25
    DepositPublicationsComponent,
25 26
   ],
26
  providers:    [FreeGuard
27
  providers:    [FreeGuard,PreviousRouteRecorder
27 28
  ]
28 29
})
29 30
export class DepositPublicationsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts
1 1
import { NgModule } from '@angular/core';
2 2
import { RouterModule } from '@angular/router';
3

  
3
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
4 4
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6 6

  
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard] ,canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositDatasets.module.ts
10 10
import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module';
11 11
import {DepoditModule} from '../deposit.module';
12 12
import {FreeGuard} from'../../login/freeGuard.guard';
13

  
13
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
14 14
@NgModule({
15 15
  imports: [
16 16
    CommonModule, FormsModule,
......
25 25
  exports: [
26 26
    DepositDatasetsComponent,
27 27
   ],
28
  providers:    [FreeGuard
28
  providers:    [FreeGuard,PreviousRouteRecorder
29 29
  ]
30 30
})
31 31
export class DepositDatasetsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/depositResult.component.ts
10 10
import { Meta} from '../../angular2-meta';
11 11

  
12 12
import {RouterHelper} from '../utils/routerHelper.class';
13
import {PiwikService} from '../utils/piwik/piwik.service';
13 14

  
14 15
@Component({
15 16
    selector: 'deposit-result',
......
132 133
    public status: number;
133 134
    public errorCodes:ErrorCodes = new ErrorCodes();
134 135

  
135
    sub: any;
136
    sub: any; piwiksub: any;
136 137
    subDataproviders: any;
137 138

  
138 139
    public routerHelper:RouterHelper = new RouterHelper();
......
145 146
    constructor (private _router: Router,
146 147
        private  route: ActivatedRoute,
147 148
        private _searchDataprovidersService: SearchDataprovidersService,
148
        private _organizationService: OrganizationService, private _meta: Meta) {
149
        private _organizationService: OrganizationService, private _meta: Meta, private _piwikService:PiwikService) {
149 150

  
150 151
            this.zenodo = OpenaireProperties.getZenodoURL();
151 152
            this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
......
154 155
            this.updateTitle("Deposit "+this.requestFor);
155 156
            this.updateDescription("Openaire,  repositories, open access,  data provider, compatibility, organization, deposit "+ this.requestFor);
156 157
            this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
158
            this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
157 159
        }
158 160
        updateDescription(description:string){
159 161
          this._meta.updateMeta("description", description);
......
192 194

  
193 195
    ngOnDestroy() {
194 196
      this.sub.unsubscribe();
197
      if(this.piwiksub){
198
  this.piwiksub.unsubscribe();
199
}
195 200
      if(this.subDataproviders != undefined) {
196 201
          this.subDataproviders.unsubscribe();
197 202
      }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublications-routing.module.ts
1 1
import { NgModule } from '@angular/core';
2 2
import { RouterModule } from '@angular/router';
3

  
3
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
4 4
import { DepositPublicationsComponent } from './depositPublications.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6 6

  
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
      { path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard]  }
10
      { path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder]   }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/utils/piwik/previousRouteRecorder.guard.ts
1

  
2
import { Injectable } from '@angular/core';
3
import { CanDeactivate, Router} from '@angular/router';
4
import {Observable}       from 'rxjs/Observable';
5

  
6
@Injectable() // do not forget to register this class as a provider
7
export class PreviousRouteRecorder implements CanDeactivate<any> {
8
  constructor(private router: Router) {
9
  }
10
  canDeactivate(component: any): Observable<boolean> | boolean {
11
    if (typeof localStorage !== 'undefined') {
12
      console.log("In PreviousRouteRecorder : "+this.router.url );
13
      localStorage.setItem('previousRoute', this.router.url);
14
    }
15
    return true;
16
  }
17
}
modules/uoa-services-portal/trunk/portal-2/src/app/utils/piwik/piwik.service.ts
1
import {Injectable} from '@angular/core';
2
import {Http, Response, Headers, RequestOptions, URLSearchParams} from '@angular/http';
3
import {Observable}     from 'rxjs/Observable';
4
import 'rxjs/add/observable/of';
5
import 'rxjs/add/operator/do';
6
import 'rxjs/add/operator/share';
7
import {Location} from '@angular/common';
8

  
9
import {OpenaireProperties} from '../properties/openaireProperties';
10
import {StringUtils} from '../string-utils.class';
11

  
12

  
13
@Injectable()
14
export class PiwikService {
15
    private piwikbaseUrl:string = "";
16
    constructor(private http: Http, private location: Location ) {}
17

  
18
    trackView (title):any {
19

  
20
      var ua = this.getUserAgent();
21
      var referrer = this.getReferrer();
22
      if(typeof location !== 'undefined'){
23
            var url = OpenaireProperties.getPiwikBaseURL()+"&rec=1&url="+StringUtils.URIEncode(location.href)+"&action_name="+StringUtils.URIEncode(title)+
24
            ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+
25
            ((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):'');
26
            console.log("Piwik - trackDownload: " + url);
27

  
28
            return this.http.get( url);
29
                          // .do(request => console.info("Piwik request completed" ));
30

  
31
      }
32
    }
33
    trackDownload (downloadURL):any {
34
      var ua = this.getUserAgent();
35
      var referrer = this.getReferrer();
36
      var url = OpenaireProperties.getPiwikBaseURL()+"&rec=1&url="+StringUtils.URIEncode(downloadURL)+"&download="+StringUtils.URIEncode(downloadURL)+
37
      ((ua != null && ua.length > 0)?('&ua='+StringUtils.URIEncode(ua)):'')+
38
      ((referrer != null && referrer.length > 0)?('&urlref='+StringUtils.URIEncode(referrer)):'');
39
      console.log("Piwik - trackDownload: "+url);
40

  
41
      return this.http.get( url)
42
                    .do(request => console.info("Piwik request completed" ));
43

  
44
    }
45
    private getUserAgent(){
46
      if (typeof navigator !== 'undefined') {
47
        console.log("navigator.userAgent:" + navigator.userAgent);
48
        return navigator.userAgent;
49

  
50
      }else{
51
        return null;
52
      }
53
    }
54
    private getReferrer(){
55
      var referrer = "";
56
      if (typeof document !== 'undefined') {
57
        console.log("document.referrer:" + document.referrer);
58
        referrer = document.referrer;
59

  
60
      }
61
      if((referrer == null || referrer.length == 0)&&typeof localStorage !== 'undefined'){
62

  
63
          referrer =localStorage.getItem('previousRoute');
64
       }
65
       return referrer;
66
    }
67
    parse(data:any){
68
    }
69

  
70
}
modules/uoa-services-portal/trunk/portal-2/src/app/utils/piwik/piwikService.module.ts
1
import { NgModule }            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4

  
5
import {PiwikService} from './piwik.service';
6

  
7

  
8
@NgModule({
9
  imports: [
10
    CommonModule, FormsModule,
11

  
12
  ],
13
  declarations: [
14

  
15
  ],
16
  providers: [ PiwikService ],
17
  exports: [
18

  
19
    ]
20
})
21
export class PiwikServiceModule{ }
modules/uoa-services-portal/trunk/portal-2/src/app/utils/properties/openaireProperties.ts
90 90

  
91 91
    private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
92 92

  
93
    private static piwikBaseUrl =" https://analytics.openaire.eu/piwik.php?idsite=6";
94
    private static enablePiwikTrack:boolean = false;
95

  
93 96
    private static loginUrl ="http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/openid_connect_login";
94 97
    private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login";
95 98

  
......
312 315
      }else{
313 316
        return this.uploadService;
314 317
      }
315
        // return this.uploadService;
316 318
    }
317 319
    //vocabularies API
318 320
    public static getVocabulariesAPI():string{
319 321
        return this.vocabulariesAPI;
320 322
    }
323
    public static getPiwikBaseURL():string{
324
        return this.piwikBaseUrl;
325
    }
326
    public static isPiwikTrackEnabled():boolean{
327
        return this.enablePiwikTrack;
328
    }
321 329
    public static getLoginURL():string{
322 330
      if(this.productionMode){
323 331
        return this.loginUrl_pm;
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/find/mainSearch.module.ts
17 17
import {SearchFormModule} from  '../searchUtils/searchForm.module';
18 18
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
19 19
import {FreeGuard} from'../../login/freeGuard.guard';
20
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
21
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
20 22

  
21 23
@NgModule({
22 24
  imports: [
23 25
    CommonModule, FormsModule, RouterModule,
24 26
    DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule,
25 27
    PublicationsServiceModule, OrganizationsServiceModule,
26
    BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule//, SearchFilterModalModule
28
    BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule, PiwikServiceModule//, SearchFilterModalModule
27 29

  
28 30
  ],
29 31
  declarations: [
30 32
    SearchComponent
31 33
   ],
32
  providers:[FreeGuard
34
  providers:[FreeGuard, PreviousRouteRecorder
33 35
    ],
34 36
  exports: [
35 37
    SearchComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/find/mainSearch-routing.module.ts
3 3

  
4 4
import{SearchComponent} from './search.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: SearchComponent, canActivate: [FreeGuard] }
11
     	{ path: '', component: SearchComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/find/search.component.ts
23 23
import {RouterHelper} from '../../utils/routerHelper.class';
24 24
import {NumberUtils} from '../../utils/number-utils.class';
25 25
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
26
import {PiwikService} from '../../utils/piwik/piwik.service';
26 27

  
27 28
@Component({
28 29
  changeDetection: ChangeDetectionStrategy.Default,
......
309 310
     `
310 311
})
311 312
export class SearchComponent {
312
  public sub: any;
313
  public sub: any; piwiksub: any;
313 314
  public subfunders: any;
314 315
  public reloadPublications: boolean;
315 316
  public reloadDatasets: boolean;
......
358 359
      private _searchDatasetsService: SearchDatasetsService,
359 360
      private _searchOrganizationsService: SearchOrganizationsService,
360 361
      private _refineFieldResultsService:RefineFieldResultsService,
361
      private location: Location, private _meta: Meta ) {
362
    this.fetchPublications = new FetchPublications(this._searchPublicationsService);
363
    this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
364
    this.fetchProjects = new FetchProjects(this._searchProjectsService);
365
    this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
366
    this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService);
362
      private location: Location, private _meta: Meta,private _piwikService:PiwikService ) {
363
          this.fetchPublications = new FetchPublications(this._searchPublicationsService);
364
          this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
365
          this.fetchProjects = new FetchProjects(this._searchProjectsService);
366
          this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
367
          this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService);
367 368

  
368
    var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
369
    var title = "Search publications, datasets, projects... | OpenAIRE";
370
    var url = OpenaireProperties.getBaseLink()+this._router.url;
371
    this._meta.setTitle(title);
372
    this._meta.updateMeta("description", description);
373
    this._meta.updateProperty("og:description", description);
374
    this._meta.updateProperty("og:title", title);
375
    this._meta.updateProperty("og:url", url);
376
    this.getNumbers();
369
          var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
370
          var title = "Search publications, datasets, projects... | OpenAIRE";
371
          var url = OpenaireProperties.getBaseLink()+this._router.url;
372
          this._meta.setTitle(title);
373
          this._meta.updateMeta("description", description);
374
          this._meta.updateProperty("og:description", description);
375
          this._meta.updateProperty("og:title", title);
376
          this._meta.updateProperty("og:url", url);
377
          this.getNumbers();
378
          if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
379
            this.piwiksub = this._piwikService.trackView("Search publications, datasets, projects... | OpenAIRE").subscribe();
380
          }
377 381

  
378 382
  }
379 383

  
......
392 396
  public ngOnDestroy() {
393 397
    this.sub.unsubscribe();
394 398
    this.subfunders.unsubscribe();
399
    if(this.piwiksub){
400
  this.piwiksub.unsubscribe();
401
}
395 402
    if(this.keyword !=null && this.keyword.length > 0){
396 403
        if(this.subPub){
397 404
          this.subPub.unsubscribe();
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts
1 1
import { NgModule } from '@angular/core';
2 2
import { RouterModule } from '@angular/router';
3

  
3
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
4 4
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6 6

  
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard] }
10
     	{ path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts
3 3

  
4 4
import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard]}
11
     	{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder]}
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts
3 3

  
4 4
import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard] }
11
     	{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts
3 3

  
4 4
import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard] }
11
     	{ path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts
3 3

  
4 4
import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard] }
11
     	{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts
1 1
import {Component, Input, ViewChild, Output, EventEmitter,ElementRef} from '@angular/core';
2 2
import {Observable}       from 'rxjs/Observable';
3 3
import {Location} from '@angular/common';
4
import {  Router} from '@angular/router';
5

  
4 6
import { Filter, Value} from './searchHelperClasses.class';
5 7
import {SearchResult}     from '../../utils/entities/searchResult';
6 8
import {SearchFields} from '../../utils/properties/searchFields';
......
12 14
import {SearchFilterModalComponent} from './searchFilterModal.component';
13 15
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
14 16
import { ErrorCodes} from '../../utils/properties/openaireProperties';
17
import {PiwikService} from '../../utils/piwik/piwik.service';
15 18

  
16 19

  
17 20
@Component({
......
136 139
  @Input() disableForms: boolean = false;
137 140
  @Input() tableView: boolean = false;
138 141
  @Input() searchFormClass: string = "searchForm";
139

  
140 142
  @ViewChild (ModalLoading) loading : ModalLoading ;
141 143
  public fieldIdsMap;//:  { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string  }};
142 144
  private searchFieldsHelper:SearchFields = new SearchFields();
143 145
  private queryParameters: Map<string, string>  = new Map<string,string>();
144 146
  private baseURLWithParameters:string = '';
145
  private sub: any;
147
  private sub: any; piwiksub: any;
146 148
  public countFilters= 0;
147 149
  public urlParam: string;
148 150
  public parameterNames:string[] =[];
......
151 153
  //@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
152 154
  public currentFilter: Filter;
153 155

  
154
  constructor (private location: Location , private _meta: Meta,private element: ElementRef) {
156
  constructor (private location: Location , private _meta: Meta,private element: ElementRef,private _piwikService:PiwikService, private router: Router) {
155 157
   }
156 158

  
157 159
  ngOnInit() {
......
165 167
        if(typeof window !== 'undefined') {
166 168
          this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname);
167 169
        }
170
        if(typeof document !== 'undefined' && OpenaireProperties.isPiwikTrackEnabled()){
171
          this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
172
        }
168 173
        // console.info(this.entityType + "   " + this.urlParam + this.type);
169 174
  }
170 175
  ngAfterViewChecked(){
171 176

  
172 177
  }
173

  
178
  ngOnDestroy() {
179
    if(this.piwiksub){
180
      this.piwiksub.unsubscribe();
181
    }
182
  }
174 183
  toggleModal($event) {
175 184
    this.currentFilter = $event.value;
176 185
    //this.searchFilterModal.open();
......
337 346
  */
338 347
  public updateBaseUrlWithParameters(filters:Filter[]){
339 348
    this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(filters,false);
349

  
340 350
  }
341 351
  /*
342 352
  *
......
509 519
    var indexQuery = this.createIndexQueryParameters(this.filters);
510 520

  
511 521
    this.location.go(location.pathname,urlParameters);
512

  
522
/* Code For Piwik*/
523
    if (typeof localStorage !== 'undefined') {
524
      console.log("In PreviousRouteRecorder : "+this.router.url );
525
      localStorage.setItem('previousRoute', this.router.url);
526
    }
527
    if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
528
      this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
529
    }
530
    /* End Piwik Code */
513 531
    this.queryChange.emit({
514 532
        value: queryParameters,
515 533
        index:indexQuery
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchPageTableView.component.ts
13 13
import { ErrorCodes} from '../../utils/properties/openaireProperties';
14 14
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
15 15
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
16
import {PiwikService} from '../../utils/piwik/piwik.service';
16 17

  
17 18
@Component({
18 19
    selector: 'search-page-table',
......
178 179
  @ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
179 180
  public currentFilter: Filter;
180 181
  public errorCodes:ErrorCodes = new ErrorCodes();
181

  
182
  constructor (private location: Location , private _meta: Meta) {
182
  piwiksub: any;
183
  constructor (private location: Location , private _meta: Meta, private _piwikService:PiwikService) {
183 184
   }
184 185

  
185 186
  ngOnInit() {
......
188 189
        if(typeof window !== 'undefined') {
189 190
          this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname);
190 191
        }
192
        if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
193
          this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
194
        }
191 195
  }
192

  
196
  ngOnDestroy() {
197
     if(this.piwiksub){
198
  this.piwiksub.unsubscribe();
199
}
200
  }
193 201
  public sortByOrganization = (dataprovider: any) => {
194 202
    if(dataprovider.organizations && dataprovider.organizations.length > 0) {
195 203
      return dataprovider.organizations[0].name.toUpperCase();
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.module.ts
11 11
import{SearchPagingModule} from './searchPaging.module';
12 12

  
13 13
import {AdvancedSearchFormModule} from '../searchUtils/advancedSearchForm.module';
14
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
15
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
14 16

  
15 17
@NgModule({
16 18
  imports: [
17
    CommonModule, FormsModule,  RouterModule, SearchResultsModule, LoadingModalModule, ReportsServiceModule, SearchPagingModule, AdvancedSearchFormModule, SearchDownloadModule
19
    CommonModule, FormsModule,  RouterModule, SearchResultsModule, LoadingModalModule, ReportsServiceModule, SearchPagingModule, AdvancedSearchFormModule, SearchDownloadModule, PiwikServiceModule
18 20
  ],
19 21
  declarations: [
20 22
    AdvancedSearchPageComponent,
21 23
],
22 24

  
23 25
  providers:[
26
    PreviousRouteRecorder
24 27
  ],
25 28
  exports: [
26 29
    AdvancedSearchPageComponent,
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchPage.module.ts
15 15
import{SearchPagingModule} from './searchPaging.module';
16 16
import {SearchDownloadModule} from './searchDownload.module';
17 17
import {ModalModule} from '../../utils/modal/modal.module';
18
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
19
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
18 20

  
19 21

  
20 22
@NgModule({
21 23
  imports: [
22 24
    CommonModule, FormsModule,RouterModule,  SearchFormModule, SearchResultsModule,
23
    /*DatasourceTableViewModule,*/ LoadingModalModule, ReportsServiceModule,
24
    SearchPagingModule, SearchDownloadModule, ModalModule, SearchFilterModule
25
    LoadingModalModule, ReportsServiceModule,
26
    SearchPagingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule
25 27
  ],
26 28
  declarations: [
27
    SearchPageComponent//,
28
    //SearchFilterComponent,
29
    //SearchFilterModalComponent
30
    ,
29
    SearchPageComponent
31 30
],
32 31

  
33 32
  providers:[
33
    PreviousRouteRecorder
34 34
  ],
35 35
  exports: [
36
    SearchPageComponent//,
37
    //SearchFilterComponent,
38
    //SearchFilterModalComponent
36
    SearchPageComponent
39 37
    ]
40 38
})
41 39
export class SearchPageModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/advancedSearchPage.component.ts
1 1
import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core';
2 2
import {Observable}       from 'rxjs/Observable';
3 3
import {Location} from '@angular/common';
4
import {  Router} from '@angular/router';
4 5
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
5 6
import {SearchResult}     from '../../utils/entities/searchResult';
6 7
import {SearchFields} from '../../utils/properties/searchFields';
......
9 10
import {StringUtils, Dates} from '../../utils/string-utils.class';
10 11
import { Meta} from '../../../angular2-meta';
11 12
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
13
import {PiwikService} from '../../utils/piwik/piwik.service';
12 14

  
13 15
@Component({
14 16
    selector: 'advanced-search-page',
......
67 69
  @Input() csvPath: string;
68 70
  @Input() simpleSearchLink: string = "";
69 71
  @Input() disableForms:boolean = false;
70

  
72
  piwiksub: any;
71 73
  public parameterNames:string[] =[];
72 74
  public parameterValues:string[] =[];
73 75

  
......
75 77
  public baseURLWithParameters:string = '';
76 78

  
77 79
  @Output() queryChange  = new EventEmitter();
78
  constructor (private location: Location, private _meta: Meta) {
80
  constructor (private location: Location, private _meta: Meta, private _piwikService:PiwikService, private router: Router) {
79 81
   }
80 82

  
81 83
  ngOnInit() {
......
88 90
      this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
89 91
     this.updateBaseUrlWithParameters();
90 92
     this.defineUrlParam();
93
     if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
94
       this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
95
     }
91 96
  }
97

  
98
  ngOnDestroy() {
99
    if(this.piwiksub){
100
  this.piwiksub.unsubscribe();
101
}
102
  }
92 103
  updateDescription(description:string){
93 104
    this._meta.updateMeta("description", description);
94 105
    this._meta.updateProperty("og:description", description);
......
249 260
    this.queryChange.emit({
250 261
        value: queryParameters
251 262
    });
252

  
263
    /* Code For Piwik*/
264
        if (typeof localStorage !== 'undefined') {
265
          console.log("In PreviousRouteRecorder : "+this.router.url );
266
          localStorage.setItem('previousRoute', this.router.url);
267
        }
268
        if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
269
          this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe();
270
        }
271
        /* End Piwik Code */
253 272
  }
254 273

  
255 274
  queryChanged($event) {
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/searchUtils/searchPageTableView.module.ts
19 19
import {DataTableModule} from "angular2-datatable";
20 20
import {ContentProvidersDatatablePipe} from '../../utils/pipes/contentProvidersDatatable.pipe';
21 21

  
22
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
23
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
22 24

  
23 25
@NgModule({
24 26
  imports: [
25 27
    CommonModule, FormsModule,RouterModule,  SearchFormModule, SearchResultsModule, /*DatasourceTableViewModule,*/ LoadingModalModule,
26
    ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, DataTableModule, SearchFilterModule
28
    ReportsServiceModule, SearchPagingModule, SearchDownloadModule, ModalModule, PagingModule, DataTableModule, SearchFilterModule, PiwikServiceModule
27 29
  ],
28 30
  declarations: [
29 31
    SearchPageTableViewComponent//,
......
34 36
],
35 37

  
36 38
  providers:[
39
    PreviousRouteRecorder
37 40
  ],
38 41
  exports: [
39 42
    SearchPageTableViewComponent//,
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable-routing.module.ts
3 3

  
4 4
import{SearchEntityRegistriesTableComponent} from './entityRegistriesTable.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchEntityRegistriesTableComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/journals-routing.module.ts
3 3

  
4 4
import{SearchJournalsComponent} from './journals.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchJournalsComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchJournalsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/journalsTable-routing.module.ts
3 3

  
4 4
import{SearchJournalsTableComponent} from './journalsTable.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchJournalsTableComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claimsAdmin/claimsAdmin.module.ts
6 6
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
7 7
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
8 8
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
9
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
9 10

  
10 11
@NgModule({
11 12
  imports: [
......
15 16
    DisplayClaimsModule
16 17

  
17 18
  ],
18
    providers:[AdminLoginGuard],
19
    providers:[AdminLoginGuard, PreviousRouteRecorder],
19 20
  declarations: [
20 21
    ClaimsAdminComponent
21 22
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claimsAdmin/claimsAdmin-routing.module.ts
3 3
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
4 4

  
5 5
import { ClaimsAdminComponent } from './claimsAdmin.component';
6
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
      { path: '', component: ClaimsAdminComponent, canActivate: [AdminLoginGuard]},
11
      { path: '', component: ClaimsAdminComponent, canActivate: [AdminLoginGuard],canDeactivate: [PreviousRouteRecorder]},
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts
3 3

  
4 4
import{SearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard]  }
11
     	{ path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts
3 3

  
4 4
import{SearchEntityRegistriesComponent} from './entityRegistries.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable-routing.module.ts
3 3

  
4 4
import{SearchCompatibleDataprovidersTableComponent} from './compatibleDataProvidersTable.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchCompatibleDataprovidersTableComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPublications-routing.module.ts
3 3

  
4 4
import{SearchPublicationsComponent} from './searchPublications.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchOrganizations-routing.module.ts
3 3

  
4 4
import{SearchOrganizationsComponent} from './searchOrganizations.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard] , canDeactivate: [PreviousRouteRecorder] }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchProjects-routing.module.ts
3 3

  
4 4
import{SearchProjectsComponent} from './searchProjects.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6

  
6
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
     	{ path: '', component: SearchProjectsComponent, canActivate: [FreeGuard]  }
10
     	{ path: '', component: SearchProjectsComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder]  }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositBySubjectResult-routing.module.ts
3 3

  
4 4
import { DepositBySubjectResultComponent } from './depositBySubjectResult.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard]  }
11
     	{ path: '', component: DepositBySubjectResultComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder]   }
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositBySubjectResult.component.ts
10 10
import { Meta} from '../../../angular2-meta';
11 11

  
12 12
import {RouterHelper} from '../../utils/routerHelper.class';
13
import {PiwikService} from '../../utils/piwik/piwik.service';
13 14

  
14 15
@Component({
15 16
    selector: 'deposit-by-subject-result',
......
94 95

  
95 96
    sub: any;
96 97
    subDataproviders: any;
98
    piwiksub: any;
97 99
    public fetchDataproviders : FetchDataproviders;
98 100

  
99 101
    public routerHelper:RouterHelper = new RouterHelper();
......
107 109

  
108 110
    constructor (private _router: Router,
109 111
        private  route: ActivatedRoute,
110
        private _searchDataprovidersService: SearchDataprovidersService,  private _meta: Meta) {
112
        private _searchDataprovidersService: SearchDataprovidersService,  private _meta: Meta, private _piwikService:PiwikService) {
111 113

  
112 114
            this.zenodo = OpenaireProperties.getZenodoURL();
113 115
            this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
......
116 118
            this.updateTitle("Deposit "+this.requestFor);
117 119
            this.updateDescription("Openaire,  repositories, open access,  data provider, compatibility, organization, deposit "+ this.requestFor);
118 120
            this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
121
            if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
122
              this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
123
            }
119 124
        }
120 125
        updateDescription(description:string){
121 126
          this._meta.updateMeta("description", description);
......
141 146
            this.searchDataproviders();
142 147
        });
143 148
    }
149
     
144 150
    totalPages(): number {
145 151
        let totalPages:any = this.fetchDataproviders.searchUtils.totalResults/(this.fetchDataproviders.searchUtils.size);
146 152
        if(!(Number.isInteger(totalPages))) {
......
161 167
      if(this.subDataproviders != undefined) {
162 168
          this.subDataproviders.unsubscribe();
163 169
      }
170
      if(this.piwiksub){
171
  this.piwiksub.unsubscribe();
172
}
164 173
    }
165 174

  
166 175
    public searchDataproviders() {
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositBySubjectResults.module.ts
7 7
import {DepositBySubjectResultsRoutingModule} from './depositBySubjectResult-routing.module';
8 8
import {DepoditModule} from '../deposit.module';
9 9
import {FreeGuard} from'../../login/freeGuard.guard';
10
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
10 11
import {PagingModule } from '../../utils/paging.module';
11

  
12

  
13

  
14 12
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
15

  
16 13
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
17 14

  
18 15

  
19

  
20 16
@NgModule({
21 17
  imports: [
22 18
    CommonModule, FormsModule,
......
31 27
  exports: [
32 28
    DepositBySubjectResultComponent,
33 29
   ],
34
  providers:    [FreeGuard  ]
30
  providers:    [FreeGuard,PreviousRouteRecorder  ]
35 31
})
36 32
export class DepositBySubjectResultsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublicationsResult-routing.module.ts
1 1
import { NgModule } from '@angular/core';
2 2
import { RouterModule } from '@angular/router';
3

  
3
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
4 4
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6 6

  
7 7
@NgModule({
8 8
  imports: [
9 9
    RouterModule.forChild([
10
      { path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard]  }
10
      { path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard]  ,canDeactivate: [PreviousRouteRecorder] }
11 11

  
12 12
    ])
13 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/deposit.component.ts
3 3
import { Router } from '@angular/router';
4 4
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
5 5
import { Meta} from '../../angular2-meta';
6
import {PiwikService} from '../utils/piwik/piwik.service';
6 7

  
7 8

  
8 9
@Component({
......
65 66
    public errorCodes:ErrorCodes = new ErrorCodes();
66 67
    public selectedId: string = "";
67 68
    public warningMessage: string = "";
69
    piwiksub:any;
68 70

  
69
    constructor (private _router: Router, private _meta: Meta) {
71
    constructor (private _router: Router, private _meta: Meta, private _piwikService:PiwikService) {
70 72

  
71 73
        this.openAccess = OpenaireProperties.getOpenAccess();
72 74
        this.openAccessRepo = OpenaireProperties.getOpenAccessRepo();
......
77 79
        this.updateTitle("Deposit "+this.requestFor);
78 80
        this.updateDescription("Openaire,  repositories, open access,  data provider, compatibility, organization, deposit "+ this.requestFor);
79 81
        this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
82
        this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe();
80 83
    }
84
    ngOnDestroy() {
85
      if(this.piwiksub){
86
  this.piwiksub.unsubscribe();
87
}
88
    }
81 89
    updateDescription(description:string){
82 90
      this._meta.updateMeta("description", description);
83 91
      this._meta.updateProperty("og:description", description);
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claimsByToken/claimsByToken.module.ts
17 17

  
18 18
import {PagingModule} from '../../utils/paging.module';
19 19
import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe';
20
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
20 21

  
21 22

  
22 23
@NgModule({
......
35 36
  ],
36 37
  providers:[
37 38
    ClaimsByTokenService,
38
    LoginGuard
39
    LoginGuard, PreviousRouteRecorder
39 40
  ],
40 41
  declarations: [
41 42
    ClaimsByTokenComponent, ClaimsDatatablePipe
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claimsByToken/claimsByToken-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3
import { LoginGuard} from'../../login/loginGuard.guard';
4 4
import { ClaimsByTokenComponent } from './claimsByToken.component';
5
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
      { path: '', component: ClaimsByTokenComponent, canActivate: [LoginGuard]}
10
      { path: '', component: ClaimsByTokenComponent, canActivate: [LoginGuard],canDeactivate: [PreviousRouteRecorder]}
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/claims/directLinking/directLinking-routing.module.ts
3 3
import { LoginGuard} from'../../login/loginGuard.guard';
4 4

  
5 5
import { DirectLinkingComponent } from './directLinking.component';
6
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
      { path: '', component: DirectLinkingComponent, canActivate: [LoginGuard]},
11
      { path: '', component: DirectLinkingComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/claims/myClaims/myClaims-routing.module.ts
3 3
import { LoginGuard} from'../../login/loginGuard.guard';
4 4

  
5 5
import { MyClaimsComponent } from './myClaims.component';
6
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
      { path: '', component: MyClaimsComponent, canActivate: [LoginGuard]},
11
      { path: '', component: MyClaimsComponent, canActivate: [LoginGuard], canDeactivate: [PreviousRouteRecorder]},
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/error/error-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import { ErrorPageComponent } from './errorPage.component';
5
import {PreviousRouteRecorder} from'../utils/piwik/previousRouteRecorder.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
      { path: 'error', component: ErrorPageComponent},
10
      { path: '**', component: ErrorPageComponent},
10
      { path: 'error', component: ErrorPageComponent,canDeactivate: [PreviousRouteRecorder] },
11
      { path: '**', component: ErrorPageComponent,canDeactivate: [PreviousRouteRecorder] },
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/dataset/dataset-routing.module.ts
3 3

  
4 4
import { DatasetComponent } from './dataset.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
 imports: [
9 10
  RouterModule.forChild([
10
    { path: '', component: DatasetComponent, canActivate: [FreeGuard] }
11
    { path: '', component: DatasetComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
11 12
  ])
12 13
]
13 14
})
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/organization/organization-routing.module.ts
3 3

  
4 4
import { OrganizationComponent } from './organization.component';
5 5
import {FreeGuard} from'../../login/freeGuard.guard';
6
import {PreviousRouteRecorder} from'../../utils/piwik/previousRouteRecorder.guard';
6 7

  
7 8
@NgModule({
8 9
 imports: [
9 10
  RouterModule.forChild([
10
    { path: '', component: OrganizationComponent, canActivate: [FreeGuard] }
11
    { path: '', component: OrganizationComponent, canActivate: [FreeGuard],canDeactivate: [PreviousRouteRecorder] }
11 12
  ])
12 13
]
13 14
})
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/project/project.component.ts
16 16
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
17 17
import { Meta} from '../../../angular2-meta';
18 18

  
19
import {PiwikService} from '../../utils/piwik/piwik.service';
19 20

  
20 21
@Component({
21 22
    selector: 'project',
......
50 51
  public errorMessage = "";
51 52
  public showLoading: boolean = true;
52 53

  
53
  sub: any;
54
  sub: any;piwiksub: any;
54 55

  
55 56
  public activeTab: string = "Publications";
56 57
  public reloadDatasets: boolean = true;
......
66 67

  
67 68
  constructor ( private element: ElementRef,
68 69
                private _projectService: ProjectService,
70
                private _piwikService:PiwikService,
69 71
                private  route: ActivatedRoute,
70 72
                private _searchPublicationsService: SearchPublicationsService,
71 73
                private _searchDatasetsService: SearchDatasetsService,
......
78 80
    this.sub =  this.route.queryParams.subscribe(params => {
79 81
        this.metricsClicked = false;
80 82
        this.statsClicked = false;
81

  
82 83
        this.fetchPublications = new FetchPublications( this._searchPublicationsService);
83 84
        this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
84 85

  
......
130 131

  
131 132
  ngOnDestroy() {
132 133
    this.sub.unsubscribe();
134
    if(this.piwiksub){
135
  this.piwiksub.unsubscribe();
136
}
133 137
  }
134 138

  
135 139
  createClipboard() {
......
186 190
          }
187 191
          this.updateTitle(this.projectName);
188 192
          this.updateDescription("project, funding, open access, publications, datasets, "+this.projectName+ ","+this.projectInfo.funder);
193
          if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){
194
            this.piwiksub = this._piwikService.trackView(this.projectName).subscribe();
195
          }
196

  
189 197
          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 };
190 198

  
191 199
          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';
modules/uoa-services-portal/trunk/portal-2/src/app/sharedComponents/sharedComponents.module.ts
11 11
import {UserMiniComponent} from '../login/userMini.component';
12 12

  
13 13

  
14

  
14 15
@NgModule({
15 16
  imports: [
16 17
    CommonModule, FormsModule,
modules/uoa-services-portal/trunk/portal-2/src/app/claims/directLinking/directLinking.module.ts
14 14
import {PublicationsServiceModule} from '../../services/publicationsService.module';
15 15
import {DatasetsServiceModule} from '../../services/datasetsService.module';
16 16
import {LoginGuard} from'../../login/loginGuard.guard';
17
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
17 18

  
18 19

  
19 20

  
......
25 26

  
26 27

  
27 28
  ],
28
  providers:[LoginGuard],
29
  providers:[LoginGuard, PreviousRouteRecorder],
29 30
  declarations: [
30 31
    DirectLinkingComponent
31 32
  ], exports:[DirectLinkingComponent]
modules/uoa-services-portal/trunk/portal-2/src/app/claims/myClaims/myClaims.module.ts
6 6
// import{ClaimServiceModule} from '../claim-utils/service/claimsService.module';
7 7
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
8 8
import {LoginGuard} from'../../login/loginGuard.guard';
9
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
9 10

  
10 11
@NgModule({
11 12
  imports: [
......
15 16
    DisplayClaimsModule
16 17

  
17 18
  ],
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff