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

Merge branch 'master' into instance/fid

parents b16f45e4 e92a20b2
Branches
Tags
No related merge requests found
......@@ -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');
......
......@@ -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
......@@ -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');
......
......@@ -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;')
......
......@@ -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
......
......@@ -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
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