From 881ea5443dc10483104b23cc1ffb2716b4f4117b Mon Sep 17 00:00:00 2001 From: "sofia.baltzi" Date: Tue, 17 Apr 2018 13:00:23 +0000 Subject: [PATCH] Replace meta service import and use with meta and title from angular/platform-browser for user, publication, claimAdmin,claimsByToken, directLinking, linkingGeneric, myClaims, depositBySubject, depositBySubjectResult, deposit, depositResult, dataProvider, htmlProjectReport, organization, project, software, search, advancedSearchPage, searchPage and searchPageTableView component git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51835 d315682c-612b-4755-9ff5-7f18f6832af3 --- claims/claimsAdmin/claimsAdmin.component.ts | 22 +++--- .../claimsByToken/claimsByToken.component.ts | 39 ++++++---- .../directLinking/directLinking.component.ts | 34 +++++---- claims/linking/linkingGeneric.component.ts | 32 +++++--- claims/myClaims/myClaims.component.ts | 14 ++-- .../datasets/depositBySubject.component.ts | 34 ++++++--- .../depositBySubjectResult.component.ts | 64 +++++++++------- deposit/deposit.component.ts | 44 ++++++----- deposit/depositResult.component.ts | 43 ++++++----- .../dataProvider/dataProvider.component.ts | 60 ++++++++------- .../htmlProjectReport.component.ts | 38 ++++++---- .../organization/organization.component.ts | 62 ++++++++-------- landingPages/project/project.component.ts | 68 +++++++++-------- .../publication/publication.component.ts | 34 +++++---- .../publication/publication.module.ts | 56 ++++++++------ landingPages/software/software.component.ts | 39 +++++----- login/user.component.ts | 26 ++++--- login/user.module.ts | 33 +++++---- searchPages/find/search.component.ts | 74 +++++++++---------- .../advancedSearchPage.component.ts | 70 ++++++++++-------- .../searchUtils/searchPage.component.ts | 62 +++++++++------- .../searchPageTableView.component.ts | 72 ++++++++++-------- 22 files changed, 586 insertions(+), 434 deletions(-) diff --git a/claims/claimsAdmin/claimsAdmin.component.ts b/claims/claimsAdmin/claimsAdmin.component.ts index f315cdd5..bfa26aa6 100644 --- a/claims/claimsAdmin/claimsAdmin.component.ts +++ b/claims/claimsAdmin/claimsAdmin.component.ts @@ -1,7 +1,9 @@ -import {Component, ViewChild, Input} from '@angular/core'; -import {Location} from '@angular/common'; -import {Observable} from 'rxjs/Observable'; -import { Meta} from '../../sharedComponents/metaService'; +import {Component, ViewChild, Input} from '@angular/core'; +import {Location} from '@angular/common'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; + @Component({ selector: 'claims-admin', @@ -35,12 +37,14 @@ export class ClaimsAdminComponent { @Input() fetchId:string; @Input() isConnect:boolean = false; - constructor ( private _meta: Meta ) { - if(this.isConnect){ - this._meta.setTitle("OpenAIRE Connect | Claims Administrator"); + constructor ( private _meta: Meta, private _title: Title) { + var titleConnect = "OpenAIRE Connect | Claims Administrator"; + var title = "OpenAIRE | Claims Administrator"; - }else{ - this._meta.setTitle("OpenAIRE | Claims Administrator"); + if(this.isConnect) { + this._title.setTitle(titleConnect); + } else { + this._title.setTitle(title); } diff --git a/claims/claimsByToken/claimsByToken.component.ts b/claims/claimsByToken/claimsByToken.component.ts index ccb0b148..0d5fcc3c 100644 --- a/claims/claimsByToken/claimsByToken.component.ts +++ b/claims/claimsByToken/claimsByToken.component.ts @@ -1,19 +1,22 @@ import {Component, ViewChild, Input} from '@angular/core'; -import {Location} from '@angular/common'; -import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Params} from '@angular/router'; -import {ClaimsByTokenService} from './claimsByToken.service'; +import {Location} from '@angular/common'; +import {ActivatedRoute, Params} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import {ModalSelect} from '../../utils/modal/selectModal.component'; -import {ModalLoading} from '../../utils/modal/loading.component'; +import {DataTableDirective} from 'angular-datatables'; +import {Observable} from 'rxjs/Observable'; -import {Session} from '../../login/utils/helper.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import { Meta} from '../../sharedComponents/metaService'; -import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe'; -import { DataTableDirective } from 'angular-datatables'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe'; + +import {Session} from '../../login/utils/helper.class'; +import {RouterHelper} from '../../utils/routerHelper.class'; + +import {ModalSelect} from '../../utils/modal/selectModal.component'; +import {ModalLoading} from '../../utils/modal/loading.component'; + +import {ClaimsByTokenService} from './claimsByToken.service'; @Component({ selector: 'claims-project-manager', @@ -53,10 +56,14 @@ export class ClaimsByTokenComponent { @ViewChild (ModalSelect) selectModal : ModalSelect; @ViewChild (ModalLoading) loading : ModalLoading ; -properties:EnvProperties; + + properties:EnvProperties; + public routerHelper:RouterHelper = new RouterHelper(); - constructor ( private route: ActivatedRoute, private claimsByTokenService: ClaimsByTokenService, private _meta: Meta) { + constructor (private route: ActivatedRoute, + private claimsByTokenService: ClaimsByTokenService, + private _meta: Meta, private _title: Title) { } ngOnInit() { @@ -265,7 +272,9 @@ public sortByTitle2= (claim: any) => { updateTitle(title:string){ var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); + this._meta.updateTag({content:_title},"property='og:title'"); + this._title.setTitle(_title); + } } diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index 43818e33..fdc7a67a 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -1,14 +1,17 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Router} from '@angular/router'; -import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; -import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class'; -import {SearchPublicationsService} from '../../services/searchPublications.service'; -import {SearchDatasetsService} from '../../services/searchDatasets.service'; -import {SearchSoftwareService} from '../../services/searchSoftware.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Component, Input} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; + +import {EnvProperties} from '../../utils/properties/env-properties'; + +import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class'; + +import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; +import {SearchSoftwareService} from '../../services/searchSoftware.service'; -import { Meta} from '../../sharedComponents/metaService'; @Component({ selector: 'directLinking', @@ -34,9 +37,14 @@ export class DirectLinkingComponent { validInput:boolean = null;//'true; properties:EnvProperties; - constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, - private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private softwareSearch:SearchSoftwareService, private _meta: Meta) { - this._meta.setTitle("OpenAIRE | Direct Linking"); + constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, + private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, + private softwareSearch:SearchSoftwareService, private _meta: Meta, private _title: Title) { + + var title = "OpenAIRE | Direct Linking"; + + this._meta.updateTag({content:title},"property='og:title'"); + this._title.setTitle(title); } ngOnInit() { this.route.data diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index 14448bd2..ff08d7cf 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -1,12 +1,16 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Router} from '@angular/router'; -import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; -import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class'; -import {SearchPublicationsService} from '../../services/searchPublications.service'; -import {SearchDatasetsService} from '../../services/searchDatasets.service'; -import { Meta} from '../../sharedComponents/metaService'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Component, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; + +import {EnvProperties} from '../../utils/properties/env-properties'; + +import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class'; + +import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; declare var UIkit:any; @@ -38,9 +42,13 @@ export class LinkingGenericComponent { sub:any =null; properties:EnvProperties; - constructor ( private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, - private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, private _meta: Meta) { - this._meta.setTitle("OpenAIRE | Linking"); + constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, + private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService, + private _meta: Meta, private _title: Title) { + + var title = "OpenAIRE | Linking"; + this._meta.updateTag({content:title},"property='og:title'"); + this._title.setTitle(title); } ngOnInit() { this.route.data diff --git a/claims/myClaims/myClaims.component.ts b/claims/myClaims/myClaims.component.ts index 74b865ec..880f9c0e 100644 --- a/claims/myClaims/myClaims.component.ts +++ b/claims/myClaims/myClaims.component.ts @@ -1,7 +1,6 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import { Meta} from '../../sharedComponents/metaService'; - +import {Component, Input} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import {Title, Meta} from '@angular/platform-browser'; @Component({ selector: 'my-claims', @@ -26,8 +25,11 @@ import { Meta} from '../../sharedComponents/metaService'; }) export class MyClaimsComponent { - constructor ( private _meta: Meta ) { - this._meta.setTitle("OpenAIRE | My Claims"); + constructor (private _meta: Meta, private _title: Title) { + var title = "OpenAIRE | My Claims"; + + this._meta.updateTag({content:title},"property='og:title'"); + this._title.setTitle(title); } ngOnInit() { diff --git a/deposit/datasets/depositBySubject.component.ts b/deposit/datasets/depositBySubject.component.ts index 514697ec..d5e35f1e 100644 --- a/deposit/datasets/depositBySubject.component.ts +++ b/deposit/datasets/depositBySubject.component.ts @@ -1,10 +1,12 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import { Router, ActivatedRoute} from '@angular/router'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; -import { Meta} from '../../sharedComponents/metaService'; +import {Component, Input} from '@angular/core'; +import {Router, ActivatedRoute} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; +import {Observable} from 'rxjs/Observable'; + +import {EnvProperties} from '../../utils/properties/env-properties'; + +import {PiwikService} from '../../utils/piwik/piwik.service'; @Component({ @@ -29,17 +31,25 @@ export class DepositBySubjectComponent { @Input() subjectKeyword: string=''; @Input() piwikSiteId = null; properties:EnvProperties; - constructor (private _router: Router,private route: ActivatedRoute, private _meta: Meta, private _piwikService:PiwikService) { } + + constructor (private _router: Router,private route: ActivatedRoute, + private _meta: Meta, private _title: Title, + private _piwikService: PiwikService) { } ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; - this._meta.setTitle("Deposit by Subjects" ); - this._meta.updateProperty("og:title","Deposit by subjects"); - this._meta.updateProperty("og:url", data.envSpecific.baseLink+this._router.url); - this._meta.updateMeta("description", "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject"); - this._meta.updateProperty("og:description", "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject"); + var title = "Deposit by Subjects"; + var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit by subject" + var url = data.envSpecific.baseLink+this._router.url; + + this._title.setTitle(title); + this._meta.updateTag({content:title},"property='og:title'"); + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); + this._meta.updateTag({content:url},"property='og:url'"); + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this._piwikService.trackView(this.properties, "Deposit by subjects" , this.piwikSiteId).subscribe(); } diff --git a/deposit/datasets/depositBySubjectResult.component.ts b/deposit/datasets/depositBySubjectResult.component.ts index 54fb1263..c1a59f70 100644 --- a/deposit/datasets/depositBySubjectResult.component.ts +++ b/deposit/datasets/depositBySubjectResult.component.ts @@ -1,17 +1,20 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import { Router } from '@angular/router'; -import { ActivatedRoute } from '@angular/router'; -import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import { SearchDataprovidersService } from '../../services/searchDataproviders.service'; +import {Component, Input} from '@angular/core'; +import {Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import {OrganizationService} from '../../services/organization.service'; -import { Meta} from '../../sharedComponents/metaService'; +import {Observable} from 'rxjs/Observable'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {EnvProperties} from '../../utils/properties/env-properties'; + +import {ErrorCodes} from '../../utils/properties/errorCodes'; + +import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {RouterHelper} from '../../utils/routerHelper.class'; + +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {OrganizationService} from '../../services/organization.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; @Component({ selector: 'deposit-by-subject-result', @@ -44,20 +47,24 @@ export class DepositBySubjectResultComponent { piwiksub: any; properties:EnvProperties; - constructor ( private _router: Router, - private route: ActivatedRoute, - private _searchDataprovidersService: SearchDataprovidersService, - private _meta: Meta, private _piwikService:PiwikService) { + constructor (private _router: Router, + private route: ActivatedRoute, + private _searchDataprovidersService: SearchDataprovidersService, + private _meta: Meta, + private _title: Title, + private _piwikService:PiwikService) { this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); this.status = this.errorCodes.LOADING; - this.updateTitle("Deposit "+this.requestFor); - this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor); + + var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor; + var title = "Deposit "+this.requestFor; + + this.updateTitle(title); + this.updateDescription(description); } - - ngOnInit() { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { @@ -118,17 +125,18 @@ export class DepositBySubjectResultComponent { this.searchDataproviders(); } - private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + private updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - private updateTitle(title:string){ + private updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + private updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } } diff --git a/deposit/deposit.component.ts b/deposit/deposit.component.ts index f0493b7b..9c3d2897 100644 --- a/deposit/deposit.component.ts +++ b/deposit/deposit.component.ts @@ -1,9 +1,12 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import { Router, ActivatedRoute} from '@angular/router'; -import { Meta} from '../sharedComponents/metaService'; -import {PiwikService} from '../utils/piwik/piwik.service'; -import{EnvProperties} from '../utils/properties/env-properties'; +import {Component, Input} from '@angular/core'; +import {Router, ActivatedRoute} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; + +import {EnvProperties} from '../utils/properties/env-properties'; + +import {PiwikService} from '../utils/piwik/piwik.service'; @Component({ @@ -38,10 +41,15 @@ export class DepositComponent { piwiksub:any; properties:EnvProperties; - constructor ( private route: ActivatedRoute, private _router: Router, private _meta: Meta, private _piwikService:PiwikService) { + constructor (private route: ActivatedRoute, private _router: Router, + private _meta: Meta, private _title: Title, + private _piwikService:PiwikService) { - this.updateTitle("Deposit "+this.requestFor); - this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor); + var title = "Deposit "+this.requestFor; + var description = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor; + + this.updateTitle(title); + this.updateDescription(description); } ngOnInit() { this.route.data @@ -79,21 +87,21 @@ export class DepositComponent { } } - public valueChanged($event){ + public valueChanged($event) { this.selectedId = $event.value; } - private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + private updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - private updateTitle(title:string){ + private updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + private updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } } diff --git a/deposit/depositResult.component.ts b/deposit/depositResult.component.ts index 6c98f86f..09939a0f 100644 --- a/deposit/depositResult.component.ts +++ b/deposit/depositResult.component.ts @@ -1,16 +1,17 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ErrorCodes} from '../utils/properties/errorCodes'; -import { Router, ActivatedRoute } from '@angular/router'; -import { FetchDataproviders } from '../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import { SearchDataprovidersService } from '../services/searchDataproviders.service'; +import {Component, Input} from '@angular/core'; +import {Router, ActivatedRoute} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import {OrganizationService} from '../services/organization.service'; -import { Meta} from '../sharedComponents/metaService'; +import {Observable} from 'rxjs/Observable'; +import {ErrorCodes} from '../utils/properties/errorCodes'; + +import{EnvProperties} from '../utils/properties/env-properties'; import {RouterHelper} from '../utils/routerHelper.class'; +import {FetchDataproviders} from '../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {SearchDataprovidersService} from '../services/searchDataproviders.service'; +import {OrganizationService} from '../services/organization.service'; import {PiwikService} from '../utils/piwik/piwik.service'; -import{EnvProperties} from '../utils/properties/env-properties'; @Component({ selector: 'deposit-result', @@ -160,13 +161,19 @@ export class DepositResultComponent { private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService, private _organizationService: OrganizationService, - private _meta: Meta, private _piwikService:PiwikService) { + private _meta: Meta, + private _title: Title, + private _piwikService:PiwikService) { this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); this.status = this.errorCodes.LOADING; - this.updateTitle("Deposit "+this.requestFor); - this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor); + + var description = "Deposit "+this.requestFor; + var title = "Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor; + + this.updateTitle(title); + this.updateDescription(description); } ngOnInit() { @@ -274,17 +281,17 @@ export class DepositResultComponent { } } - private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + private updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } private updateTitle(title:string){ var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + this._meta.updateTag({content:url},"property='og:url'"); } } diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 37935848..c534337e 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -1,26 +1,31 @@ -import {Component, ViewChild, ElementRef, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {DataProviderService} from './dataProvider.service'; -import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; -import {ActivatedRoute, Router} from '@angular/router'; -import { Meta} from '../../sharedComponents/metaService'; -import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; -import { SearchPublicationsService } from '../../services/searchPublications.service'; -import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import { SearchDatasetsService } from '../../services/searchDatasets.service'; -import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import { SearchProjectsService } from '../../services/searchProjects.service'; -import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import { SearchDataprovidersService } from '../../services/searchDataproviders.service'; -import { RelatedDatasourcesTabComponent } from './relatedDatasourcesTab.component'; -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Component, ViewChild} from '@angular/core'; +import {ElementRef, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; import 'rxjs/add/operator/switch'; import 'rxjs/add/operator/switchMap'; +import {EnvProperties} from '../../utils/properties/env-properties'; + +import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; +import {DataProviderService} from './dataProvider.service'; +import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; +import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; +import {SearchProjectsService} from '../../services/searchProjects.service'; +import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {RelatedDatasourcesTabComponent} from './relatedDatasourcesTab.component'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {RouterHelper} from '../../utils/routerHelper.class'; +import {PiwikService} from '../../utils/piwik/piwik.service'; + + @Component({ selector: 'dataprovider', templateUrl: 'dataProvider.component.html', @@ -92,6 +97,7 @@ export class DataProviderComponent { private _piwikService:PiwikService, private route: ActivatedRoute, private _meta: Meta, + private _title: Title, private _router: Router, private _searchPublicationsService: SearchPublicationsService, private _searchDatasetsService: SearchDatasetsService, @@ -177,18 +183,18 @@ export class DataProviderComponent { } } - private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + private updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - private updateTitle(title:string){ + private updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + private updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } private initTabs(){ diff --git a/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/landingPages/htmlProjectReport/htmlProjectReport.component.ts index 028541c4..23d34776 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -1,11 +1,14 @@ -import {Component, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; +import {Component, Input} from '@angular/core'; import {ActivatedRoute, Params, Router} from '@angular/router'; -import {HtmlProjectReportService} from './htmlProjectReport.service'; -import {ProjectService} from '../project/project.service'; -import { Meta} from '../../sharedComponents/metaService'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; + +import {EnvProperties} from '../../utils/properties/env-properties'; + +import {HtmlProjectReportService} from './htmlProjectReport.service'; +import {ProjectService} from '../project/project.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; declare var UIkit: any; @@ -64,7 +67,9 @@ export class HtmlProjectReportComponent{ private htmlService: HtmlProjectReportService, private _piwikService:PiwikService, private _projectService: ProjectService, - private _meta: Meta, private _router: Router) { + private _meta: Meta, + private _title: Title, + private _router: Router) { } ngOnInit() { @@ -93,8 +98,11 @@ export class HtmlProjectReportComponent{ this.resultsType = 'software'; } - this.updateTitle("Project's "+this.resultsType+" report"); - this.updateDescription("project, project "+ this.resultsType +" report, funding, open access, publications, research data, software"); + var title = "Project's "+this.resultsType+" report"; + var description = "project, project "+ this.resultsType +" report, funding, open access, publications, research data, software"; + this.updateTitle(title); + this.updateDescription(description); + } else { this.showLoading = false; this.warningMessage="Requested type should be publication or research data or software"; @@ -238,16 +246,16 @@ export class HtmlProjectReportComponent{ } private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } private updateTitle(title:string){ var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + this._meta.updateTag({content:url},"property='og:url'"); } } diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index f2269bd8..3fa0b6ba 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -1,27 +1,29 @@ -import {Component, ViewChild, ElementRef, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {Subject} from 'rxjs/Subject'; -import {ActivatedRoute, Router} from '@angular/router'; +import {Component, ViewChild} from '@angular/core'; +import {ElementRef, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import {OrganizationService} from '../../services/organization.service'; -import {OrganizationInfo} from '../../utils/entities/organizationInfo'; -import {ReportsService} from '../../services/reports.service'; -import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; -import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import {SearchPublicationsService} from '../../services/searchPublications.service'; -import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; -import {SearchProjectsService} from '../../services/searchProjects.service'; -import { Meta} from '../../sharedComponents/metaService'; -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {SearchingProjectsTabComponent} from '../landing-utils/searchingProjectsInTab.component'; -import {RouterHelper} from '../../utils/routerHelper.class'; +import {Observable} from 'rxjs/Observable'; +import {Subject} from 'rxjs/Subject'; -import {ModalLoading} from '../../utils/modal/loading.component'; -import {AlertModal} from '../../utils/modal/alert'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import {StringUtils} from '../../utils/string-utils.class'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {OrganizationService} from '../../services/organization.service'; +import {OrganizationInfo} from '../../utils/entities/organizationInfo'; +import {ReportsService} from '../../services/reports.service'; +import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; +import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {SearchProjectsService} from '../../services/searchProjects.service'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {SearchingProjectsTabComponent} from '../landing-utils/searchingProjectsInTab.component'; +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'; +import {StringUtils} from '../../utils/string-utils.class'; +import {EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'organization', @@ -97,7 +99,9 @@ export class OrganizationComponent { private _searchDataprovidersService: SearchDataprovidersService, private _reportsService: ReportsService, private _searchPublicationsService: SearchPublicationsService, - private _searchProjectsService: SearchProjectsService, private _meta: Meta, + private _searchProjectsService: SearchProjectsService, + private _meta: Meta, + private _title: Title, private _router: Router) { this.fetchPublications = new FetchPublications(this._searchPublicationsService); @@ -425,18 +429,18 @@ export class OrganizationComponent { // }//); } - private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + private updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } private updateTitle(title:string){ var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + this._meta.updateTag({content:url},"property='og:url'"); } private openLoading(){ diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 5e29e50e..88678a2f 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -1,30 +1,35 @@ -import {Component, ViewChild, ElementRef, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Params, Router} from '@angular/router'; -import {ProjectService} from './project.service'; -import {ProjectInfo} from '../../utils/entities/projectInfo'; -import {RouterHelper} from '../../utils/routerHelper.class'; +import {Component, ViewChild} from '@angular/core'; +import {ElementRef, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Params} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; -import { SearchPublicationsService } from '../../services/searchPublications.service'; -import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import { SearchDatasetsService } from '../../services/searchDatasets.service'; -import { FetchSoftware } from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; -import { SearchSoftwareService } from '../../services/searchSoftware.service'; +import {Observable} from 'rxjs/Observable'; -import {ModalLoading} from '../../utils/modal/loading.component'; +import {ProjectService} from './project.service'; +import {ProjectInfo} from '../../utils/entities/projectInfo'; +import {RouterHelper} from '../../utils/routerHelper.class'; -import {ReportsService} from '../../services/reports.service'; -import { ErrorCodes} from '../../utils/properties/errorCodes'; -import { Meta} from '../../sharedComponents/metaService'; +import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; +import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; +import {SearchSoftwareService} from '../../services/searchSoftware.service'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {ModalLoading} from '../../utils/modal/loading.component'; + +import {ReportsService} from '../../services/reports.service'; +import {ErrorCodes} from '../../utils/properties/errorCodes' + +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'project', templateUrl: 'project.component.html', }) + export class ProjectComponent{ @Input() piwikSiteId = null; public projectInfo: ProjectInfo; @@ -94,7 +99,9 @@ properties:EnvProperties; private _searchPublicationsService: SearchPublicationsService, private _searchDatasetsService: SearchDatasetsService, private _searchSoftwareService: SearchSoftwareService, - private _reportsService: ReportsService, private _meta: Meta, + private _reportsService: ReportsService, + private _meta: Meta, + private _title: Title, private _router: Router) { } @@ -112,8 +119,11 @@ properties:EnvProperties; this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); - this.updateTitle("Project"); - this.updateDescription("project, funding, open access, publications, research data, software"); + var title = "Project"; + var description = "project, funding, open access, publications, research data, software"; + + this.updateTitle(title); + this.updateDescription(description); this.projectId = params['projectId']; var grantId = params['grantId']; @@ -375,18 +385,18 @@ actionsAfterGettingProjectInfo(){ this.pageViews = $event.pageViews; } - private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + private updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - private updateTitle(title:string){ + private updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + private updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } private openLoading(){ diff --git a/landingPages/publication/publication.component.ts b/landingPages/publication/publication.component.ts index a8b61c11..e7c532a9 100644 --- a/landingPages/publication/publication.component.ts +++ b/landingPages/publication/publication.component.ts @@ -1,14 +1,16 @@ -import {Component, ViewChild, ElementRef, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {PublicationService} from './publication.service'; -import {PublicationInfo} from '../../utils/entities/publicationInfo'; -import {ActivatedRoute, Router} from '@angular/router'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Component, ViewChild} from '@angular/core'; +import {ElementRef, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import { Meta} from '../../sharedComponents/metaService'; +import {Observable} from 'rxjs/Observable'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {PublicationInfo} from '../../utils/entities/publicationInfo'; +import {RouterHelper} from '../../utils/routerHelper.class'; + +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {PublicationService} from './publication.service'; @Component({ @@ -67,7 +69,9 @@ export class PublicationComponent { constructor ( private element: ElementRef, private _publicationService: PublicationService, private _piwikService:PiwikService, - private route: ActivatedRoute, private _meta: Meta, + private route: ActivatedRoute, + private _meta: Meta, + private _title: Title, private _router: Router) { } @@ -205,18 +209,18 @@ export class PublicationComponent { } private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } private updateTitle(title:string){ var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(title); + this._meta.updateTag({content:title},"property='og:title'"); } private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + this._meta.updateTag({content:url},"property='og:url'"); } public totalPages(totalResults: number): number { diff --git a/landingPages/publication/publication.module.ts b/landingPages/publication/publication.module.ts index 5472c560..92cade63 100644 --- a/landingPages/publication/publication.module.ts +++ b/landingPages/publication/publication.module.ts @@ -1,32 +1,40 @@ //import {MaterialModule} from '@angular/material'; -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { SharedModule } from '../../shared/shared.module'; -import { RouterModule } from '@angular/router'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {RouterModule} from '@angular/router'; -import { PublicationService} from './publication.service'; -import { PublicationComponent } from './publication.component'; // import { PublicationRoutingModule } from './publication-routing.module'; -import {MetricsModule} from '../landing-utils/metrics.module'; -import {IFrameModule} from '../../utils/iframe.module'; -import {AltMetricsModule} from '../../utils/altmetrics.module'; -import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; -import {PagingModule} from '../../utils/paging.module'; +import {SharedModule} from '../../shared/shared.module'; +import {MetricsModule} from '../landing-utils/metrics.module'; +import {ResultLandingModule} from '../landing-utils/resultLanding.module'; +import {LandingModule} from '../landing-utils/landing.module'; +import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; +import {IFrameModule} from '../../utils/iframe.module'; +import {AltMetricsModule} from '../../utils/altmetrics.module'; +import {PagingModule} from '../../utils/paging.module'; +import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module'; + +import {FreeGuard} from'../../login/freeGuard.guard'; +import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; +import {PublicationService} from './publication.service'; +import {PublicationComponent} from './publication.component'; + -import { ResultLandingModule } from '../landing-utils/resultLanding.module'; -import { LandingModule } from '../landing-utils/landing.module'; -import {FreeGuard} from'../../login/freeGuard.guard'; -import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; -import {MetaModule} from '../../sharedComponents/metaService.module'; -import { ConfigurationServiceModule } from '../../utils/configuration/configurationService.module'; @NgModule({ imports: [ - CommonModule, FormsModule, LandingModule,SharedModule, RouterModule, CiteThisModule, PagingModule, - ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, - MetaModule, ConfigurationServiceModule], - declarations: [PublicationComponent], - providers:[PublicationService, FreeGuard, IsRouteEnabled], - exports: [PublicationComponent] + CommonModule, FormsModule, LandingModule, SharedModule, RouterModule, + CiteThisModule, PagingModule, ResultLandingModule, IFrameModule, + MetricsModule, AltMetricsModule, ConfigurationServiceModule + ], + declarations: [ + PublicationComponent + ], + providers: [ + PublicationService, FreeGuard, IsRouteEnabled + ], + exports: [ + PublicationComponent + ] }) export class PublicationModule { } diff --git a/landingPages/software/software.component.ts b/landingPages/software/software.component.ts index f7db4774..d33bcec4 100644 --- a/landingPages/software/software.component.ts +++ b/landingPages/software/software.component.ts @@ -1,12 +1,16 @@ -import {Component, ViewChild, ElementRef, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {SoftwareService} from './software.service'; -import {SoftwareInfo} from '../../utils/entities/softwareInfo'; -import {ActivatedRoute, Router} from '@angular/router'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import { Meta} from '../../sharedComponents/metaService'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Component, ViewChild} from '@angular/core'; +import {ElementRef, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; + +import {SoftwareService} from './software.service'; +import {SoftwareInfo} from '../../utils/entities/softwareInfo'; + +import {RouterHelper} from '../../utils/routerHelper.class'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'software', @@ -53,6 +57,7 @@ export class SoftwareComponent { private _piwikService:PiwikService, private route: ActivatedRoute, private _meta: Meta, + private _title: Title, private _router: Router) { } @@ -151,18 +156,18 @@ export class SoftwareComponent { this.pageViews = $event.pageViews; } - private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + private updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - private updateTitle(title:string){ + private updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + private updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } public buildCurationTooltip() { diff --git a/login/user.component.ts b/login/user.component.ts index a89206ff..06850132 100644 --- a/login/user.component.ts +++ b/login/user.component.ts @@ -1,12 +1,14 @@ -import {Component, ElementRef} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Router} from '@angular/router'; +import {Component, ElementRef} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -// import {LoginService} from './login.service'; -import {User,Session} from './utils/helper.class'; -import {RouterHelper} from '../utils/routerHelper.class'; -import { Meta} from '../sharedComponents/metaService'; -import{EnvProperties} from '../utils/properties/env-properties'; +import {Observable} from 'rxjs/Observable'; + +// import {LoginService} from './login.service'; +import {User,Session} from './utils/helper.class'; +import {RouterHelper} from '../utils/routerHelper.class'; + +import {EnvProperties} from '../utils/properties/env-properties'; @Component({ selector: 'user', @@ -28,8 +30,12 @@ export class UserComponent { properties:EnvProperties; constructor( private router: Router, - private route: ActivatedRoute, private _meta: Meta) { - this._meta.setTitle("OpenAIRE | Login"); + private route: ActivatedRoute, + private _meta: Meta, + private _title: Title) { + + var title = "OpenAIRE | Login"; + this._title.setTitle(title); } ngOnInit() { diff --git a/login/user.module.ts b/login/user.module.ts index 48d36ffa..f546d8ed 100644 --- a/login/user.module.ts +++ b/login/user.module.ts @@ -1,24 +1,29 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; + +import {UserRoutingModule} from './user-routing.module'; + +import {UserComponent} from './user.component'; -import {UserComponent } from './user.component'; -import { UserRoutingModule } from './user-routing.module'; import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard'; -import {FreeGuard} from './freeGuard.guard'; -import {LoginGuard} from './loginGuard.guard'; -import {MetaModule} from '../sharedComponents/metaService.module'; +import {FreeGuard} from './freeGuard.guard'; +import {LoginGuard} from './loginGuard.guard'; +// import {LoginService} from './login.service'; -// import {LoginService} from './login.service'; @NgModule({ imports: [ - CommonModule, FormsModule, - UserRoutingModule, MetaModule - + CommonModule, FormsModule, UserRoutingModule, + ], + providers: [ + PreviousRouteRecorder, FreeGuard, LoginGuard ], - providers:[PreviousRouteRecorder, FreeGuard,LoginGuard ], declarations: [ UserComponent -], exports:[UserComponent] + ], + exports: [ + UserComponent + ] }) + export class UserModule { } diff --git a/searchPages/find/search.component.ts b/searchPages/find/search.component.ts index 01581d83..360e148b 100644 --- a/searchPages/find/search.component.ts +++ b/searchPages/find/search.component.ts @@ -1,31 +1,34 @@ -import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Location} from '@angular/common'; +import {Component, Input, Output} from '@angular/core'; +import {EventEmitter, ViewChild} from '@angular/core'; +import {ChangeDetectionStrategy} from '@angular/core'; +import {ViewEncapsulation} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Location} from '@angular/common'; +import {Title, Meta} from '@angular/platform-browser'; -import { Meta, MetaDefinition} from '../../sharedComponents/metaService'; +import {Observable} from 'rxjs/Observable'; -import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; -import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import { FetchSoftware } from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; -import { FetchOrganizations } from '../../utils/fetchEntitiesClasses/fetchOrganizations.class'; +import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class'; +import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; +import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; +import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class'; +import {FetchOrganizations} from '../../utils/fetchEntitiesClasses/fetchOrganizations.class'; -import {SearchPublicationsService} from '../../services/searchPublications.service'; -import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; -import {SearchProjectsService} from '../../services/searchProjects.service'; -import {SearchDatasetsService} from '../../services/searchDatasets.service'; -import {SearchSoftwareService} from '../../services/searchSoftware.service'; -import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; +import {SearchPublicationsService} from '../../services/searchPublications.service'; +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {SearchProjectsService} from '../../services/searchProjects.service'; +import {SearchDatasetsService} from '../../services/searchDatasets.service'; +import {SearchSoftwareService} from '../../services/searchSoftware.service'; +import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; -import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; -import {ErrorCodes} from '../../utils/properties/errorCodes'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import { ConfigurationService } from '../../utils/configuration/configuration.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {RouterHelper} from '../../utils/routerHelper.class'; +import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {ConfigurationService} from '../../utils/configuration/configuration.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; @Component({ changeDetection: ChangeDetectionStrategy.Default, @@ -96,7 +99,10 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; private _searchSoftwareService: SearchSoftwareService, private _searchOrganizationsService: SearchOrganizationsService, private _refineFieldResultsService:RefineFieldResultsService, - private location: Location, private _meta: Meta,private _piwikService:PiwikService, + private location: Location, + private _meta: Meta, + private _title: Title, + private _piwikService:PiwikService, private config: ConfigurationService ) { this.fetchPublications = new FetchPublications(this._searchPublicationsService); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); @@ -105,11 +111,6 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService); - - - - - } public ngOnInit() { @@ -117,15 +118,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; .subscribe((data: { envSpecific: EnvProperties }) => { var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; - var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE"; this.properties = data.envSpecific; - var url =data.envSpecific.baseLink+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); + var url = data.envSpecific.baseLink+this._router.url; + this._title.setTitle(title); + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); + this._meta.updateTag({content:title},"property='og:title'"); + this._meta.updateTag({content:url},"property='og:url'"); if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...").subscribe(); diff --git a/searchPages/searchUtils/advancedSearchPage.component.ts b/searchPages/searchUtils/advancedSearchPage.component.ts index eebe726d..38791caf 100644 --- a/searchPages/searchUtils/advancedSearchPage.component.ts +++ b/searchPages/searchUtils/advancedSearchPage.component.ts @@ -1,16 +1,20 @@ -import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {Location} from '@angular/common'; -import {ActivatedRoute, Router} from '@angular/router'; -import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; -import {SearchResult} from '../../utils/entities/searchResult'; -import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; -import {SearchUtilsClass} from './searchUtils.class'; -import {ModalLoading} from '../../utils/modal/loading.component'; -import {StringUtils, Dates} from '../../utils/string-utils.class'; -import { Meta} from '../../sharedComponents/metaService'; - import {PiwikService} from '../../utils/piwik/piwik.service'; - import{EnvProperties} from '../../utils/properties/env-properties'; +import {Component, Input, ViewChild} from '@angular/core'; +import {Output, EventEmitter} from '@angular/core'; +import {Location} from '@angular/common'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; + +import {Filter, Value, AdvancedField} from '../searchUtils/searchHelperClasses.class'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; +import {SearchUtilsClass} from './searchUtils.class'; +import {ModalLoading} from '../../utils/modal/loading.component'; +import {StringUtils, Dates} from '../../utils/string-utils.class'; + +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'advanced-search-page', @@ -49,7 +53,12 @@ export class AdvancedSearchPageComponent { properties:EnvProperties; @Output() queryChange = new EventEmitter(); - constructor (private route: ActivatedRoute,private location: Location, private _meta: Meta, private _piwikService:PiwikService, private router: Router) { + constructor (private route: ActivatedRoute, + private location: Location, + private _meta: Meta, + private _title: Title, + private _piwikService:PiwikService, + private router: Router) { } ngOnInit() { @@ -68,36 +77,37 @@ export class AdvancedSearchPageComponent { } }); + var title = "Advanced search "+this.pageTitle; + var description = "Openaire, search, repositories, open access, type, content provider, funder, project, "+ this.pageTitle; - this.updateTitle("Advanced search "+this.pageTitle); - this.updateDescription("Openaire, search, repositories, open access, type, content provider, funder, project, "+ this.pageTitle); + this.updateTitle(title); + this.updateDescription(description); - - this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl; - this.updateBaseUrlWithParameters(); + this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl; + this.updateBaseUrlWithParameters(); } ngOnDestroy() { if(this.piwiksub){ - this.piwiksub.unsubscribe(); -} + this.piwiksub.unsubscribe(); + } } - updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - updateTitle(title:string){ + updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } - public getSelectedFiltersFromUrl(params){ + public getSelectedFiltersFromUrl(params) { for(var i=0; i< this.fieldIds.length ; i++){ var fieldId = this.fieldIds[i]; diff --git a/searchPages/searchUtils/searchPage.component.ts b/searchPages/searchUtils/searchPage.component.ts index 0535429d..f132b9c9 100644 --- a/searchPages/searchUtils/searchPage.component.ts +++ b/searchPages/searchUtils/searchPage.component.ts @@ -1,20 +1,23 @@ -import {Component, Input, ViewChild, Output, EventEmitter,ElementRef} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {Location} from '@angular/common'; -import {Router, ActivatedRoute} from '@angular/router'; +import {Component, Input} from '@angular/core'; +import {ViewChild, Output} from '@angular/core'; +import {EventEmitter,ElementRef} from '@angular/core'; +import {Location} from '@angular/common'; +import {Router, ActivatedRoute} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import { Filter, Value} from './searchHelperClasses.class'; -import {SearchResult} from '../../utils/entities/searchResult'; -import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; -import {SearchUtilsClass} from './searchUtils.class'; -import {DOI, StringUtils} from '../../utils/string-utils.class'; -import {ModalLoading} from '../../utils/modal/loading.component'; -import { Meta} from '../../sharedComponents/metaService'; -import{SearchFilterComponent} from './searchFilter.component'; -import {SearchFilterModalComponent} from './searchFilterModal.component'; -import { ErrorCodes} from '../../utils/properties/errorCodes'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Observable} from 'rxjs/Observable'; + +import {Filter, Value} from './searchHelperClasses.class'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; +import {SearchUtilsClass} from './searchUtils.class'; +import {DOI, StringUtils} from '../../utils/string-utils.class'; +import {ModalLoading} from '../../utils/modal/loading.component'; +import {SearchFilterComponent} from './searchFilter.component'; +import {SearchFilterModalComponent} from './searchFilterModal.component'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; @Component({ @@ -66,7 +69,13 @@ export class SearchPageComponent { public isPiwikEnabled; properties:EnvProperties; - constructor (private route: ActivatedRoute,private location: Location , private _meta: Meta,private element: ElementRef,private _piwikService:PiwikService, private router: Router) { + constructor (private route: ActivatedRoute, + private location: Location, + private _meta: Meta, + private _title: Title, + private element: ElementRef, + private _piwikService:PiwikService, + private router: Router) { } ngOnInit() { @@ -90,7 +99,8 @@ export class SearchPageComponent { } // this.updateBaseUrlWithParameters(this.filters); this.updateTitle(this.pageTitle); - this.updateDescription("Openaire, search, repositories, open access, type, content provider, funder, project, " + this.type + "," +this.pageTitle); + var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.type + "," +this.pageTitle; + this.updateDescription(description); } ngAfterViewChecked(){ @@ -106,18 +116,18 @@ export class SearchPageComponent { //this.searchFilterModal.open(); } - updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - updateTitle(title:string){ + updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } public getQueryParametersFromUrl(params){ diff --git a/searchPages/searchUtils/searchPageTableView.component.ts b/searchPages/searchUtils/searchPageTableView.component.ts index 10352fc2..f66775d2 100644 --- a/searchPages/searchUtils/searchPageTableView.component.ts +++ b/searchPages/searchUtils/searchPageTableView.component.ts @@ -1,23 +1,29 @@ -import {Component, Input, ViewChild, Output, EventEmitter, ViewEncapsulation, OnInit, AfterViewInit} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import { Subject } from 'rxjs/Subject'; -import {Location} from '@angular/common'; -import {ActivatedRoute} from '@angular/router'; +import {Component, Input} from '@angular/core'; +import {ViewChild, Output} from '@angular/core'; +import {EventEmitter, ViewEncapsulation} from '@angular/core'; +import {OnInit, AfterViewInit} from '@angular/core'; +import {Location} from '@angular/common'; +import {ActivatedRoute} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; -import { Filter, Value} from './searchHelperClasses.class'; -import {SearchResult} from '../../utils/entities/searchResult'; -import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; -import {SearchUtilsClass} from './searchUtils.class'; -import {DOI, StringUtils} from '../../utils/string-utils.class'; -import {ModalLoading} from '../../utils/modal/loading.component'; -import { Meta} from '../../sharedComponents/metaService'; -import{SearchFilterComponent} from './searchFilter.component'; -import {SearchFilterModalComponent} from './searchFilterModal.component'; -import { ErrorCodes} from '../../utils/properties/errorCodes'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import { DataTableDirective } from 'angular-datatables'; +import {Observable} from 'rxjs/Observable'; +import {Subject} from 'rxjs/Subject'; + +import {DataTableDirective } from 'angular-datatables'; + +import {EnvProperties} from '../../utils/properties/env-properties'; + +import {Filter, Value} from './searchHelperClasses.class'; +import {SearchResult} from '../../utils/entities/searchResult'; +import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; +import {SearchUtilsClass} from './searchUtils.class'; +import {DOI, StringUtils} from '../../utils/string-utils.class'; +import {ModalLoading} from '../../utils/modal/loading.component'; +import {SearchFilterComponent} from './searchFilter.component'; +import {SearchFilterModalComponent} from './searchFilterModal.component'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {PiwikService} from '../../utils/piwik/piwik.service'; //import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; -import {EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-page-table', @@ -49,7 +55,7 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit { @Input() searchViewLink: string; @Input() disableForms: boolean = false; @Input() searchFormClass: string = "searchForm"; -@Input() formPlaceholderText = "Type Keywords..."; + @Input() formPlaceholderText = "Type Keywords..."; @ViewChild (ModalLoading) loading : ModalLoading ; private searchFieldsHelper:SearchFields = new SearchFields(); private queryParameters: Map = new Map(); @@ -68,8 +74,13 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit { dtOptions: DataTables.Settings = {}; showTable = false; filteringAdded = false; @ViewChild(DataTableDirective) datatableElement: DataTableDirective; - dtTrigger: Subject = new Subject(); //necessary - constructor (private route: ActivatedRoute,private location: Location , private _meta: Meta, private _piwikService:PiwikService) { } + dtTrigger: Subject = new Subject(); //necessary + + constructor (private route: ActivatedRoute, + private location: Location, + private _meta: Meta, + private _title: Title, + private _piwikService:PiwikService) { } ngOnInit() { this.route.data @@ -91,7 +102,8 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit { "pageLength": this.rowsOnPage }; this.updateTitle(this.pageTitle); - this.updateDescription("Openaire, search, repositories, open access, type, content provider, funder, project, " + this.type + "," +this.pageTitle); + var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.type + "," +this.pageTitle; + this.updateDescription(description); } ngOnDestroy() { @@ -127,18 +139,18 @@ export class SearchPageTableViewComponent implements OnInit, AfterViewInit { } - updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + updateDescription(description:string) { + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } - updateTitle(title:string){ + updateTitle(title:string) { var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } - updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + updateUrl(url:string) { + this._meta.updateTag({content:url},"property='og:url'"); } public getParametersFromUrl(params) {