Skip to content

Commit 46d8045

Browse files
committed
Discussion changes
1 parent 4816c33 commit 46d8045

14 files changed

Lines changed: 137 additions & 115 deletions

File tree

config/vufind/Regex.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
2-
# This file contains the settings for the Regex feature
3-
# A header will be considered matching if any of the elements matches
2+
# This file contains named regular expressions to be used with the VuFind\Regex\Regex matcher.
3+
# Each named regex can contain one or more expressions.
4+
# A regex will match if any of the expression matches
45

56
# Status
67
# Regex in this section are used to match against the specific item status value

module/VuFind/src/VuFind/AjaxHandler/GetItemStatuses.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ protected function renderCallnumbers(string $callnumberSetting, array $callnumbe
287287
* reserve: string,
288288
* reserve_message: string,
289289
* callnumberHtml: string,
290-
* getThisURI: string,
290+
* getThisURL: string,
291291
* } Summarized availability information
292292
*/
293293
protected function getItemStatus(
@@ -298,13 +298,13 @@ protected function getItemStatus(
298298
if (isset($this->getThis)) {
299299
$urlHelper = $this->renderer->plugin('url');
300300
$itemIdParams = !empty($record[0]['item_id']) ? ['query' => ['item_id' => $record[0]['item_id']]] : null;
301-
$getThisURI = $urlHelper(
301+
$getThisURL = $urlHelper(
302302
'record-getthis',
303303
['id' => $record[0]['id'] ?? null],
304304
$itemIdParams
305305
);
306306
} else {
307-
$getThisURI = '';
307+
$getThisURL = '';
308308
}
309309
// Summarize call number, location and availability info across all items:
310310
$callNumbers = $locations = [];
@@ -360,7 +360,7 @@ protected function getItemStatus(
360360
'reserve_message'
361361
=> $this->translate($reserve ? 'on_reserve' : 'Not On Reserve'),
362362
'callnumberHtml' => $this->renderCallnumbers($callnumberSetting, $callNumber),
363-
'getThisURI' => $getThisURI,
363+
'getThisURL' => $getThisURL,
364364
];
365365
}
366366

@@ -407,21 +407,21 @@ protected function getItemStatusGroup($record, $callnumberSetting)
407407
) {
408408
$itemIdParams = !empty($locationStatus['item_id'])
409409
? ['query' => ['item_id' => $locationStatus['item_id']]] : null;
410-
$getThisURI = $urlHelper(
410+
$getThisURL = $urlHelper(
411411
'record-getthis',
412412
['id' => $record[0]['id'] ?? null],
413413
$itemIdParams
414414
);
415415
} else {
416-
$getThisURI = '';
416+
$getThisURL = '';
417417
}
418418

419419
$locationInfo = [
420420
'availability' => $locationStatus['availability'],
421421
'location' => $this->translateWithPrefix('location_', $location),
422422
'callnumberHtml' =>
423423
$this->renderCallnumbers($callnumberSetting, $locationCallnumbers),
424-
'getThisURI' => $getThisURI,
424+
'getThisURL' => $getThisURL,
425425
];
426426
$locationList[] = $locationInfo;
427427
}

module/VuFind/src/VuFind/GetThis/GetThisLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class GetThisLoader implements LoggerAwareInterface
9292
/**
9393
* Initializes the loader.
9494
*
95-
* @param array $config Config pulled from the config file defined above
95+
* @param array $config Config to use
9696
* @param Regex $regex Regex service
9797
*/
9898
public function __construct(

module/VuFind/src/VuFind/RecordTab/HoldingsILS.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,20 @@ class HoldingsILS extends AbstractBase
6464
/**
6565
* Constructor.
6666
*
67-
* @param ?Connection $catalog ILS connection to use to check for holdings before
68-
* displaying the tab; may be set to null if no check
69-
* is needed.
70-
* @param ?string $template Holdings template to use
71-
* @param bool $hideWhenEmpty Whether the holdings tab should be hidden when
72-
* empty or not
73-
* @param ?Closure $getThisLoaderGetter Closure to get the getThisLoader if enabled in the
74-
* config And prevent loading it if not necessary
67+
* @param ?Connection $catalog ILS connection to use to check for holdings before
68+
* displaying the tab; may be set to null if no check
69+
* is needed.
70+
* @param ?string $template Holdings template to use
71+
* @param bool $hideWhenEmpty Whether the holdings tab should be hidden when
72+
* empty or not
73+
* @param ?Closure $getThisLoaderFactoryCallback Closure to get the getThisLoader if enabled in the
74+
* config And prevent loading it if not necessary
7575
*/
7676
public function __construct(
7777
protected ?Connection $catalog = null,
7878
?string $template = null,
7979
protected bool $hideWhenEmpty = false,
80-
protected ?Closure $getThisLoaderGetter = null
80+
protected ?Closure $getThisLoaderFactoryCallback = null
8181
) {
8282
$this->template = $template ?? 'standard';
8383
}
@@ -225,8 +225,8 @@ public function getPaginator($totalItemCount, $page, $itemLimit)
225225
public function getGetThisLoader(): ?GetThisLoader
226226
{
227227
if (!isset($this->getThisLoader)) {
228-
$this->getThisLoader = isset($this->getThisLoaderGetter)
229-
? call_user_func($this->getThisLoaderGetter) : null;
228+
$this->getThisLoader = isset($this->getThisLoaderFactoryCallback)
229+
? call_user_func($this->getThisLoaderFactoryCallback) : null;
230230
}
231231
return $this->getThisLoader;
232232
}

module/VuFind/src/VuFind/RecordTab/HoldingsILSFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public function __invoke(
7575
// object:
7676
$config = $container->get(\VuFind\Config\ConfigManagerInterface::class)->getConfigArray('config');
7777
$catalog = $container->get(\VuFind\ILS\Connection::class);
78-
$getThisEnabled = ($config['Record']['getThisEnabled'] ?? null) == true;
79-
$getThisLoaderGetter = $getThisEnabled ? (fn () => $container->get(GetThisLoader::class))(...) : null;
78+
$getThisEnabled = (bool)($config['Record']['getThisEnabled'] ?? false);
79+
$getThisLoaderFactoryCallback = $getThisEnabled ? (fn () => $container->get(GetThisLoader::class))(...) : null;
8080
return new $requestedName(
8181
$catalog,
8282
(string)($config['Site']['holdingsTemplate'] ?? 'standard'),
8383
(bool)($config['Site']['hideHoldingsTabWhenEmpty'] ?? false),
84-
$getThisLoaderGetter
84+
$getThisLoaderFactoryCallback
8585
);
8686
}
8787
}

module/VuFind/src/VuFind/Regex/Regex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
class Regex
3131
{
3232
/**
33-
* Initializes the loader.
33+
* Constructor.
3434
*
3535
* @param array $config Regular expression configuration
3636
*/

themes/bootstrap5/js/check_item_statuses.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ VuFind.register('itemStatuses', function ItemStatuses() {
3434
// Full status mode is on -- display the HTML and hide extraneous junk:
3535
callnumAndLocations.forEach((callnumAndLocation) => {
3636
VuFind.setInnerHtml(callnumAndLocation, VuFind.updateCspNonce(result.full_status));
37-
callnumAndLocation.querySelectorAll('.getThis').forEach((link) => {
38-
VuFind.lightbox.bind(link);
39-
});
4037
});
38+
VuFind.lightbox.bind(callnumAndLocations);
4139
el.querySelectorAll('.callnumber,.hideIfDetailed,.location,.status').forEach((e) => { e.classList.add('hidden'); });
4240
} else if (typeof(result.missing_data) !== 'undefined'
4341
&& result.missing_data
@@ -51,9 +49,7 @@ VuFind.register('itemStatuses', function ItemStatuses() {
5149
locationDetails.classList.remove('hidden');
5250
VuFind.setInnerHtml(locationDetails, result.locationList);
5351
});
54-
el.querySelectorAll('.getThis').forEach((link) => {
55-
VuFind.lightbox.bind(link);
56-
});
52+
VuFind.lightbox.bind(el);
5753
} else {
5854
// Default case -- load call number and location into appropriate containers:
5955
el.querySelectorAll('.callnumber').forEach((callnumber) => {
@@ -64,8 +60,8 @@ VuFind.register('itemStatuses', function ItemStatuses() {
6460
}
6561
});
6662
el.querySelectorAll('.getThis').forEach((getThisContainer) => {
67-
if (result.getThisURI) {
68-
getThisContainer.getElementsByTagName('a')[0].href = result.getThisURI;
63+
if (result.getThisURL && getThisContainer.getElementsByTagName('a').length > 0) {
64+
getThisContainer.getElementsByTagName('a')[0].href = result.getThisURL;
6965
} else {
7066
getThisContainer.remove();
7167
}

themes/bootstrap5/templates/RecordTab/holdingsils/extended.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$getThisLoader->setItems([$holding]);
1010
$getThisLoader->setRecord($this->record($this->driver));
1111
$isOnlineResource = $getThisLoader->isOnlineResource($holding['item_id'] ?? null);
12-
$getThisURI = $isOnlineResource ? null : $this->url(
12+
$getThisURL = $isOnlineResource ? null : $this->url(
1313
'record-getthis',
1414
['id' => $holding['id']],
1515
['query' => ['item_id' => $holding['item_id'] ?? null]]
@@ -96,9 +96,9 @@
9696
<?=$this->relais()->renderButtonIfActive($this->driver ?? null)?>
9797
</span>
9898
<?php endif; ?>
99-
<?php if (isset($getThisURI)): ?>
99+
<?php if (isset($getThisURL)): ?>
100100
<span class="holding-field get-this">
101-
<a data-lightbox href="<?= $this->escapeHtmlAttr($getThisURI) ?>" rel="nofollow">
101+
<a data-lightbox href="<?= $this->escapeHtmlAttr($getThisURL) ?>" rel="nofollow">
102102
<?=$this->transEsc('Get This')?>
103103
</a>
104104
</span>

themes/bootstrap5/templates/RecordTab/holdingsils/standard.phtml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$getThisLoader->setItems([$holding]);
1010
$getThisLoader->setRecord($this->driver);
1111
$isOnlineResource = $getThisLoader->isOnlineResource($holding['item_id'] ?? null);
12-
$getThisURI = $isOnlineResource ? null : $this->url(
12+
$getThisURL = $isOnlineResource ? null : $this->url(
1313
'record-getthis',
1414
['id' => $holding['id']],
1515
['query' => ['item_id' => $holding['item_id'] ?? null]]
@@ -62,8 +62,8 @@
6262
<span class="icon-link__label"><?=$this->transEsc($checkILLRequest ? 'ill_request_check_text' : 'ill_request_place_text')?></span>
6363
</a>
6464
<?php endif; ?>
65-
<?php if (isset($getThisURI, $isOnlineResource) && !$isOnlineResource): ?>
66-
<a data-lightbox href="<?= $this->escapeHtmlAttr($getThisURI) ?>" rel="nofollow">
65+
<?php if (isset($getThisURL, $isOnlineResource) && !$isOnlineResource): ?>
66+
<a data-lightbox href="<?= $this->escapeHtmlAttr($getThisURL) ?>" rel="nofollow">
6767
<?=$this->transEsc('Get This')?>
6868
</a>
6969
<?php endif; ?>
@@ -82,8 +82,8 @@
8282
<span class="icon-link__label"><?=$this->transEsc($check ? 'Check Recall' : 'Recall This')?></span>
8383
</a>
8484
<?php endif; ?>
85-
<?php if (isset($getThisURI)): ?>
86-
<a data-lightbox href="<?= $this->escapeHtmlAttr($getThisURI) ?>" rel="nofollow">
85+
<?php if (isset($getThisURL)): ?>
86+
<a data-lightbox href="<?= $this->escapeHtmlAttr($getThisURL) ?>" rel="nofollow">
8787
<?=$this->transEsc('Get This')?>
8888
</a>
8989
<?php endif; ?>

themes/bootstrap5/templates/ajax/itemLocationList.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</div>
99
<div class="groupCallnumber">
1010
<span><?=$location['callnumberHtml']?></span>
11-
<?php if (!empty($location['getThisURI'])): ?>
11+
<?php if (!empty($location['getThisURL'])): ?>
1212
<span class="getThis">
13-
<a rel="nofollow" data-lightbox href="<?= $location['getThisURI'] ?>"><?=$this->transEsc('Get This')?></a>
13+
<a rel="nofollow" data-lightbox href="<?= $location['getThisURL'] ?>"><?=$this->transEsc('Get This')?></a>
1414
</span>
1515
<?php endif; ?>
1616
</div>

0 commit comments

Comments
 (0)