Skip to content

Commit

Permalink
Merge branch 'dev' into vufind-1677
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Feb 3, 2025
2 parents a50954b + 429c14f commit 4a5ab46
Show file tree
Hide file tree
Showing 66 changed files with 3,222 additions and 217 deletions.
170 changes: 170 additions & 0 deletions config/vufind/ProQuestFSG.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
; This section contains global settings affecting search behavior.
; For ProQuest Federated Search Gateway API documentation:
; https://support.proquest.com/s/article/ProQuest-Academic-Platform-Federated-Search-Options
[General]
; Enable the ProQuest Federated Search Gateway integration. Disabled by default.
;enabled = true

; This setting controls the default sort order of search results; the selected
; option should be one of the options present in the [Sorting] section below.
default_sort = relevance
; This section controls the result limit options for search results. default_limit
; sets the default number of results per page. limit_options is a comma-separated
; list of numbers to be presented to the end-user. If only one limit is required,
; set default_limit and leave limit_options commented out.
; WARNING: using large limits may cause problems due to a variety of limitations,
; especially if you support bulk operations (which can cause large URLs/requests).
; If you must support large page sizes, you may need to raise the PHP memory_limit
; and max_input_vars settings and/or adjust the Apache LimitRequestLine setting.
default_limit = 20
; limit_options = 10,20,40,60,80,100

; This setting allows to limit pagination of a search result as deep pagination
; costs a lot of performance and most users are not very likely to navigate
; further down than 20 pages of a search result.
; This is especially useful to prevent webcrawlers from descending too deep and
; eating up search backend performance.
; Default is 400; the API supports a maximum limit of 1000.
;result_limit = 400

; These are the default recommendations modules to use when no specific setting
; are found in the [TopRecommendations], [SideRecommendations] or
; [NoResultsRecommendations] sections below.
; See the comments above those sections for details on legal settings. You may
; repeat these lines to load multiple recommendations.
default_side_recommend[] = SideFacets:Facets:CheckboxFacets:ProQuestFSG
;default_noresults_recommend[] = SwitchTab
default_noresults_recommend[] = RemoveFilters

; When you filter a search using facets, should VuFind retain your current filters
; on the next search and provide a reset button to clear them (true), or should it
; always perform new searches unfiltered (false)?
retain_filters_by_default = true

; Whether to always (when there are active filters) display the "Reset Filters"
; button regardless of the retain_filters_by_default setting. Default is false.
always_display_reset_filters = false

; This controls whether results are loaded with JavaScript when paging or changing
; settings. Loading results this way improves performance and accessibility, and is
; enabled by default. Loading will automatically fall back to non-JS mode if
; JavaScript is not supported by the browser.
load_results_with_js = true

; This setting can be used to configure pagination control on top of results.
; Possible options are:
; empty string or false No top pagination (default)
; simple Simple next/prev button pagination
; full Full pagination alike to the one at the bottom of results
;top_paginator = simple

; The following two sections can be used to associate specific recommendations
; modules with specific search types defined in the [Basic_Searches] section
; below. For all the details on how these sections work, see the comments above
; the equivalent sections of searches.ini. Recommendations work the same in
; ProQuestFSG as they do in the regular Search module.
;[SideRecommendations]
; No search-specific settings by default -- add your own here.
;[TopRecommendations]
; No search-specific settings by default -- add your own here.

; The order of display is as shown below
; The name of the index field is on the left
; The display name of the field is on the right
[Facets]
Databases = "Source"

; This section is reserved for special boolean facets. These are displayed
; as checkboxes. If the box is checked, the filter on the left side of the
; equal sign is applied. If the box is not checked, the filter is not applied.
; The value on the right side of the equal sign is the text to display to the
; user . It will be run through the translation code, so be sure to update the
; language files appropriately.
[CheckboxFacets]
limitFullText = "fulltext_limit"
limitScholarlyJournals = "scholarly_limit"
limitPeerReviewed = "peer_reviewed_limit"

; Facet display settings
[Results_Settings]
; By default, the side facets will only show 6 facets and then the "show more"
; button. This can get configured with the showMore settings.
; You can use the * to set a new default setting.
showMore[*] = 6
; Or you can set a facet specific value by using the facet name as index.
;showMore['rtype'] = 10
; Do we want any facets to be collapsed by default?
;collapsedFacets = *

; This section shows which search types will display in the basic search box at
; the top of ProQuest pages. The name of each setting below corresponds with an
; index defined in the ProQuestFSG API. The value of each setting is the text to
; display on screen. All on-screen text will be run through the translator, so
; be sure to update language files if necessary. The order of these settings
; will be maintained in the drop-down list in the UI.
[Basic_Searches]
cql.serverChoice = "All Fields"
title = Title
author = Author
subject = Subject
publication = Journal Title
;abstract = Abstract

; This section defines which search options will be included on the advanced
; search screen. All the notes above [Basic_Searches] also apply here.
[Advanced_Searches]
cql.serverChoice = "All Fields"
title = Title
author = Author
subject = Subject
publication = Journal Title
;abstract = Abstract

; This section defines the sort options available on search results.
[Sorting]
relevance = sort_relevance
date/descending = sort_year
date/ascending = sort_year_asc

; This section allows you to specify hidden sorting options. They can be used to create a

; This section controls the behavior of the ProQuestFSGRecord module.
[Record]
; Set this to true in order to enable "next" and "previous" links to navigate
; through the current result set from within the record view.
next_prev_navigation = false

; This section controls what happens when a record title in a search result list
; is clicked. VuFind can either embed the full result directly in the list using
; AJAX or can display it at its own separate URL as a full HTML page.
; full - separate page (default)
; tabs - embedded using tabs (see record/tabs.phtml)
; accordion - embedded using an accordion (see record/accordion.phtml)
; NOTE: To turn this feature on for favorite lists, see the lists_view setting
; in the [Social] section of config.ini.
; NOTE: This feature is incompatible with SyndeticsPlus content; please use
; regular Syndetics if necessary.
[List]
view=full

; This section provides settings for optional caching of search requests.
[SearchCache]
; Supported adapters: Memcached, Filesystem. Others may also work, but have not been
; tested.
;adapter = Memcached
; Comma-separated list of servers for Memcached adapter:
;options[servers] = "localhost:11211"
; Cache directory for Filesystem adapter:
;options[cache_dir] = "/tmp/search-cache"
; Other options. See https://docs.laminas.dev/laminas-cache/storage/adapter/ for
; documentation on options for different adapters.
; ttl, Time to Live, i.e. cache entry life time in seconds. 300 seconds by default.
;options[ttl] = 300

; This example section provides filters for the ProQuestFSGResults recommendation
; module. The section name is specified in the recommendation module config.
; [ProQuestFSGResultsDissertationsFilter]

; Filters are defined as in [RawHiddenFilters] in order to handle more complex
; filter combinations.
; 0 = "Databases:pqdtglobal1"
7 changes: 7 additions & 0 deletions config/vufind/RecordTabs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ tabs[Preview] = preview
tabs[Details] = StaffViewArray
defaultTab = null

[VuFind\RecordDriver\ProQuestFSG]
tabs[Description] = Description
tabs[UserComments] = UserComments
tabs[Reviews] = Reviews
tabs[Details] = StaffViewMARC
defaultTab = null

[VuFind\RecordDriver\SolrAuthDefault]
tabs[Details] = StaffViewArray
defaultTab = null
Expand Down
5 changes: 5 additions & 0 deletions config/vufind/searches.ini
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ WorkKeys = year
; OpenLibrarySubjectsDeferred:[GET parameter]:[limit]:[date filter]:[Subject types]
; The same as OpenLibrarySubjects but uses AJAX to make the API calls after the
; main result set has loaded
; ProQuestFSGResults:[GET parameter]:[result limit]:[custom heading]:[filter ini section]:[sort]
; Display ProQuestFSG search results matching. See CatalogResults above for parameter
; definitions. The [filter ini section] parameter refers to a section in ProQuestFSG.ini.
; ProQuestFSGResultsDeferred:[GET parameter]:[result limit]:[custom heading]:[filter ini section]:[sort]
; Same as ProQuestFSGResults, but loaded via AJAX.
; RandomRecommend:[backend]:[limit]:[display mode]:[random mode]:[minimumset]
; :[facet1]:[facetvalue1]:[facet2]:[facetvalue2]:...:[facet-n]:[facetvalue-n]
; This module offers random records either from the whole backend or within
Expand Down
2 changes: 2 additions & 0 deletions languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,8 @@ Production Credits = "Production Credits"
Profile = "Profile"
profile_update = "Your profile was updated as requested"
pronounced = "pronounced"
proquestfsg_recommendations = "ProQuest Results"
proquestfsg_recommendations_more = "More ProQuest Results"
Provider = "Provider"
proxied_user = "Place request for proxied user"
proxy_hold_place_success_html = 'Your proxy request was successful. <a href="%%url%%">Your Holds and Recalls</a>.'
Expand Down
8 changes: 8 additions & 0 deletions module/VuFind/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@
'VuFind\Controller\Pazpar2Controller' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\PrimoController' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\PrimorecordController' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\ProQuestFSGController' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\ProQuestFSGrecordController' => 'VuFind\Controller\AbstractBaseFactory',
'VuFind\Controller\QRCodeController' => 'VuFind\Controller\QRCodeControllerFactory',
'VuFind\Controller\RecordController' => 'VuFind\Controller\AbstractBaseWithConfigFactory',
'VuFind\Controller\RecordsController' => 'VuFind\Controller\AbstractBaseFactory',
Expand Down Expand Up @@ -325,6 +327,10 @@
'primo' => 'VuFind\Controller\PrimoController',
'PrimoRecord' => 'VuFind\Controller\PrimorecordController',
'primorecord' => 'VuFind\Controller\PrimorecordController',
'ProQuestFSG' => 'VuFind\Controller\ProQuestFSGController',
'proquestfsg' => 'VuFind\Controller\ProQuestFSGController',
'ProQuestFSGRecord' => 'VuFind\Controller\ProQuestFSGrecordController',
'proquestfsgrecord' => 'VuFind\Controller\ProQuestFSGrecordController',
'QRCode' => 'VuFind\Controller\QRCodeController',
'qrcode' => 'VuFind\Controller\QRCodeController',
'Record' => 'VuFind\Controller\RecordController',
Expand Down Expand Up @@ -753,6 +759,7 @@
'epfrecord' => 'EPFRecord',
'missingrecord' => 'MissingRecord',
'primorecord' => 'PrimoRecord',
'proquestfsgrecord' => 'ProQuestFSGRecord',
'solrauthrecord' => 'AuthorityRecord',
'summonrecord' => 'SummonRecord',
'worldcatrecord' => 'WorldcatRecord',
Expand Down Expand Up @@ -823,6 +830,7 @@
'Overdrive/MyContent','Overdrive/Hold',
'Pazpar2/Home', 'Pazpar2/Search',
'Primo/Advanced', 'Primo/CitedBy', 'Primo/Cites', 'Primo/Home', 'Primo/Search',
'ProQuestFSG/Advanced', 'ProQuestFSG/Home', 'ProQuestFSG/Results',
'QRCode/Show', 'QRCode/Unavailable', 'Records/Home',
'Relais/Login', 'Relais/Request',
'Search/Advanced',
Expand Down
4 changes: 2 additions & 2 deletions module/VuFind/src/VuFind/Auth/ChoiceAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function supportsPasswordRecovery()
*/
public function getUsernamePolicy()
{
return $this->proxyAuthMethod('getUsernamePolicy', func_get_args());
return $this->proxyAuthMethod('getUsernamePolicy', func_get_args()) ?: [];
}

/**
Expand All @@ -322,7 +322,7 @@ public function getUsernamePolicy()
*/
public function getPasswordPolicy()
{
return $this->proxyAuthMethod('getPasswordPolicy', func_get_args());
return $this->proxyAuthMethod('getPasswordPolicy', func_get_args()) ?: [];
}

/**
Expand Down
81 changes: 81 additions & 0 deletions module/VuFind/src/VuFind/Controller/Feature/CheckEnabledTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/**
* Check Enabled Trait
*
* PHP version 8
*
* Copyright (C) Villanova University 2024.
*
* 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 Maccabee Levine <msl321@lehigh.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Page
*/

namespace VuFind\Controller\Feature;

use Laminas\Mvc\MvcEvent;
use VuFind\Exception\Forbidden as ForbiddenException;

/**
* Check Enabled Trait
*
* @category VuFind
* @package Controller_Plugins
* @author Maccabee Levine <msl321@lehigh.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org Main Page
*/
trait CheckEnabledTrait
{
/**
* Check whether the controller is enabled
*
* @return void
*
* @throws ForbiddenException if the controller is not enabled
*/
protected function checkEnabled()
{
$configId = $this->searchClassId ?? $this->sourceId ?? null;
if (!$configId) {
return;
}

$config = $this->getConfig($configId);
if (!($config['General']['enabled'] ?? false)) {
throw new ForbiddenException($configId . ' is disabled');
}
}

/**
* Add to event listeners a check that the controller is enabled
*
* @return void
*/
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
$events = $this->getEventManager();
$events->attach(
MvcEvent::EVENT_DISPATCH,
fn () => $this->checkEnabled(),
1000
);
}
}
Loading

0 comments on commit 4a5ab46

Please sign in to comment.