diff --git a/module/finc/src/finc/Controller/AmslResourceController.php b/module/finc/src/finc/Controller/AmslResourceController.php index 278f3fd14af3da3584ccbb179ebb853cc92c43d1..cf187741d7a47407cd8f781d4542b84c638d39a2 100644 --- a/module/finc/src/finc/Controller/AmslResourceController.php +++ b/module/finc/src/finc/Controller/AmslResourceController.php @@ -78,6 +78,13 @@ class AmslResourceController extends AbstractBase */ protected $baseUrl; + /** + * mapping of resource labels to be re-written for the query string + * + * @var array | null + */ + protected $resourceMapping; + /** * Constructor * @@ -91,13 +98,15 @@ class AmslResourceController extends AbstractBase ServiceLocatorInterface $sm, \Zend\Config\Config $config, \VuFindHttp\HttpService $httpClient, - \VuFind\Cache\Manager $cacheManager = null + \VuFind\Cache\Manager $cacheManager = null, + array $resourceMapping = null ) { parent::__construct($sm); $this->config = $config; $this->apiConfig = $config->API; $this->httpClient = $httpClient; $this->cacheManager = $cacheManager; + $this->resourceMapping = $resourceMapping; } /** @@ -265,16 +274,10 @@ class AmslResourceController extends AbstractBase } if(!empty($mapping->show_link) && !empty($source[$mapping->sub_key])) { - $misspelled = $this->config->get('MisspelledResources'); + $searchTerm = $source[$mapping->sub_key]; - if (!empty($misspelled)) { - foreach ($misspelled as $wrongLabel => $rightLabel) { - if (strpos($searchTerm, $wrongLabel) !== false) { - $searchTerm = $rightLabel; - break; - } - } - } + // map the source label to the correct SOLR search term + $searchTerm = $this->resourceMapping[$searchTerm] ?? $searchTerm; if (!$this->baseUrl) { $urlHelper = $this->getViewRenderer()->plugin('url'); diff --git a/module/finc/src/finc/Controller/AmslResourceControllerFactory.php b/module/finc/src/finc/Controller/AmslResourceControllerFactory.php index 92f8b637cc5f0baaf6062652ec17f75b2f5a46e0..a0b5134d6a8704fcc9f3dab7ed6b914c3c875d08 100644 --- a/module/finc/src/finc/Controller/AmslResourceControllerFactory.php +++ b/module/finc/src/finc/Controller/AmslResourceControllerFactory.php @@ -2,6 +2,7 @@ namespace finc\Controller; use Psr\Container\ContainerInterface; +use VuFind\Config\YamlReader; use Zend\ServiceManager\ServiceLocatorInterface; class AmslResourceControllerFactory @@ -13,11 +14,13 @@ class AmslResourceControllerFactory */ public function __invoke(ContainerInterface $container) { + $reader = $container->get('VuFind\YamlReader'); return new AmslResourceController( $container, $container->get('VuFind\Config\PluginManager')->get('Amsl'), $container->get('VuFindHttp\HttpService'), - $container->get('VuFind\Cache\Manager') + $container->get('VuFind\Cache\Manager'), + $reader->get('AmslResourceMapping.yaml') ); } } \ No newline at end of file diff --git a/themes/finc/js/advanced_search.js b/themes/finc/js/advanced_search.js index 5dad9556167bd8b8b43e983a3b53e7b2f05d26a9..dde587e5f5a727b796cbeae9590cec96e99720f0 100644 --- a/themes/finc/js/advanced_search.js +++ b/themes/finc/js/advanced_search.js @@ -10,10 +10,13 @@ function addSearch(group, _fieldValues) { var $newSearch = $($('#new_search_template').html()); $newSearch.attr('id', 'search' + inputID); + $newSearch.find('fieldset legend').text($newSearch.find('fieldset legend').text().replace('1', (groupLength[group] + 1))); $newSearch.find('input.form-control') .attr('id', 'search_lookfor' + inputID) .attr('name', 'lookfor' + group + '[]') .val(''); + $newSearch.find('.adv-input label').attr('for', 'search_lookfor' + inputID); + $newSearch.find('.adv-select label').attr('for', 'search_type' + inputID); $newSearch.find('select.adv-term-type option:first-child').attr('selected', 1); $newSearch.find('select.adv-term-type') .attr('id', 'search_type' + inputID) @@ -44,7 +47,6 @@ function addSearch(group, _fieldValues) { .attr('name', 'op' + group + '[]') .removeClass('hidden'); $newSearch.find('.first-op').remove(); - $newSearch.find('label').remove(); // Show x if we have more than one search inputs $('#group' + group + ' .adv-term-remove').removeClass('hidden'); } @@ -67,7 +69,12 @@ function deleteSearch(group, sindex) { } if (groupLength[group] > 1) { groupLength[group]--; - $('#search' + group + '_' + groupLength[group]).remove(); + var toRemove = $('#search' + group + '_' + groupLength[group]); + var parent = toRemove.parent(); + toRemove.remove(); + if(parent.length) { + parent.find('.adv-search input.form-control').focus(); + } if (groupLength[group] === 1) { $('#group' + group + ' .adv-term-remove').addClass('hidden'); // Hide x } @@ -84,6 +91,7 @@ function addGroup(_firstTerm, _firstField, _join) { $newGroup.find('.adv-group-label') // update label .attr('for', 'search_lookfor' + nextGroup + '_0'); $newGroup.attr('id', 'group' + nextGroup); + $newGroup.attr('aria-label', $newGroup.attr('aria-label').replace('0', nextGroup + 1)); $newGroup.find('.search_place_holder') .attr('id', 'group' + nextGroup + 'Holder') .removeClass('hidden'); diff --git a/themes/finc/scss/_customVariables.scss b/themes/finc/scss/_customVariables.scss index b744684a339ee1b6eb72242b91594d623687833a..22f4fbe355a768e56638d3eecd736e9204fde147 100644 --- a/themes/finc/scss/_customVariables.scss +++ b/themes/finc/scss/_customVariables.scss @@ -59,6 +59,8 @@ $modal-close-color-hover: $brand-danger !default; //// Anchor/Link text decoration $textdecoration-anchor: none !default; +// needs to be overriden in catalogues if visited color does not fit - AP +$a-visited-color: $steel !default; //// FORM FEEDBACK states colors and, by default, alerts colors (i.e. alerts are //// defined like so '$alert-success-bg: $state-success-bg;') diff --git a/themes/finc/scss/compiled.scss b/themes/finc/scss/compiled.scss index 8a5183ea841f34b9e2d1c901662c38a50dd5ad62..a59ea2fa489aa9fdfc9dccaa512923bdbf3c21d6 100644 --- a/themes/finc/scss/compiled.scss +++ b/themes/finc/scss/compiled.scss @@ -566,6 +566,11 @@ select { // LINKS // ANCHORS a { text-decoration: $textdecoration-anchor; + + // set different color for links already visited + &:visited { + color: $a-visited-color; + } } // LINKS - END diff --git a/themes/finc/templates/search/advanced/limit.phtml b/themes/finc/templates/search/advanced/limit.phtml index 3a48c286d3ff45643374b11c44fe93e25d0941f7..1143d26934ef25977b5349a1ea7bda7ea273530d 100644 --- a/themes/finc/templates/search/advanced/limit.phtml +++ b/themes/finc/templates/search/advanced/limit.phtml @@ -10,12 +10,12 @@ <?php if (count($limitList) > 1): ?> <fieldset class="limits"> <legend><?=$this->transEsc('Results per page')?></legend> + <label for="limit"><?=$this->transEsc('Limit To')?></label> <select id="limit" name="limit" class="form-control"> <?php foreach ($limitList as $limitVal): ?> <option value="<?=$this->escapeHtmlAttr($limitVal)?>" <?=($limitVal == $defaultLimit) ? 'selected="selected"' : ''?>><?=$this->escapeHtml($limitVal)?></option> <?php endforeach; ?> </select> - <label for="limit"><?=$this->transEsc('Limit To')?></label> </fieldset> <?php endif; ?> <!-- finc: search - advanced - limit - END --> \ No newline at end of file