Skip to content
Snippets Groups Projects
Commit ba3ac017 authored by Robert Lange's avatar Robert Lange
Browse files

Merge branch 'master' into instance/fid

parents 501f9ee8 ac8ac991
Branches
Tags
No related merge requests found
;####################################################################
;##################### DO NOT DELETE THIS HEADER ####################
;################### Leipzig University Library © 2020 ##############
;
; This is the default ALPHA-INI-file and inherits
; all the settings from the INI-file defined in [Parent_Config] which
; points to the default INI-file located in the folder vufind2/local
;
[Parent_Config]
relative_path = ../../../config/vufind/Amsl.ini
; A comma-separated list of config sections from the parent which should be
; completely overwritten by the equivalent sections in this configuration;
; any sections not listed here will be merged on a section-by-section basis.
;override_full_sections = "Languages,AlphaBrowse_Types"
;
; Add ALPHA-specific customization after this header.
;
;##################### DO NOT DELETE THIS HEADER ####################
;####################################################################
[API]
; no caching for alpha
;ttl = 0
;####################################################################
;##################### DO NOT DELETE THIS HEADER ####################
;################### Leipzig University Library © 2020 ##############
;
; This is the ISIL-instance-specific default INI-file
; for the configuration of the Amsl API
;
[API]
;url = "https://live.amsl.technology/inhouseservices/list?do=catalog_metadataList&isil=ISIL"
response_type = 'application/json'
; max caching in seconds
; standard is 86400 i.e. one week
ttl = 86400
; Contains label patterns for two layers of source hierarchy
; these will normally be source and collection represented by main_label and sub_label, resp.
; use array_keys in double percent signs to be rendered in the labels
; the main label MUST contain the main key and the main key SHOULD identify the source
; same for the sub key and label
[Mapping]
main_key = 'source_id'
main_label = '%%source_label%%'
sortBySourceLabel = true
default_main_label = 'untitled source'
sub_key = 'collection_label'
sub_label = '%%collection_label%%'
default_sub_label = 'untitled collection'
show_link = true
; show_description can be api, local or false
; api or true displays entry from AMSL-API as defined in sub_description_key
; local displays entry from local translation file
; false does not show a description
show_description = false
;sub_description_key = 'collection_description'
[MisspelledResources]
; wrong collection label = correct collection label for links
; "" means no link
\ No newline at end of file
......@@ -124,7 +124,7 @@ class AmslResourceController extends AbstractBase
);
}
$rendered = $this->getViewRenderer()->render($view);
$this->setCacheData($rendered,'rendered');
$this->setCacheData($rendered, 'rendered');
$view->rendered_html = $rendered;
}
......@@ -154,7 +154,7 @@ class AmslResourceController extends AbstractBase
);
break;
}
if (isset($amsl_sources)) {
$results = $this->createSourceHierarchy($amsl_sources);
}
......@@ -244,11 +244,23 @@ class AmslResourceController extends AbstractBase
{
$mapping = $this->config->get('Mapping');
if (isset($mapping->sub_description_key) && isset($source[$mapping->sub_description_key])) {
if (!empty($mapping->show_description)) {
$showDescription = $mapping->show_description ?? false;
switch($showDescription) {
case 1:
case 'true':
case 'api':
if (isset($mapping->sub_description_key) && isset($source[$mapping->sub_description_key])) {
$source["desc"] = $source[$mapping->sub_description_key];
unset($source[$mapping->sub_description_key]);
}
unset($source[$mapping->sub_description_key]);
break;
case 'local':
$source['desc'] = $this->translate('AMSLScopeNotes::'.$source[$mapping->sub_key], [], '');
break;
case 0:
case 'false':
default:
// do nothing
}
if(!empty($mapping->show_link) && !empty($source[$mapping->sub_key])) {
......@@ -296,8 +308,8 @@ class AmslResourceController extends AbstractBase
/**
* Helper function for writing data to controller specific cache
*
* @param string $value Cache value to write
* @param string $tag optional tag to be used for cache key
* @param string $value Cache value to write
* @param string $tag optional tag to be used for cache key
* @throws \Exception
*/
private function setCacheData($value, $tag = '')
......@@ -320,7 +332,7 @@ class AmslResourceController extends AbstractBase
/**
* Helper function to generate config-specific cache key
*
* @param string $tag optional tag to make cache more specific
* @param string $tag optional tag to make cache more specific
* @return string
*/
protected function getCacheKey($tag = '')
......
......@@ -384,6 +384,7 @@ class FincLibero extends FincILS implements TranslatorAwareInterface
protected function getCustomData($item)
{
$customData = [];
$customData['pickUpLocations'] = [];
foreach (['available', 'unavailable'] as $availability) {
if (isset($item[$availability])) {
foreach ($item[$availability] as $available) {
......@@ -398,17 +399,20 @@ class FincLibero extends FincILS implements TranslatorAwareInterface
) {
// if we have limitations qualifying for pickUpLocations,
// save those in customData
$customData['pickUpLocations'] = $pickUpLocations;
} elseif (!isset($customData['pickUpLocations']) && isset($item['department'])) {
$customData['pickUpLocations'] = array_merge(
$customData['pickUpLocations'],
$pickUpLocations
);
} elseif (empty($customData['pickUpLocations']) && isset($item['department'])) {
// if we have no explicit limitations qualifying for
// pickUpLocations, assume the item's department as single
// pickUpLocation
$customData['pickUpLocations'] = [
$customData['pickUpLocations'] = array_merge($customData['pickUpLocations'], [
[
'locationID' => $item['department']['id'],
'locationDisplay' => $item['department']['content']
]
];
]);
}
// deal with EmailHold information
if (isset($available['limitation'])) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment