diff --git a/module/VuFind/src/VuFind/Controller/CombinedController.php b/module/VuFind/src/VuFind/Controller/CombinedController.php index d9a54b5c49a..f21aec850d9 100644 --- a/module/VuFind/src/VuFind/Controller/CombinedController.php +++ b/module/VuFind/src/VuFind/Controller/CombinedController.php @@ -125,7 +125,7 @@ public function resultAction() 'domId' => 'combined_' . str_replace(':', '____', $sectionId), ]; // Initialize theme resources: - ($this->getViewRenderer()->plugin('headThemeResources'))(); + ($this->getViewRenderer()->plugin('headThemeResources'))(true); // Render content: $html = $this->getViewRenderer()->render( 'combined/results-list.phtml', diff --git a/module/VuFind/src/VuFind/View/Helper/Root/AccountMenu.php b/module/VuFind/src/VuFind/View/Helper/Root/AccountMenu.php index f7e116a5888..c479c71a366 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/AccountMenu.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/AccountMenu.php @@ -360,10 +360,11 @@ protected function getIlsConnection(): IlsConnection * Render account menu * * @param string $activeItem The name of current active item + * @param string $idPrefix Element ID prefix * * @return string */ - public function render(string $activeItem): string + public function render(string $activeItem, string $idPrefix = ''): string { $contextHelper = $this->getView()->plugin('context'); return $contextHelper->renderInContext( @@ -371,6 +372,7 @@ public function render(string $activeItem): string [ 'items' => $this->getItems(), 'active' => $activeItem, + 'idPrefix' => $idPrefix, ] ); } diff --git a/module/VuFind/src/VuFind/View/Helper/Root/SearchBox.php b/module/VuFind/src/VuFind/View/Helper/Root/SearchBox.php index d85e745df0e..df155d109c7 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/SearchBox.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/SearchBox.php @@ -426,7 +426,6 @@ protected function getCombinedHandlers($activeSearchClass, $activeHandler) { // Build settings: $handlers = []; - $selectedFound = false; $backupSelectedIndex = false; $addedBrowseHandlers = false; $settings = $this->getCombinedHandlerConfig($activeSearchClass); @@ -447,10 +446,9 @@ protected function getCombinedHandlers($activeSearchClass, $activeHandler) $j++; $selected = $target == $activeSearchClass && $activeHandler == $searchVal; - if ($selected) { - $selectedFound = true; - } elseif ( - $backupSelectedIndex === false + if ( + !$selected + && $backupSelectedIndex === false && $target == $activeSearchClass ) { $backupSelectedIndex = count($handlers); @@ -503,7 +501,8 @@ protected function getCombinedHandlers($activeSearchClass, $activeHandler) } // If we didn't find an exact match for a selected index, use a fuzzy - // match: + // match (do the check here since it could be an AlphaBrowse index too): + $selectedFound = in_array(true, array_column($handlers, 'selected'), true); if (!$selectedFound && $backupSelectedIndex !== false) { $handlers[$backupSelectedIndex]['selected'] = true; } diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OaiTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OaiTest.php index 16e1dc242ce..a3d13d23ba3 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OaiTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/OaiTest.php @@ -81,6 +81,7 @@ public static function serverProvider(): array * * @dataProvider serverProvider */ + #[\VuFindTest\Attribute\HtmlValidation(false)] public function testDisabledByDefault(string $path): void { $session = $this->getMinkSession(); diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/SetupThemeResources.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/SetupThemeResources.php index fabf2b6ef70..c891b264393 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/SetupThemeResources.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/SetupThemeResources.php @@ -64,12 +64,16 @@ public function __construct(\VuFindTheme\ResourceContainer $container) /** * Set up items based on contents of theme resource container. * + * @param bool $partial Whether rendering an HTML snippet instead of a full page + * * @return void */ - public function __invoke() + public function __invoke(bool $partial = false) { - $this->addMetaTags(); - $this->addLinks(); + if (!$partial) { + $this->addMetaTags(); + } + $this->addLinks($partial); $this->addScripts(); } @@ -97,9 +101,11 @@ protected function addMetaTags() /** * Add links to header. * + * @param bool $partial Whether rendering an HTML snippet instead of a full page + * * @return void */ - protected function addLinks() + protected function addLinks(bool $partial = false) { // Convenient shortcut to view helper: $headLink = $this->getView()->plugin('headLink'); @@ -125,8 +131,7 @@ protected function addLinks() // If `favicon` is a string then treat it as a single file path to an .ico icon. // If `favicon` is an array then treat each item as an assoc array of html attributes and render // a link element for each. - $favicon = $this->container->getFavicon(); - if (!empty($favicon)) { + if (!$partial && ($favicon = $this->container->getFavicon())) { $imageLink = $this->getView()->plugin('imageLink'); if (is_array($favicon)) { foreach ($favicon as $attrs) { diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js index 1f3c25df610..4f4c478880e 100644 --- a/themes/bootstrap3/js/common.js +++ b/themes/bootstrap3/js/common.js @@ -408,9 +408,11 @@ var VuFind = (function VuFind() { link.addEventListener('click', function toggleQRCode() { var holder = this.nextElementSibling; if (holder.querySelectorAll('img').length === 0) { - // We need to insert the QRCode image - var template = holder.querySelector('.qrCodeImgTag').innerHTML; - holder.innerHTML = template; + // Replace the QRCode template with the image: + const templateEl = holder.querySelector('.qrCodeImgTag'); + if (templateEl) { + templateEl.parentNode.innerHTML = templateEl.innerHTML; + } } }); }); diff --git a/themes/bootstrap3/templates/Recommend/SideFacets.phtml b/themes/bootstrap3/templates/Recommend/SideFacets.phtml index a4e7557ea28..b170f39d900 100644 --- a/themes/bootstrap3/templates/Recommend/SideFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/SideFacets.phtml @@ -54,7 +54,7 @@ =$this->icon('collapse', 'facet-title-icon') ?> -
= $this->translate('explain_relevance', [ - '%%recordId%%' => '' . $recordId . '', + '%%recordId%%' => '' . $this->escapeHtml($recordId) . '', '%%relevanceValue%%' => $this->localizedNumber($totalScore, $decimalPlaces)]) ?> diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml index 99a53222d6a..75f4939aa78 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/list-entry.phtml @@ -226,7 +226,7 @@ 'buttonLink' => $deleteUrlGet, 'buttonIcon' => 'user-list-remove', 'buttonLabel' => 'Delete', - 'confirmId' => "confirm_delete_item_$id", + 'confirmId' => 'confirm_delete_item_' . urlencode($id), ] ) ?> diff --git a/themes/bootstrap3/templates/header.phtml b/themes/bootstrap3/templates/header.phtml index 19e09b0c107..3a9d7b20cb0 100644 --- a/themes/bootstrap3/templates/header.phtml +++ b/themes/bootstrap3/templates/header.phtml @@ -43,7 +43,7 @@
diff --git a/themes/bootstrap3/templates/hierarchy/tree.phtml b/themes/bootstrap3/templates/hierarchy/tree.phtml index d9fca576494..73da3ace684 100644 --- a/themes/bootstrap3/templates/hierarchy/tree.phtml +++ b/themes/bootstrap3/templates/hierarchy/tree.phtml @@ -17,8 +17,7 @@ // Function for rendering a tree level. Optimized to avoid extra objects or // template calls and defined as array to avoid interfering with the plugin __call // magic. - $this->renderTreeLevel = [function ($nodes, $context, $hierarchyID, $driver, $selectedID) { - $this->parentNodeId ??= ''; + $this->renderTreeLevel = [function ($nodes, $context, $hierarchyID, $driver, $selectedID, $parentNodeId = '') { $nodeId = 0; $icons = [ 'hierarchy-collection' => $this->icon('hierarchy-collection'), @@ -62,10 +61,10 @@ if ($hasChildren) { echo '