diff --git a/local/alpha/config/vufind/searches.ini b/local/alpha/config/vufind/searches.ini index c259bc11f28286b2a81579ecd8e5f050c11f314c..6ac686dcbd2734ad5274d3ec21a7b7ebcb50118c 100644 --- a/local/alpha/config/vufind/searches.ini +++ b/local/alpha/config/vufind/searches.ini @@ -26,4 +26,7 @@ highlighting = true [IndexShards] ai = ai.ub.uni-leipzig.de/solr/biblio -main = index.ub.uni-leipzig.de/solr/biblio \ No newline at end of file +main = index.ub.uni-leipzig.de/solr/biblio + +[NewItem] +method = ils \ No newline at end of file diff --git a/local/config/vufind/searches.ini b/local/config/vufind/searches.ini index 64ab99beb2ddc6f028d4c2c8a8e4196590d2f9a6..1dbec8eddd33723afa4ba2786ee92204f0ada6a1 100644 --- a/local/config/vufind/searches.ini +++ b/local/config/vufind/searches.ini @@ -435,7 +435,7 @@ side[] = "ExpandFacets:Author" ; (see https://vufind.org/wiki/indexing:tracking_record_changes). If using the ILS, ; your driver must support the getNewItems() method. ; Valid options: ils, solr; default: ils -method = ils +method = solr ; Comma-separated list of date ranges to offer to the user (i.e. 1,5,30 = one day ; old, or five days old, or thirty days old). If using the "ils" method, be careful ; about raising the maximum age too high -- searching very long date ranges may put diff --git a/local/languages/de.ini b/local/languages/de.ini index 29ae8c90af51aed7880a7919bebfb4fabd72158d..b257ab271cbbbf0aba982fd9af093519c8487ff9 100644 --- a/local/languages/de.ini +++ b/local/languages/de.ini @@ -217,6 +217,7 @@ Change Profile Data = "Benutzerdaten ändern" Change User PIN of Self-Checkout = "Benutzer-PIN für Selbstverbuchung ändern" Checkedout = "Ausgeliehene Medien" Checkedoutpermanent = "Längerfristige Ausleihen" +Choose Period = Zeitraum auswählen Cite this = Zitieren Click here to view book = Volltext Clock = "Uhr" @@ -2050,3 +2051,6 @@ select_item = "Titel auswählen" Email = "Mailen" Print = "Drucken" bookbag_email_selected = "Links zu ausgewählten Medien per E-Mail versenden" + +; #18441 +Skip_navigation_links = "Sprunglinks zur Suche und zum Inhalt" diff --git a/local/languages/en.ini b/local/languages/en.ini index 962d249c742cb4d301349c47973d00dd95cf1a62..a4cb46bf4b95a77e2b4f17edcbcb02e68f6345b7 100644 --- a/local/languages/en.ini +++ b/local/languages/en.ini @@ -355,6 +355,7 @@ By Alphabetical = "In Alphabetic Order" Cannot find similar records = "Cannot find similar records." Cassette = Cassette Checkedoutpermanent = "Checked Out Permanent Items" +Choose Period = Choose Date Range # Chinese = "ä¸æ–‡ï¼ˆç¹é«”)" Chinese = Chinese Clock = "" @@ -2131,4 +2132,7 @@ form-button-submit = "Submit the completed form" offcanvas-toggler-search-tips = "Show search help" ; #18019 remove if using VuFind 7.0 -select_item = "Select item" \ No newline at end of file +select_item = "Select item" + +; #18441 +Skip_navigation_links = "Skip navigation links" diff --git a/module/finc/config/module.config.php b/module/finc/config/module.config.php index f2631035d077e3e888772a4c53bf14cebc96ab53..515cee83dffde153dc95b8c1f5e2ee32ed7a3658 100644 --- a/module/finc/config/module.config.php +++ b/module/finc/config/module.config.php @@ -51,9 +51,11 @@ $config = [ 'controller_plugins' => [ 'factories' => [ 'finc\Controller\Plugin\EmailHold' => 'finc\Controller\Plugin\EmailHoldFactory', + 'finc\Controller\Plugin\NewItems' => 'finc\Controller\Plugin\NewItemsFactory' ], 'aliases' => [ - 'emailHold' => 'finc\Controller\Plugin\EmailHold' + 'emailHold' => 'finc\Controller\Plugin\EmailHold', + 'newItems' => 'finc\Controller\Plugin\NewItems' ] ], 'vufind' => [ diff --git a/module/finc/src/finc/Controller/Plugin/NewItems.php b/module/finc/src/finc/Controller/Plugin/NewItems.php new file mode 100644 index 0000000000000000000000000000000000000000..25998371eac9064e2bbef24bea316f6bd7dfb29e --- /dev/null +++ b/module/finc/src/finc/Controller/Plugin/NewItems.php @@ -0,0 +1,80 @@ +<?php +/** + * VuFind Action Helper - New Items Support Methods + * + * PHP version 7 + * + * Copyright (C) Leipzig University Library 2020. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind + * @package Controller_Plugins + * @author Demian Katz <demian.katz@villanova.edu> + * @author Robert Lange <lange@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +namespace finc\Controller\Plugin; + +use Zend\Config\Config; +use Zend\Mvc\Controller\Plugin\AbstractPlugin; + +/** + * Zend action helper to perform new items-related actions + * + * @category VuFind + * @package Controller_Plugins + * @author Demian Katz <demian.katz@villanova.edu> + * @author Robert Lange <lange@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org Main Page + */ +class NewItems extends \VuFind\Controller\Plugin\NewItems +{ + /** + * Main Configuration + * + * @var null|Config + */ + protected $mainConfig; + + /** + * Constructor + * + * @param Config $searchConfig Configuration + * @param Config $mainConfig Configuration + */ + public function __construct(Config $searchConfig, Config $mainConfig) + { + $this->config = $searchConfig; + $this->mainConfig = $mainConfig; + } + + /** + * Get a Solr filter to limit to the specified number of days. + * + * @param int $range Days to search + * + * @return string + */ + public function getSolrFilter($range) + { + $field = 'first_indexed'; + if (!empty($isilPrefix = $this->mainConfig->CustomIndex->indexExtension)) { + $field = "{$isilPrefix}_date"; + } + return "$field:[NOW-{$range}DAY TO NOW]"; + } +} diff --git a/module/finc/src/finc/Controller/Plugin/NewItemsFactory.php b/module/finc/src/finc/Controller/Plugin/NewItemsFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..42fe4cf4689f3f013792ef9137a65f4ad74affbb --- /dev/null +++ b/module/finc/src/finc/Controller/Plugin/NewItemsFactory.php @@ -0,0 +1,63 @@ +<?php +/** + * Factory for controller plugins. + * + * PHP version 7 + * + * Copyright (C) Leipzig University Library 2020. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @author Robert Lange <lange@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +namespace finc\Controller\Plugin; + +use Psr\Container\ContainerInterface; +use finc\Controller\Plugin\NewItems; +use Zend\ServiceManager\ServiceManager; + +/** + * Factory for controller plugins. + * + * @category VuFind + * @package View_Helpers + * @author Demian Katz <demian.katz@villanova.edu> + * @author André Lahmann <lahmann@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + * + * @codeCoverageIgnore + */ +class NewItemsFactory +{ + /** + * Construct the NewItems plugin. + * + * @param ServiceManager $sm Service manager. + * + * @return NewItems + */ + public function __invoke(ContainerInterface $sm) + { + $search = $sm->get('VuFind\Config\PluginManager')->get('searches'); + $config = isset($search->NewItem) + ? $search->NewItem : new \Zend\Config\Config([]); + return new NewItems($config, $sm->get('VuFind\Config\PluginManager')->get('config')); + } +} diff --git a/themes/finc/scss/compiled.scss b/themes/finc/scss/compiled.scss index 693a8217d1776965d6f32473e600ec1e756f6daa..21e429ef2b0d63c2274a376a97ecfae14702a54f 100644 --- a/themes/finc/scss/compiled.scss +++ b/themes/finc/scss/compiled.scss @@ -362,6 +362,11 @@ legend { padding-left: ($grid-gutter-width / 2); padding-right: ($grid-gutter-width / 2); width: auto; + + // Recent acquisitions search form (search/NewItem) + .form-search-newitem & { + padding-left: 0; + } } //// label {} @@ -521,7 +526,8 @@ select { } // remove icons in limiter select boxes in adv. search -#advSearchForm .limiter-boxes select.form-control { +#advSearchForm .limiter-boxes select.form-control, +#newitem_department { background-image: none; height: auto; } @@ -1540,7 +1546,7 @@ header, .search.container { padding-right: 0; - // Make wider to fit searchbox and right-hand nav-elements in + // Make wider to fit searchbox and right-hand nav-elements @media (min-width: $screen-sm-min) { flex: 0 1 auto; padding-top: $button-top-padding; @@ -1550,14 +1556,26 @@ header, // Float "Find" button next to searchbox on XS and SM @media (max-width: $screen-sm-max) { padding-left: 0; + } + + @media only screen and (min-width: $screen-sm-min) and (max-width: $screen-sm-max) { + flex: content; + } - .searchForm { + .searchForm_lookfor { + @media (max-width: $screen-xs-max) { + //max-width: 80%; + } + } + + .searchForm { + @media only screen and (max-width: $screen-sm-max) { display: flex; input { flex-grow: 2; flex-shrink: 2; - max-width: 43%; + // max-width: 43%; } .navbar { @@ -1571,23 +1589,8 @@ header, top: 40px; } } - } - @media only screen and (max-width: $screen-xs-max) { - .searchForm_lookfor { - max-width: 80%; - } - } - - @media only screen and (min-width: $screen-sm-min) and (max-width: $screen-sm-max) { - flex: content; - - .btn, - .form-control { - float: left; - } - - .searchForm { + @media only screen and (min-width: $screen-sm-min) and (max-width: $screen-sm-max) { display: block; .checkbox { @@ -1595,6 +1598,13 @@ header, } } } + + .btn, + .form-control { + @media only screen and (min-width: $screen-sm-min) and (max-width: $screen-sm-max) { + float: left; + } + } } //// this will get search box and buttons in line diff --git a/themes/finc/templates/layout/layout.phtml b/themes/finc/templates/layout/layout.phtml index 2993ffd55b4da7907a2a64ae0fc8096f3329df2d..de31a198ebb34751939531dd2df5d536f8046c64 100644 --- a/themes/finc/templates/layout/layout.phtml +++ b/themes/finc/templates/layout/layout.phtml @@ -153,28 +153,30 @@ if (!isset($this->layout()->searchbox)) { $this->layout()->searchbox = $this->render('search/searchbox.phtml'); } ?> -<?php if (isset($this->layout()->srmessage)): // message for benefit of screen-reader users ?> - <span class="sr-only" role="heading" aria-level="1"><?=$this->layout()->srmessage?></span> -<?php endif; ?> -<?php /* Add landmark role to avoid 'all content must be inside landmarks error', CK */ ?> -<div role="navigation" aria-label="Skip_navigation_links"> - <?php /* Show skip to search link only when page is not "advanced" search, CK */ ?> - <?php if (strtolower($this->layout()->templateName) !== 'advanced'): ?> - <a class="sr-only" href="#searchForm_lookfor"><?=$this->transEsc('Skip to search')?></a> +<?php /* Move skip links inside header landmark; + Start header here, not above, custom finc, CK */ ?> +<header class="hidden-print"> + <?php if (isset($this->layout()->srmessage)): // message for benefit of screen-reader users ?> + <span class="sr-only" role="heading" aria-level="1"><?=$this->layout()->srmessage?></span> <?php endif; ?> - <a class="sr-only" href="#content"><?=$this->transEsc('Skip to content')?></a> - <?php if (substr_count(strtolower($this->layout()->templateName), 'results') > 0): ?> - <?php if (strcmp($this->layout()->userLang, 'de') == 0): ?> - <a class="sr-only hidden-xs" href="#myresearch-sidebar"><?=$this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search')?></a> - <?php else: ?> - <a class="sr-only hidden-xs" href="#myresearch-sidebar"><?=$this->transEsc('skip-to')?><?=strtolower($this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search'))?></a> + + <?php /* Add landmark role to avoid 'all content must be inside landmarks error', CK */ ?> + <div role="navigation" aria-label="<?=$this->transEsc('Skip_navigation_links')?>"> + <?php /* Show skip to search link only when page is not "advanced" search, CK */ ?> + <?php if (strtolower($this->layout()->templateName) !== 'advanced'): ?> + <a class="sr-only" href="#searchForm_lookfor"><?=$this->transEsc('Skip to search')?></a> <?php endif; ?> - <?php endif; ?> -</div> - -<?php /* Start header here, not above, custom finc, CK */ ?> -<header class="hidden-print"> + <a class="sr-only" href="#content"><?=$this->transEsc('Skip to content')?></a> + <?php if (substr_count(strtolower($this->layout()->templateName), 'results') > 0): ?> + <?php if (strcmp($this->layout()->userLang, 'de') == 0): ?> + <a class="sr-only hidden-xs" href="#myresearch-sidebar"><?=$this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search')?></a> + <?php else: ?> + <a class="sr-only hidden-xs" href="#myresearch-sidebar"><?=$this->transEsc('skip-to')?><?=strtolower($this->transEsc(isset($this->overrideSideFacetCaption) ? $this->overrideSideFacetCaption : 'Narrow Search'))?></a> + <?php endif; ?> + <?php endif; ?> + </div> + <?=$this->render('header.phtml')?> </header> <nav class="breadcrumbs" aria-label="<?=$this->transEsc('Breadcrumbs')?>"> diff --git a/themes/finc/templates/search/newitem.phtml b/themes/finc/templates/search/newitem.phtml index 90b2a2077bfc8393592372667e03c42bf49b7f02..75049b76728d99909875fd5c5c842176e1c25d1c 100644 --- a/themes/finc/templates/search/newitem.phtml +++ b/themes/finc/templates/search/newitem.phtml @@ -1,41 +1,40 @@ <!-- finc - templates - search - newitem --> <?php - // Set up page title: - $this->headTitle($this->translate('New Item Search')); - - // Set up breadcrumbs: - $this->layout()->breadcrumbs = '<li class="active">' . $this->transEsc('New Items') . '</li>'; - - // Convenience variable: - $offlineMode = $this->ils()->getOfflineMode(); + // Set up page title: + $this->headTitle($this->translate('New Item Search')); + + // Set up breadcrumbs: + $this->layout()->breadcrumbs = '<li class="active">' . $this->transEsc('New Items') . '</li>'; + + // Convenience variable: + $offlineMode = $this->ils()->getOfflineMode(); ?> - -<h1><?=$this->transEsc('Find New Items')?></h1> -<?php if ($offlineMode == "ils-offline"): ?> - <?=$this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_holdings_message'])?> -<?php endif; ?> -<form method="get" class="form-search-newitem"> - <div class="form-group"> - <label class="control-label"><?=$this->transEsc('Range')?>:</label> - <div class="btn-group" data-toggle="buttons"> +<div class="mainbody"> + <h1><?= $this->transEsc('Find New Items') ?></h1> + <?php if ($offlineMode == "ils-offline"): ?> + <?= $this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_holdings_message']) ?> + <?php endif; ?> + <form method="get" class="form-search-newitem"> + <div class="form-group"> + <legend><?= $this->transEsc("Choose Period") ?>:</legend> <?php foreach ($this->ranges as $key => $range): ?> - <label class="btn btn-primary<?php if($key == 0): ?> active<?php endif ?>"> - <input type="radio" name="range" id="newitem_range_<?=$this->escapeHtmlAttr($key)?>" value="<?=$this->escapeHtmlAttr($range)?>"<?=($key == 0) ? ' checked="checked"' : ''?>/> - <?=($range == 1) ? $this->transEsc('Yesterday') : $this->transEsc('past_days', ['%%range%%' => $this->escapeHtml($range)])?> + <input type="radio" name="range" id="newitem_range_<?= $this->escapeHtmlAttr($key) ?>" value="<?= $this->escapeHtmlAttr($range) ?>"<?= ($key == 0) ? ' checked="checked"' : '' ?>/> + <label for="newitem_range_<?= $this->escapeHtmlAttr($key) ?>"> + <?= ($range == 1) ? $this->transEsc('From') . " " . $this->transEsc('Yesterday') : $this->transEsc('past_days', ['%%range%%' => $this->escapeHtml($range)]) ?> </label> <?php endforeach; ?> </div> - </div> - <?php if (is_array($this->fundList) && !empty($this->fundList)): ?> - <div class="form-group"> - <label class="control-label" for="newitem_department"><?=$this->transEsc('Department')?>:</label> - <select id="newitem_department" name="department" size="10" class="form-control"> - <?php foreach ($this->fundList as $fundId => $fund): ?> - <option value="<?=$this->escapeHtmlAttr($fundId)?>"><?=$this->transEsc($fund)?></option> - <?php endforeach; ?> - </select> - </div> - <?php endif; ?> - <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Find')?>"/> -</form> + <?php if (is_array($this->fundList) && !empty($this->fundList)): ?> + <div class="form-group"> + <label class="control-label" for="newitem_department"><?= $this->transEsc('Department') ?>:</label> + <select id="newitem_department" name="department" size="10" class="form-control"> + <?php foreach ($this->fundList as $fundId => $fund): ?> + <option value="<?= $this->escapeHtmlAttr($fundId) ?>"><?= $this->transEsc($fund) ?></option> + <?php endforeach; ?> + </select> + </div> + <?php endif; ?> + <input class="btn btn-primary" type="submit" name="submit" value="<?= $this->transEsc('Find') ?>"/> + </form> +</div> <!-- finc - templates - search - newitem - END --> diff --git a/themes/finc/templates/search/searchbox.phtml b/themes/finc/templates/search/searchbox.phtml index 65f67b3019798d98b1547c5a727e735da9afb250..0b308f0212f9d935458d87b116de2738ea5d8fd7 100644 --- a/themes/finc/templates/search/searchbox.phtml +++ b/themes/finc/templates/search/searchbox.phtml @@ -60,7 +60,7 @@ $hiddenFilterParams = $this->searchTabs()->getCurrentHiddenFilterParams($this->s <?php endif; ?> <button type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i> <span class="find-label sr-only"><?=$this->transEsc("Find")?></span></button> <?php if ($advSearch): ?> - <a href="<?=$this->url($advSearch) . ((isset($this->searchId) && $this->searchId) ? '?edit=' . $this->escapeHtmlAttr($this->searchId) : $hiddenFilterParams)?>" class="btn btn-transparent" role="button" rel="nofollow"><i class="fa fa-cog"></i> <span class="hidden-xs hidden-sm hidden-md"><?=$this->transEsc("Advanced")?></span></a> + <a href="<?=$this->url($advSearch) . ((isset($this->searchId) && $this->searchId) ? '?edit=' . $this->escapeHtmlAttr($this->searchId) : $hiddenFilterParams)?>" class="btn btn-transparent" role="button" rel="nofollow" aria-label="<?=$this->transEsc("Advanced")?>"><i class="fa fa-cog"></i> <span class="hidden-xs hidden-sm hidden-md"><?=$this->transEsc("Advanced")?></span></a> <?php endif; ?> <?php if ($geoUrl = $this->geocoords()->getSearchUrl($options)) : ?> <a href="<?=$geoUrl?>" class="btn btn-link"><?=$this->transEsc('Geographic Search')?></a>