From 7003b6826cb00872c5c4f7fb60f7169bbd34e746 Mon Sep 17 00:00:00 2001 From: Viola Elsenhans <elsenhans@ub.uni-leipzig.de> Date: Wed, 4 Jan 2023 12:58:43 +0100 Subject: [PATCH] refs #22956 [finc] fix collection view * fix book bag button in collection view * add missing translations co-authored by: Alexander Purr <purr@ub.uni-leipzig.de> * scss comment --- local/languages/de.ini | 6 +- local/languages/en.ini | 7 +- .../finc/scss/components/_hierarchy-tree.scss | 14 ++ .../templates/RecordTab/collectionlist.phtml | 139 ++++++++++++++++++ themes/finc/templates/collection/view.phtml | 120 +++++++++------ 5 files changed, 235 insertions(+), 51 deletions(-) create mode 100644 themes/finc/templates/RecordTab/collectionlist.phtml diff --git a/local/languages/de.ini b/local/languages/de.ini index 7980b367eac..ac985af71fe 100644 --- a/local/languages/de.ini +++ b/local/languages/de.ini @@ -2110,4 +2110,8 @@ main_navigation = "Hauptnavigation" aria_search_header = "Bedienelemente zur Steuerung der Ansicht" ; 22240 -No linguistic content = "Nichtsprachlicher Inhalt" \ No newline at end of file +No linguistic content = "Nichtsprachlicher Inhalt" + +# Collections Search +Search Collection Items = "Enthaltene Objekte durchsuchen" +sidebar_expand_collections = "Ergebnisse weiter eingrenzen" diff --git a/local/languages/en.ini b/local/languages/en.ini index ee7ffca62fa..92b702f9d18 100644 --- a/local/languages/en.ini +++ b/local/languages/en.ini @@ -2195,4 +2195,9 @@ main_navigation = "Hauptnavigation" aria_search_header = "List view controls" ; 22240 -No linguistic content = "No linguistic content" \ No newline at end of file +No linguistic content = "No linguistic content" + + +# Collections Search +Search Collection Items = "Search Collection Items" +sidebar_expand_collections = "Filter Collection Items" diff --git a/themes/finc/scss/components/_hierarchy-tree.scss b/themes/finc/scss/components/_hierarchy-tree.scss index 0830d558708..45b072e82bd 100644 --- a/themes/finc/scss/components/_hierarchy-tree.scss +++ b/themes/finc/scss/components/_hierarchy-tree.scss @@ -127,3 +127,17 @@ } } +/* ***************************************************************************************** */ +/* TODO move following styles to seprate component (_collection-view.scss) in finc or de_105 */ +/* TODO upcoming refs #22979 */ + +.collection-control { + display: inline-block; + float: left; + margin-top: 6px; + width: 49%; +} + +#moreInfoToggle.collapsed { + margin-bottom: 2em; +} diff --git a/themes/finc/templates/RecordTab/collectionlist.phtml b/themes/finc/templates/RecordTab/collectionlist.phtml new file mode 100644 index 00000000000..54d4e61c391 --- /dev/null +++ b/themes/finc/templates/RecordTab/collectionlist.phtml @@ -0,0 +1,139 @@ +<!-- finc: RecordTab - collectionlist --> +<?php + // Set page title. + $this->headTitle($this->translate('Collection Items') . ': ' . $this->driver->getBreadcrumb()); + + // Get search results + $results = $this->tab->getResults(); + $params = $this->tab->getParams(); + $searchDetails = ['results' => $results, 'params' => $params, 'indexStart' => 1]; + + $filterList = $params->getFilterList(true); + $checkboxFilters = $params->getCheckboxFacets(); +?> + +<div class="<?=$this->layoutClass('mainbody')?>"> + + <?php /* de_15: add SECOND offcanvas-toggler here, + this one should hide the '.icon-bar' of the Record View and + show only the Facets Sidebar for the collection - CK */ ?> + <span class="offcanvas-toggler"> + <a class="search-filter-toggle collections visible-xs" href="javascript:" data-toggle="offcanvas" title="<?= $this->transEsc('sidebar_expand_collections') ?>"> + <?=$this->transEsc('sidebar_expand_collections')?> + </a> + </span> + +<?php if (($recordTotal = $results->getResultTotal()) > 0): // only display these at very top if we have results?> + <?php foreach ($results->getRecommendations('top') as $current): ?> + <?=$this->recommend($current)?> + <?php endforeach; ?> + <?php endif; ?> + + <?php /* finc: do not use classname 'collection-list-results' here */ /* + <div> */ ?> + <?php /* finc: we use search in sidebar, see 'Recommend/CollectionSideFacets.phtml' */ /* + <div class="collection-control"> + <form class="form-inline" role="form" method="get" name="keywordFilterForm" id="keywordFilterForm"> + <div class="input-group"> + <input id="keywordFilter_lookfor" type="text" name="lookfor" placeholder="<?=$this->transEsc('Search within collection')?>" value="<?=$params->getDisplayQuery()?>" class="form-control"> + <?php foreach ($filterList as $field => $filters): ?> + <?php foreach ($filters as $filter): ?> + <input type="hidden" name="filter[]" value="<?=$this->escapeHtmlAttr($filter['field'])?>:"<?=$this->escapeHtmlAttr($filter['value'])?>"" /> + <?php endforeach; ?> + <?php endforeach; ?> + <input type="hidden" name="limit" value="<?=$params->getLimit() ?>" /> + <input type="hidden" name="sort" value="<?=$params->getSort() ?>" /> + <span class="input-group-btn"> + <button class="btn btn-primary" type="submit" name="submit"> + <span class="sr-only"><?=$this->transEsc('Search')?></span><i class="fa fa-search"></i> + </button> + </span> + </div> + </form> + </div> + */?> + <div class="collection-control"> + <?=$this->render('search/controls/limit.phtml', $searchDetails)?> + </div> + <div class="collection-control"> + <?=$this->render('search/controls/sort.phtml', $searchDetails)?> + </div> + <?php /* + </div> + */?> + + + <?php if ($filterList || $checkboxFilters): ?> + <?=$this->render( + 'search/filters.phtml', + [ + 'urlQuery' => $results->getUrlQuery(), + 'filterList' => $filterList, + 'checkboxFilters' => $checkboxFilters, + 'searchClassId' => $this->searchClassId, + 'searchType' => 'basic', + ] +); ?> + <?php endif; ?> + + <div class="collection-list-results"> + <?php if ($recordTotal > 0): ?> + <div class="clearfix hidden-print"> + <?php /* finc: We're NEITHER showing the found xxx of yyy number NOR the query time*/ ?> + <?php /* + <div class="pull-left flip"> + <?php + $transParams = [ + '%%start%%' => $this->localizedNumber($results->getStartRecord()), + '%%end%%' => $this->localizedNumber($results->getEndRecord()), + '%%total%%' => $this->localizedNumber($recordTotal) + ]; + ?> + <?php if (!isset($this->skipTotalCount)): ?> + <?=$this->translate('showing_items_of_html', $transParams); ?> + <?php else: ?> + <?=$this->translate('showing_items_html', $transParams); ?> + <?php endif; ?> + */?> + </div> + <form class="form-inline" method="post" name="bulkActionForm" action="<?=$this->url('cart-searchresultsbulk')?>"> + <?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', $searchDetails + ['idPrefix' => ''])?> + <?=$this->render('search/list-' . $results->getParams()->getView() . '.phtml', $searchDetails)?> + <?=$this->paginationControl($results->getPaginator(), 'Sliding', 'search/pagination.phtml', ['results' => $results])?> + </form> + <?php else: ?> + <?php /* finc: change h4 to h3 */ ?> + <h3><?=$this->transEsc($params->getDisplayQuery() || ($filterCount ?? 0) > 0 ? 'nohit_heading' : 'collection_empty')?></h3> + <div class="clearfix"> + </div> + <?php endif; ?> + </div> +</div> + +<?php /* finc: keep '.bottom' to differentiate top and bottom sidebars, CK */ ?> +<div class="bottom <?=$this->layoutClass('sidebar')?>"> +<?php /* finc: we use search in sidebar, not in mainbody above, CK */ ?> + <h2><?=$this->transEsc('Search Collection Items')?></h2> + <form class="form-inline" role="form" method="get" name="keywordFilterForm" id="keywordFilterForm"> + <div class="input-group"> + <input id="keywordFilter_lookfor" type="text" name="lookfor" placeholder="<?=$this->transEsc('Search within collection')?>" value="<?=$params->getDisplayQuery()?>" class="form-control"> + <?php foreach ($filterList as $field => $filters): ?> + <?php foreach ($filters as $filter): ?> + <input type="hidden" name="filter[]" value="<?=$this->escapeHtmlAttr($filter['field'])?>:"<?=$this->escapeHtmlAttr($filter['value'])?>"" /> + <?php endforeach; ?> + <?php endforeach; ?> + <input type="hidden" name="limit" value="<?=$params->getLimit() ?>" /> + <input type="hidden" name="sort" value="<?=$params->getSort() ?>" /> + <span class="input-group-btn"> + <button class="btn btn-primary" type="submit" name="submit"> + <span class="sr-only"><?=$this->transEsc('Search Collection Items')?></span><i class="fa fa-search" aria-hidden="true"></i> + </button> + </span> + </div> + </form> + + <?php foreach ($results->getRecommendations('side') as $current): ?> + <?=$this->recommend($current)?> + <?php endforeach; ?> +</div> +<!-- finc: RecordTab - collectionlist - END --> \ No newline at end of file diff --git a/themes/finc/templates/collection/view.phtml b/themes/finc/templates/collection/view.phtml index 7c0dca05e56..6737f30866d 100644 --- a/themes/finc/templates/collection/view.phtml +++ b/themes/finc/templates/collection/view.phtml @@ -10,7 +10,7 @@ // Add RDF header link if applicable: if ($this->export()->recordSupportsFormat($this->driver, 'RDF')) { - $this->headLink()->appendAlternate($this->recordLink()->getActionUrl($this->driver, 'RDF'), 'application/rdf+xml', 'RDF Representation'); + $this->headLink()->appendAlternate($this->recordLink()->getActionUrl($this->driver, 'RDF'), 'application/rdf+xml', 'RDF Representation'); } // Set flag for special cases relating to full-width hierarchy tree tab: @@ -22,69 +22,91 @@ $this->layout()->breadcrumbs = '<li>' . $lastSearch . '</li> '; } $this->layout()->breadcrumbs .= '<li><a href="' . $this->url('collections-home') . '">' . $this->transEsc('Collections') . '</a></li> ' - . '<li class="active">' . $this->recordLink()->getBreadcrumb($this->driver) . '</li>'; + . '<li class="active">' . $this->recordLink()->getBreadcrumb($this->driver) . '</li>'; ?> <?php if (isset($this->scrollData) && ($this->scrollData['previousRecord'] || $this->scrollData['nextRecord'])): ?> <?=$this->render('record/prev-next.phtml'); ?> <?php endif; ?> - <?=$this->record($this->driver)->getToolbar()?> +<?php /* finc: add offcanvas-toggler here */ ?> +<span class="offcanvas-toggler"> + <a class="search-filter-toggle top visible-xs" href="#myresearch-sidebar" data-toggle="offcanvas" title="<?= $this->transEsc('sidebar_expand') ?>"> + <?=$this->transEsc('offcanvas-toggler-record-view')?> + </a> +</span> + +<?php /* DON'T pull the toolbar in here but below, finc-specific, CK */ ?> <div class="record"> <?php /* finc - don't use '<?=count($sidebarList) < 1 ? ' solo' : '' ?>' or toolbar won't fit; BS count sidebars but our toolbar isn't counted */ ?> - <div<?php if (!$tree): /* in tree mode, do not constrain width with a class */ ?> class="<?= $this->layoutClass('mainbody') ?>"<?php endif; ?>> + <div<?php if (!$tree): /* in tree mode, do not constrain width with a class */ ?> class="<?= $this->layoutClass('mainbody') ?>" <?php else: ?> class="mainbody left" <?php endif; ?>> <input type="hidden" value="<?= $this->escapeHtmlAttr($this->driver->getUniqueId()) ?>" class="hiddenId" id="record_id"/> <input type="hidden" value="<?= $this->escapeHtmlAttr($this->driver->getSourceIdentifier()) ?>" class="hiddenSource"/> - <?= $this->flashmessages() ?> - <?= $this->record($this->driver)->getCollectionMetadata() ?> - - <?php if (count($this->tabs) > 0): ?> - <a name="tabnav"></a> - <div class="record-tabs"> - <ul class="nav nav-tabs"> - <?php foreach ($this->tabs as $tab => $obj): ?> - <?php // add current tab to breadcrumbs if applicable: + <?= $this->flashmessages() ?> + <?= $this->record($this->driver)->getCollectionMetadata() ?> + </div> +</div> - if (strtolower($tab) === 'details' - && $this->config()->get('config')->Site->showStaffViewInLightbox - && strtolower($this->activeTab) !== 'details' /* load in new browser tab after right click */) { - // #21993 show button for staff view in toolbar instead - continue; - } +<?php /* finc: pull the first toolbar for top area here; add id for accessibility */ ?> +<div id="myresearch-sidebar" class="<?= $this->layoutClass('sidebar') ?>" id="myresearch-sidebar"> + <?= $this->record($this->driver)->getToolbar() ?> +</div> - $desc = $obj->getDescription(); - $tab_classes = []; - if (0 === strcasecmp($this->activeTab, $tab)) { - if (!$this->loadInitialTabWithAjax || !$obj->supportsAjax()) { - $tab_classes[] = 'active'; - } - $tab_classes[] = 'initiallyActive'; - $this->layout()->breadcrumbs .= '<li class="active">' . $this->transEsc($desc) . '</li>'; - $activeTabObj = $obj; - } - if (!$obj->isVisible()) { - $tab_classes[] = 'hidden';} - if (!$obj->supportsAjax()) { $tab_classes[] = 'noajax'; } - ?> - <li<?=count($tab_classes) > 0 ? ' class="' . implode(' ', $tab_classes) . '"' : ''?>> - <a class="<?=strtolower($tab) ?>" href="<?=$this->recordLink()->getTabUrl($this->driver, $tab)?>#tabnav"<?php if ($obj->supportsAjax() && in_array($tab, $this->backgroundTabs)):?> data-background<?php endif ?>><?=$this->transEsc($desc)?></a> - </li> - <?php endforeach; ?> - </ul> +<?php /* finc: NO initiate break between top and bottom here #22956 */ ?> - <div class="tab-content collectionDetails<?=$tree ? 'Tree' : ''?>"> - <?php if (!$this->loadInitialTabWithAjax || !isset($activeTabObj) || !$activeTabObj->supportsAjax()): ?> - <div class="tab-pane active <?=$this->activeTab ?>-tab"> - <?=isset($activeTabObj) ? $this->record($this->driver)->getTab($activeTabObj) : '' ?> - </div> - <?php endif; ?> - </div> - </div> - <?php endif; ?> +<?php /* finc: use '.mainbody' class, so we do NOT get full width display (see TUF with closed record details, collection has to move up) #22956 */ ?> +<div class="collection-hierarchy mainbody"> + <?php /* de_15: create fake collapse items out of the tabs on XS (see caret, below) - CK */ ?> + <?php if (count($this->tabs) > 0): ?> + <a id="tabnav"></a> + <div class="record-tabs collection"> + <ul class="nav nav-tabs"> + <?php foreach ($this->tabs as $tab => $obj): ?> + <?php // add current tab to breadcrumbs if applicable: - <?=$this->driver->supportsCoinsOpenURL()?'<span class="Z3988" title="' . $this->escapeHtmlAttr($this->driver->getCoinsOpenURL()) . '"></span>':''?> - </div> + if (strtolower($tab) === 'details' + && $this->config()->get('config')->Site->showStaffViewInLightbox + && strtolower($this->activeTab) !== 'details' /* load in new browser tab after right click */) { + // #21993 show button for staff view in toolbar instead + continue; + } + + $desc = $obj->getDescription(); + $tab_classes = []; + if (0 === strcasecmp($this->activeTab, $tab)) { + if (!$this->loadInitialTabWithAjax || !$obj->supportsAjax()) { + $tab_classes[] = 'active'; + } + $tab_classes[] = 'initiallyActive'; + $this->layout()->breadcrumbs .= '<li class="active">' . $this->transEsc($desc) . '</li>'; + $activeTabObj = $obj; + } + if (!$obj->isVisible()) { + $tab_classes[] = 'hidden';} + if (!$obj->supportsAjax()) { $tab_classes[] = 'noajax'; } + ?> + <li<?=count($tab_classes) > 0 ? ' class="' . implode(' ', $tab_classes) . '"' : ''?>> + <a class="<?=strtolower($tab) ?>" href="<?=$this->recordLink()->getTabUrl($this->driver, $tab)?>#tabnav"<?php if ($obj->supportsAjax() && in_array($tab, $this->backgroundTabs)):?> data-background<?php endif ?>> + <?=$this->transEsc($desc)?> + <?php /* finc: add span with icon #10126 */ ?> + <span class="visible-xs-inline right caret" aria-hidden="true"></span> + </a> + </li> + <?php endforeach; ?> + </ul> + </div> + <?php endif; ?> +</div> + +<?php /* finc: show sidebar (rendered as tab) outside of '.mainbody' class #22956 */ ?> +<?php if (!$this->loadInitialTabWithAjax || !isset($activeTabObj) || !$activeTabObj->supportsAjax()): ?> + <div class="tab-pane active <?=$this->activeTab ?>-tab"> + <?=isset($activeTabObj) ? $this->record($this->driver)->getTab($activeTabObj) : '' ?> </div> +<?php endif; ?> + +<?=$this->driver->supportsCoinsOpenURL()?'<span class="Z3988" title="' . $this->escapeHtmlAttr($this->driver->getCoinsOpenURL()) . '"></span>':''?> + <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, '$(document).ready(recordDocReady);', 'SET'); ?> <!-- finc: collection - view - END --> -- GitLab