diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b319666d..16508d3c 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,3 +1,4 @@ +import { AppSettings } from './services/app-settings'; import { PeriodicalFulltextItemComponent } from './periodical/periodical-content/periodical-fulltext-layout/periodical-fulltext-item/periodical-fulltext-item.component'; import { PeriodicalFulltextLayoutComponent } from './periodical/periodical-content/periodical-fulltext-layout/periodical-fulltext-layout.component'; import { MusicService } from './services/music.service'; @@ -199,7 +200,8 @@ const ROUTES: Routes = [ CollectionService, HistoryService, AltoService, - MusicService + MusicService, + AppSettings ], bootstrap: [AppComponent] }) diff --git a/src/app/logo/logo.component.ts b/src/app/logo/logo.component.ts index 293745c4..2aad1137 100644 --- a/src/app/logo/logo.component.ts +++ b/src/app/logo/logo.component.ts @@ -1,5 +1,5 @@ +import { AppSettings } from './../services/app-settings'; import { Component, OnInit } from '@angular/core'; -import { environment } from '../../environments/environment'; @Component({ selector: 'app-logo', @@ -10,9 +10,9 @@ export class LogoComponent implements OnInit { logo; title; - constructor() { - this.title = environment.title; - this.logo = environment.logo; + constructor(private appSettings: AppSettings) { + this.title = appSettings.title; + this.logo = appSettings.logo; } ngOnInit() { diff --git a/src/app/search/search_query.model.ts b/src/app/search/search_query.model.ts index b71d09ac..1830791d 100644 --- a/src/app/search/search_query.model.ts +++ b/src/app/search/search_query.model.ts @@ -1,5 +1,5 @@ -import { environment } from '../../environments/environment'; import { Utils } from '../services/utils.service'; +import { AppSettings } from '../services/app-settings'; export class SearchQuery { accessibility: string; @@ -206,11 +206,11 @@ export class SearchQuery { q += '&q1=' + qString + '&fl=PID,dostupnost,model_path,dc.creator,root_title,root_pid,datum_str,img_full_mime,score' + '&group=true&group.field=root_pid&group.ngroups=true&group.sort=score desc'; - if (environment.solr.facetTruncate) { - q += '&group.truncate=true'; - } else { - q += '&group.facet=true'; - } + // if (environment.solr.facetTruncate) { + q += '&group.truncate=true'; + // } else { + // q += '&group.facet=true'; + // } } else { q += '&fl=PID,dostupnost,fedora.model,dc.creator,dc.title,datum_str,img_full_mime'; } diff --git a/src/app/services/app-settings.ts b/src/app/services/app-settings.ts new file mode 100644 index 00000000..bc4817e1 --- /dev/null +++ b/src/app/services/app-settings.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; + +declare var APP_GLOBAL: any; + +@Injectable() + +export class AppSettings { + + public title = APP_GLOBAL.title; + public logo = APP_GLOBAL.logo; + public url = APP_GLOBAL.url; + public joinedDoctypes = APP_GLOBAL.joinedDoctypes; + public doctypes = APP_GLOBAL.doctypes; +} diff --git a/src/app/services/kramerius-api.service.ts b/src/app/services/kramerius-api.service.ts index 58a8db49..edab7544 100644 --- a/src/app/services/kramerius-api.service.ts +++ b/src/app/services/kramerius-api.service.ts @@ -13,7 +13,7 @@ import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/map'; import { UnauthorizedError } from '../common/errors/unauthorized-error'; import { Response } from '@angular/http/src/static_response'; -import { environment } from '../../environments/environment'; +import { AppSettings } from './app-settings'; @Injectable() export class KrameriusApiService { @@ -37,8 +37,9 @@ export class KrameriusApiService { constructor(private http: Http, private utils: Utils, + private appSettings: AppSettings, private solrService: SolrService) { - this.BASE_URL = environment.url; + this.BASE_URL = appSettings.url; this.API_URL = this.BASE_URL + '/search/api/v5.0'; } diff --git a/src/app/services/search.service.ts b/src/app/services/search.service.ts index 8fa65b96..894e3314 100644 --- a/src/app/services/search.service.ts +++ b/src/app/services/search.service.ts @@ -10,7 +10,7 @@ import { SearchQuery } from './../search/search_query.model'; import { Page } from './../model/page.model'; import { Injectable } from '@angular/core'; import { CollectionService } from './collection.service'; -import { environment } from '../../environments/environment'; +import { AppSettings } from './app-settings'; @Injectable() @@ -32,19 +32,17 @@ export class SearchService { activeMobilePanel: String; - solrConfig; - constructor( private router: Router, private collectionService: CollectionService, private solrService: SolrService, private localStorageService: LocalStorageService, private krameriusApiService: KrameriusApiService, + private appSettings: AppSettings, private translator: Translator) { translator.languageChanged.subscribe(() => { this.translateCollections(); }); - this.solrConfig = environment.solr; } @@ -175,7 +173,7 @@ export class SearchService { break; } case 'doctypes': { - this.doctypes = this.solrService.facetDoctypeList(response, this.solrConfig.joinedDoctypes, this.solrConfig.doctypes); + this.doctypes = this.solrService.facetDoctypeList(response, this.appSettings.joinedDoctypes, this.appSettings.doctypes); break; } case 'authors': { diff --git a/src/app/services/solr.service.ts b/src/app/services/solr.service.ts index 6ed1605b..7c350335 100644 --- a/src/app/services/solr.service.ts +++ b/src/app/services/solr.service.ts @@ -181,7 +181,6 @@ export class SolrService { } else { item.doctype = dp; } - console.log('qqqqqq', query); if (item.doctype === 'periodical') { if (query.accessibility !== 'all') { params['accessibility'] = query.accessibility; @@ -195,7 +194,6 @@ export class SolrService { item.authors = doc['dc.creator']; item.resolveUrl(); item.params = params; - console.log(item); items.push(item); } return items; diff --git a/src/assets/globals.js b/src/assets/globals.js new file mode 100644 index 00000000..2c2e9bb1 --- /dev/null +++ b/src/assets/globals.js @@ -0,0 +1,8 @@ +var APP_GLOBAL = { + title: 'Moravská zemská knihovna', + logo: 'http://registr.digitalniknihovna.cz/libraries/mzk/logo', + url: 'https://kramerius.mzk.cz', + ga: 'UA-65303593-14', + joinedDoctypes: true, + doctypes: ['monograph', 'periodical', 'map', 'graphic', 'archive', 'manuscript', 'soundrecording', 'sheetmusic'] +}; \ No newline at end of file diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 20ad6c49..3612073b 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,42 +1,3 @@ export const environment = { - production: true, - // MZK - // title: 'Moravská zemská knihovna', - // logo: 'http://registr.digitalniknihovna.cz/libraries/mzk/logo', - // url: 'https://kramerius.mzk.cz', - // solr: { - // joinedDoctypes: true, - // facetTruncate: true, - // doctypes: ['monograph', 'periodical', 'map', 'graphic', 'archive', 'manuscript', 'soundrecording', 'sheetmusic'] - // } - - // KNAV - // title: 'Knihovna Akademie věd ČR', - // logo: 'http://registr.digitalniknihovna.cz/libraries/knav/logo', - // url: 'https://kramerius.lib.cas.cz', - // solr: { - // joinedDoctypes: false, - // facetTruncate: true, - // doctypes: ['monograph', 'periodical'] - // } - - // NKP - // title: 'Národní knihovna České republiky', - // logo: 'http://registr.digitalniknihovna.cz/libraries/nkp/logo', - // url: 'http://kramerius4.nkp.cz', - // solr: { - // joinedDoctypes: false, - // facetTruncate: true, - // doctypes: ['monograph', 'periodical', 'map', 'sheetmusic'] - // } - - // MLP - title: 'Městská knihovna v Praze', - logo: 'http://registr.digitalniknihovna.cz/libraries/mlp/logo', - url: 'http://kramerius4.mlp.cz', - solr: { - joinedDoctypes: true, - facetTruncate: true, - doctypes: ['monograph', 'periodical', 'soundrecording', 'sheetmusic'] - } + production: true }; diff --git a/src/index.html b/src/index.html index 6f1ff142..395f2460 100644 --- a/src/index.html +++ b/src/index.html @@ -9,6 +9,7 @@
+