From 91b7c11f0a0162288daf712205aac7db27965271 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Mon, 5 Feb 2018 13:14:59 +0000 Subject: [PATCH] USe a json file to read properties | replace openaire Properties | parameterize menu (use params, community, ) | parameterize search pages (hide community information) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@50586 d315682c-612b-4755-9ff5-7f18f6832af3 --- app-routing.module.ts | 109 +++++++++ app.component.ts | 58 ++++- app.module.ts | 95 +------- .../claimContextSearchForm.component.ts | 15 +- .../claimProjectSearchForm.component.ts | 7 +- .../claimResultSearchForm.component.ts | 35 +-- .../displayClaims.component.html | 4 +- .../displayClaims/displayClaims.component.ts | 22 +- .../claimEntityFormatter.component.ts | 8 +- .../projectTitleFormatter.component.ts | 4 +- claims/claim-utils/service/claims.service.ts | 51 ++-- .../claim-utils/service/contexts.service.ts | 16 +- .../service/searchCrossref.service.ts | 22 +- .../service/searchDatacite.service.ts | 17 +- .../service/searchOrcid.service.ts | 14 +- .../claimsByToken.component.html | 166 +++++++++++++ .../claimsByToken/claimsByToken.component.ts | 181 +------------- claims/claimsByToken/claimsByToken.service.ts | 11 +- .../directLinking.component.html | 8 +- .../directLinking/directLinking.component.ts | 16 +- .../linking/bulkClaim/bulkClaim.component.ts | 9 +- claims/linking/bulkLinking.component.ts | 16 -- .../insertClaim/insertClaim.component.ts | 6 +- claims/linking/linkingGeneric.component.html | 10 +- claims/linking/linkingGeneric.component.ts | 9 + .../selected/selectedContexts.component.ts | 6 +- .../selected/selectedProjects.component.ts | 7 +- .../selected/selectedResults.component.ts | 11 - .../datasets/depositBySubject.component.ts | 3 +- .../depositBySubjectResult.component.html | 2 +- .../depositBySubjectResult.component.ts | 25 +- deposit/deposit.component.html | 2 +- deposit/deposit.component.ts | 34 ++- deposit/depositResult.component.ts | 35 +-- error/isRouteEnabled.guard.ts | 27 ++- .../dataProvider/dataProvider.component.html | 12 +- .../dataProvider/dataProvider.component.ts | 47 ++-- .../dataProvider/dataProvider.service.ts | 10 +- .../dataProvider/datasetsTab.component.ts | 6 +- .../dataProvider/datasourcesTab.component.ts | 7 +- .../dataProvider/projectsTab.component.ts | 7 +- .../dataProvider/publicationsTab.component.ts | 7 +- .../relatedDatasourcesTab.component.ts | 8 +- .../dataProvider/statisticsTab.component.ts | 2 +- landingPages/dataset/dataset.component.html | 10 +- landingPages/dataset/dataset.component.ts | 22 +- landingPages/dataset/dataset.service.ts | 8 +- .../htmlProjectReport.component.ts | 25 +- .../htmlProjectReport.service.ts | 9 +- .../landing-utils/addThis.component.ts | 4 +- .../landing-utils/availableOn.component.ts | 1 - .../landing-utils/fundedBy.component.ts | 3 +- .../landing-utils/metrics.component.ts | 4 +- .../landing-utils/parsingFunctions.class.ts | 3 +- .../landing-utils/publishedIn.component.ts | 1 - .../searchingProjectsInTab.component.ts | 8 +- .../showIdentifiers.component.ts | 7 +- .../landing-utils/tabTable.component.ts | 8 +- .../organization/organization.component.html | 9 +- .../organization/organization.component.ts | 67 +++--- landingPages/project/project.component.html | 6 +- landingPages/project/project.component.ts | 46 ++-- landingPages/project/project.service.ts | 26 +- .../publication/publication.component.html | 6 +- .../publication/publication.component.ts | 18 +- .../publication/publication.service.ts | 10 +- landingPages/software/software.component.html | 8 +- landingPages/software/software.component.ts | 22 +- landingPages/software/software.service.ts | 8 +- login/adminLoginGuard.guard.ts | 4 +- login/freeGuard.guard.ts | 7 +- login/loginGuard.guard.ts | 3 + login/user.component.ts | 13 +- login/userMini.component.ts | 34 +-- login/utils/helper.class.ts | 6 +- login/utils/logoutOpenaire.service.ts | 19 -- reload/reload.component.ts | 1 - .../advancedSearchDataProviders.component.ts | 91 ++++--- .../advancedSearchDatasets.component.ts | 125 +++++----- .../advancedSearchOrganizations.component.ts | 46 ++-- .../advancedSearchProjects.component.ts | 131 +++++----- .../advancedSearchPublications.component.ts | 134 ++++++----- .../advancedSearchSoftware.component.ts | 130 +++++----- .../compatibleDataProviders.component.ts | 15 +- .../compatibleDataProvidersTable.component.ts | 18 +- .../entityRegistries.component.ts | 16 +- .../entityRegistriesTable.component.ts | 15 +- .../dataProviders/journals.component.ts | 15 +- .../dataProviders/journalsTable.component.ts | 19 +- searchPages/find/search.component.html | 24 +- searchPages/find/search.component.ts | 165 +++++++------ .../advancedSearchForm.component.html | 6 +- .../advancedSearchForm.component.ts | 11 +- .../advancedSearchPage.component.html | 16 +- .../advancedSearchPage.component.ts | 51 ++-- .../searchUtils/browseEntities.component.ts | 7 +- .../searchUtils/browseStatistic.component.ts | 4 +- .../searchUtils/searchDownload.component.ts | 23 +- .../searchUtils/searchFilter.component.html | 26 +- .../searchUtils/searchFilter.component.ts | 2 +- .../searchUtils/searchForm.component.ts | 2 +- .../searchUtils/searchPage.component.html | 21 +- .../searchUtils/searchPage.component.ts | 75 ++++-- .../searchPageTableView.component.ts | 26 +- .../searchUtils/searchResult.component.ts | 48 ++-- .../simple/searchDataproviders.component.ts | 51 ++-- .../simple/searchDatasets.component.ts | 52 ++-- .../simple/searchOrganizations.component.ts | 39 +-- .../simple/searchProjects.component.ts | 41 ++-- .../simple/searchPublications.component.ts | 148 +++++++----- .../simple/searchSoftware.component.ts | 140 ++++++----- services/metrics.service.ts | 17 +- services/organization.service.ts | 22 +- services/refineFieldResults.service.ts | 42 +++- services/reports.service.ts | 2 - services/searchDataproviders.service.ts | 124 ++++++---- services/searchDatasets.service.ts | 60 ++--- services/searchOrganizations.service.ts | 31 ++- services/searchProjects.service.ts | 55 +++-- services/searchPublications.service.ts | 65 +++-- services/searchSoftware.service.ts | 60 ++--- sharedComponents/menu.ts | 25 ++ sharedComponents/navigationBar.component.html | 81 ++++--- sharedComponents/navigationBar.component.ts | 214 ++++------------- sharedComponents/navigationBar.module.ts | 3 +- utils/configuration/configuration.service.ts | 58 +++-- .../entitiesAutoComplete.component.ts | 13 +- .../entitySearch.service.ts | 62 ++--- .../fetchDataproviders.class.ts | 29 +-- .../fetchDatasets.class.ts | 21 +- .../fetchOrganizations.class.ts | 5 +- .../fetchProjects.class.ts | 17 +- .../fetchPublications.class.ts | 18 +- .../fetchSoftware.class.ts | 21 +- utils/helper/helper.component.ts | 35 +-- utils/helper/helper.module.ts | 18 +- utils/helper/helper.service.ts | 16 +- utils/pagingFormatter.component.ts | 14 +- utils/pipes/contentProvidersDatatable.pipe.ts | 226 +++++++++--------- utils/properties/env-properties.ts | 121 ++++++++++ .../environment-specific.service.ts | 60 +++++ .../properties/environmentSpecificResolver.ts | 23 ++ utils/properties/openaireProperties.ts | 44 +++- .../ISVocabularies.service.ts | 25 +- .../staticAutoComplete.component.ts | 9 +- 145 files changed, 2851 insertions(+), 2111 deletions(-) create mode 100644 app-routing.module.ts create mode 100644 claims/claimsByToken/claimsByToken.component.html delete mode 100644 claims/linking/bulkLinking.component.ts delete mode 100644 login/utils/logoutOpenaire.service.ts create mode 100644 sharedComponents/menu.ts create mode 100644 utils/properties/env-properties.ts create mode 100644 utils/properties/environment-specific.service.ts create mode 100644 utils/properties/environmentSpecificResolver.ts diff --git a/app-routing.module.ts b/app-routing.module.ts new file mode 100644 index 00000000..1ed57b7e --- /dev/null +++ b/app-routing.module.ts @@ -0,0 +1,109 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import {IsRouteEnabled} from './error/isRouteEnabled.guard'; + +import {EnvironmentSpecificResolver} from './utils/properties/environmentSpecificResolver'; +import { EnvironmentSpecificService } from './utils/properties/environment-specific.service'; + +import { ErrorPageComponent } from './error/errorPage.component'; +import {SearchComponent} from './searchPages/find/search.component'; + +import {PublicationComponent} from './landingPages/publication/publication.component'; +import {DatasetComponent} from './landingPages/dataset/dataset.component'; +import {SoftwareComponent} from './landingPages/software/software.component'; +import {DataProviderComponent} from './landingPages/dataProvider/dataProvider.component'; +import {ProjectComponent} from './landingPages/project/project.component'; +import {OrganizationComponent} from './landingPages/organization/organization.component'; + + +import {DepositDatasetsComponent} from './deposit/datasets/depositDatasets.component'; +import {DepositDatasetsResultComponent} from './deposit/datasets/depositDatasetsResult.component'; +import {DepositBySubjectResultComponent} from './deposit/datasets/depositBySubjectResult.component'; +import {DepositPublicationsComponent} from './deposit/publications/depositPublications.component'; +import {DepositPublicationsResultComponent} from './deposit/publications/depositPublicationsResult.component'; + +import {SearchDatasetsComponent} from './searchPages/simple/searchDatasets.component'; +import {SearchPublicationsComponent} from './searchPages/simple/searchPublications.component'; +import {SearchSoftwareComponent} from './searchPages/simple/searchSoftware.component'; +import {SearchDataprovidersComponent} from './searchPages/simple/searchDataproviders.component'; +import {SearchProjectsComponent} from './searchPages/simple/searchProjects.component'; +import {SearchOrganizationsComponent} from './searchPages/simple/searchOrganizations.component'; + +import {AdvancedSearchPublicationsComponent} from './searchPages/advanced/advancedSearchPublications.component'; +import {AdvancedSearchDatasetsComponent} from './searchPages/advanced/advancedSearchDatasets.component'; +import {AdvancedSearchSoftwareComponent} from './searchPages/advanced/advancedSearchSoftware.component'; +import {AdvancedSearchDataProvidersComponent} from './searchPages/advanced/advancedSearchDataProviders.component'; +import {AdvancedSearchProjectsComponent} from './searchPages/advanced/advancedSearchProjects.component'; +import {AdvancedSearchOrganizationsComponent} from './searchPages/advanced/advancedSearchOrganizations.component'; + +import {SearchEntityRegistriesComponent} from './searchPages/dataProviders/entityRegistries.component'; +import {SearchEntityRegistriesTableComponent} from './searchPages/dataProviders/entityRegistriesTable.component'; +import {SearchJournalsTableComponent} from './searchPages/dataProviders/journalsTable.component'; +import {SearchJournalsComponent} from './searchPages/dataProviders/journals.component'; +import {SearchCompatibleDataprovidersComponent} from './searchPages/dataProviders/compatibleDataProviders.component'; +import {SearchCompatibleDataprovidersTableComponent} from './searchPages/dataProviders/compatibleDataProvidersTable.component'; + +import {ClaimsAdminComponent} from './claims/claimsAdmin/claimsAdmin.component'; +import {MyClaimsComponent} from './claims/myClaims/myClaims.component'; + +import {ClaimsByTokenComponent} from './claims/claimsByToken/claimsByToken.component'; +import {DirectLinkingComponent} from './claims/directLinking/directLinking.component'; +import {LinkingGenericComponent} from './claims/linking/linkingGeneric.component'; + +import{ HtmlProjectReportComponent} from './landingPages/htmlProjectReport/htmlProjectReport.component'; + +const routes: Routes = [ + + { path: '', component: SearchComponent, resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate: [ IsRouteEnabled], data: { + redirect: '/error',api: "http://duffy.di.uoa.gr:8080/uoa-admin-tools", community :"openaire"}}, + { path: 'home', component: SearchComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/publication', component: PublicationComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/dataset', component: DatasetComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/software', component: SoftwareComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/project', component: ProjectComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/dataprovider', component: DataProviderComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/organization', component: OrganizationComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'participate/deposit-datasets', component: DepositDatasetsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'participate/deposit-datasets-result', component: DepositDatasetsResultComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'participate/deposit-subject-result', component: DepositBySubjectResultComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'participate/deposit-publications', component: DepositPublicationsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'participate/deposit-publications-result', component: DepositPublicationsResultComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/find', component: SearchComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/find/publications', component: SearchPublicationsComponent , resolve: { envSpecific: EnvironmentSpecificResolver }, canActivate: [ IsRouteEnabled], data: { + redirect: '/error',api: "http://duffy.di.uoa.gr:8080/uoa-admin-tools", community :"openaire"} }, + { path: 'search/find/datasets', component:SearchDatasetsComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/find/software', component:SearchSoftwareComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/find/projects', component:SearchProjectsComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/find/dataproviders', component:SearchDataprovidersComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/find/organizations', component:SearchOrganizationsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/content-providers', component: SearchCompatibleDataprovidersComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/content-providers-table', component: SearchCompatibleDataprovidersTableComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/entity-registries',component: SearchEntityRegistriesComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/entity-registries-table', component: SearchEntityRegistriesTableComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/journals', component: SearchJournalsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/journals-table', component: SearchJournalsTableComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/advanced/publications', component: AdvancedSearchPublicationsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/advanced/datasets', component: AdvancedSearchDatasetsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/advanced/software', component: AdvancedSearchSoftwareComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/advanced/organizations',component: AdvancedSearchOrganizationsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/advanced/dataproviders', component: AdvancedSearchDataProvidersComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'search/advanced/projects', component: AdvancedSearchProjectsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'project-report', component: HtmlProjectReportComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'myclaims',component: MyClaimsComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'claims', component: ClaimsAdminComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'participate/claim', component: LinkingGenericComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'participate/direct-claim',component: DirectLinkingComponent, resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'claims-project-manager', component: ClaimsByTokenComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'reload', loadChildren: './reload/reload.module#ReloadModule' , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'user-info', loadChildren: './login/user.module#UserModule' , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: 'error', component: ErrorPageComponent , resolve: { envSpecific: EnvironmentSpecificResolver } }, + { path: '**',pathMatch: 'full',component: ErrorPageComponent } +]; + +@NgModule({ + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule], + providers: [EnvironmentSpecificResolver, EnvironmentSpecificService, IsRouteEnabled] +}) +export class AppRoutingModule { } diff --git a/app.component.ts b/app.component.ts index 3a973630..64ae88dd 100644 --- a/app.component.ts +++ b/app.component.ts @@ -1,6 +1,10 @@ import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core'; import { ConfigurationService } from './utils/configuration/configuration.service'; import {Observable} from 'rxjs/Observable'; +import { EnvProperties } from './utils/properties/env-properties'; +import {ActivatedRoute} from '@angular/router'; +import{EnvironmentSpecificService} from './utils/properties/environment-specific.service'; +import{MenuItem,RootMenuItem} from './sharedComponents/menu'; @Component({ //changeDetection: ChangeDetectionStrategy.Default, @@ -9,7 +13,9 @@ import {Observable} from 'rxjs/Observable'; styles: [` `], template: ` - + +

Openaire Lib Component

@@ -42,10 +48,55 @@ import {Observable} from 'rxjs/Observable'; }) export class AppComponent { isClient:boolean = false; - constructor(private config: ConfigurationService) {} + public properties:EnvProperties = null; + constructor(private config: ConfigurationService, private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService) { + } + + + userMenuItems:MenuItem[] = [ new MenuItem("","My profile","","",false,[],[],{}), + new MenuItem("","My claims","","/myclaims",false,[],["/myclaims"],{}), + new MenuItem("","Manage all claims","","/claims",true,[],["/claims"],{})] + + + menuItems:RootMenuItem [] = [ + {rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find"],{}), + items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],{}), + new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],{}), + new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],{}), + new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],{}), + new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{}), + new MenuItem("","Organizations","","/search/find/organizations/",false,["organization"],["/search/find/organizations"],{}) + ]}, + { + rootItem: new MenuItem("share","Share","","",false,[],["/participate/deposit-publications","/participate/deposit-datasets"],{}), + items: [new MenuItem("","Publications","","/participate/deposit-publications",false,["publication"],["/participate/deposit-publications"],{}), + new MenuItem("","Research Data","","/participate/deposit-datasets",false,["dataset"],["/participate/deposit-datasets"],{})] + }, + { + rootItem: new MenuItem("link","Link","","/participate/claim",false,[],["/participate/claim"],{}), + items: [] + }, + { + rootItem: new MenuItem("datasources","Content Providers","","",false,["datasource"],[],{}), + items: [new MenuItem("","Data Policies","https://beta.openaire.eu/oa-policies-mandates","",false,["datasource"],[],{}), + new MenuItem("","Repositories","","/search/content-providers",false,["datasource"],["/search/content-providers"],{}), + new MenuItem("","Journals","","/search/journals",false,["datasource"],["/search/journals"],{}), + new MenuItem("","Registries","","/search/entity-registries",false,["datasource"],["/search/entity-registries"],{}), + new MenuItem("","Browse all","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{})] + } + ]; ngOnInit() { + this.propertiesService.loadEnvironment() + .then(es => { + this.propertiesService.setEnvProperties(es); + this.properties = this.propertiesService.envSpecific; + }, error => { + console.log("App couldn't fetch properties"); + console.log(error); + + }); if (typeof document !== 'undefined') { try{ this.isClient = true; @@ -53,4 +104,7 @@ export class AppComponent { } } } + + + } diff --git a/app.module.ts b/app.module.ts index 2bf79852..1bb51f5d 100755 --- a/app.module.ts +++ b/app.module.ts @@ -12,89 +12,54 @@ import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module import {Meta} from '../angular2-meta'; // import { ErrorModule } from './error/error.module'; import { ConfigurationService } from './utils/configuration/configuration.service'; -import { ErrorPageComponent } from './error/errorPage.component'; -import {SearchComponent} from './searchPages/find/search.component'; import {MainSearchModule} from './searchPages/find/mainSearch.module'; -import {PublicationComponent} from './landingPages/publication/publication.component'; import {PublicationModule} from './landingPages/publication/publication.module'; -import {DatasetComponent} from './landingPages/dataset/dataset.component'; import {DatasetModule} from './landingPages/dataset/dataset.module'; -import {SoftwareComponent} from './landingPages/software/software.component'; import {SoftwareModule} from './landingPages/software/software.module'; -import {DataProviderComponent} from './landingPages/dataProvider/dataProvider.component'; import {DataProviderModule} from './landingPages/dataProvider/dataProvider.module'; -import {ProjectComponent} from './landingPages/project/project.component'; import {ProjectModule} from './landingPages/project/project.module'; -import {OrganizationComponent} from './landingPages/organization/organization.component'; import {OrganizationModule} from './landingPages/organization/organization.module'; import {ReloadModule} from './reload/reload.module'; import {ErrorModule} from './error/error.module'; import {DepositDatasetsModule} from './deposit/datasets/depositDatasets.module'; -import {DepositDatasetsComponent} from './deposit/datasets/depositDatasets.component'; import {DepositDatasetsResultsModule} from './deposit/datasets/depositDatasetsResults.module'; -import {DepositDatasetsResultComponent} from './deposit/datasets/depositDatasetsResult.component'; import {DepositBySubjectResultsModule} from './deposit/datasets/depositBySubjectResults.module'; -import {DepositBySubjectResultComponent} from './deposit/datasets/depositBySubjectResult.component'; import {DepositPublicationsModule} from './deposit/publications/depositPublications.module'; -import {DepositPublicationsComponent} from './deposit/publications/depositPublications.component'; import {DepositPublicationsResultsModule} from './deposit/publications/depositPublicationsResults.module'; -import {DepositPublicationsResultComponent} from './deposit/publications/depositPublicationsResult.component'; import {SearchPublicationsModule} from './searchPages/simple/searchPublications.module'; -import {SearchPublicationsComponent} from './searchPages/simple/searchPublications.component'; import {SearchDatasetsModule} from './searchPages/simple/searchDatasets.module'; -import {SearchDatasetsComponent} from './searchPages/simple/searchDatasets.component'; import {SearchSoftwareModule} from './searchPages/simple/searchSoftware.module'; -import {SearchSoftwareComponent} from './searchPages/simple/searchSoftware.component'; import {SearchDataProvidersModule} from './searchPages/simple/searchDataProviders.module'; -import {SearchDataprovidersComponent} from './searchPages/simple/searchDataproviders.component'; import {SearchProjectsModule} from './searchPages/simple/searchProjects.module'; -import {SearchProjectsComponent} from './searchPages/simple/searchProjects.component'; import {SearchOrganizationsModule} from './searchPages/simple/searchOrganizations.module'; -import {SearchOrganizationsComponent} from './searchPages/simple/searchOrganizations.component'; import {AdvancedSearchPublicationsModule} from './searchPages/advanced/advancedSearchPublications.module'; -import {AdvancedSearchPublicationsComponent} from './searchPages/advanced/advancedSearchPublications.component'; import {AdvancedSearchDatasetsModule} from './searchPages/advanced/advancedSearchDatasets.module'; -import {AdvancedSearchDatasetsComponent} from './searchPages/advanced/advancedSearchDatasets.component'; import {AdvancedSearchSoftwareModule} from './searchPages/advanced/advancedSearchSoftware.module'; -import {AdvancedSearchSoftwareComponent} from './searchPages/advanced/advancedSearchSoftware.component'; import {AdvancedSearchDataProvidersModule} from './searchPages/advanced/advancedSearchDataProviders.module'; -import {AdvancedSearchDataProvidersComponent} from './searchPages/advanced/advancedSearchDataProviders.component'; import {AdvancedSearchProjectsModule} from './searchPages/advanced/advancedSearchProjects.module'; -import {AdvancedSearchProjectsComponent} from './searchPages/advanced/advancedSearchProjects.component'; import {AdvancedSearchOrganizationsModule} from './searchPages/advanced/advancedSearchOrganizations.module'; -import {AdvancedSearchOrganizationsComponent} from './searchPages/advanced/advancedSearchOrganizations.component'; - import {EntityRegistriesModule} from './searchPages/dataProviders/entityRegistries.module'; -import {SearchEntityRegistriesComponent} from './searchPages/dataProviders/entityRegistries.component'; import {EntityRegistriesTableModule} from './searchPages/dataProviders/entityRegistriesTable.module'; -import {SearchEntityRegistriesTableComponent} from './searchPages/dataProviders/entityRegistriesTable.component'; import {JournalsTableModule} from './searchPages/dataProviders/journalsTable.module'; -import {SearchJournalsTableComponent} from './searchPages/dataProviders/journalsTable.component'; import {JournalsModule} from './searchPages/dataProviders/journals.module'; -import {SearchJournalsComponent} from './searchPages/dataProviders/journals.component'; import {CompatibleDataProvidersModule} from './searchPages/dataProviders/compatibleDataProviders.module'; -import {SearchCompatibleDataprovidersComponent} from './searchPages/dataProviders/compatibleDataProviders.component'; import {CompatibleDataProvidersTableModule} from './searchPages/dataProviders/compatibleDataProvidersTable.module'; -import {SearchCompatibleDataprovidersTableComponent} from './searchPages/dataProviders/compatibleDataProvidersTable.component'; import {ClaimsAdminModule} from './claims/claimsAdmin/claimsAdmin.module'; -import {ClaimsAdminComponent} from './claims/claimsAdmin/claimsAdmin.component'; import {MyClaimsModule} from './claims/myClaims/myClaims.module'; -import {MyClaimsComponent} from './claims/myClaims/myClaims.component'; import {ClaimsByTokenModule} from './claims/claimsByToken/claimsByToken.module'; -import {ClaimsByTokenComponent} from './claims/claimsByToken/claimsByToken.component'; import {DirectLinkingModule} from './claims/directLinking/directLinking.module'; -import {DirectLinkingComponent} from './claims/directLinking/directLinking.component'; import {LinkingGenericModule} from './claims/linking/linkingGeneric.module'; -import {LinkingGenericComponent} from './claims/linking/linkingGeneric.component'; - +import{ HtmlProjectReportModule} from './landingPages/htmlProjectReport/htmlProjectReport.module'; +import {IsRouteEnabled} from './error/isRouteEnabled.guard'; +import { AppRoutingModule } from './app-routing.module'; @NgModule({ imports: [ @@ -113,53 +78,9 @@ import {LinkingGenericComponent} from './claims/linking/linkingGeneric.component EntityRegistriesModule, CompatibleDataProvidersModule, JournalsModule, JournalsTableModule, EntityRegistriesTableModule, CompatibleDataProvidersTableModule, ClaimsAdminModule, MyClaimsModule, ClaimsByTokenModule, LinkingGenericModule, DirectLinkingModule, + HtmlProjectReportModule, BrowserModule.withServerTransition({appId: 'my-app'}), - RouterModule.forRoot([ - { path: '', component: SearchComponent}, - { path: 'home', component: SearchComponent}, - { path: 'search/publication', component: PublicationComponent }, - { path: 'search/dataset', component: DatasetComponent}, - { path: 'search/software', component: SoftwareComponent}, - { path: 'search/project', component: ProjectComponent }, - { path: 'search/dataprovider', component: DataProviderComponent }, - { path: 'search/organization', component: OrganizationComponent }, - { path: 'participate/deposit-datasets', component: DepositDatasetsComponent }, - { path: 'participate/deposit-datasets-result', component: DepositDatasetsResultComponent}, - { path: 'participate/deposit-subject-result', component: DepositBySubjectResultComponent }, - { path: 'participate/deposit-publications', component: DepositPublicationsComponent }, - { path: 'participate/deposit-publications-result', component: DepositPublicationsResultComponent}, - { path: 'search/find', component: SearchComponent}, - { path: 'search/find/publications', component: SearchPublicationsComponent }, - { path: 'search/find/datasets', component:SearchDatasetsComponent}, - { path: 'search/find/software', component:SearchSoftwareComponent}, - { path: 'search/find/projects', component:SearchProjectsComponent}, - { path: 'search/find/dataproviders', component:SearchDataprovidersComponent }, - { path: 'search/find/organizations', component:SearchOrganizationsComponent }, - { path: 'search/content-providers', component: SearchCompatibleDataprovidersComponent}, - { path: 'search/content-providers-table', component: SearchCompatibleDataprovidersTableComponent}, - { path: 'search/entity-registries',component: SearchEntityRegistriesComponent}, - { path: 'search/entity-registries-table', component: SearchEntityRegistriesTableComponent}, - { path: 'search/journals', component: SearchJournalsComponent }, - { path: 'search/journals-table', component: SearchJournalsTableComponent }, - { path: 'search/advanced/publications', component: AdvancedSearchPublicationsComponent }, - { path: 'search/advanced/datasets', component: AdvancedSearchPublicationsComponent }, - { path: 'search/advanced/software', component: AdvancedSearchPublicationsComponent }, - { path: 'search/advanced/organizations',component: AdvancedSearchPublicationsComponent }, - { path: 'search/advanced/dataproviders', component: AdvancedSearchPublicationsComponent }, - { path: 'search/advanced/projects', component: AdvancedSearchPublicationsComponent }, - { path: 'project-report', loadChildren: './landingPages/htmlProjectReport/htmlProjectReport.module#HtmlProjectReportModule' }, - { path: 'myclaims',component: MyClaimsComponent }, - { path: 'claims', component: ClaimsAdminComponent }, - { path: 'participate/claim', component: LinkingGenericComponent}, - { path: 'participate/direct-claim',component: DirectLinkingComponent}, - { path: 'claims-project-manager', component: ClaimsByTokenComponent }, - { path: 'reload', loadChildren: './reload/reload.module#ReloadModule' }, - { path: 'user-info', loadChildren: './login/user.module#UserModule' }, - { path: 'error', component: ErrorPageComponent }, - { path: '**',pathMatch: 'full',component: ErrorPageComponent } - - - ]), + AppRoutingModule ], declarations: [ AppComponent ], exports: [ AppComponent ], @@ -167,3 +88,9 @@ import {LinkingGenericComponent} from './claims/linking/linkingGeneric.component bootstrap: [AppComponent] }) export class AppModule {} +/* + +, canActivate: [ IsRouteEnabled], data: { + redirect: '/error' +} +*/ diff --git a/claims/claim-utils/claimContextSearchForm.component.ts b/claims/claim-utils/claimContextSearchForm.component.ts index f3938127..25aca236 100644 --- a/claims/claim-utils/claimContextSearchForm.component.ts +++ b/claims/claim-utils/claimContextSearchForm.component.ts @@ -7,6 +7,7 @@ import { StaticAutoCompleteComponent } from '../../utils/staticAutoComplete/stat declare var UIkit:any; import {Session} from '../../login/utils/helper.class'; import {ErrorCodes} from '../../login/utils/guardHelper.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ // moduleId: module.id, @@ -32,7 +33,7 @@ import {ErrorCodes} from '../../login/utils/guardHelper.class';
- +
@@ -49,7 +50,7 @@ import {ErrorCodes} from '../../login/utils/guardHelper.class';
- +
@@ -132,6 +133,8 @@ public showComponent:boolean = true ; // for claimed started from landing pages @Input() public projects; @Input() public results; @Input() public inlineEntity; +@Input() public properties:EnvProperties; + public selectedCommunityId:string = "0"; public selectedCategoryId:string ="0"; // @Output() contextSelected = new EventEmitter(); @@ -206,7 +209,7 @@ getCommunities () { }else{ this.loading = true; var token=Session.getUserJwt(); - this._contextService.getCommunities().subscribe( + this._contextService.getCommunities(this.properties.claimsAPIURL).subscribe( data => { this.communities = data.communities; this.loading = false; @@ -228,7 +231,7 @@ getCommunities () { }else{ var token=Session.getUserJwt(); - this._contextService.getCategories(this.selectedCommunityId).subscribe( + this._contextService.getCategories(this.selectedCommunityId,this.properties.claimsAPIURL).subscribe( data => { this.categories = (Array.isArray(data.category))? data.category:[data.category]; @@ -257,7 +260,7 @@ getCommunities () { }else{ this.concepts = []; var token=Session.getUserJwt(); - this._contextService.getConcepts(this.selectedCategoryId, "",true).subscribe( + this._contextService.getConcepts(this.selectedCategoryId, "",true, this.properties.claimsAPIURL).subscribe( data => { this.concepts =data; @@ -301,7 +304,7 @@ getCommunities () { this.conceptsClass[categoryId] = []; var token=Session.getUserJwt(); this.conceptsCategoryLoading[categoryId] = true; - this._contextService.getConcepts(categoryId, "",false).subscribe( + this._contextService.getConcepts(categoryId, "",false, this.properties.claimsAPIURL).subscribe( data => { var concepts = (Array.isArray(data))? data:[data]; for(var i=0;i
- +
@@ -45,6 +47,7 @@ export class ClaimProjectsSearchFormComponent { public selectedFunderId:string ="0"; selectedFunderName:string ="Select funder:"; @Output() projectSelected = new EventEmitter(); + @Input() public properties:EnvProperties; public projects:string[]; public warningMessage = ""; @@ -167,7 +170,7 @@ handleClick(event){ } getFunders () { console.info("Getting Funders...."); - this._projectService.getFunders().subscribe( + this._projectService.getFunders(this.properties).subscribe( data => { this.funders = data[1]; console.log("this.funders"); diff --git a/claims/claim-utils/claimResultSearchForm.component.ts b/claims/claim-utils/claimResultSearchForm.component.ts index adb95fab..a443c30a 100644 --- a/claims/claim-utils/claimResultSearchForm.component.ts +++ b/claims/claim-utils/claimResultSearchForm.component.ts @@ -10,6 +10,8 @@ import {SearchSoftwareService} from '../../services/searchSoftware.service'; import { ErrorCodes} from '../../utils/properties/openaireProperties'; import {ClaimResult} from '../claim-utils/claimEntities.class'; import{DOI} from '../../utils/string-utils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; + declare var UIkit:any; @Component({ @@ -27,6 +29,8 @@ export class ClaimResultSearchFormComponent { } ngOnInit() { + console.log("Init of ClaimResultSearchFormComponent"); + console.log(this.properties); if(this.keyword !=null && this.keyword.length > 0){ this.search(false); } @@ -43,6 +47,8 @@ export class ClaimResultSearchFormComponent { @Input() public select:boolean = true ; @Input() public keyword:string = ''; @Input() public selectedResults:ClaimResult[]; + @Input() public properties:EnvProperties; + // @Output() datasetsChange = new EventEmitter(); // @Output() publicationsChange = new EventEmitter(); @@ -146,14 +152,14 @@ export class ClaimResultSearchFormComponent { private getCrossrefResults (term: string, size : number, page : number) { this.crossrefStatus = this.errorCodes.LOADING; if( this.DOIs.length > 0 ){ - this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs).subscribe( + this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs, this.properties.searchCrossrefAPIURL).subscribe( data => { if(data != null) { this.crossrefResults = data.items; this.crossrefPage=page; this.crossrefResultsNum = data['total-results']; if(data.items == 0){ - this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe( + this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe( data => { if(data != null) { this.crossrefResults = data.items; @@ -178,7 +184,7 @@ private getCrossrefResults (term: string, size : number, page : number) { }, err => { //console.log(err); - this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe( + this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe( data => { this.crossrefResults = data.items; this.crossrefPage=page; @@ -198,7 +204,7 @@ private getCrossrefResults (term: string, size : number, page : number) { }else{ - this._searchCrossrefService.searchCrossrefResults(term, size, page).subscribe( + this._searchCrossrefService.searchCrossrefResults(term, size, page, this.properties.searchCrossrefAPIURL).subscribe( data => { if(data != null) { this.crossrefResults = data.items; @@ -222,7 +228,7 @@ private getCrossrefResults (term: string, size : number, page : number) { if(this.DOIs.length > 0 ){ this.openairePubsStatus = this.errorCodes.LOADING; - this._searchPublicationsService.searchPublicationsByDois(this.DOIs, null, page, size, []).subscribe( + this._searchPublicationsService.searchPublicationsByDois(this.DOIs, null, page, size, [], this.properties).subscribe( data => { if(data != null) { this.openairePubsPage=page; @@ -243,7 +249,7 @@ private getCrossrefResults (term: string, size : number, page : number) { ); }else{ this.openairePubsStatus = this.errorCodes.LOADING; - this._searchPublicationsService.searchPublications('q='+term, null, page, size, []).subscribe( + this._searchPublicationsService.searchPublications('q='+term, null, page, size, [], this.properties).subscribe( data => { if(data != null) { this.openairePubsPage=page; @@ -300,7 +306,7 @@ private getCrossrefResults (term: string, size : number, page : number) { //passing structures in order to fill them in service this._searchOrcidService.searchOrcidAuthor(term, this.authorIds, - this.authorGivenNames, this.authorFamilyNames).subscribe( + this.authorGivenNames, this.authorFamilyNames, this.properties).subscribe( data => { if(data != null && data == true) { this.getOrcidResultsByIndex(0); @@ -330,7 +336,7 @@ private getCrossrefResults (term: string, size : number, page : number) { this.orcidStatus = this.errorCodes.LOADING; //passing structures in order to fill them in service this._searchOrcidService.searchOrcidAuthors(term, this.authorIds, - this.authorGivenNames, this.authorFamilyNames).subscribe( + this.authorGivenNames, this.authorFamilyNames, this.properties).subscribe( data => { if(data != null && data == true) { this.getOrcidResultsByIndex(0); @@ -366,7 +372,7 @@ private getCrossrefResults (term: string, size : number, page : number) { this.authorId = id; console.info("getOrcidResultsById: "+id); this.orcidStatus = this.errorCodes.LOADING; - this._searchOrcidService.searchOrcidPublications(id).subscribe( + this._searchOrcidService.searchOrcidPublications(id, this.properties).subscribe( data => { if(data != null) { this.orcidResults=data['orcid-work']; @@ -492,7 +498,7 @@ openaireSoftwarePageChange($event) { private searchOpenaireData (term: string, size : number, page : number) { if(this.DOIs.length > 0 ){ this.openaireDataStatus = this.errorCodes.LOADING; - this._searchDatasetsService.searchDatasetsByDois(this.DOIs, null, page, size, []).subscribe( + this._searchDatasetsService.searchDatasetsByDois(this.DOIs, null, page, size, [], this.properties).subscribe( data => { if(data != null) { this.openaireDataPage=page; @@ -510,7 +516,7 @@ openaireSoftwarePageChange($event) { } ); }else{ - this._searchDatasetsService.searchDatasets('q='+term+'', null, page, size, []).subscribe( + this._searchDatasetsService.searchDatasets('q='+term+'', null, page, size, [], this.properties).subscribe( data => { if(data != null) { this.openaireDataPage=page; @@ -535,7 +541,7 @@ openaireSoftwarePageChange($event) { private searchOpenaireSoftware (term: string, size : number, page : number) { if(this.DOIs.length > 0 ){ this.openaireSoftwareStatus = this.errorCodes.LOADING; - this._searchSoftwareService.searchSoftwareByDois(this.DOIs, null, page, size, []).subscribe( + this._searchSoftwareService.searchSoftwareByDois(this.DOIs, null, page, size, [], this.properties).subscribe( data => { if(data != null) { this.openaireSoftwarePage=page; @@ -553,7 +559,7 @@ openaireSoftwarePageChange($event) { } ); }else{ - this._searchSoftwareService.searchSoftware('q='+term+'', null, page, size, []).subscribe( + this._searchSoftwareService.searchSoftware('q='+term+'', null, page, size, [], this.properties).subscribe( data => { if(data != null) { this.openaireSoftwarePage=page; @@ -576,7 +582,8 @@ openaireSoftwarePageChange($event) { } private getDataciteResults (term: string, size : number, page : number) { - this._searchDataciteService.searchDataciteResults(term, size, page).subscribe( + console.log("getDataciteResults + "+this.properties.searchDataciteAPIURL) + this._searchDataciteService.searchDataciteResults(term, size, page, this.properties).subscribe( data => { this.dataciteResults = data.data; this.datacitePage=page; diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index 5e385958..5c549304 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -99,8 +99,8 @@ - - + + {{claim.userMail}} {{claim.date}} diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index d6773c57..d1d2953e 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -6,6 +6,7 @@ import {ClaimsService} from '../service/claims.service'; import {ModalLoading} from '../../../utils/modal/loading.component'; import {AlertModal} from '../../../utils/modal/alert'; import {Session} from '../../../login/utils/helper.class'; +import{EnvProperties} from '../../../utils/properties/env-properties'; @Component({ @@ -15,10 +16,17 @@ import {Session} from '../../../login/utils/helper.class'; }) export class DisplayClaimsComponent { + properties:EnvProperties; + constructor (private _claimService: ClaimsService, private route: ActivatedRoute, private _router:Router, private location: Location) { } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + + }); this.sub = this.route.queryParams.subscribe(params => { if( this.myClaims){ this.fetchBy = "User"; @@ -109,7 +117,7 @@ export class DisplayClaimsComponent { types+=(types.length>0?'&':'')+"types="+type; } if(this.fetchBy =="Project" ){ - this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe( + this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe( data => { this.claims = data.data; this.resultsNum= data.total; @@ -119,7 +127,7 @@ export class DisplayClaimsComponent { } ); }else if(this.fetchBy =="User"){ - this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe( + this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types,this.properties.claimsAPIURL).subscribe( data => { this.claims = data.data; this.resultsNum= data.total; @@ -129,7 +137,7 @@ export class DisplayClaimsComponent { } ); }else if(this.fetchBy =="Result"){ - this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe( + this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe( data => { this.claims = data.data; this.resultsNum= data.total; @@ -139,7 +147,7 @@ export class DisplayClaimsComponent { } ); }else if(this.fetchBy =="Context"){ - this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types).subscribe( + this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe( data => { this.claims = data.data; this.resultsNum= null; @@ -150,7 +158,7 @@ export class DisplayClaimsComponent { } ); }else{ - this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types).subscribe( + this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe( data => { this.claims = data.data; this.resultsNum = null; @@ -418,7 +426,7 @@ handleErrors(err){ var token=Session.getUserJwt(); console.log("Deleting claim with id:"+id); // this._claimService.deleteClaimById(id); - this._claimService.deleteClaimById(id).subscribe( + this._claimService.deleteClaimById(id, this.properties.claimsAPIURL).subscribe( res => { console.log('Delete response'+res.code ); console.log("Deleted claim with id:"+ id); @@ -450,7 +458,7 @@ handleErrors(err){ }else{ var token=Session.getUserJwt(); console.warn("Deleting claim with ids:"+ids); - this._claimService.deleteBulk(ids).subscribe( + this._claimService.deleteBulk(ids,this.properties.claimsAPIURL).subscribe( res => { console.info('Delete response'+res.code ); console.warn("Deleted ids:"+ res.deletedIds); diff --git a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts index 8a1262a8..66f8d6de 100644 --- a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts @@ -1,4 +1,5 @@ import {Component, Input} from '@angular/core'; +import{EnvProperties} from '../../../utils/properties/env-properties'; //Usage Example " " @@ -22,7 +23,7 @@ import {Component, Input} from '@angular/core';
- +
@@ -34,14 +35,11 @@ import {Component, Input} from '@angular/core'; export class ClaimEntityFormatter { @Input() entity: string[]; @Input() type: string; + @Input() properties: EnvProperties; constructor () {} ngOnInit() { - if(this.type && this.type == "software"){ - - console.log(this.entity); - } } diff --git a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts index b1b95aa1..175e03f0 100644 --- a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts @@ -1,5 +1,4 @@ import {Component, Input} from '@angular/core'; -import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; import {RouterHelper} from '../../../utils/routerHelper.class'; //Usage Example " " @@ -15,11 +14,12 @@ import {RouterHelper} from '../../../utils/routerHelper.class'; export class ProjectTitleFormatter { @Input() project: string[]; + @Input() searchLink: string; public url:string; public routerHelper:RouterHelper = new RouterHelper(); constructor () {} ngOnInit() { - this.url = OpenaireProperties.getsearchLinkToProject() + "?projectId=" + this.project["openaireId"]; + this.url =this.searchLink+ "?projectId=" + this.project["openaireId"]; } } diff --git a/claims/claim-utils/service/claims.service.ts b/claims/claim-utils/service/claims.service.ts index 45107b3b..4ed72da6 100644 --- a/claims/claim-utils/service/claims.service.ts +++ b/claims/claim-utils/service/claims.service.ts @@ -3,62 +3,57 @@ import {URLSearchParams } from '@angular/http'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; // import {Claim} from '../claim'; -import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; -import { } from '../../../shared/cache.service'; import { CustomOptions } from './customOptions.class'; @Injectable() export class ClaimsService { - private baseUrl; constructor(private http: Http ) { - this.baseUrl = OpenaireProperties.getClaimsAPIURL(); } private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any { console.info('ClaimsService: Claims request: '+url); let key = url; - //(fromCache && OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url - return this.http.get(url, CustomOptions.getAuthOptions()) + return this.http.get(url, CustomOptions.getAuthOptions()) .map(request => request.json()) .do(request => console.info("Get claims: offset = "+(size*(page-1)) + " limit ="+size )) .catch(this.handleError); } - getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string):any { + getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any { console.info('ClaimsService: getClaims ' ); console.info('ClaimsService: Types : '+types ); - let url = this.baseUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; + let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; return this.getClaimRequest(size,page,url,true); } - getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string):any { + getClaimsByUser( size : number, page : number, user:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any { console.info('ClaimsService: getClaims for user : '+user); - let url = this.baseUrl +"users/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; + let url = apiUrl +"users/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; return this.getClaimRequest(size,page,url,false); } - getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string ):any { + getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string):any { console.info('ClaimsService: getClaims for context : '+contextId); - let url = this.baseUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; + let url = apiUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; return this.getClaimRequest(size,page,url,true); } - getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string ):any { + getClaimsByResult( size : number, page : number, resultId:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string ):any { console.info('ClaimsService: getClaims for result : '+resultId); - let url = this.baseUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; + let url = apiUrl +"results/"+resultId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; return this.getClaimRequest(size,page,url,true); } - getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string ):any { + getClaimsByProject( size : number, page : number, projectId:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string ):any { console.info('ClaimsService: getClaims for project : '+projectId); - let url = this.baseUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; + let url = apiUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+"&"+types; return this.getClaimRequest(size,page,url,true); } - deleteClaimById(claimId:string ):any{ + deleteClaimById(claimId:string , apiUrl:string):any{ console.warn('Trying to delete claim with id : '+claimId); - let url = this.baseUrl +"claims/"+claimId; + let url = apiUrl +"claims/"+claimId; // let headers = new Headers({ 'Content-Type': 'application/json' }); // let options = new RequestOptions({ headers: headers }); return this.http.delete( url, CustomOptions.getAuthOptionsWithBody()).map(request => request.json()) @@ -66,7 +61,7 @@ export class ClaimsService { .catch(this.handleError); } - deleteBulk(claimIds:string[]):any{ + deleteBulk(claimIds:string[], apiUrl:string):any{ console.warn('Trying to delete claims with ids : '+claimIds); var url = ""; @@ -74,7 +69,7 @@ export class ClaimsService { for(var claimId of claimIds){ url=url+(url.length >0 ?"&":"")+"claimId="+claimId; } - url= this.baseUrl +"claims/bulk?"+url; + url= apiUrl +"claims/bulk?"+url; // let headers = new Headers({ 'Content-Type': 'application/json' }); // let options = new RequestOptions({ headers: headers }); @@ -83,9 +78,9 @@ export class ClaimsService { .catch(this.handleError); } - insertBulkClaims(claims):any{ + insertBulkClaims(claims, apiUrl:string):any{ console.warn('Trying toinsert claims : '+claims); - let url = this.baseUrl +"claims/bulk"; + let url = apiUrl +"claims/bulk"; let body = JSON.stringify( claims ); console.warn('Json body: : '+body); // let headers = new Headers({ 'Content-Type': 'application/json' }); @@ -96,9 +91,9 @@ export class ClaimsService { .catch(this.handleError); } - insertClaim(claim):any{ + insertClaim(claim, apiUrl:string):any{ console.warn('Trying toinsert claim : '+claim); - let url = this.baseUrl +"claims"; + let url = apiUrl +"claims"; let body = JSON.stringify( claim ); // let headers = new Headers({ 'Content-Type': 'application/json' }); // let options = new RequestOptions({ headers: headers }); @@ -108,9 +103,9 @@ export class ClaimsService { .catch(this.handleError); } - insertDirectRecords(records):any{ + insertDirectRecords(records, apiUrl:string):any{ console.warn('Trying to feedrecords : '+records); - let url = this.baseUrl +"feed/bulk"; + let url = apiUrl +"feed/bulk"; let body = JSON.stringify( records ); console.warn('Json body: : '+body); // let headers = new Headers({ 'Content-Type': 'application/json' }); @@ -128,8 +123,8 @@ export class ClaimsService { return Observable.throw(error || 'Server error'); } - getClaim(id:string):any { - let url = this.baseUrl+"claims/"+id; + getClaim(id:string, apiUrl:string):any { + let url = apiUrl+"claims/"+id; return new Promise((resolve, reject) => { this.http.get(url) .map(res => res.json()) diff --git a/claims/claim-utils/service/contexts.service.ts b/claims/claim-utils/service/contexts.service.ts index f5d15f70..cf9a2956 100644 --- a/claims/claim-utils/service/contexts.service.ts +++ b/claims/claim-utils/service/contexts.service.ts @@ -3,22 +3,18 @@ import {Jsonp, URLSearchParams, RequestOptions, Headers} from '@angular/http'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import {Claim} from '../claim'; -import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; import {AutoCompleteValue} from '../../../searchPages/searchUtils/searchHelperClasses.class'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; -import { } from '../../../shared/cache.service'; import { COOKIE } from '../../../login/utils/helper.class'; @Injectable() export class ContextsService { - private baseUrl; constructor(private http: Http ) { - this.baseUrl = OpenaireProperties.getClaimsAPIURL(); } - public getCommunities():any { - let url = this.baseUrl + 'communities'; + public getCommunities( apiUrl:string):any { + let url = apiUrl + 'communities'; let key = url; @@ -28,9 +24,9 @@ export class ContextsService { // .do(request => console.info("Get claims: offset = ")) .catch(this.handleError); } - public getCategories(communityId :string):any { + public getCategories(communityId :string, apiUrl:string):any { console.info('ContextsService: request categories for community with id '+communityId); - let url= this.baseUrl + 'communities/' + communityId + '/categories'; + let url= apiUrl + 'communities/' + communityId + '/categories'; let key = url; @@ -39,9 +35,9 @@ export class ContextsService { // .do(request => console.info("Get claims: offset = " )) .catch(this.handleError);; } - public getConcepts(categoryId :string, keyword: string, parsing:boolean):any { + public getConcepts(categoryId :string, keyword: string, parsing:boolean, apiUrl:string):any { console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword); - let url= this.baseUrl + 'categories/' + categoryId+ "/concepts"; + let url= apiUrl + 'categories/' + categoryId+ "/concepts"; let key = url+"_parsing="+parsing; diff --git a/claims/claim-utils/service/searchCrossref.service.ts b/claims/claim-utils/service/searchCrossref.service.ts index 40c4e993..38000e3a 100644 --- a/claims/claim-utils/service/searchCrossref.service.ts +++ b/claims/claim-utils/service/searchCrossref.service.ts @@ -1,7 +1,6 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; -import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; @@ -10,8 +9,8 @@ export class SearchCrossrefService { constructor( private http: Http ) {} - searchCrossrefResults (term: string, size : number, page : number):any { - let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?query='+term+'&rows='+size+'&offset='+(size*(page-1)); + searchCrossrefResults (term: string, size : number, page : number, apiUrl:string):any { + let url = apiUrl+'?query='+term+'&rows='+size+'&offset='+(size*(page-1)); let key = url; return this.http.get(url) @@ -20,18 +19,13 @@ export class SearchCrossrefService { //.catch(this.handleError); } - searchCrossrefByDOIs(DOIs: string[]):any { - /* - $request ="http://api.crossref.org/works"."?filter="; - foreach($dois as $doi){ - $request.="doi:".urlencode( trim($doi)).","; - } - */ + searchCrossrefByDOIs(DOIs: string[], apiUrl:string):any { + var doisParams = ""; for(var i =0 ;i < DOIs.length; i++){ doisParams+=(doisParams.length > 0?",":"")+'doi:'+DOIs[i]; } - let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter='+doisParams; + let url = apiUrl+'?filter='+doisParams; let key = url; @@ -41,12 +35,12 @@ export class SearchCrossrefService { //.catch(this.handleError); } - searchCrossrefByMultipleDOIs(dois: string[]):any { - let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter=doi:'; + searchCrossrefByMultipleDOIs(dois: string[], apiUrl:string):any { + let url = apiUrl+'?filter=doi:'; for(var i=0; i request.json()) .do(items => console.info(items)) .do(items => console.log("Datacite Results: total results = "+items.meta.total+" keyword = "+term)); //.catch(this.handleError); } - getDataciteResultByDOI (doi: string):any { + getDataciteResultByDOI (doi: string, properties:EnvProperties):any { console.info("Fetch datacite resultt by DOI: "+doi); - let url = OpenaireProperties.getSearchDataciteAPIURL()+'/'+doi; + let url = properties.searchDataciteAPIURL+'/'+doi; let key = url; - return this.http.get( (OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get( (properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(request => request.json()) .do(items => console.info(items)); // .do(items => console.log("Datacite Results: total results = "+items.meta.total+" doi = "+doi)) diff --git a/claims/claim-utils/service/searchOrcid.service.ts b/claims/claim-utils/service/searchOrcid.service.ts index 0a60ef7a..6adccbfa 100644 --- a/claims/claim-utils/service/searchOrcid.service.ts +++ b/claims/claim-utils/service/searchOrcid.service.ts @@ -3,7 +3,7 @@ import {URLSearchParams} from '@angular/http'; import {Http, Response} from '@angular/http'; import { Headers, RequestOptions } from '@angular/http'; import {Observable} from 'rxjs/Observable'; -import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; +import{EnvProperties} from '../../../utils/properties/env-properties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; @@ -14,13 +14,13 @@ export class SearchOrcidService { searchOrcidAuthor (term: string, authorIds: string[], - authorGivenNames: string[], authorFamilyNames: string[]):any { + authorGivenNames: string[], authorFamilyNames: string[], properties:EnvProperties):any { console.info("In searchOrcidAuthor: "+term); var headers = new Headers(); headers.append('Accept', 'application/orcid+json'); - let url = OpenaireProperties.getSearchOrcidURL()+term+'/orcid-bio'; + let url = properties.searchOrcidURL + term+'/orcid-bio'; let key = url; return this.http.get(url, { headers: headers }) @@ -32,13 +32,13 @@ export class SearchOrcidService { } searchOrcidAuthors (term: string, authorIds: string[], - authorGivenNames: string[], authorFamilyNames: string[]):any { + authorGivenNames: string[], authorFamilyNames: string[], properties:EnvProperties):any { console.info("In search Orcid authors for keyword: "+term); var headers = new Headers(); headers.append('Accept', 'application/orcid+json'); - let url = OpenaireProperties.getSearchOrcidURL()+'search/orcid-bio?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10'; + let url = properties.searchOrcidURL+'search/orcid-bio?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10'; let key = url; return this.http.get(url, { headers: headers }) @@ -47,13 +47,13 @@ export class SearchOrcidService { } - searchOrcidPublications (id: string):any { + searchOrcidPublications (id: string, properties:EnvProperties):any { console.info("In search Orcid publications for author: "+id); var headers = new Headers(); headers.append('Accept', 'application/orcid+json'); - let url = OpenaireProperties.getSearchOrcidURL()+id+'/orcid-works'; + let url =properties.searchOrcidURL+id+'/orcid-works'; let key = url; return this.http.get(url, { headers: headers }) diff --git a/claims/claimsByToken/claimsByToken.component.html b/claims/claimsByToken/claimsByToken.component.html new file mode 100644 index 00000000..6d61f438 --- /dev/null +++ b/claims/claimsByToken/claimsByToken.component.html @@ -0,0 +1,166 @@ +
+
+
+
+ + +
+
+ + +

Oops! Your email does not give you the authority to view claims for the selected project. Please contact the administrators.

+
+
+ +
+
+ Claims Administrator + + {{project['name']}} ({{project['funderName']}}) + + +
+

Pending Claims

+ +
+
No pending claims found.
+
+ +
+ +
+
+ +
+
+ + + {{totalPendingResults.count}} pending claims, page {{activePendingPage.page}} of {{totalPages(totalPendingResults.count)}} + + + + + + + + + + + + + + + + + + + + + + +
Research Result Claimed By Claimed Date Approve
{{claim1.userMail}}{{claim1.date}} + + + +
+
+ +
*Note that claims you did not approved or disapproved are considered as right (but not curated)
+ + +

Already Curated Claims

+ +
+
No curated claims found.
+
+ +
+ +
+
+ +
+
+ + + {{totalCuratedResults.count}} curated claims, page {{activeCuratedPage.page}} of {{totalPages(totalCuratedResults.count)}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Research ResultClaimed by Claimed Date Curated by Curation Date Approved
{{claim.userMail}}{{claim.date}}{{claim.curatedBy}}{{claim.curationDate}} + + + + + +
+
+ + + +
+ +
+
+
+
diff --git a/claims/claimsByToken/claimsByToken.component.ts b/claims/claimsByToken/claimsByToken.component.ts index dc30a911..71532793 100644 --- a/claims/claimsByToken/claimsByToken.component.ts +++ b/claims/claimsByToken/claimsByToken.component.ts @@ -13,177 +13,11 @@ import {RouterHelper} from '../../utils/routerHelper.class'; import { Meta} from '../../../angular2-meta'; import {ClaimsDatatablePipe} from '../../utils/pipes/claimsDatatable.pipe'; import { DataTableDirective } from 'angular-datatables'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'claims-project-manager', - template: ` -
-
-
-
- - -
-
- - -

Oops! Your email does not give you the authority to view claims for the selected project. Please contact the administrators.

-
-
- -
-
- Claims Administrator - - {{project['name']}} ({{project['funderName']}}) - - -
-

Pending Claims

- -
-
No pending claims found.
-
- -
- -
-
- -
-
- - - {{totalPendingResults.count}} pending claims, page {{activePendingPage.page}} of {{totalPages(totalPendingResults.count)}} - - - - - - - - - - - - - - - - - - - - - - -
Research Result Claimed By Claimed Date Approve
{{claim1.userMail}}{{claim1.date}} - - - -
-
- -
*Note that claims you did not approved or disapproved are considered as right (but not curated)
- - -

Already Curated Claims

- -
-
No curated claims found.
-
- -
- -
-
- -
-
- - - {{totalCuratedResults.count}} curated claims, page {{activeCuratedPage.page}} of {{totalPages(totalCuratedResults.count)}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Research ResultClaimed by Claimed Date Curated by Curation Date Approved
{{claim.userMail}}{{claim.date}}{{claim.curatedBy}}{{claim.curationDate}} - - - - - -
-
- - - -
- -
-
-
-
- `, + templateUrl: 'claimsByToken.component.html' }) export class ClaimsByTokenComponent { @@ -219,13 +53,18 @@ export class ClaimsByTokenComponent { @ViewChild (ModalSelect) selectModal : ModalSelect; @ViewChild (ModalLoading) loading : ModalLoading ; - +properties:EnvProperties; public routerHelper:RouterHelper = new RouterHelper(); constructor ( private route: ActivatedRoute, private claimsByTokenService: ClaimsByTokenService, private _meta: Meta) { } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + + }); this.sub = this.route.queryParams.subscribe(params => { this.token = params['token']; this.selectedRight = new Set(); @@ -287,7 +126,7 @@ public sortByTitle2= (claim: any) => { validateJWTandToken() { var jwtToken=Session.getUserJwt(); if(this.token) { - this.claimsByTokenService.getClaims(this.token, jwtToken).subscribe( + this.claimsByTokenService.getClaims(this.token, jwtToken, this.properties.claimsAPIURL).subscribe( data => { this.closeLoading(); this.accessStatus = "valid"; @@ -376,7 +215,7 @@ public sortByTitle2= (claim: any) => { console.info("Changes Saved!"); var jwtToken=Session.getUserJwt(); - this.claimsByTokenService.updateClaimsCuration(this.selectedRight, this.selectedWrong).subscribe( + this.claimsByTokenService.updateClaimsCuration(this.selectedRight, this.selectedWrong, this.properties.claimsAPIURL).subscribe( data => { console.info(data); }, diff --git a/claims/claimsByToken/claimsByToken.service.ts b/claims/claimsByToken/claimsByToken.service.ts index ab75c85a..d01b06b6 100644 --- a/claims/claimsByToken/claimsByToken.service.ts +++ b/claims/claimsByToken/claimsByToken.service.ts @@ -2,7 +2,6 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Jsonp, URLSearchParams,ResponseOptions, RequestOptions, Headers} from '@angular/http'; import {Observable} from 'rxjs/Observable'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import 'rxjs/add/operator/do'; import { CustomOptions } from '../claim-utils/service/customOptions.class'; @@ -12,17 +11,17 @@ export class ClaimsByTokenService { constructor(private http: Http ) {} - getClaims(token: string, jwtToken: string):any { + getClaims(token: string, jwtToken: string, apiURL:string):any { console.info("getClaims in service"); - let url = OpenaireProperties.getClaimsAPIURL()+"project/claims?projectToken="+token; + let url = apiURL+"project/claims?projectToken="+token; let key = url; return this.http.get(url, CustomOptions.getAuthOptions()) //.map(res => res.text()) .map(request => request.json()); - + } @@ -40,8 +39,8 @@ export class ClaimsByTokenService { } */ - updateClaimsCuration( selectedRight: Set, selectedWrong: Set) { - let url = OpenaireProperties.getClaimsAPIURL() + "curate/bulk"; + updateClaimsCuration( selectedRight: Set, selectedWrong: Set, apiURL:string) { + let url = apiURL + "curate/bulk"; let claimsCurationInfo: any = []; //e.g.: [{"id":"2","approved":true},{"id":"1","approved":true}] selectedRight.forEach(function(selected) { diff --git a/claims/directLinking/directLinking.component.html b/claims/directLinking/directLinking.component.html index cf995879..3244f314 100644 --- a/claims/directLinking/directLinking.component.html +++ b/claims/directLinking/directLinking.component.html @@ -102,11 +102,11 @@
- + - + - +
@@ -114,7 +114,7 @@
+ (showChange)="showChange($event)" [(properties)]=properties>
    diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index 8df535bb..db945592 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -6,6 +6,7 @@ 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 { Meta} from '../../../angular2-meta'; @@ -31,11 +32,18 @@ export class DirectLinkingComponent { sub:any =null; show:string="claim"; //{claim,result} 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"); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + + }); if(localStorage.getItem("projects")){ this.projects = JSON.parse(localStorage.getItem("projects")); } @@ -101,7 +109,7 @@ export class DirectLinkingComponent { } } getProjectById(id:string){ - this.sub = this.entitySearch.fetchByType(id,"project").subscribe( + this.sub = this.entitySearch.fetchByType(id,"project", this.properties).subscribe( data => { console.log(data); var item =data[0]; @@ -128,7 +136,7 @@ export class DirectLinkingComponent { } getPublicationById(id:string, isInlineResult:boolean){ - this.sub = this.publicationsSearch.searchPublicationById(id).subscribe( + this.sub = this.publicationsSearch.searchPublicationById(id,this.properties).subscribe( data => { var item =data[0]; var result: ClaimResult = new ClaimResult(); @@ -154,7 +162,7 @@ export class DirectLinkingComponent { }); } getDatasetById(id:string, isInlineResult:boolean){ - this.sub = this.datasetsSearch.searchDatasetById(id).subscribe( + this.sub = this.datasetsSearch.searchDatasetById(id,this.properties).subscribe( data => { var item =data[0]; var result: ClaimResult = new ClaimResult(); @@ -180,7 +188,7 @@ export class DirectLinkingComponent { }); } getSoftwareById(id:string, isInlineResult:boolean){ - this.sub = this.softwareSearch.searchSoftwareById(id).subscribe( + this.sub = this.softwareSearch.searchSoftwareById(id,this.properties).subscribe( data => { var item =data[0]; var result: ClaimResult = new ClaimResult(); diff --git a/claims/linking/bulkClaim/bulkClaim.component.ts b/claims/linking/bulkClaim/bulkClaim.component.ts index a7627bcf..d65b7d16 100644 --- a/claims/linking/bulkClaim/bulkClaim.component.ts +++ b/claims/linking/bulkClaim/bulkClaim.component.ts @@ -5,8 +5,8 @@ import {SearchDataciteService} from '../../claim-utils/service/searchDatacite.se import {ModalLoading} from '../../../utils/modal/loading.component'; import {Dates, DOI} from '../../../utils/string-utils.class'; -import {OpenaireProperties} from '../../../utils/properties/openaireProperties'; import {ClaimResult} from '../../claim-utils/claimEntities.class'; +import{EnvProperties} from '../../../utils/properties/env-properties'; @Component({ @@ -86,6 +86,7 @@ export class BulkClaimComponent { resultsFromSearch:number; @Input() public select:boolean = true ; @Input() public results; + @Input() public properties:EnvProperties; allIds:string[] = []; foundIds:string[] = []; @@ -113,7 +114,7 @@ export class BulkClaimComponent { } this.loading.open(); - this.makeFileRequest(OpenaireProperties.getUploadServiceUrl(), [], this.filesToUpload).then((result) => { + this.makeFileRequest(this.properties.uploadService, [], this.filesToUpload).then((result) => { var rows = (result as any).split('\n'); // I have used space, you can use any thing. var i = 0; this.duplicateIds = []; @@ -199,7 +200,7 @@ export class BulkClaimComponent { } fetchResult(id:string,accessMode:string,date:string){ - this._searchCrossrefService.searchCrossrefByDOIs([id]).subscribe( + this._searchCrossrefService.searchCrossrefByDOIs([id], this.properties.searchCrossrefAPIURL).subscribe( data => { var crossrefResult = data.items[0]; @@ -222,7 +223,7 @@ export class BulkClaimComponent { ); } searchInDatacite(id:string,accessMode:string,date:string){ - this._searchDataciteService.getDataciteResultByDOI(id).subscribe( + this._searchDataciteService.getDataciteResultByDOI(id,this.properties).subscribe( item => { var dataciteResult = item.data; diff --git a/claims/linking/bulkLinking.component.ts b/claims/linking/bulkLinking.component.ts deleted file mode 100644 index 96e32dcf..00000000 --- a/claims/linking/bulkLinking.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -// import {Component, Input} from '@angular/core'; -// import {Observable} from 'rxjs/Observable'; -// -// @Component({ -// selector: 'bulk-linking', -// //providers: [MdRadioDispatcher], -// template: ` -// -// ` -// -// }) -// //[(ngModel)]="date" -// export class BulkLinkingComponent { -// constructor () { -// } -// } diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index faea79ff..6b811362 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -8,6 +8,7 @@ import {AlertModal} from '../../../utils/modal/alert'; import {Md5} from 'ts-md5/dist/md5'; import {Session} from '../../../login/utils/helper.class'; import {ErrorCodes} from '../../../login/utils/guardHelper.class'; +import{EnvProperties} from '../../../utils/properties/env-properties'; @Component({ selector: 'claim-insert', @@ -40,6 +41,7 @@ export class ClaimInsertComponent { @Input() public showButton:boolean = true; @Input() show='claim'; @Input() inlineEntity = null; // the entity from the landing page + @Input() public properties:EnvProperties; @Output() showChange = new EventEmitter(); @ViewChild (ModalLoading) loading : ModalLoading ; @@ -122,7 +124,7 @@ private insertActions(){ //first call direct index service - when call is done (success or error) call isertBulkClaims method to insert claims in DB console.info("\n\ndirectclaims: "+directclaims.length+"\n\n"); if(directclaims.length > 0){ - this.claimService.insertDirectRecords(directclaims).subscribe( + this.claimService.insertDirectRecords(directclaims,this.properties.claimsAPIURL).subscribe( data => { this.insertedRecords = data.insertedIds; @@ -149,7 +151,7 @@ private insertActions(){ private isertBulkClaims(claims){ console.info("try to insert "+claims.length+" claims"); - this.claimService.insertBulkClaims(claims).subscribe( + this.claimService.insertBulkClaims(claims,this.properties.claimsAPIURL).subscribe( data => { this.insertedClaims = data.insertedIds; this.errorInClaims = data.errorInClaims; diff --git a/claims/linking/linkingGeneric.component.html b/claims/linking/linkingGeneric.component.html index 64cbe741..18fefae4 100644 --- a/claims/linking/linkingGeneric.component.html +++ b/claims/linking/linkingGeneric.component.html @@ -52,11 +52,11 @@
    • - +
    • - +
    @@ -82,8 +82,8 @@
- - + +
@@ -100,7 +100,7 @@
  • + (showChange)="showChange($event)" [(properties)] = properties>
  • diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index 379b8677..789d072f 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -6,6 +6,8 @@ import {ClaimProject, ClaimResult} from '../claim-utils/claimEntities.class'; import {SearchPublicationsService} from '../../services/searchPublications.service'; import {SearchDatasetsService} from '../../services/searchDatasets.service'; import { Meta} from '../../../angular2-meta'; +import{EnvProperties} from '../../utils/properties/env-properties'; + declare var UIkit:any; @Component({ @@ -34,11 +36,18 @@ export class LinkingGenericComponent { entityTypes=["dataset", "publication", "project","context"]; inlineResult:ClaimResult =null; 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"); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + + }); if( typeof localStorage !== 'undefined') { if(localStorage.getItem("projects")){ this.projects = JSON.parse(localStorage.getItem("projects")); diff --git a/claims/linking/selected/selectedContexts.component.ts b/claims/linking/selected/selectedContexts.component.ts index c8e572a9..ca728220 100644 --- a/claims/linking/selected/selectedContexts.component.ts +++ b/claims/linking/selected/selectedContexts.component.ts @@ -9,11 +9,7 @@ import {ClaimContext} from '../../claim-utils/claimEntities.class';
    - +
    Selected Communities ({{contexts.length}})
    diff --git a/claims/linking/selected/selectedProjects.component.ts b/claims/linking/selected/selectedProjects.component.ts index d8929ec3..a84d20ea 100644 --- a/claims/linking/selected/selectedProjects.component.ts +++ b/claims/linking/selected/selectedProjects.component.ts @@ -8,12 +8,7 @@ import {RouterHelper} from '../../../utils/routerHelper.class';
    - - +
    Selected Projects ({{projects.length}})
      diff --git a/claims/linking/selected/selectedResults.component.ts b/claims/linking/selected/selectedResults.component.ts index b1b91aca..a115e11c 100644 --- a/claims/linking/selected/selectedResults.component.ts +++ b/claims/linking/selected/selectedResults.component.ts @@ -10,17 +10,6 @@ import {Dates} from '../../../utils/string-utils.class'; - -
      There are no selected research results
      diff --git a/deposit/datasets/depositBySubject.component.ts b/deposit/datasets/depositBySubject.component.ts index 17a17268..b26485fd 100644 --- a/deposit/datasets/depositBySubject.component.ts +++ b/deposit/datasets/depositBySubject.component.ts @@ -1,7 +1,6 @@ import {Component, Input} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import { Router } from '@angular/router'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; @@ -29,6 +28,6 @@ export class DepositBySubjectComponent { constructor (private _router: Router) { } public search() { - this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "q": this.subjectKeyword } } ); + this._router.navigate( ['participate/deposit-subject-result'], { queryParams: { "subject": this.subjectKeyword } } ); } } diff --git a/deposit/datasets/depositBySubjectResult.component.html b/deposit/datasets/depositBySubjectResult.component.html index 69825626..c99b3667 100644 --- a/deposit/datasets/depositBySubjectResult.component.html +++ b/deposit/datasets/depositBySubjectResult.component.html @@ -47,7 +47,7 @@ + [custom_class]="'other-results'" [(properties)] = properties>
      diff --git a/deposit/datasets/depositBySubjectResult.component.ts b/deposit/datasets/depositBySubjectResult.component.ts index 438db3c1..54f0342b 100644 --- a/deposit/datasets/depositBySubjectResult.component.ts +++ b/deposit/datasets/depositBySubjectResult.component.ts @@ -1,6 +1,6 @@ import {Component, Input} from '@angular/core'; import {Observable} from 'rxjs/Observable'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import { Router } from '@angular/router'; import { ActivatedRoute } from '@angular/router'; import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; @@ -11,6 +11,7 @@ import { Meta} from '../../../angular2-meta'; import {RouterHelper} from '../../utils/routerHelper.class'; import {PiwikService} from '../../utils/piwik/piwik.service'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'deposit-by-subject-result', @@ -41,31 +42,37 @@ export class DepositBySubjectResultComponent { sub: any; piwiksub: any; + properties:EnvProperties; constructor ( private _router: Router, private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService, private _meta: Meta, private _piwikService:PiwikService) { - this.zenodo = OpenaireProperties.getZenodoURL(); 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); - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe(); - } } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + this.zenodo = this.properties.zenodo; + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe(); + } + + }); console.info('depositResult init'); this.sub = this.route.queryParams.subscribe(params => { - this.subject = params['q']; + this.subject = params['subject']; this.newSubject = this.subject; this.searchDataproviders(); }); @@ -95,8 +102,8 @@ export class DepositBySubjectResultComponent { public searchDataproviders() { this.subject = this.newSubject; - this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10); - this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders(); + this.fetchDataproviders.getResultsBySubjectsForDeposit( (this.subject =="")?"*":this.subject, this.requestFor, this.page, 10, this.properties); + this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders; } public goToDeposit() { diff --git a/deposit/deposit.component.html b/deposit/deposit.component.html index f18817f4..c62af9f3 100644 --- a/deposit/deposit.component.html +++ b/deposit/deposit.component.html @@ -30,7 +30,7 @@
      - diff --git a/deposit/deposit.component.ts b/deposit/deposit.component.ts index 04565a11..6d4c1010 100644 --- a/deposit/deposit.component.ts +++ b/deposit/deposit.component.ts @@ -1,9 +1,9 @@ import {Component, Input} from '@angular/core'; import {Observable} from 'rxjs/Observable'; -import { Router } from '@angular/router'; -import {OpenaireProperties} from '../utils/properties/openaireProperties'; +import { Router, ActivatedRoute} from '@angular/router'; import { Meta} from '../../angular2-meta'; import {PiwikService} from '../utils/piwik/piwik.service'; +import{EnvProperties} from '../utils/properties/env-properties'; @Component({ @@ -36,22 +36,30 @@ export class DepositComponent { public warningMessage: string = ""; piwiksub:any; + properties:EnvProperties; - constructor (private _router: Router, private _meta: Meta, private _piwikService:PiwikService) { + constructor ( private route: ActivatedRoute, private _router: Router, private _meta: Meta, private _piwikService:PiwikService) { - this.openAccess = OpenaireProperties.getOpenAccess(); - this.openAccessRepo = OpenaireProperties.getOpenAccessRepo(); - this.fp7Guidlines = OpenaireProperties.getFP7Guidlines(); - this.h2020Guidlines = OpenaireProperties.getH2020Guidlines(); - this.ercGuidlines = OpenaireProperties.getERCGuidlines(); - this.helpdesk = OpenaireProperties.getHelpdesk(); this.updateTitle("Deposit "+this.requestFor); this.updateDescription("Openaire, repositories, open access, content provider, compatibility, organization, deposit "+ this.requestFor); - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe(); - } } + ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.openAccess = this.properties.openAccess; + this.openAccessRepo = this.properties.openAccessRepo; + this.fp7Guidlines = this.properties.fp7Guidlines + this.h2020Guidlines = this.properties.h2020Guidlines + this.ercGuidlines = this.properties.ercGuidlines + this.helpdesk = this.properties.helpdesk; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe(); + } + }); + } ngOnDestroy() { if(this.piwiksub){ this.piwiksub.unsubscribe(); diff --git a/deposit/depositResult.component.ts b/deposit/depositResult.component.ts index bbd41c31..c3b5b199 100644 --- a/deposit/depositResult.component.ts +++ b/deposit/depositResult.component.ts @@ -1,8 +1,7 @@ import {Component, Input} from '@angular/core'; import {Observable} from 'rxjs/Observable'; -import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties'; -import { Router } from '@angular/router'; -import { ActivatedRoute } from '@angular/router'; +import {ErrorCodes} from '../utils/properties/openaireProperties'; +import { Router, ActivatedRoute } from '@angular/router'; import { FetchDataproviders } from '../utils/fetchEntitiesClasses/fetchDataproviders.class'; import { SearchDataprovidersService } from '../services/searchDataproviders.service'; @@ -11,6 +10,7 @@ import { Meta} from '../../angular2-meta'; import {RouterHelper} from '../utils/routerHelper.class'; import {PiwikService} from '../utils/piwik/piwik.service'; +import{EnvProperties} from '../utils/properties/env-properties'; @Component({ selector: 'deposit-result', @@ -37,7 +37,7 @@ import {PiwikService} from '../utils/piwik/piwik.service';
      - @@ -79,7 +79,7 @@ import {PiwikService} from '../utils/piwik/piwik.service'; + [custom_class]="'other-results'" [(properties)] =properties>
      @@ -154,6 +154,7 @@ export class DepositResultComponent { public errorCodes:ErrorCodes = new ErrorCodes(); sub: any; piwiksub: any; + properties:EnvProperties; constructor ( private _router: Router, private route: ActivatedRoute, @@ -161,19 +162,25 @@ export class DepositResultComponent { private _organizationService: OrganizationService, private _meta: Meta, private _piwikService:PiwikService) { - this.zenodo = OpenaireProperties.getZenodoURL(); 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); - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe(); - } - } + } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.zenodo = this.properties.zenodo; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView("Deposit "+this.requestFor).subscribe(); + } + }); + console.info('depositResult init'); this.sub = this.route.queryParams.subscribe(params => { @@ -204,15 +211,15 @@ export class DepositResultComponent { // if(this.organization != undefined) { // this.fetchDataproviders.getResults(this.organization.name, false, 1, 10); // } else if(this.organizationId != undefined) { - this.fetchDataproviders.getResultsForDeposit( this.organizationId,this.requestFor, 1, 10); + this.fetchDataproviders.getResultsForDeposit( this.organizationId,this.requestFor, 1, 10, this.properties); //} - this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders(); + this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders; } private getOrganizationInfo () { console.info("inside getOrganizationInfo of component"); - this._organizationService.getOrganizationInfo(this.organizationId).subscribe( + this._organizationService.getOrganizationInfo(this.organizationId,this.properties).subscribe( data => { if(data == null) { this.status = this.errorCodes.NOT_FOUND; diff --git a/error/isRouteEnabled.guard.ts b/error/isRouteEnabled.guard.ts index f196f322..f1e800f2 100644 --- a/error/isRouteEnabled.guard.ts +++ b/error/isRouteEnabled.guard.ts @@ -1,23 +1,28 @@ import { Injectable } from '@angular/core'; -import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router'; +import {ActivatedRoute, Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/operator/filter'; import { ConfigurationService } from '../utils/configuration/configuration.service'; +import{EnvProperties} from '../utils/properties/env-properties'; @Injectable() export class IsRouteEnabled implements CanActivate { - constructor(private router: Router, private config: ConfigurationService) {} + constructor(private route: ActivatedRoute,private router: Router, private config: ConfigurationService) {} canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { - let customRedirect = route.data['redirect']; - console.log("In IsRouteEnabled"); - console.log(state.url.split("?")[0].substring(1)); - let isEnabled = this.config.isPageEnabled(state.url.split("?")[0].substring(1)); - let redirect = !!customRedirect ? customRedirect : '/error'; - isEnabled.filter(enabled => !enabled) - .subscribe(() => this.router.navigate([redirect], { queryParams: { "page": state.url } })); + + let customRedirect = route.data['redirect']; + let api = route.data['api']; + let community = route.data['community'] + console.log("In IsRouteEnabled"); + console.log(state.url.split("?")[0].substring(1)); + let isEnabled = this.config.isPageEnabled(api, community,"/"+state.url.split("?")[0].substring(1)); + let redirect = !!customRedirect ? customRedirect : '/error'; + isEnabled.filter(enabled => !enabled) + .subscribe(() => this.router.navigate([redirect], { queryParams: { "page": state.url } })); - return isEnabled; - } + return isEnabled; + + } } diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 2a5d336a..b02652d8 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -129,22 +129,22 @@ + [fetchPublications] = "fetchPublications" [(properties)]=properties> + [fetchDatasets]="fetchDatasets" [(properties)]=properties> + [fetchProjects]="fetchProjects" [(properties)]=properties> + [fetchDataproviders]="fetchDataproviders" [(properties)]=properties> + [fetchDatasets]="fetchAggregatorsDatasets" [(properties)]=properties> @@ -207,7 +207,7 @@ + (metricsResults)="metricsResults($event)" [(properties)] = properties> diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 155960ee..653b15c8 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -13,9 +13,10 @@ 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 {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {RouterHelper} from '../../utils/routerHelper.class'; import {PiwikService} from '../../utils/piwik/piwik.service'; +import{EnvProperties} from '../../utils/properties/env-properties'; import 'rxjs/add/operator/switch'; import 'rxjs/add/operator/switchMap'; @@ -83,6 +84,7 @@ export class DataProviderComponent { piwiksub: any; subInfo: any; relatedDatasourcesSub: any; + properties:EnvProperties; constructor (private element: ElementRef, private _dataproviderService: DataProviderService, @@ -99,10 +101,15 @@ export class DataProviderComponent { this.fetchProjects = new FetchProjects(this._searchProjectsService); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + }); this.sub = this.route.queryParams.subscribe(data => { this.updateTitle("Content provider"); this.updateDescription("Content provider, search, repositories, open access"); @@ -142,14 +149,14 @@ export class DataProviderComponent { this.showLoading = false; this.warningMessage="No valid datasource id"; }else{ - this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId).subscribe( + this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe( data => { this.dataProviderInfo = data; this.initTabs(); this.showTabs = true ; this.updateTitle(this.dataProviderInfo.title.name); this.updateDescription("Content provider, search, repositories, open access,"+this.dataProviderInfo.title.name); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.dataProviderInfo.title.name).subscribe(); } @@ -198,13 +205,13 @@ export class DataProviderComponent { this.metricsClicked = false; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcRepoViews","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "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":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "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":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&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'; + this.viewsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcRepoViews","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "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":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "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":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&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'; */ - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","dtsrcName":"'+this.datasourceId+'","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 downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","dtsrcName":"'+this.datasourceId+'","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 downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; /* - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","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 downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&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'; + this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","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 downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&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'; */ this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.datasourceId+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": -30, "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=600&h=250'; @@ -274,52 +281,52 @@ export class DataProviderComponent { if( this.reloadPublications && ( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING || this.fetchPublications.searchUtils.status == this.errorCodes.DONE ) ) { - this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size); + this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } this.reloadPublications = false; } private countPublications(page: number, size: number) { - this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size); + this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } private searchDatasets(page: number, size: number) { if( this.reloadDatasets && ( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING || this.fetchDatasets.searchUtils.status == this.errorCodes.DONE ) ) { - this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size); + this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } this.reloadDatasets = false; } private countDatasets(page: number, size: number) { - this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size); + this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } private searchProjects(page: number, size: number) { if( this.reloadProjects && ( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING || this.fetchProjects.searchUtils.status == this.errorCodes.DONE ) ) { - this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size); + this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties); } this.reloadProjects = false; } private countProjects(page: number, size: number) { - this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size); + this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties); } private searchDatasources(page: number, size: number) { if( this.reloadDataproviders && ( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING || this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE ) ) { - this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size); + this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties); } this.reloadDataproviders = false; } private countDatasources(page: number, size: number) { - this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size); + this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties); } private searchRelatedDatasources(page: number, size: number) { @@ -338,8 +345,8 @@ export class DataProviderComponent { () => { this.preprocessRelatedDatasources(); } ) - this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size); - this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size); + this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties); + this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties); } else { this.loadingRelatedDatasources = false; } @@ -349,8 +356,8 @@ export class DataProviderComponent { } private countRelatedDatasources(page: number, size: number) { - this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size); - this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size); + this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties); + this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties); } diff --git a/landingPages/dataProvider/dataProvider.service.ts b/landingPages/dataProvider/dataProvider.service.ts index 4b549e8d..dafb74b0 100644 --- a/landingPages/dataProvider/dataProvider.service.ts +++ b/landingPages/dataProvider/dataProvider.service.ts @@ -2,10 +2,10 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Injectable() @@ -15,12 +15,12 @@ export class DataProviderService { dataProviderInfo: DataProviderInfo; - getDataproviderInfo (id: string):any { + getDataproviderInfo (id: string, properties:EnvProperties):any { console.info("getDataProviderInfo in service"); - let url = OpenaireProperties.getSearchAPIURLLast() + 'datasources/' +id +"?format=json"; + let url = properties.searchAPIURLLAst + 'datasources/' +id +"?format=json"; let key = url; - return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .map(res => res['result']['metadata']['oaf:entity']) .map(res => [res['oaf:datasource'], @@ -142,7 +142,7 @@ export class DataProviderService { this.dataProviderInfo.organizations[counter] = {"name": "", "id": ""}; this.dataProviderInfo.organizations[counter]['name'] = mydata.legalname; - this.dataProviderInfo.organizations[counter]['id'] = /*OpenaireProperties.getsearchLinkToOrganization()+*/mydata['to'].content; + this.dataProviderInfo.organizations[counter]['id'] = mydata['to'].content; if(mydata.country != '' && mydata['country'].classname != '') { if(!countriesSet.has(mydata['country'].classname)) { diff --git a/landingPages/dataProvider/datasetsTab.component.ts b/landingPages/dataProvider/datasetsTab.component.ts index d75edae7..c2ae9753 100644 --- a/landingPages/dataProvider/datasetsTab.component.ts +++ b/landingPages/dataProvider/datasetsTab.component.ts @@ -1,7 +1,8 @@ import {Component, Input} from '@angular/core'; import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'datasetsTab', @@ -35,13 +36,14 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro export class DatasetsTabComponent { @Input() paramsForSearchLink = {}; @Input() fetchDatasets : FetchDatasets; + @Input() properties:EnvProperties ; public linkToSearchDatasets = ""; public errorCodes:ErrorCodes = new ErrorCodes(); constructor () {} ngOnInit() { - this.linkToSearchDatasets = OpenaireProperties.getLinkToAdvancedSearchDatasets(); + this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets; } ngOnDestroy() {} diff --git a/landingPages/dataProvider/datasourcesTab.component.ts b/landingPages/dataProvider/datasourcesTab.component.ts index 4db8adf8..a873d80d 100644 --- a/landingPages/dataProvider/datasourcesTab.component.ts +++ b/landingPages/dataProvider/datasourcesTab.component.ts @@ -1,7 +1,8 @@ import {Component, Input} from '@angular/core'; import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'datasourcesTab', @@ -37,13 +38,15 @@ export class DatasourcesTabComponent { @Input() paramsForSearchLink = {}; @Input() fetchDataproviders : FetchDataproviders; + @Input() properties:EnvProperties ; + public linkToSearchDataproviders = ""; public errorCodes:ErrorCodes = new ErrorCodes(); constructor () {} ngOnInit() { - this.linkToSearchDataproviders = OpenaireProperties.getLinkToAdvancedSearchDataProviders(); + this.linkToSearchDataproviders = this.properties.searchLinkToAdvancedDataProviders; } ngOnDestroy() {} diff --git a/landingPages/dataProvider/projectsTab.component.ts b/landingPages/dataProvider/projectsTab.component.ts index 4102e285..08bf7469 100644 --- a/landingPages/dataProvider/projectsTab.component.ts +++ b/landingPages/dataProvider/projectsTab.component.ts @@ -2,7 +2,8 @@ import {Component, Input} from '@angular/core'; import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import { ErrorCodes} from '../../utils/properties/openaireProperties'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'projectsTab', @@ -36,13 +37,15 @@ export class ProjectsTabComponent { @Input() paramsForSearchLink = {}; @Input() fetchProjects : FetchProjects; + @Input() properties:EnvProperties ; + public linkToSearchProjects = ""; public errorCodes:ErrorCodes = new ErrorCodes(); constructor () {} ngOnInit() { - this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects(); + this.linkToSearchProjects = this.properties.searchLinkToAdvancedProjects; } ngOnDestroy() {} diff --git a/landingPages/dataProvider/publicationsTab.component.ts b/landingPages/dataProvider/publicationsTab.component.ts index 156e48e6..8cf59f26 100644 --- a/landingPages/dataProvider/publicationsTab.component.ts +++ b/landingPages/dataProvider/publicationsTab.component.ts @@ -1,7 +1,8 @@ import {Component, Input} from '@angular/core'; import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'publicationsTab', @@ -37,13 +38,15 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro export class PublicationsTabComponent { @Input() paramsForSearchLink = {};//: string = ""; @Input() fetchPublications : FetchPublications; + @Input() properties:EnvProperties ; + public linkToSearchPublications = ""; public errorCodes:ErrorCodes = new ErrorCodes(); constructor () {} ngOnInit() { - this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();//+this.paramsForSearchLink; + this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications } ngOnDestroy() {} diff --git a/landingPages/dataProvider/relatedDatasourcesTab.component.ts b/landingPages/dataProvider/relatedDatasourcesTab.component.ts index da85f597..96ffd3ad 100644 --- a/landingPages/dataProvider/relatedDatasourcesTab.component.ts +++ b/landingPages/dataProvider/relatedDatasourcesTab.component.ts @@ -3,9 +3,10 @@ import {Component, Input} from '@angular/core'; import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class'; import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import { ErrorCodes} from '../../utils/properties/openaireProperties'; import {RouterHelper} from '../../utils/routerHelper.class'; import { Observable } from 'rxjs/Observable'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'relatedDatasourcesTab', @@ -89,6 +90,7 @@ export class RelatedDatasourcesTabComponent { @Input() loading: boolean = true; // Εvery content provider's id is a single key of a map @Input() results: Map; + @Input() properties:EnvProperties ; public linkToSearchPublications: string = ""; public linkToSearchResearchData: string = ""; @@ -102,8 +104,8 @@ export class RelatedDatasourcesTabComponent { constructor () {} ngOnInit() { - this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();//+"?&hostedBy=";//+ +"&ho=and&collectedFrom="+ +"&co=and"; - this.linkToSearchResearchData = OpenaireProperties.getLinkToAdvancedSearchDatasets(); + this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications; + this.linkToSearchResearchData = this.properties.searchLinkToAdvancedDatasets; } ngOnDestroy() {} diff --git a/landingPages/dataProvider/statisticsTab.component.ts b/landingPages/dataProvider/statisticsTab.component.ts index 4aae1f91..586ca574 100644 --- a/landingPages/dataProvider/statisticsTab.component.ts +++ b/landingPages/dataProvider/statisticsTab.component.ts @@ -1,7 +1,7 @@ import {Component, Input} from '@angular/core'; import { SearchDatasetsComponent } from '../../searchPages/simple/searchDatasets.component'; import { SearchPublicationsComponent } from '../../searchPages/simple/searchPublications.component'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import { ErrorCodes} from '../../utils/properties/openaireProperties'; @Component({ selector: 'statisticsTab', diff --git a/landingPages/dataset/dataset.component.html b/landingPages/dataset/dataset.component.html index f14ec667..7ec3e7d9 100644 --- a/landingPages/dataset/dataset.component.html +++ b/landingPages/dataset/dataset.component.html @@ -12,9 +12,9 @@
      {{datasetInfo.types.join(", ")}} - {{datasetInfo.languages.join(", ")}} + {{datasetInfo.languages.join(", ")}} - {{datasetInfo.title.accessMode}} + {{datasetInfo.title.accessMode}} @@ -155,7 +155,7 @@
      {{provenanceaction}}
      - +
      @@ -165,14 +165,14 @@ No similar research results available
      - +
    + (metricsResults)="metricsResults($event)" [(properties)] = properties> diff --git a/landingPages/dataset/dataset.component.ts b/landingPages/dataset/dataset.component.ts index b1c5829b..8661c099 100644 --- a/landingPages/dataset/dataset.component.ts +++ b/landingPages/dataset/dataset.component.ts @@ -3,10 +3,10 @@ import {Observable} from 'rxjs/Observable'; import {DatasetService} from './dataset.service'; import {DatasetInfo} from '../../utils/entities/datasetInfo'; import {ActivatedRoute, Router} from '@angular/router'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties' import {RouterHelper} from '../../utils/routerHelper.class'; import { Meta} from '../../../angular2-meta'; import {PiwikService} from '../../utils/piwik/piwik.service'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'dataset', @@ -45,6 +45,7 @@ export class DatasetComponent { private result ; sub: any; piwiksub: any; infoSub: any; + properties:EnvProperties; constructor (private element: ElementRef, private _datasetService: DatasetService, @@ -52,10 +53,15 @@ export class DatasetComponent { private route: ActivatedRoute, private _meta: Meta, private _router: Router) { - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + }); this.sub = this.route.queryParams.subscribe(params => { this.datasetInfo = null; this.updateTitle("Dataset"); @@ -73,12 +79,12 @@ export class DatasetComponent { this.metricsClicked = false; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; */ - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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'; + this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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'; */ if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); @@ -102,12 +108,12 @@ export class DatasetComponent { this.errorMessage="" this.showLoading = true; - this.infoSub = this._datasetService.getDatasetInfo(id).subscribe( + this.infoSub = this._datasetService.getDatasetInfo(id, this. properties).subscribe( data => { this.datasetInfo = data; this.updateTitle(this.datasetInfo.title.name); this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.datasetInfo.title.name).subscribe(); } diff --git a/landingPages/dataset/dataset.service.ts b/landingPages/dataset/dataset.service.ts index a6328f2e..63923050 100644 --- a/landingPages/dataset/dataset.service.ts +++ b/landingPages/dataset/dataset.service.ts @@ -2,10 +2,10 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import {DatasetInfo} from '../../utils/entities/datasetInfo'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; +import{EnvProperties} from '../../utils/properties/env-properties'; import { ParsingFunctions } from '../landing-utils/parsingFunctions.class'; @@ -19,14 +19,14 @@ export class DatasetService { public parsingFunctions: ParsingFunctions; datasetInfo: DatasetInfo; - getDatasetInfo (id: string):any { + getDatasetInfo (id: string, properties:EnvProperties):any { console.info("getDatasetInfo in service"); - let url = OpenaireProperties. getSearchAPIURLLast()+'datasets/'+id+"?format=json"; + let url = properties.searchAPIURLLAst+'datasets/'+id+"?format=json"; let key = url; - return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .do(res => console.info(res['result']['metadata']['oaf:entity'])) .map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']['oaf:result']]) diff --git a/landingPages/htmlProjectReport/htmlProjectReport.component.ts b/landingPages/htmlProjectReport/htmlProjectReport.component.ts index b08ccf15..d318ec0f 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.component.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.component.ts @@ -3,9 +3,9 @@ import {Observable} from 'rxjs/Observable'; import {ActivatedRoute, Params, Router} from '@angular/router'; import {HtmlProjectReportService} from './htmlProjectReport.service'; import {ProjectService} from '../project/project.service'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import { Meta} from '../../../angular2-meta'; import {PiwikService} from '../../utils/piwik/piwik.service'; +import{EnvProperties} from '../../utils/properties/env-properties'; declare var UIkit: any; @@ -57,16 +57,22 @@ export class HtmlProjectReportComponent{ public warningMessage: string = ""; public errorMessage: string = ""; public showLoading: boolean = true; + properties:EnvProperties; constructor ( private route: ActivatedRoute, private htmlService: HtmlProjectReportService, private _piwikService:PiwikService, private _projectService: ProjectService, private _meta: Meta, private _router: Router) { - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + }); this.sub = this.route.queryParams.subscribe(params => { this.projectId = params['projectId']; @@ -119,7 +125,7 @@ export class HtmlProjectReportComponent{ } private createHeaders() { - this.subHTMLInfo = this._projectService.getHTMLInfo(this.projectId).subscribe( + this.subHTMLInfo = this._projectService.getHTMLInfo(this.projectId, this.properties).subscribe( data => { this.createHeader1(data); if(data.acronym) { @@ -127,7 +133,7 @@ export class HtmlProjectReportComponent{ } else if(data.title){ this.updateTitle(data.title+" "+this.resultsType+" report"); } - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(((data.acronym)?data.acronym:data.title)+" "+this.resultsType+" report").subscribe(); } }, @@ -154,10 +160,15 @@ export class HtmlProjectReportComponent{ intro += ''; if (typeof window !== 'undefined') { - this.subHTML = this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType).subscribe( + this.subHTML = this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType, this.properties.csvAPIURL).subscribe( data => { - let body: string = intro+'

    '+this.header1+'

    '+this.header2+'

    '+data+''; - this.htmlResult = data; + //let body: string = intro+'

    '+this.header1+'

    '+this.header2+'

    '+data+''; + let body: string = intro+'

    '+this.header1+'

    '+this.header2+'

    '; + body += ""+data+"
    TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
    "; + body += ''; + + //this.htmlResult = data; + this.htmlResult = ""+data+"
    TitleAuthorsPublication YearDOIPermanent IdentifierPublication typeJournalProject Name (GA Number)Access Mode
    "; let clipboard; let Clipboard; diff --git a/landingPages/htmlProjectReport/htmlProjectReport.service.ts b/landingPages/htmlProjectReport/htmlProjectReport.service.ts index c044af95..095a9ea2 100644 --- a/landingPages/htmlProjectReport/htmlProjectReport.service.ts +++ b/landingPages/htmlProjectReport/htmlProjectReport.service.ts @@ -1,7 +1,6 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import 'rxjs/add/operator/do'; @Injectable() @@ -9,7 +8,7 @@ export class HtmlProjectReportService { constructor(private http: Http ) {} - getHTML(id: string, size: number, type:string):any { + getHTML(id: string, size: number, type:string, csvAPIURL: string ):any { console.info("getHTML in service"); let resultTypeId: string; @@ -25,9 +24,9 @@ export class HtmlProjectReportService { requestType = 'software' } - //let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json"; - let url = OpenaireProperties.getCsvAPIURL(); - url += 'resources?format=html&page=0&size='+size+'&type='+requestType+'&query=(((oaftype exact result) and (resulttypeid exact '+resultTypeId+')) and (relprojectid exact "'+id+'"))'; + let url = csvAPIURL; + url += '?format=html&type='+requestType+'&fq=(((oaftype exact result) and (resulttypeid exact '+resultTypeId+')) and (relprojectid exact "'+id+'"))'; + let key = url; return this.http.get(url) diff --git a/landingPages/landing-utils/addThis.component.ts b/landingPages/landing-utils/addThis.component.ts index b17d1cae..0d30db1f 100644 --- a/landingPages/landing-utils/addThis.component.ts +++ b/landingPages/landing-utils/addThis.component.ts @@ -27,12 +27,12 @@ export class AddThisComponent { ngOnInit() { this.sub = this.route.queryParams.subscribe(data => { - if (typeof document !== 'undefined') { + if (typeof document !== 'undefined' && typeof addthis !== 'undefined') { try{ addthis.init(); addthis.layers.refresh(); }catch (e) { - console.log(e); + console.log("AddThis may didn't load properly"); } } }); diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 40b1baab..ae9f9c7d 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -1,5 +1,4 @@ import {Component, Input, ElementRef} from '@angular/core'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; @Component({ selector: 'availableOn', diff --git a/landingPages/landing-utils/fundedBy.component.ts b/landingPages/landing-utils/fundedBy.component.ts index 885ad549..20247d96 100644 --- a/landingPages/landing-utils/fundedBy.component.ts +++ b/landingPages/landing-utils/fundedBy.component.ts @@ -1,6 +1,5 @@ import {Component, Input, ElementRef} from '@angular/core'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; - + @Component({ selector: 'fundedBy', template: ` diff --git a/landingPages/landing-utils/metrics.component.ts b/landingPages/landing-utils/metrics.component.ts index b4c75833..120602fd 100644 --- a/landingPages/landing-utils/metrics.component.ts +++ b/landingPages/landing-utils/metrics.component.ts @@ -4,6 +4,7 @@ import {MetricsService } from '../../services/metrics.service'; import {ErrorCodes} from '../../utils/properties/openaireProperties'; import { Subscription } from 'rxjs/Subscription'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'metrics', @@ -167,6 +168,7 @@ export class MetricsComponent { @Input() entity: string; //@Input() name: string = ""; @Input() pageViews: number = 0; + @Input() properties:EnvProperties; public metrics: Metrics; public errorCodes:ErrorCodes; @@ -194,7 +196,7 @@ export class MetricsComponent { // console.log("supplied id in metrics is not acceptable"); //} - this.sub = this._metricsService.getMetrics(this.id, this.entityType).subscribe( + this.sub = this._metricsService.getMetrics(this.id, this.entityType, this.properties).subscribe( data => { this.metrics = data; this.status = this.errorCodes.DONE; diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 70b8e0c2..394c0ee3 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -1,4 +1,3 @@ -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; export class ParsingFunctions { @@ -157,7 +156,7 @@ export class ParsingFunctions { available.downloadName = publisher; } - let url = OpenaireProperties.getDoiURL()+identifiers.get("doi")[0]; + let url = "https://dx.doi.org/"+identifiers.get("doi")[0]; available.downloadUrl = new Array(); available.accessMode = new Array(); diff --git a/landingPages/landing-utils/publishedIn.component.ts b/landingPages/landing-utils/publishedIn.component.ts index 7a4f47be..0f5eed1c 100644 --- a/landingPages/landing-utils/publishedIn.component.ts +++ b/landingPages/landing-utils/publishedIn.component.ts @@ -1,5 +1,4 @@ import {Component, Input, ElementRef} from '@angular/core'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; @Component({ selector: 'publishedIn', diff --git a/landingPages/landing-utils/searchingProjectsInTab.component.ts b/landingPages/landing-utils/searchingProjectsInTab.component.ts index c96d23ba..88a9802e 100644 --- a/landingPages/landing-utils/searchingProjectsInTab.component.ts +++ b/landingPages/landing-utils/searchingProjectsInTab.component.ts @@ -4,9 +4,10 @@ import {ActivatedRoute} from '@angular/router'; import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class'; import { SearchProjectsService } from '../../services/searchProjects.service'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {StringUtils} from '../../utils/string-utils.class'; import {RouterHelper} from '../../utils/routerHelper.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'searchingProjectsTab', @@ -57,6 +58,7 @@ import {RouterHelper} from '../../utils/routerHelper.class'; export class SearchingProjectsTabComponent { @Input() fetchProjects : FetchProjects; @Input() organizationId:string = ""; + @Input() properties:EnvProperties; public page :number = 1; public size :number = 10; public linkToSearchProjects: string; @@ -74,7 +76,7 @@ export class SearchingProjectsTabComponent { ngOnInit() { if(this.organizationId) { - this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();//+"?organization="+this.organizationId+"or=and";; + this.linkToSearchProjects = this.properties.searchLinkToAdvancedPublications;//+"?organization="+this.organizationId+"or=and";; if(this.fetchProjects.searchUtils.totalResults > 0) { this.search(false,""); } @@ -84,7 +86,7 @@ export class SearchingProjectsTabComponent { private search(refine:boolean, filterQuery:string){ var refineFields:string [] = ["funder"]; - this.fetchProjects.getResultsForOrganizations(this.organizationId, filterQuery, this.page, this.size,(refine)?refineFields:[]); + this.fetchProjects.getResultsForOrganizations(this.organizationId, filterQuery, this.page, this.size,(refine)?refineFields:[], this.properties); } public pageChange($event) { diff --git a/landingPages/landing-utils/showIdentifiers.component.ts b/landingPages/landing-utils/showIdentifiers.component.ts index 1092d55c..1ddc4035 100644 --- a/landingPages/landing-utils/showIdentifiers.component.ts +++ b/landingPages/landing-utils/showIdentifiers.component.ts @@ -1,5 +1,4 @@ import {Component, Input, ElementRef} from '@angular/core'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; @Component({ selector: 'showIdentifiers', @@ -47,9 +46,9 @@ export class ShowIdentifiersComponent { public pageSize: number = 10; constructor (private element: ElementRef) { - this.doiURL = OpenaireProperties.getDoiURL(); - this.pmcURL = OpenaireProperties.getPmcURL(); - this.handleURL = OpenaireProperties.getHandleURL(); + this.doiURL = "https://dx.doi.org/"; + this.pmcURL = "http://europepmc.org/articles/"; + this.handleURL = "http://hdl.handle.net/"; } ngOnInit() {} diff --git a/landingPages/landing-utils/tabTable.component.ts b/landingPages/landing-utils/tabTable.component.ts index 83e51e77..7ed62215 100644 --- a/landingPages/landing-utils/tabTable.component.ts +++ b/landingPages/landing-utils/tabTable.component.ts @@ -1,7 +1,7 @@ import {Component, Input} from '@angular/core'; import {RouterHelper} from '../../utils/routerHelper.class'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; //import {PagingModule} from '../utils/paging.module'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'tabTable', @@ -69,7 +69,7 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties'; export class TabTableComponent { @Input() info: { "name": string, "url": string, "date": string, "trust": number}[];//Map; - + @Input() properties:EnvProperties; public routerHelper:RouterHelper = new RouterHelper(); public searchLinkToPublication: string; public searchLinkToDataset: string; @@ -81,8 +81,8 @@ export class TabTableComponent { } ngOnInit() { - this.searchLinkToPublication = OpenaireProperties.getsearchLinkToPublication(); - this.searchLinkToDataset = OpenaireProperties.getsearchLinkToDataset(); + this.searchLinkToPublication = this.properties.searchLinkToPublication; + this.searchLinkToDataset = this.properties.searchLinkToDataset; } totalPages(totalResults: number): number { diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index 83ebdb03..734c2202 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -107,7 +107,7 @@
    - +
    @@ -160,7 +160,7 @@ - + Project list for {{funder.name}} (CSV) @@ -175,7 +175,10 @@
  • - + + + + Publications of organization (CSV) - based on the affiliation information. diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 1e02b02d..c0cd9348 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -13,7 +13,7 @@ import {SearchPublicationsService} from '../../services/searchPublications.servi import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchProjectsService} from '../../services/searchProjects.service'; import { Meta} from '../../../angular2-meta'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchingProjectsTabComponent} from '../landing-utils/searchingProjectsInTab.component'; import {RouterHelper} from '../../utils/routerHelper.class'; @@ -21,6 +21,7 @@ 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', @@ -85,7 +86,7 @@ export class OrganizationComponent { countProjectsSub: any; countPublSub: any; downloadProjectPublSub: any; - + properties:EnvProperties; //private ngUnsubscribe: Subject = new Subject(); constructor (private element: ElementRef, @@ -101,10 +102,15 @@ export class OrganizationComponent { this.fetchPublications = new FetchPublications(this._searchPublicationsService); this.fetchProjects = new FetchProjects(this._searchProjectsService); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + }); console.info('organization init'); this.sub = this.route.queryParams.subscribe(params => { this.organizationInfo=null; @@ -130,8 +136,8 @@ export class OrganizationComponent { }); - this.downloadURLAPI = OpenaireProperties.getCsvAPIURL(); - this.csvProjectParamsHead = 'format=csv&type=projects&page=0&query=( (oaftype exact project)and (funder exact "'; + this.downloadURLAPI =this.properties.csvAPIURL; + this.csvProjectParamsHead = 'format=csv&type=projects&fq=( (oaftype exact project)and (funder exact "'; //this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact '; } @@ -172,7 +178,7 @@ export class OrganizationComponent { this.errorMessage="" this.showLoading = true; - this.infoSub = this._organizationService.getOrganizationInfo(this.organizationId).subscribe( + this.infoSub = this._organizationService.getOrganizationInfo(this.organizationId, this.properties).subscribe( data => { if(data == null) { this.showLoading = false; @@ -181,16 +187,16 @@ export class OrganizationComponent { this.organizationInfo = data; this.updateTitle(this.organizationInfo.title.name); this.updateDescription("Organization, country, projects, search, repositories, open access"+this.organizationInfo.title.name); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.organizationInfo.title.name).subscribe(); } var refineFields:string [] = ["funder"]; this.searchPublications(); - this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0,refineFields); + this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0,refineFields,this.properties); - this.fetchDataproviders.getNumForEntity("organization", this.organizationId); + this.fetchDataproviders.getNumForEntity("organization", this.organizationId,this.properties); this.showLoading = false; @@ -215,19 +221,7 @@ export class OrganizationComponent { } ); } -/* - private getMetrics() { - console.info("getOrganizationMetrics: component"); - this._organizationService.getMetrics(this.organizationId).subscribe( - data => { - this.metrics = data; - }, - err => { - console.log(err); - } - ); - } -*/ + /* private handleClick(funder: string) { if(this.emptyFundersSet) { @@ -256,8 +250,8 @@ export class OrganizationComponent { //} private searchPublications() { - this.fetchPublications.getResultsForEntity("organization", this.organizationId, 1, 10); - this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();// + "?project=" + this.projectId+"&pr=and"; + this.fetchPublications.getResultsForEntity("organization", this.organizationId, 1, 10,this.properties); + this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications; if(this.fetchPublications.searchUtils.totalResults > 0) { //this.activeTab = "Publications"; } else { @@ -266,8 +260,8 @@ export class OrganizationComponent { } private searchDataproviders() { - this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10); - this.linkToSearchDataproviders = OpenaireProperties.getLinkToAdvancedSearchDataProviders(); + this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10,this.properties); + this.linkToSearchDataproviders = this.properties.searchLinkToAdvancedDataProviders; if(this.fetchDataproviders.searchUtils.totalResults > 0) { this.reloadDataproviders = false; @@ -293,7 +287,7 @@ export class OrganizationComponent { data => { this.closeLoading(); window.open(window.URL.createObjectURL(data)); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.downloadFilePiwikSub = this._piwikService.trackDownload(url).subscribe(); } }, @@ -317,24 +311,27 @@ export class OrganizationComponent { let counter: number = count; let title: boolean = false; - this.countProjectsSub = this._searchProjectsService.getProjectsForOrganizations(this.organizationId,' and (funder exact "'+ funderId + '" ) ',1,count,[]).subscribe( + this.countProjectsSub = this._searchProjectsService.getProjectsForOrganizations(this.organizationId,' and (funder exact "'+ funderId + '" ) ',1,count,[], this.properties).subscribe( data => { projects = data[1]; for(let index=0; index < projects.length; index++) { - this.countPublSub = this._searchPublicationsService.numOfEntityPublications(projects[index].id, "project").subscribe( + this.countPublSub = this._searchPublicationsService.numOfEntityPublications(projects[index].id, "project", this.properties).subscribe( data => { // let index: number = this.organizationInfo.projects.get(funder).indexOf(project); let url: string; - if(index == 0 || !title) { - url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special&size="+data; + if(!title) { + //url = this.downloadURLAPI+"projects/"+projects[index].id+"?type=publications&format=csv-special";//&size="+data; + url = this.downloadURLAPI+"?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact '"+projects[index].id+"'))" + console.info(url); } else { - url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special-notitle&size="+data; + //url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special-notitle";//&size="+data; + url = this.downloadURLAPI+"?format=csv-special-notitle&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact '"+projects[index].id+"'))" } - if(data == 0) { // if no publications for this project + if(data == 0 && (counter > 1 || title)) { // if no publications for this project counter--; response[index] = ""; if(counter == 0) { @@ -345,7 +342,7 @@ export class OrganizationComponent { } this.closeLoading(); window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' }))); - // if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + // if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ // this._piwikService.trackDownload(url).subscribe(); // } } @@ -366,7 +363,7 @@ export class OrganizationComponent { } this.closeLoading(); window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' }))); - // if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + // if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ // this._piwikService.trackDownload(url).subscribe(); // } } diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 43a4b467..f2610a3a 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -270,7 +270,7 @@ + (metricsResults)="metricsResults($event)" [(properties)] = properties>
  • - + Get {{projectInfo.funder}} report (CSV)
  • @@ -356,7 +356,7 @@
  • - + Get {{projectInfo.funder}} report (CSV)
  • diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 3e8f32d3..beef051a 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -15,10 +15,11 @@ import { SearchSoftwareService } from '../../services/searchSoftware.service'; import {ModalLoading} from '../../utils/modal/loading.component'; import {ReportsService} from '../../services/reports.service'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import { ErrorCodes} from '../../utils/properties/openaireProperties'; import { Meta} from '../../../angular2-meta'; import {PiwikService} from '../../utils/piwik/piwik.service'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'project', @@ -84,7 +85,7 @@ export class ProjectComponent{ @ViewChild('AlertModalCsvError') alertCsvError; sub: any; piwiksub: any; infoSub: any; downloadFilePiwikSub: any; - +properties:EnvProperties; constructor ( private element: ElementRef, private _projectService: ProjectService, private _piwikService:PiwikService, @@ -94,10 +95,15 @@ export class ProjectComponent{ private _searchSoftwareService: SearchSoftwareService, private _reportsService: ReportsService, private _meta: Meta, private _router: Router) { - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + }); this.sub = this.route.queryParams.subscribe(params => { this.metricsClicked = false; this.statsClicked = false; @@ -142,19 +148,19 @@ export class ProjectComponent{ this.getProjectInfo(this.projectId); this.searchPublications(); - this.fetchDatasets.getNumForEntity("project", this.projectId); - this.fetchSoftware.getNumForEntity("project", this.projectId); + this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties); + this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties); }else{ this.showLoading = false; this.warningMessage="No valid project id"; } - this.downloadURLAPI = OpenaireProperties.getCsvAPIURL(); + this.downloadURLAPI = this.properties.csvAPIURL; this.createClipboard(); - this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size="; - this.csvParamsDatasets = "format=csv-special&page=0&type=datasets&query=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact "+this.projectId+"))&size="; - this.csvParamsSoftware = "format=csv-special&page=0&type=software&query=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact "+this.projectId+"))&size="; + this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))"; + this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact "+this.projectId+"))"; + this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact "+this.projectId+"))"; if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); @@ -189,8 +195,8 @@ export class ProjectComponent{ } private searchPublications() { - this.fetchPublications.getResultsForEntity("project", this.projectId, 1, 10); - this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();// + "?project=" + this.projectId+"&pr=and"; + this.fetchPublications.getResultsForEntity("project", this.projectId, 1, 10, this.properties); + this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications;// + "?project=" + this.projectId+"&pr=and"; if(this.fetchPublications.searchUtils.totalResults > 0) { //this.activeTab = "Publications"; } else { @@ -199,16 +205,16 @@ export class ProjectComponent{ } private searchDatasets() { - this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10); - this.linkToSearchDatasets = OpenaireProperties.getLinkToAdvancedSearchDatasets();// + "?project=" + this.projectId+"&pr=and"; + this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10, this.properties); + this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;// + "?project=" + this.projectId+"&pr=and"; this.reloadDatasets = false; //this.activeTab = "Research Data"; } private searchSoftware() { - this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10); - this.linkToSearchSoftware = OpenaireProperties.getLinkToAdvancedSearchSoftware(); + this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10, this.properties); + this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware; this.reloadSoftware = false; } @@ -234,7 +240,7 @@ export class ProjectComponent{ this.errorMessage="" this.showLoading = true; - this.infoSub = this._projectService.getProjectInfo(id).subscribe( + this.infoSub = this._projectService.getProjectInfo(id, this.properties).subscribe( data => { this.projectInfo = data; @@ -244,15 +250,15 @@ export class ProjectComponent{ } this.updateTitle(this.projectName); this.updateDescription("project, funding, open access, publications, research data, "+this.projectName+ ","+this.projectInfo.funder); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.projectName).subscribe(); } this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate }; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"projRepoViews","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projRepoDownloads","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 downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"projRepoDownloads","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 downloads"],"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'; //stats tab charts this.chartScientificResultsUrl='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projScient","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "spline", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250'; @@ -277,7 +283,7 @@ export class ProjectComponent{ data => { this.closeLoading(); window.open(window.URL.createObjectURL(data)); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.downloadFilePiwikSub = this._piwikService.trackDownload(url).subscribe(); } }, diff --git a/landingPages/project/project.service.ts b/landingPages/project/project.service.ts index 57b57d90..d52bb0ad 100644 --- a/landingPages/project/project.service.ts +++ b/landingPages/project/project.service.ts @@ -2,10 +2,10 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import {ProjectInfo} from '../../utils/entities/projectInfo'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; +import{EnvProperties} from '../../utils/properties/env-properties'; import { ParsingFunctions } from '../landing-utils/parsingFunctions.class'; @@ -19,31 +19,31 @@ export class ProjectService { public parsingFunctions: ParsingFunctions; projectInfo: ProjectInfo; - getProjectInfo (id: string):any { + getProjectInfo (id: string, properties:EnvProperties):any { console.info("getProjectInfo in service"); - let url = OpenaireProperties. getSearchAPIURLLast() + 'projects/'+id+"?format=json"; + let url = properties.searchAPIURLLAst + 'projects/'+id+"?format=json"; let key = url; - return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .map(res => res['result']['metadata']['oaf:entity']['oaf:project']) .map(res => [res, res['fundingtree'], res['rels']['rel']]) - .map(res => this.parseProjectInfo(res)); + .map(res => this.parseProjectInfo(res, properties)); } /* get project strtDate and endDate */ - getProjectDates (id: string):any { + getProjectDates (id: string, properties:EnvProperties):any { - let url = OpenaireProperties. getSearchAPIURLLast()+'projects/'+id+"?format=json"; + let url = properties.searchAPIURLLAst+'projects/'+id+"?format=json"; let key = url+'_projectDates'; - return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .map(res => res['result']['metadata']['oaf:entity']['oaf:project']) .map(res => [res, @@ -53,11 +53,11 @@ export class ProjectService { } - getHTMLInfo(id: string): any { - let url = OpenaireProperties. getSearchAPIURLLast() + 'projects/'+id+"?format=json"; + getHTMLInfo(id: string, properties:EnvProperties): any { + let url = properties.searchAPIURLLAst + 'projects/'+id+"?format=json"; let key = url; - return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .map(res => res['result']['metadata']['oaf:entity']['oaf:project']) .map(res => this.parseHTMLInfo(res)); @@ -79,7 +79,7 @@ export class ProjectService { return htmlInfo; } - parseProjectInfo (data: any):any { + parseProjectInfo (data: any, properties:EnvProperties):any { this.projectInfo = new ProjectInfo(); if(data[0] != null) { @@ -186,7 +186,7 @@ export class ProjectService { } if(this.projectInfo.funder == "EC") { - this.projectInfo.url = OpenaireProperties.getCordisURL()+this.projectInfo.contractNum; + this.projectInfo.url = properties.cordisURL+this.projectInfo.contractNum; this.projectInfo.urlInfo = "Detailed project information (CORDIS)"; } diff --git a/landingPages/publication/publication.component.html b/landingPages/publication/publication.component.html index 1fa28104..7f76b198 100644 --- a/landingPages/publication/publication.component.html +++ b/landingPages/publication/publication.component.html @@ -285,7 +285,7 @@
    {{provenanceaction}}
    - +
    @@ -297,7 +297,7 @@
    - +
    @@ -419,7 +419,7 @@ + (metricsResults)="metricsResults($event)" [(properties)] = properties> { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + }); this.sub = this.route.queryParams.subscribe(data => { this.publicationInfo = null; this.updateTitle("Publication"); @@ -92,9 +98,9 @@ export class PublicationComponent { this.warningMessage="No valid publication id"; } - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.articleId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.articleId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.articleId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.downloadsFrameUrl =this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.articleId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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'; if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); @@ -117,7 +123,7 @@ export class PublicationComponent { this.errorMessage="" this.showLoading = true; - this.infoSub = this._publicationService.getPublicationInfo(this.articleId).subscribe( + this.infoSub = this._publicationService.getPublicationInfo(this.articleId, this.properties).subscribe( data => { this.publicationInfo = data; @@ -125,7 +131,7 @@ export class PublicationComponent { // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestaccessright, embargoEndDate: ''}; this.updateTitle(this.publicationInfo.title.name); this.updateDescription("Dataset, search, repositories, open access,"+this.publicationInfo.title.name); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.publicationInfo.title.name).subscribe(); } diff --git a/landingPages/publication/publication.service.ts b/landingPages/publication/publication.service.ts index 2aabb215..51e2787a 100644 --- a/landingPages/publication/publication.service.ts +++ b/landingPages/publication/publication.service.ts @@ -3,11 +3,11 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import {PublicationInfo} from '../../utils/entities/publicationInfo'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; import 'rxjs/add/operator/map'; +import{EnvProperties} from '../../utils/properties/env-properties'; import { ParsingFunctions } from '../landing-utils/parsingFunctions.class'; @@ -22,12 +22,12 @@ export class PublicationService { public parsingFunctions: ParsingFunctions; publicationInfo: PublicationInfo; - getPublicationInfo (id: string):any { + getPublicationInfo (id: string, properties:EnvProperties):any { console.info("getPublicationInfo in service"); - let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json"; + let url = properties.searchAPIURLLAst + 'publications/' +id+"?format=json"; let key = url; - return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']]) .map(res => [ res[1]['oaf:result'], @@ -325,7 +325,7 @@ export class PublicationService { citationId = Array.isArray(citation['id']) ? citation['id'][j] : citation['id']; if(citationId.type == "pmid") { - url = OpenaireProperties.getPmidURL()+citationId.value; + url = "http://www.ncbi.nlm.nih.gov/pubmed/"+citationId.value; } } } diff --git a/landingPages/software/software.component.html b/landingPages/software/software.component.html index f047c3cd..ecb43a5b 100644 --- a/landingPages/software/software.component.html +++ b/landingPages/software/software.component.html @@ -12,8 +12,8 @@
    {{softwareInfo.types.join(", ")}} - {{softwareInfo.languages.join(", ")}} - {{softwareInfo.title.accessMode}} + {{softwareInfo.languages.join(", ")}} + {{softwareInfo.title.accessMode}} @@ -156,7 +156,7 @@
    {{provenanceaction}}
    - +
    @@ -173,7 +173,7 @@ + (metricsResults)="metricsResults($event)" [(properties)] = properties> diff --git a/landingPages/software/software.component.ts b/landingPages/software/software.component.ts index 9e2456b3..018c3213 100644 --- a/landingPages/software/software.component.ts +++ b/landingPages/software/software.component.ts @@ -3,10 +3,10 @@ import {Observable} from 'rxjs/Observable'; import {SoftwareService} from './software.service'; import {SoftwareInfo} from '../../utils/entities/softwareInfo'; import {ActivatedRoute, Router} from '@angular/router'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties' import {RouterHelper} from '../../utils/routerHelper.class'; import { Meta} from '../../../angular2-meta'; import {PiwikService} from '../../utils/piwik/piwik.service'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'software', @@ -45,6 +45,7 @@ export class SoftwareComponent { private result ; sub: any; piwiksub: any; infoSub: any; + properties:EnvProperties; constructor (private element: ElementRef, private _softwareService: SoftwareService, @@ -52,10 +53,15 @@ export class SoftwareComponent { private route: ActivatedRoute, private _meta: Meta, private _router: Router) { - this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.updateUrl(data.envSpecific.baseLink+this._router.url); + + }); this.sub = this.route.queryParams.subscribe(params => { this.softwareInfo = null; this.updateTitle("Software"); @@ -73,12 +79,12 @@ export class SoftwareComponent { this.metricsClicked = false; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; */ - this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; - /*this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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'; + this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; + /*this.downloadsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.softwareId+'", "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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&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(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'; */ if (typeof document !== 'undefined') { this.element.nativeElement.scrollIntoView(); @@ -102,12 +108,12 @@ export class SoftwareComponent { this.errorMessage="" this.showLoading = true; - this.infoSub = this._softwareService.getSoftwareInfo(id).subscribe( + this.infoSub = this._softwareService.getSoftwareInfo(id, this.properties).subscribe( data => { this.softwareInfo = data; this.updateTitle(this.softwareInfo.title.name); this.updateDescription("Software, search, repositories, open access,"+this.softwareInfo.title.name); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if( this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.softwareInfo.title.name).subscribe(); } diff --git a/landingPages/software/software.service.ts b/landingPages/software/software.service.ts index c0fc5806..bfd782ab 100644 --- a/landingPages/software/software.service.ts +++ b/landingPages/software/software.service.ts @@ -2,10 +2,10 @@ import {Injectable} from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import {SoftwareInfo} from '../../utils/entities/softwareInfo'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/share'; +import{EnvProperties} from '../../utils/properties/env-properties'; import { ParsingFunctions } from '../landing-utils/parsingFunctions.class'; @@ -19,14 +19,14 @@ export class SoftwareService { public parsingFunctions: ParsingFunctions; softwareInfo: SoftwareInfo; - getSoftwareInfo (id: string):any { + getSoftwareInfo (id: string, properties:EnvProperties):any { console.info("getSoftwareInfo in service"); - let url = OpenaireProperties. getSearchAPIURLLast()+'software/'+id+"?format=json"; + let url = properties.searchAPIURLLAst+'software/'+id+"?format=json"; let key = url; - return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) .map(res => res.json()) .do(res => console.info(res['result']['metadata']['oaf:entity'])) .map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']['oaf:result']]) diff --git a/login/adminLoginGuard.guard.ts b/login/adminLoginGuard.guard.ts index c35d8eb0..4a7d6c33 100644 --- a/login/adminLoginGuard.guard.ts +++ b/login/adminLoginGuard.guard.ts @@ -3,6 +3,8 @@ import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from ' import {Observable} from 'rxjs/Observable'; import {Session} from './utils/helper.class'; import {ErrorCodes} from './utils/guardHelper.class'; +import{EnvProperties} from '../utils/properties/env-properties'; + @Injectable() export class AdminLoginGuard implements CanActivate { @@ -13,7 +15,7 @@ export class AdminLoginGuard implements CanActivate { var loggedIn = false; var isAdmin = false; var errorCode = ErrorCodes.NOT_LOGGIN; - + var properties:EnvProperties = route.data.envSpecific; if(Session.isLoggedIn()){ loggedIn = true; if(!Session.isValidAndRemove()){ diff --git a/login/freeGuard.guard.ts b/login/freeGuard.guard.ts index 316ff266..9585d5af 100644 --- a/login/freeGuard.guard.ts +++ b/login/freeGuard.guard.ts @@ -1,8 +1,9 @@ import { Injectable } from '@angular/core'; -import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router'; +import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, ActivatedRoute} from '@angular/router'; import {Observable} from 'rxjs/Observable'; import {Session} from './utils/helper.class'; import {ErrorCodes} from './utils/guardHelper.class'; +import{EnvProperties} from '../utils/properties/env-properties'; @Injectable() export class FreeGuard implements CanActivate { @@ -14,7 +15,9 @@ export class FreeGuard implements CanActivate { var valid = true; var loggedIn = false; var errorCode = ErrorCodes.NOT_LOGGIN; - + var properties = route.data; +console.log("FreeGuard"); +console.log(properties); if(Session.isLoggedIn()){ loggedIn = true; if(!Session.isValidAndRemove()){ diff --git a/login/loginGuard.guard.ts b/login/loginGuard.guard.ts index 59999519..0f06b9d3 100644 --- a/login/loginGuard.guard.ts +++ b/login/loginGuard.guard.ts @@ -3,6 +3,7 @@ import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from ' import {Observable} from 'rxjs/Observable'; import {Session} from './utils/helper.class'; import {ErrorCodes} from './utils/guardHelper.class'; +import{EnvProperties} from '../utils/properties/env-properties'; @Injectable() export class LoginGuard implements CanActivate { @@ -13,6 +14,8 @@ export class LoginGuard implements CanActivate { var user; var loggedIn = false; var errorCode = ErrorCodes.NOT_LOGGIN; + var properties:EnvProperties = route.data.envSpecific; + if(Session.isLoggedIn()){ loggedIn = true; if(!Session.isValidAndRemove()){ diff --git a/login/user.component.ts b/login/user.component.ts index 076c2cd2..f8f03c57 100644 --- a/login/user.component.ts +++ b/login/user.component.ts @@ -6,7 +6,7 @@ import {ActivatedRoute, Router} from '@angular/router'; import {User,Session} from './utils/helper.class'; import {RouterHelper} from '../utils/routerHelper.class'; import { Meta} from '../../angular2-meta'; -import {OpenaireProperties} from '../utils/properties/openaireProperties'; +import{EnvProperties} from '../utils/properties/env-properties'; @Component({ selector: 'user', @@ -24,7 +24,8 @@ export class UserComponent { public errorCode: string = ""; public redirectUrl: string = ""; public routerHelper:RouterHelper = new RouterHelper(); - public loginUrl= OpenaireProperties.getLoginURL(); + public loginUrl; + properties:EnvProperties; constructor( private router: Router, private route: ActivatedRoute, private _meta: Meta) { @@ -32,6 +33,12 @@ export class UserComponent { } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.loginUrl = this.properties.loginUrl; + + }); if( typeof document !== 'undefined') { this.server = false; } @@ -113,7 +120,7 @@ export class UserComponent { Session.setCurrentParameters(queryParams); } - window.location.href = OpenaireProperties.getLoginURL(); + window.location.href = this.properties.loginUrl; } // login() { diff --git a/login/userMini.component.ts b/login/userMini.component.ts index 02bf1c6f..c28311a9 100644 --- a/login/userMini.component.ts +++ b/login/userMini.component.ts @@ -5,9 +5,9 @@ import {Location} from '@angular/common'; // import {LoginService} from './login.service'; import {User,Session} from './utils/helper.class'; import {RouterHelper} from '../utils/routerHelper.class'; -import {OpenaireProperties} from '../utils/properties/openaireProperties'; import {StringUtils} from '../utils/string-utils.class'; -import {LogoutOpenaireService} from './utils/logoutOpenaire.service'; +import{EnvProperties} from '../utils/properties/env-properties'; + declare var logoutClicked; @Component({ selector: 'user-mini', @@ -31,8 +31,8 @@ declare var logoutClicked;
  • Manage all Claims
  • - {{item.title}} - {{item.title}} + {{item.title}} + {{item.title}}
  • Log out
  • @@ -80,19 +80,25 @@ export class UserMiniComponent { @Input() userMenuItems; @Input() logInUrl; @Input() logOutUrl; + @Input() cookieDomain; public redirectUrl: string = ""; private baseUrl = "user-info"; sub:any; - constructor( private router: Router, private route: ActivatedRoute, private location: Location, private logoutOpenaire: LogoutOpenaireService) {} + // public properties:EnvProperties; + + constructor( private router: Router, private route: ActivatedRoute, private location: Location) {} ngOnInit() { - if( typeof document !== 'undefined') { - this.server = false; - } - this.initialize(); - this.sub = this.route.queryParams.subscribe(params => { - this.initialize(); - }); + + if( typeof document !== 'undefined') { + this.server = false; + } + this.initialize(); + this.sub = this.route.queryParams.subscribe(params => { + this.initialize(); + }); + + } ngOnDestroy(){ this.sub.unsubscribe(); @@ -139,7 +145,7 @@ export class UserMiniComponent { // }); logoutClicked(); console.log("Redirect to "+location.href); - window.location.href = (this.logOutUrl)?this.logOutUrl:OpenaireProperties.getLogoutURL()+ StringUtils.URIEncode(location.href); + window.location.href = this.logOutUrl + StringUtils.URIEncode(location.href); } this.loggedIn = false; @@ -150,7 +156,7 @@ export class UserMiniComponent { logIn(){ Session.setCurrentUrl(location.pathname); Session.setCurrentParameters(location.search); - window.location.href = (this.logInUrl)?this.logInUrl:OpenaireProperties.getLoginURL(); + window.location.href = this.logInUrl } onClick(id: string) { diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index 20e0e055..cbbed24d 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -1,7 +1,5 @@ import {StringUtils} from '../../utils/string-utils.class'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; - - + export class User { email:string; firstname: string; @@ -271,6 +269,6 @@ export class MyJWT{ d.setTime(d.getTime() + expireDays * 24 * 60 * 60 * 1000); let expires:string = `expires=${d.toUTCString()}`; // let cpath:string = path ? `; path=${path}` : ''; - document.cookie = name+'='+value+'; path='+path+'; domain='+OpenaireProperties.getCookieDomain()+';'; + document.cookie = name+'='+value+'; path='+path+'; domain='+document.domain+';'; } } diff --git a/login/utils/logoutOpenaire.service.ts b/login/utils/logoutOpenaire.service.ts deleted file mode 100644 index b000789f..00000000 --- a/login/utils/logoutOpenaire.service.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {Injectable} from '@angular/core'; -import {Http, Response} from '@angular/http'; -import {Observable} from 'rxjs/Observable'; - import {OpenaireProperties} from '../../utils/properties/openaireProperties'; -import 'rxjs/add/operator/do'; -@Injectable() -export class LogoutOpenaireService { - - constructor(private http: Http ) {} - - logout():any { - console.info("Logout openaire"); - //let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json"; - let url = OpenaireProperties.getLogoutOpenaireURL(); - - return this.http.get(url).do(request => console.info("Log out?" )); - } - -} diff --git a/reload/reload.component.ts b/reload/reload.component.ts index 50338a48..07373bcf 100644 --- a/reload/reload.component.ts +++ b/reload/reload.component.ts @@ -3,7 +3,6 @@ import {Observable} from 'rxjs/Observable'; import {ActivatedRoute, Router} from '@angular/router'; import {Location} from '@angular/common'; -import {OpenaireProperties} from '../utils/properties/openaireProperties'; import {ErrorCodes} from '../utils/properties/openaireProperties'; import {RouterHelper} from '../utils/routerHelper.class'; import {Session} from '../login/utils/helper.class'; diff --git a/searchPages/advanced/advancedSearchDataProviders.component.ts b/searchPages/advanced/advancedSearchDataProviders.component.ts index 6ccd0768..69b365c9 100644 --- a/searchPages/advanced/advancedSearchDataProviders.component.ts +++ b/searchPages/advanced/advancedSearchDataProviders.component.ts @@ -4,11 +4,12 @@ import { Router, ActivatedRoute} from '@angular/router'; import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ @@ -20,7 +21,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" [(searchUtils)] = "searchUtils" (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/dataproviders" + [csvParams]="csvParams" csvPath="datasources" simpleSearchLink="/search/find/dataproviders" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"> @@ -47,16 +48,29 @@ export class AdvancedSearchDataProvidersComponent { public disableForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; + public pagingLimit: number = 0; + public isPiwikEnabled; + properties:EnvProperties; constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) { this.results =[]; this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDataProviders; + console.info("Con -base url:"+this.searchUtils.baseUrl ); } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= data.envSpecific; + this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedDataProviders; + this.pagingLimit = data.envSpecific.pagingLimit; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + + }); + + this.sub = this.route.queryParams.subscribe(params => { if(params['page'] && this.searchUtils.page != params['page']) { this.loadPaging = false; @@ -78,22 +92,26 @@ export class AdvancedSearchDataProvidersComponent { } sub: any; public getResults(parameters:string, page: number, size: number){ + if(page > this.pagingLimit ) { + size=0; + } + if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) { if(parameters!= null && parameters != '' ) { - this.csvParams ="&type=datasources&query=( "+this.resourcesQuery + "and (" + parameters + "))"; + this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))"; }else{ - this.csvParams ="&type=datasources&query="+this.resourcesQuery; + this.csvParams ="&fq="+this.resourcesQuery; } - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - //this.searchPage.openLoading(); - this.disableForms = true; - this.results = []; - this.searchUtils.totalResults = 0; + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + //this.searchPage.openLoading(); + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; - console.info("Advanced Search for Content Providers: Execute search query "+parameters); - this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe( - data => { + console.info("Advanced Search for Content Providers: Execute search query "+parameters); + this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size, this.properties).subscribe( + data => { this.searchUtils.totalResults = data[0]; console.info("Adv Search Content Providers total="+this.searchUtils.totalResults); this.results = data[1]; @@ -117,32 +135,33 @@ export class AdvancedSearchDataProvidersComponent { this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; } } - }, - err => { - console.log(err); - console.info("error"); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = errorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.NOT_AVAILABLE; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - } - //this.searchPage.closeLoading(); - this.disableForms = false; - } - ); + }, + err => { + console.log(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = errorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.NOT_AVAILABLE; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + //this.searchPage.closeLoading(); + this.disableForms = false; + } + ); + } } public queryChanged($event) { this.loadPaging = true; - + var parameters = $event.value; this.getResults(parameters, this.searchUtils.page,this.searchUtils.size); console.info("queryChanged: Execute search query "+parameters); diff --git a/searchPages/advanced/advancedSearchDatasets.component.ts b/searchPages/advanced/advancedSearchDatasets.component.ts index e31af8ad..39f1d331 100644 --- a/searchPages/advanced/advancedSearchDatasets.component.ts +++ b/searchPages/advanced/advancedSearchDatasets.component.ts @@ -4,10 +4,11 @@ import { Router, ActivatedRoute} from '@angular/router'; import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {SearchDatasetsService} from '../../services/searchDatasets.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ @@ -19,7 +20,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; [(searchUtils)] = "searchUtils" [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/datasets" + [csvParams]="csvParams" csvPath="datasets" simpleSearchLink="/search/find/datasets" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"> @@ -30,6 +31,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; export class AdvancedSearchDatasetsComponent { private errorCodes: ErrorCodes; + properties:EnvProperties; public results =[]; public filters =[]; @@ -47,17 +49,25 @@ export class AdvancedSearchDatasetsComponent { public disableForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; - + public pagingLimit: number = 0; + public isPiwikEnabled; constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) { this.results =[]; this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDatasets; } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= data.envSpecific; + this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedDataProviders; + this.pagingLimit = data.envSpecific.pagingLimit; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + + }); //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; this.sub = this.route.queryParams.subscribe(params => { @@ -82,67 +92,72 @@ export class AdvancedSearchDatasetsComponent { } sub: any; public getResults(parameters:string, page: number, size: number){ + if(page > this.pagingLimit) { + size=0; + } + if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) { if(parameters!= null && parameters != '' ) { - this.csvParams ="&type=datasets&query=( "+this.resourcesQuery + "and (" + parameters + "))"; + this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))"; }else{ - this.csvParams ="&type=datasets&query="+this.resourcesQuery; + this.csvParams ="&fq="+this.resourcesQuery; } - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - //this.searchPage.openLoading(); - this.disableForms = true; - this.results = []; - this.searchUtils.totalResults = 0; + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + //this.searchPage.openLoading(); + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; - console.info("Advanced Search for Research Data: Execute search query "+parameters); - this._searchDatasetsService.advancedSearchDatasets(parameters, page, size).subscribe( + console.info("Advanced Search for Research Data: Execute search query "+parameters); + this._searchDatasetsService.advancedSearchDatasets(parameters, page, size, this.properties).subscribe( data => { - this.searchUtils.totalResults = data[0]; - console.info("search Research Data total="+this.searchUtils.totalResults); - this.results = data[1]; - this.searchPage.updateBaseUrlWithParameters(); - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - //this.searchPage.closeLoading(); - this.disableForms = false; + this.searchUtils.totalResults = data[0]; + console.info("search Research Data total="+this.searchUtils.totalResults); + this.results = data[1]; + this.searchPage.updateBaseUrlWithParameters(); + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; + } + //this.searchPage.closeLoading(); + this.disableForms = false; - if(this.searchUtils.status == this.errorCodes.DONE) { - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; - } - } + if(this.searchUtils.status == this.errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + } + } }, err => { - console.log(err); - console.info("error"); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = errorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.NOT_AVAILABLE; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - } + console.log(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = errorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.NOT_AVAILABLE; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } - //this.searchPage.closeLoading(); - this.disableForms = false; + //this.searchPage.closeLoading(); + this.disableForms = false; } - ); + ); + } } private setFilters(){ //TODO set filters from @@ -150,7 +165,7 @@ export class AdvancedSearchDatasetsComponent { public queryChanged($event) { this.loadPaging = true; - + var parameters = $event.value; this.getResults(parameters, this.searchUtils.page,this.searchUtils.size); console.info("queryChanged: Execute search query "+parameters); diff --git a/searchPages/advanced/advancedSearchOrganizations.component.ts b/searchPages/advanced/advancedSearchOrganizations.component.ts index 320c1bd9..3d1122ae 100644 --- a/searchPages/advanced/advancedSearchOrganizations.component.ts +++ b/searchPages/advanced/advancedSearchOrganizations.component.ts @@ -4,10 +4,11 @@ import { Router, ActivatedRoute} from '@angular/router'; import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ @@ -19,7 +20,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; [(searchUtils)] = "searchUtils" [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/organizations" + [csvParams]="csvParams" csvPath="organizations" simpleSearchLink="/search/find/organizations" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"> @@ -30,6 +31,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; export class AdvancedSearchOrganizationsComponent { private errorCodes: ErrorCodes; + properties:EnvProperties; public results =[]; public filters =[]; @@ -43,6 +45,8 @@ export class AdvancedSearchOrganizationsComponent { public disableForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; + public pagingLimit: number = 0; + public isPiwikEnabled; @ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; @@ -51,12 +55,19 @@ public resourcesQuery = "(oaftype exact organization)"; this.results =[]; this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedOrganizations; } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= data.envSpecific; + this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedDataProviders; + this.pagingLimit = data.envSpecific.pagingLimit; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + + }); //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; @@ -82,21 +93,25 @@ public resourcesQuery = "(oaftype exact organization)"; } sub: any; public getResults(parameters:string, page: number, size: number){ + if(page > this.pagingLimit) { + size=0; + } + if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) { if(parameters!= null && parameters != '' ) { - this.csvParams ="&type=organizations&query=( "+this.resourcesQuery + "and (" + parameters + "))"; + this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))"; }else{ - this.csvParams ="&type=organizations&query="+this.resourcesQuery; + this.csvParams ="&fq="+this.resourcesQuery; } - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - //this.searchPage.openLoading(); - this.disableForms = true; - this.results = []; - this.searchUtils.totalResults = 0; + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + //this.searchPage.openLoading(); + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; - console.info("Advanced Search for Organizations: Execute search query "+parameters); - this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size).subscribe( + console.info("Advanced Search for Organizations: Execute search query "+parameters); + this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties).subscribe( data => { this.searchUtils.totalResults = data[0]; console.info("search Organizations total="+this.searchUtils.totalResults); @@ -142,7 +157,8 @@ public resourcesQuery = "(oaftype exact organization)"; //this.searchPage.closeLoading(); this.disableForms = false; } - ); + ); + } } private setFilters(){ //TODO set filters from @@ -150,7 +166,7 @@ public resourcesQuery = "(oaftype exact organization)"; public queryChanged($event) { this.loadPaging = true; - + var parameters = $event.value; this.getResults(parameters, this.searchUtils.page,this.searchUtils.size); console.info("queryChanged: Execute search query "+parameters); diff --git a/searchPages/advanced/advancedSearchProjects.component.ts b/searchPages/advanced/advancedSearchProjects.component.ts index 769d6f5d..027f0fe4 100644 --- a/searchPages/advanced/advancedSearchProjects.component.ts +++ b/searchPages/advanced/advancedSearchProjects.component.ts @@ -4,10 +4,11 @@ import { Router, ActivatedRoute} from '@angular/router'; import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {SearchProjectsService} from '../../services/searchProjects.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'advanced-search-projects', @@ -18,7 +19,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; [(searchUtils)] = "searchUtils" [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/projects" + [csvParams]="csvParams" csvPath="projects" simpleSearchLink="/search/find/projects" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"> @@ -39,6 +40,7 @@ export class AdvancedSearchProjectsComponent { public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS; public fieldIdsMap = this.searchFields.PROJECT_FIELDS; public selectedFields:AdvancedField[] = []; + properties:EnvProperties; @ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; public resourcesQuery = "(oaftype exact project)"; @@ -46,18 +48,28 @@ export class AdvancedSearchProjectsComponent { public disableForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; + public pagingLimit: number = 0; + public isPiwikEnabled; constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) { this.results =[]; this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedProjects; + } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= data.envSpecific; + this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedDataProviders; + this.pagingLimit = data.envSpecific.pagingLimit; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + + }); //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; this.sub = this.route.queryParams.subscribe(params => { @@ -82,68 +94,73 @@ export class AdvancedSearchProjectsComponent { } sub: any; public getResults(parameters:string, page: number, size: number){ + if(page > this.pagingLimit) { + size=0; + } + if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) { if(parameters!= null && parameters != '' ) { - this.csvParams ="&type=projects&query=( "+this.resourcesQuery + "and (" + parameters + "))"; + this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))"; }else{ - this.csvParams ="&type=projects&query="+this.resourcesQuery; + this.csvParams ="&fq="+this.resourcesQuery; } - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - //this.searchPage.openLoading(); - this.disableForms = true; - this.results = []; - this.searchUtils.totalResults = 0; + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + //this.searchPage.openLoading(); + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; - console.info("Advanced Search for Publications: Execute search query "+parameters); - this._searchProjectsService.advancedSearchProjects(parameters, page, size).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - console.info("Advanced Search for Projects total="+this.searchUtils.totalResults); - this.results = data[1]; - this.searchPage.updateBaseUrlWithParameters(); - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - //this.searchPage.closeLoading(); - this.disableForms = false; - - if(this.searchUtils.status == this.errorCodes.DONE) { - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); + console.info("Advanced Search for Publications: Execute search query "+parameters); + this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("Advanced Search for Projects total="+this.searchUtils.totalResults); + this.results = data[1]; + this.searchPage.updateBaseUrlWithParameters(); + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + //this.searchPage.closeLoading(); + this.disableForms = false; + + if(this.searchUtils.status == this.errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + } + } + }, + err => { + console.log(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = errorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.NOT_AVAILABLE; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } - } - }, - err => { - console.log(err); - console.info("error"); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = errorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.NOT_AVAILABLE; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - } - //this.searchPage.closeLoading(); - this.disableForms = false; + //this.searchPage.closeLoading(); + this.disableForms = false; - } - ); + } + ); + } } private setFilters(){ //TODO set filters from @@ -151,7 +168,7 @@ export class AdvancedSearchProjectsComponent { public queryChanged($event) { this.loadPaging = true; - + var parameters = $event.value; this.getResults(parameters, this.searchUtils.page,this.searchUtils.size); console.info("queryChanged: Execute search query "+parameters); diff --git a/searchPages/advanced/advancedSearchPublications.component.ts b/searchPages/advanced/advancedSearchPublications.component.ts index eec08478..5617512d 100644 --- a/searchPages/advanced/advancedSearchPublications.component.ts +++ b/searchPages/advanced/advancedSearchPublications.component.ts @@ -4,10 +4,11 @@ import { Router, ActivatedRoute} from '@angular/router'; import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {SearchPublicationsService} from '../../services/searchPublications.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ @@ -19,10 +20,12 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; [(searchUtils)] = "searchUtils" [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/publications" + [csvParams]="csvParams" csvPath="publications" simpleSearchLink="/search/find/publications" [disableForms]="disableForms" [loadPaging]="loadPaging" - [oldTotalResults]="oldTotalResults"> + [oldTotalResults]="oldTotalResults" + [(openaireLink)]=openaireLink + [(connectCommunityId)]=connectCommunityId> ` }) @@ -44,6 +47,11 @@ export class AdvancedSearchPublicationsComponent { public disableForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; + @Input() openaireLink: string ; + @Input() connectCommunityId: string = "egi||EGI Federation"; + public pagingLimit: number = 0; + public isPiwikEnabled; + properties:EnvProperties; @ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; @@ -53,12 +61,19 @@ export class AdvancedSearchPublicationsComponent { this.results =[]; this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPublications; } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= data.envSpecific; + this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedDataProviders; + this.pagingLimit = data.envSpecific.pagingLimit; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + + }); //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; this.sub = this.route.queryParams.subscribe(params => { @@ -83,68 +98,73 @@ export class AdvancedSearchPublicationsComponent { } sub: any; public getResults(parameters:string, page: number, size: number){ + if(page > this.pagingLimit) { + size=0; + } + if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) { if(parameters!= null && parameters != '' ) { - this.csvParams ="&type=publications&query=("+this.resourcesQuery +" and (" + parameters + "))"; + this.csvParams ="&fq=("+this.resourcesQuery +" and (" + parameters + "))"; }else{ - this.csvParams ="&type=publications&query="+this.resourcesQuery; + this.csvParams ="&fq="+this.resourcesQuery; } - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - //this.searchPage.openLoading(); - this.disableForms = true; - this.results = []; - this.searchUtils.totalResults = 0; + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + //this.searchPage.openLoading(); + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; - console.info("Advanced Search for Publications: Execute search query "+parameters); - this._searchPublicationsService.advancedSearchPublications(parameters, page, size).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - console.info("searchPubl total="+this.searchUtils.totalResults); - this.results = data[1]; - this.searchPage.updateBaseUrlWithParameters(); - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - //this.searchPage.closeLoading(); - this.disableForms = false; - - if(this.searchUtils.status == this.errorCodes.DONE) { - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); + console.info("Advanced Search for Publications: Execute search query "+parameters); + this._searchPublicationsService.advancedSearchPublications(parameters, page, size, this.properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("searchPubl total="+this.searchUtils.totalResults); + this.results = data[1]; + this.searchPage.updateBaseUrlWithParameters(); + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + //this.searchPage.closeLoading(); + this.disableForms = false; + + if(this.searchUtils.status == this.errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + } + } + }, + err => { + console.log(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.NOT_AVAILABLE; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } - } - }, - err => { - console.log(err); - console.info("error"); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.NOT_AVAILABLE; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - } - //this.searchPage.closeLoading(); - this.disableForms = false; + //this.searchPage.closeLoading(); + this.disableForms = false; - } - ); + } + ); + } } public queryChanged($event) { diff --git a/searchPages/advanced/advancedSearchSoftware.component.ts b/searchPages/advanced/advancedSearchSoftware.component.ts index 5de0eda7..4d7d8afd 100644 --- a/searchPages/advanced/advancedSearchSoftware.component.ts +++ b/searchPages/advanced/advancedSearchSoftware.component.ts @@ -4,10 +4,11 @@ import { Router, ActivatedRoute} from '@angular/router'; import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {SearchSoftwareService} from '../../services/searchSoftware.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ @@ -19,7 +20,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; [(searchUtils)] = "searchUtils" [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/software" + [csvParams]="csvParams" csvPath="software" simpleSearchLink="/search/find/software" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults"> @@ -47,17 +48,27 @@ export class AdvancedSearchSoftwareComponent { public disableForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; + public pagingLimit: number = 0; + public isPiwikEnabled; + properties:EnvProperties; constructor (private route: ActivatedRoute, private _searchSoftwareService: SearchSoftwareService ) { this.results =[]; this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedSoftware; } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= data.envSpecific; + this.searchUtils.baseUrl = data.envSpecific.searchLinkToAdvancedDataProviders; + this.pagingLimit = data.envSpecific.pagingLimit; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + + }); //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; this.sub = this.route.queryParams.subscribe(params => { @@ -82,67 +93,72 @@ export class AdvancedSearchSoftwareComponent { } sub: any; public getResults(parameters:string, page: number, size: number){ + if(page >this.pagingLimit) { + size=0; + } + if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) { if(parameters!= null && parameters != '' ) { - this.csvParams ="&type=software&query=( "+this.resourcesQuery + "and (" + parameters + "))"; + this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))"; }else{ - this.csvParams ="&type=software&query="+this.resourcesQuery; + this.csvParams ="&fq="+this.resourcesQuery; } - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.LOADING; - //this.searchPage.openLoading(); - this.disableForms = true; - this.results = []; - this.searchUtils.totalResults = 0; + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.LOADING; + //this.searchPage.openLoading(); + this.disableForms = true; + this.results = []; + this.searchUtils.totalResults = 0; - console.info("Advanced Search for Software: Execute search query "+parameters); - this._searchSoftwareService.advancedSearchSoftware(parameters, page, size).subscribe( - data => { - this.searchUtils.totalResults = data[0]; - console.info("search Software total="+this.searchUtils.totalResults); - this.results = data[1]; - this.searchPage.updateBaseUrlWithParameters(); - //var errorCodes:ErrorCodes = new ErrorCodes(); - this.searchUtils.status = this.errorCodes.DONE; - if(this.searchUtils.totalResults == 0 ){ - this.searchUtils.status = this.errorCodes.NONE; - } - //this.searchPage.closeLoading(); - this.disableForms = false; - - if(this.searchUtils.status == this.errorCodes.DONE) { - // Page out of limit!!! - let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); - if(!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); + console.info("Advanced Search for Software: Execute search query "+parameters); + this._searchSoftwareService.advancedSearchSoftware(parameters, page, size, this.properties).subscribe( + data => { + this.searchUtils.totalResults = data[0]; + console.info("search Software total="+this.searchUtils.totalResults); + this.results = data[1]; + this.searchPage.updateBaseUrlWithParameters(); + //var errorCodes:ErrorCodes = new ErrorCodes(); + this.searchUtils.status = this.errorCodes.DONE; + if(this.searchUtils.totalResults == 0 ){ + this.searchUtils.status = this.errorCodes.NONE; } - if(totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; - } - } - }, - err => { - console.log(err); - console.info("error"); - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = errorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.NOT_AVAILABLE; - if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - } + //this.searchPage.closeLoading(); + this.disableForms = false; - //this.searchPage.closeLoading(); - this.disableForms = false; - } - ); + if(this.searchUtils.status == this.errorCodes.DONE) { + // Page out of limit!!! + let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); + if(!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if(totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + } + } + }, + err => { + console.log(err); + console.info("error"); + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = errorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.NOT_AVAILABLE; + if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + } + + //this.searchPage.closeLoading(); + this.disableForms = false; + } + ); + } } private setFilters(){ //TODO set filters from diff --git a/searchPages/dataProviders/compatibleDataProviders.component.ts b/searchPages/dataProviders/compatibleDataProviders.component.ts index a069f62d..032b9cb6 100644 --- a/searchPages/dataProviders/compatibleDataProviders.component.ts +++ b/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -4,10 +4,11 @@ import { ActivatedRoute} from '@angular/router'; import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-content-providers', @@ -50,13 +51,12 @@ export class SearchCompatibleDataprovidersComponent { public resourcesQuery = '&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))'; public csvParams: string; public disableForms: boolean = false; - +properties:EnvProperties; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProviders(); for(var i = 0; i < this._prefixQueryFields.length; i++ ){ for(var j =0; j < this._prefixQueryFields[i].values.length; j++){ this._prefixQuery+="&" + this._prefixQueryFields[i].field + "=" @@ -68,6 +68,13 @@ export class SearchCompatibleDataprovidersComponent { } public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.baseUrl = data.envSpecific.searchLinkToCompatibleDataProviders + + + }); this.searchPage.refineFields = this.refineFields; this.searchPage.fieldIdsMap = this.fieldIdsMap; this.sub = this.route.queryParams.subscribe(params => { @@ -97,7 +104,7 @@ export class SearchCompatibleDataprovidersComponent { this.results = []; this.searchUtils.totalResults = 0; - this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( + this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, [],this.properties).subscribe( data => { this.searchUtils.totalResults = data[0]; console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); diff --git a/searchPages/dataProviders/compatibleDataProvidersTable.component.ts b/searchPages/dataProviders/compatibleDataProvidersTable.component.ts index 5190ff7a..27a11092 100644 --- a/searchPages/dataProviders/compatibleDataProvidersTable.component.ts +++ b/searchPages/dataProviders/compatibleDataProvidersTable.component.ts @@ -4,10 +4,11 @@ import { ActivatedRoute} from '@angular/router'; import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-content-providers-table', @@ -45,16 +46,21 @@ export class SearchCompatibleDataprovidersTableComponent { public resourcesQuery = "&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))";*/ public disableForms: boolean = false; - +properties:EnvProperties; @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.baseUrl = OpenaireProperties.getLinkToSearchCompatibleDataProvidersTable(); - } + } public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProvidersTable; + + }); this.searchPage.refineFields = this.refineFields; this.sub = this.route.queryParams.subscribe(params => { this.searchUtils.keyword = (params['keyword']?params['keyword']:''); @@ -82,11 +88,11 @@ export class SearchCompatibleDataprovidersTableComponent { this.searchUtils.totalResults = 0; let size: number = 0; - this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable().subscribe( + this.subResults = this._searchDataprovidersService.searchCompatibleDataprovidersTable(this.properties).subscribe( data => { size = data; if(size > 0) { - this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders("", null, 1, size, []).subscribe( + this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders("", null, 1, size, [],this.properties).subscribe( data => { this.searchUtils.totalResults = data[0]; console.info("search Content Providers [total results:"+this.searchUtils.totalResults+"]"); diff --git a/searchPages/dataProviders/entityRegistries.component.ts b/searchPages/dataProviders/entityRegistries.component.ts index 8339ac42..9bc5ecd7 100644 --- a/searchPages/dataProviders/entityRegistries.component.ts +++ b/searchPages/dataProviders/entityRegistries.component.ts @@ -3,10 +3,11 @@ import { ActivatedRoute} from '@angular/router'; import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-entity-registries', @@ -53,11 +54,11 @@ export class SearchEntityRegistriesComponent { @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))"; public csvParams: string; - +properties:EnvProperties; constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.baseUrl = OpenaireProperties.getLinkToSearchEntityRegistries(); + for(var i = 0; i < this._prefixQueryFields.length; i++ ){ for(var j =0; j < this._prefixQueryFields[i].values.length; j++){ this._prefixQuery+="&" + this._prefixQueryFields[i].field + "=" @@ -69,6 +70,13 @@ export class SearchEntityRegistriesComponent { } public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders; + + + }); this.searchPage.refineFields = this.refineFields; this.searchPage.fieldIdsMap = this.fieldIdsMap; this.sub = this.route.queryParams.subscribe(params => { @@ -98,7 +106,7 @@ export class SearchEntityRegistriesComponent { this.results = []; this.searchUtils.totalResults = 0; - this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( + this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, [],this.properties).subscribe( data => { this.searchUtils.totalResults = data[0]; console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); diff --git a/searchPages/dataProviders/entityRegistriesTable.component.ts b/searchPages/dataProviders/entityRegistriesTable.component.ts index 01edd533..ad9699ba 100644 --- a/searchPages/dataProviders/entityRegistriesTable.component.ts +++ b/searchPages/dataProviders/entityRegistriesTable.component.ts @@ -3,10 +3,11 @@ import { ActivatedRoute} from '@angular/router'; import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-entity-registries-table', @@ -37,7 +38,7 @@ export class SearchEntityRegistriesTableComponent { public searchFields:SearchFields = new SearchFields(); public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS; public disableForms: boolean = false; - +properties:EnvProperties; @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { @@ -46,6 +47,12 @@ export class SearchEntityRegistriesTableComponent { } public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders; + + }); this.searchPage.refineFields = this.refineFields; this.sub = this.route.queryParams.subscribe(params => { this.searchUtils.keyword = (params['keyword']?params['keyword']:''); @@ -72,11 +79,11 @@ export class SearchEntityRegistriesTableComponent { this.searchUtils.totalResults = 0; let size: number = 0; - this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable().subscribe( + this.subResults = this._searchDataprovidersService.searchEntityRegistriesTable(this.properties).subscribe( data => { size = data; if(size > 0) { - this.subResults = this._searchDataprovidersService.searchEntityRegistries("",null, page, size, []).subscribe( + this.subResults = this._searchDataprovidersService.searchEntityRegistries("",null, page, size, [],this.properties).subscribe( data => { this.searchUtils.totalResults = data[0]; console.info("search Entity Registries [total results:"+this.searchUtils.totalResults+"]"); diff --git a/searchPages/dataProviders/journals.component.ts b/searchPages/dataProviders/journals.component.ts index 7d7c527d..47b1b2c9 100644 --- a/searchPages/dataProviders/journals.component.ts +++ b/searchPages/dataProviders/journals.component.ts @@ -5,10 +5,11 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-journals', @@ -52,13 +53,12 @@ export class SearchJournalsComponent { //"&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"; public csvParams: string; public disableForms: boolean = false; - +properties:EnvProperties; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.baseUrl = OpenaireProperties.getLinkToSearchJournals(); for(var i = 0; i < this._prefixQueryFields.length; i++ ){ for(var j =0; j < this._prefixQueryFields[i].values.length; j++){ this._prefixQuery+="&" + this._prefixQueryFields[i].field + "=" @@ -70,6 +70,13 @@ export class SearchJournalsComponent { } public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.baseUrl = data.envSpecific.searchLinkToJournals; + + + }); this.searchPage.refineFields = this.refineFields; this.searchPage.fieldIdsMap = this.fieldIdsMap; this.sub = this.route.queryParams.subscribe(params => { @@ -99,7 +106,7 @@ export class SearchJournalsComponent { this.results = []; this.searchUtils.totalResults = 0; - this.subResults = this._searchDataprovidersService.searchJournals(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( + this.subResults = this._searchDataprovidersService.searchJournals(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, [],this.properties).subscribe( data => { this.searchUtils.totalResults = data[0]; console.info("search Journals: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]"); diff --git a/searchPages/dataProviders/journalsTable.component.ts b/searchPages/dataProviders/journalsTable.component.ts index f709ac13..d9faa80a 100644 --- a/searchPages/dataProviders/journalsTable.component.ts +++ b/searchPages/dataProviders/journalsTable.component.ts @@ -5,10 +5,11 @@ import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchResult} from '../../utils/entities/searchResult'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-journals-table', @@ -37,7 +38,7 @@ export class SearchJournalsTableComponent { public _location:Location; public searchFields:SearchFields = new SearchFields(); public refineFields: string[] = this.searchFields.JOURNAL_FIELDS; - +properties:EnvProperties; /*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], "export":[] }; @@ -52,10 +53,15 @@ export class SearchJournalsTableComponent { constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; - this.baseUrl = OpenaireProperties.getLinkToSearchJournalsTable(); } public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.baseUrl = data.envSpecific.searchLinkToJournalsTable; + + }); this.searchPage.refineFields = this.refineFields; this.sub = this.route.queryParams.subscribe(params => { this.searchUtils.keyword = (params['keyword']?params['keyword']:''); @@ -72,7 +78,8 @@ export class SearchJournalsTableComponent { } if(this.subResults){ this.subResults.unsubscribe(); - } } + } + } private _getResults(){ //this.csvParams = this.resourcesQuery+"&type=datasources"; @@ -83,11 +90,11 @@ export class SearchJournalsTableComponent { this.searchUtils.totalResults = 0; let size: number = 0; - this.subResults = this._searchDataprovidersService.searchJournalsTable().subscribe( + this.subResults = this._searchDataprovidersService.searchJournalsTable(this.properties).subscribe( data => { size = data; if(size > 0) { - this.subResults = this._searchDataprovidersService.searchJournals("", null, 1, size, []).subscribe( + this.subResults = this._searchDataprovidersService.searchJournals("", null, 1, size, [],this.properties).subscribe( data => { this.searchUtils.totalResults = data[0]; console.info("search Journals [total results:"+this.searchUtils.totalResults+"]"); diff --git a/searchPages/find/search.component.html b/searchPages/find/search.component.html index 16d936d9..34ac35c2 100644 --- a/searchPages/find/search.component.html +++ b/searchPages/find/search.component.html @@ -123,11 +123,11 @@ + type="publication" urlParam="articleId" [(properties)]=properties>
    - +
    @@ -143,11 +143,11 @@ + type="dataset" urlParam="datasetId" [(properties)]=properties>
    - +
    @@ -162,11 +162,11 @@ + type="software" urlParam="softwareId" [(properties)]=properties>
    - +
    @@ -182,11 +182,11 @@ + type="project" urlParam="projectId" [(properties)]=properties>
    - +
    @@ -202,11 +202,11 @@ + type="dataprovider" urlParam="datasourceId" [(properties)]=properties>
    - +
    @@ -222,11 +222,11 @@ + type="organization" urlParam="organizationId" [(properties)]=properties>
    - +
    diff --git a/searchPages/find/search.component.ts b/searchPages/find/search.component.ts index 7e713828..4b150028 100644 --- a/searchPages/find/search.component.ts +++ b/searchPages/find/search.component.ts @@ -19,13 +19,13 @@ import {SearchDatasetsService} from '../../services/searchDatasets.service'; import {SearchSoftwareService} from '../../services/searchSoftware.service'; import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {ErrorCodes} from '../../utils/properties/openaireProperties'; 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, @@ -83,6 +83,9 @@ export class SearchComponent { showProjects:boolean= false; showDataProviders:boolean= false; showOrganizations:boolean= false; + + properties: EnvProperties; + public subPub;public subData;public subProjects;public subOrg; public subDataPr; constructor ( private route: ActivatedRoute, private _router: Router, @@ -102,78 +105,86 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; this.fetchSoftware = new FetchSoftware(this._searchSoftwareService); this.fetchOrganizations = new FetchOrganizations( this._searchOrganizationsService); - var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; - var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE"; - var url = OpenaireProperties.getBaseLink()+this._router.url; - this._meta.setTitle(title); - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); - this._meta.updateProperty("og:title", title); - this._meta.updateProperty("og:url", url); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView("OpenAIRE |Search publications, research data, projects...").subscribe(); - - } } public ngOnInit() { - const entityOne = this.config.isEntityEnabled("publication"); - const entityTwo = this.config.isEntityEnabled("dataset"); - const entityThree = this.config.isEntityEnabled("project"); - const entityFour = this.config.isEntityEnabled("organization"); - const entityFive = this.config.isEntityEnabled("datasource"); - const entitySix = this.config.isEntityEnabled("software"); - const example = Observable.zip(entityOne,entityTwo,entityThree,entityFour,entityFive,entitySix); + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { -//wait until all observables have emitted a value then emit all as an array - this.sub = this.route.queryParams.subscribe(params => { - const subscribe = example.subscribe(data => { - this.showPublications = data[0]; - this.showDatasets = data[1]; - this.showProjects = data[2]; - this.showOrganizations = data[3]; - this.showDataProviders = data[4]; - this.showSoftware = data[5]; - console.log(data) - this.keyword = (params['keyword'])?params['keyword']:""; - if(this.keyword !=null && this.keyword.length > 0){ - this.reloadTabs(); - //if showPublications == false will set another entity as the first - if(this.showPublications){ - this.activeTab = "publications"; - this.searchPublications(); - }else if(this.showDatasets){ - this.activeTab = "research data"; - this.searchDatasets(); - }else if(this.showSoftware){ - this.activeTab = "software"; - this.searchSoftware(); - }else if(this.showProjects){ - this.activeTab = "projects"; - this.searchProjects(); - }else if(this.showDataProviders){ - this.activeTab = "content providers"; - this.searchDataProviders(); - }else if(this.showOrganizations){ - this.activeTab = "organizations"; - this.searchOrganizations(); - } - this.count(); + 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); + if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ + this.piwiksub = this._piwikService.trackView("OpenAIRE |Search publications, research data, projects...").subscribe(); + + } + + + + this.config.getCommunityInformation(this.properties.adminToolsAPIURL, this.properties.adminToolsCommunity ).subscribe(data => { + var showEntity = {}; + for(var i=0; i< data.entities.length; i++){ + + showEntity[""+data.entities[i]["pid"]+""] = data.entities[i]["isEnabled"]; } - }); - }); + this.showPublications = showEntity["publication"]; + this.showDatasets = showEntity["dataset"]; + this.showProjects = showEntity["project"]; + this.showOrganizations = showEntity["organization"]; + this.showDataProviders = showEntity["datasource"]; + this.showSoftware = showEntity["software"]; + this.sub = this.route.queryParams.subscribe(params => { + + this.keyword = (params['keyword'])?params['keyword']:""; + if(this.keyword !=null && this.keyword.length > 0){ + this.reloadTabs(); + //if showPublications == false will set another entity as the first + if(this.showPublications){ + this.activeTab = "publications"; + this.searchPublications(); + }else if(this.showDatasets){ + this.activeTab = "research data"; + this.searchDatasets(); + }else if(this.showSoftware){ + this.activeTab = "software"; + this.searchSoftware(); + }else if(this.showProjects){ + this.activeTab = "projects"; + this.searchProjects(); + }else if(this.showDataProviders){ + this.activeTab = "content providers"; + this.searchDataProviders(); + }else if(this.showOrganizations){ + this.activeTab = "organizations"; + this.searchOrganizations(); + } + this.count(); + } + }); + }); + }); + } + + + - } public ngOnDestroy() { this.sub.unsubscribe(); if(this.piwiksub){ - this.piwiksub.unsubscribe(); -} + this.piwiksub.unsubscribe(); + } if(this.keyword !=null && this.keyword.length > 0){ if(this.subPub){ this.subPub.unsubscribe(); @@ -199,8 +210,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; this.fetchPublications.searchUtils.status != this.errorCodes.NONE && this.fetchPublications.searchUtils.status != this.errorCodes.ERROR) { this.reloadPublications = false; - this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10); - this.linkToSearchPublications = OpenaireProperties.getLinkToSearchPublications();// + "?keyword=" + this.keyword; + this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10,this.properties); + this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword; } } public searchDatasets() { @@ -209,8 +220,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; this.fetchDatasets.searchUtils.status != this.errorCodes.NONE && this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR) { this.reloadDatasets = false; - this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10); - this.linkToSearchDatasets = OpenaireProperties.getLinkToSearchDatasets();// + "?keyword=" + this.keyword; + this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10,this.properties); + this.linkToSearchDatasets =this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword; } } public searchSoftware() { @@ -219,8 +230,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; ( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )) { this.reloadSoftware = false; - this.fetchSoftware.getResultsByKeyword(this.keyword, 1, 10); - this.linkToSearchSoftware = OpenaireProperties.getLinkToSearchSoftware();// + "?keyword=" + this.keyword; + this.fetchSoftware.getResultsByKeyword(this.keyword, 1, 10,this.properties); + this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword; } } public searchProjects() { @@ -229,8 +240,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; this.fetchProjects.searchUtils.status != this.errorCodes.NONE && this.fetchProjects.searchUtils.status != this.errorCodes.ERROR) { this.reloadProjects = false; - this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10); - this.linkToSearchProjects = OpenaireProperties.getLinkToSearchProjects();// + "?keyword=" + this.keyword; + this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10,this.properties); + this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword; } } public searchDataProviders() { @@ -239,8 +250,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE && this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR) { this.reloadDataproviders = false; - this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10); - this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();// + "?keyword=" + this.keyword; + this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10,this.properties); + this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword; } } public searchOrganizations() { @@ -249,8 +260,8 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE && this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR) { this.reloadOrganizations = false; - this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10); - this.linkToSearchOrganizations = OpenaireProperties.getLinkToSearchOrganizations();// + "?keyword=" + this.keyword; + this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10,this.properties); + this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword; } } @@ -287,7 +298,7 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; if(this.activeTab != "publications" && this.showPublications){ this.fetchPublications.searchUtils.status = this.errorCodes.LOADING; this.fetchPublications.results = []; - this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe( + this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword,this.properties).subscribe( data => { console.log("Count results: "+data); this.fetchPublications.searchUtils.totalResults = data; @@ -305,7 +316,7 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; if(this.activeTab != "research data" && this.showDatasets){ this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING; this.fetchDatasets.results = []; - this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe( + this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword,this.properties).subscribe( data => { this.fetchDatasets.searchUtils.totalResults = data; this.fetchDatasets.searchUtils.status = this.errorCodes.DONE; @@ -322,7 +333,7 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; if(this.activeTab != "software" && this.showSoftware){ this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING; this.fetchSoftware.results = []; - this.subData = this._searchSoftwareService.numOfSearchSoftware(this.keyword).subscribe( + this.subData = this._searchSoftwareService.numOfSearchSoftware(this.keyword,this.properties).subscribe( data => { this.fetchSoftware.searchUtils.totalResults = data; this.fetchSoftware.searchUtils.status = this.errorCodes.DONE; @@ -346,7 +357,7 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; if(this.activeTab != "projects" && this.showProjects){ this.fetchProjects.searchUtils.status = this.errorCodes.LOADING; this.fetchProjects.results = []; - this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe( + this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword,this.properties).subscribe( data => { this.fetchProjects.searchUtils.totalResults = data; this.fetchProjects.searchUtils.status = this.errorCodes.DONE; @@ -362,12 +373,12 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr; } if(this.activeTab != "content providers" && this.showDataProviders){ this.fetchDataproviders.results = []; - this.fetchDataproviders.getNumForSearch(this.keyword); + this.fetchDataproviders.getNumForSearch(this.keyword,this.properties); } if(this.activeTab != "organizations" && this.showOrganizations){ this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING; this.fetchOrganizations.results = []; - this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe( + this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword,this.properties).subscribe( data => { this.fetchOrganizations.searchUtils.totalResults = data; this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE; diff --git a/searchPages/searchUtils/advancedSearchForm.component.html b/searchPages/searchUtils/advancedSearchForm.component.html index 938ca3cd..6177b49f 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.html +++ b/searchPages/searchUtils/advancedSearchForm.component.html @@ -16,14 +16,14 @@ - - - + diff --git a/searchPages/searchUtils/advancedSearchForm.component.ts b/searchPages/searchUtils/advancedSearchForm.component.ts index 3700ab57..51f098fc 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.ts +++ b/searchPages/searchUtils/advancedSearchForm.component.ts @@ -1,10 +1,12 @@ import {Component, Input, Output, EventEmitter, ElementRef} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; +import {ActivatedRoute} from '@angular/router'; import {AdvancedField, OPERATOR} from '../searchUtils/searchHelperClasses.class'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {Dates} from '../../utils/string-utils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'advanced-search-form', @@ -22,12 +24,17 @@ export class AdvancedSearchFormComponent { newFieldName:string; fieldList:{[id:string]:any[]} = {}; public searchFields:SearchFields = new SearchFields(); - +properties:EnvProperties; public operators: [{name:string, id:string}] = this.searchFields.ADVANCED_SEARCH_OPERATORS; - constructor () { + constructor (private route: ActivatedRoute) { } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + + }); for(var i = 0; i < this.fieldIds.length; i++){ this.fieldList[this.fieldIds[i]]=[]; } diff --git a/searchPages/searchUtils/advancedSearchPage.component.html b/searchPages/searchUtils/advancedSearchPage.component.html index bea9e58f..bfb562be 100644 --- a/searchPages/searchUtils/advancedSearchPage.component.html +++ b/searchPages/searchUtils/advancedSearchPage.component.html @@ -23,19 +23,25 @@
    +
    - + -
    +
    + [showLoading]="true" [(properties)]=properties>
    + +
    +

    For more results please try a new, more specific query

    +
    +
    @@ -43,11 +49,11 @@
    -
    +
    - +
    diff --git a/searchPages/searchUtils/advancedSearchPage.component.ts b/searchPages/searchUtils/advancedSearchPage.component.ts index 3ffeffb2..26e23fb6 100644 --- a/searchPages/searchUtils/advancedSearchPage.component.ts +++ b/searchPages/searchUtils/advancedSearchPage.component.ts @@ -1,7 +1,7 @@ import {Component, Input, ViewChild, Output, EventEmitter} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {Location} from '@angular/common'; -import { Router} from '@angular/router'; +import {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'; @@ -9,8 +9,8 @@ import {SearchUtilsClass} from './searchUtils.class'; import {ModalLoading} from '../../utils/modal/loading.component'; import {StringUtils, Dates} from '../../utils/string-utils.class'; import { Meta} from '../../../angular2-meta'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; -import {PiwikService} from '../../utils/piwik/piwik.service'; + import {PiwikService} from '../../utils/piwik/piwik.service'; + import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'advanced-search-page', @@ -33,29 +33,48 @@ export class AdvancedSearchPageComponent { @Input() disableForms:boolean = false; @Input() loadPaging: boolean = true; @Input() oldTotalResults: number = 0; - + @Input() openaireLink: string; + @Input() connectCommunityId: string; piwiksub: any; public parameterNames:string[] =[]; public parameterValues:string[] =[]; public baseURLWithParameters:string = ''; + public csvLimit: number = 0; + public pagingLimit: number = 0; + public resultsPerPage: number = 0; + isPiwikEnabled = false; + properties:EnvProperties; + @Output() queryChange = new EventEmitter(); - constructor (private location: Location, private _meta: Meta, private _piwikService:PiwikService, private router: Router) { + constructor (private route: ActivatedRoute,private location: Location, private _meta: Meta, private _piwikService:PiwikService, private router: Router) { } ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties = data.envSpecific; + this.pagingLimit = data.envSpecific.pagingLimit; + this.resultsPerPage =data.envSpecific.resultsPerPage; + this.csvLimit = data.envSpecific.csvLimit; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + if(typeof window !== 'undefined') { + this.updateUrl(data.envSpecific.baseLink+location.pathname); + } + if(typeof document !== 'undefined' && this.isPiwikEnabled){ + this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe(); + } + }); + + this.updateTitle("Advanced search "+this.pageTitle); this.updateDescription("Openaire, search, repositories, open access, type, content provider, funder, project, "+ this.pageTitle); - if(typeof window !== 'undefined') { - this.updateUrl(OpenaireProperties.getBaseLink()+location.pathname); - } + this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl; this.updateBaseUrlWithParameters(); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ - this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe(); - } + } ngOnDestroy() { @@ -118,7 +137,10 @@ export class AdvancedSearchPageComponent { } }else{ - this.selectedFields.push(new AdvancedField(fieldId,fieldparam,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,StringUtils.unquote(values[j]),operators[j]) ); + console.log(" "+this.connectCommunityId+" "+values[j]+" "+ fieldId) + if(!(this.connectCommunityId && fieldId == "community" && this.connectCommunityId == values[j] )){ + this.selectedFields.push(new AdvancedField(fieldId,fieldparam,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,StringUtils.unquote(values[j]),operators[j]) ); + } } } } @@ -164,6 +186,7 @@ export class AdvancedSearchPageComponent { this.parameterValues.push(fields[this.fieldIds[i]].operators.join()); } } + //TODO -- if(includePage && this.searchUtils.page != 1){ params += "&page="+this.searchUtils.page; } @@ -195,7 +218,7 @@ export class AdvancedSearchPageComponent { countParams++; } } - + //TODO -- return params; } @@ -215,7 +238,7 @@ export class AdvancedSearchPageComponent { console.log("In PreviousRouteRecorder : "+this.router.url ); localStorage.setItem('previousRoute', this.router.url); } - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.isPiwikEnabled && (typeof document !== 'undefined')){ this.piwiksub = this._piwikService.trackView(this.pageTitle).subscribe(); } /* End Piwik Code */ diff --git a/searchPages/searchUtils/browseEntities.component.ts b/searchPages/searchUtils/browseEntities.component.ts index 868fe06a..0b79829c 100644 --- a/searchPages/searchUtils/browseEntities.component.ts +++ b/searchPages/searchUtils/browseEntities.component.ts @@ -5,10 +5,11 @@ import {Location} from '@angular/common'; import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass} from '../searchUtils/searchUtils.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'browse-entities', @@ -36,13 +37,13 @@ export class BrowseEntitiesComponent { @Input() public baseUrl:string = ""; @Input() public entityName:string = ""; @Input() public refineFields: string[] ;//= this.searchFields.RESULT_REFINE_FIELDS; + @Input() properties:EnvProperties; public sub: any; public errorCodes:ErrorCodes = new ErrorCodes(); public status = this.errorCodes.LOADING; public fieldIdsMap=this.searchFields.RESULT_REFINE_FIELDS; constructor ( private _refineFieldsService: RefineFieldResultsService ) { - // this.baseUrl = OpenaireProperties.getLinkToSearchPublications(); } @@ -67,7 +68,7 @@ export class BrowseEntitiesComponent { private getStats(){ this.status = this.errorCodes.LOADING; - this.sub = this._refineFieldsService.getRefineFieldsResultsByEntityName(this.refineFields,this.entityName).subscribe( + this.sub = this._refineFieldsService.getRefineFieldsResultsByEntityName(this.refineFields,this.entityName, this.properties).subscribe( data => { console.info("Get Stats for "+this.entityName+ ": [Total:"+data[0]+" ] [fields: "+data[1].length+"]"); this.filters = data[1]; diff --git a/searchPages/searchUtils/browseStatistic.component.ts b/searchPages/searchUtils/browseStatistic.component.ts index b0b78951..a0556564 100644 --- a/searchPages/searchUtils/browseStatistic.component.ts +++ b/searchPages/searchUtils/browseStatistic.component.ts @@ -5,11 +5,13 @@ import {Location} from '@angular/common'; import { Filter, Value} from '../searchUtils/searchHelperClasses.class'; import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; -import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; +import {ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass} from '../searchUtils/searchUtils.class'; import {RouterHelper} from '../../utils/routerHelper.class'; +import{EnvProperties} from '../../utils/properties/env-properties'; + @Component({ selector: 'browse-statistic', templateUrl: 'browseStatistic.component.html' diff --git a/searchPages/searchUtils/searchDownload.component.ts b/searchPages/searchUtils/searchDownload.component.ts index 55df68d0..849dde7b 100644 --- a/searchPages/searchUtils/searchDownload.component.ts +++ b/searchPages/searchUtils/searchDownload.component.ts @@ -1,16 +1,18 @@ import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core'; import {Observable} from 'rxjs/Observable'; +import { ActivatedRoute} from '@angular/router'; import {AlertModal} from '../../utils/modal/alert'; -import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {ReportsService} from '../../services/reports.service'; import {ModalLoading} from '../../utils/modal/loading.component'; import {PiwikService} from '../../utils/piwik/piwik.service'; +import{EnvProperties} from '../../utils/properties/env-properties'; @Component({ selector: 'search-download', template: ` - - + + + (CSV) @@ -31,14 +33,23 @@ export class SearchDownloadComponent { sub: any; downloadFilePiwikSub: any; + public csvLimit: number = 0; + @ViewChild (ModalLoading) loading : ModalLoading ; // Alert box when something is wrong with CSV requests @ViewChild('AlertModalCsvError') alertCsvError; + public isPiwikEnabled; - constructor ( private _reportsService: ReportsService, private _piwikService:PiwikService) {} + constructor (private route: ActivatedRoute, private _reportsService: ReportsService, private _piwikService:PiwikService) {} ngOnInit() { - this.downloadURLAPI = OpenaireProperties.getCsvAPIURL(); + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + + this.csvLimit = data.envSpecific.csvLimit; + this.downloadURLAPI = data.envSpecific.csvAPIURL; + this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + }); } ngOnDestroy() { @@ -70,7 +81,7 @@ export class SearchDownloadComponent { data => { this.closeLoading(); window.open(window.URL.createObjectURL(data),filename+".csv"); - if(OpenaireProperties.isPiwikTrackEnabled() && (typeof document !== 'undefined')){ + if(this.isPiwikEnabled && (typeof document !== 'undefined')){ this.downloadFilePiwikSub = this._piwikService.trackDownload(url).subscribe(); } }, diff --git a/searchPages/searchUtils/searchFilter.component.html b/searchPages/searchUtils/searchFilter.component.html index fdf83db7..73827dfc 100644 --- a/searchPages/searchUtils/searchFilter.component.html +++ b/searchPages/searchUtils/searchFilter.component.html @@ -7,18 +7,23 @@
    + +
    {{_formatName(value)}}
    ({{value.number}}) +
    -
    +
    +
    {{_formatName(value)}}
    ({{value.number}}) +
    @@ -41,19 +46,24 @@ {{filter.title}} +
    -
    - - {{_formatName(value)}}
    - ({{value.number}}) +

    -
    - {{_formatName(value)}}
    - ({{value.number}}) + +
    + {{_formatName(value)}}
    + ({{value.number}}) +
    diff --git a/searchPages/searchUtils/searchFilter.component.ts b/searchPages/searchUtils/searchFilter.component.ts index a120673c..47233dfa 100644 --- a/searchPages/searchUtils/searchFilter.component.ts +++ b/searchPages/searchUtils/searchFilter.component.ts @@ -15,7 +15,7 @@ export class SearchFilterComponent { @Input() showResultCount:boolean = true; @Input() isDisabled:boolean = false; @Input() addShowMore:boolean = true; - + @Input() connectCommunityId:string public showAll:boolean = false; public _maxCharacters:number =28; diff --git a/searchPages/searchUtils/searchForm.component.ts b/searchPages/searchUtils/searchForm.component.ts index 0a6ba9a8..d327721e 100644 --- a/searchPages/searchUtils/searchForm.component.ts +++ b/searchPages/searchUtils/searchForm.component.ts @@ -14,7 +14,7 @@ import {Router} from '@angular/router';
    Search -
    - More search options + More search options @@ -51,7 +51,7 @@
    Filter By:
    - +
    @@ -62,17 +62,18 @@