From 948c8de2f8b8a615f0d75da4034773f1c13e4197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Wed, 28 Aug 2024 11:47:52 +0100 Subject: [PATCH 01/11] feat: Grouping_Item instances contain edition so that a patron can see the edition of the records when looking through the 'Where is it' modal on the search results page, adds an 'edition' property to the Grouping_Item class, and update getRawItemDataFromDB() on GroupedWorkDriver instances so that edition is fetched from the database and included in a scopedItem's data. This ultimately adds the 'edition' property to the $summary variable in the getCopyDetails method on the GroupedWork_AJAX class, allowing it to be assigned to $interface, thus making it available to copyDetails.tpl. --- code/web/RecordDrivers/GroupedWorkDriver.php | 6 +++++- code/web/sys/Grouping/Item.php | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/web/RecordDrivers/GroupedWorkDriver.php b/code/web/RecordDrivers/GroupedWorkDriver.php index 3a0b11263d..7ed00684c3 100644 --- a/code/web/RecordDrivers/GroupedWorkDriver.php +++ b/code/web/RecordDrivers/GroupedWorkDriver.php @@ -3138,7 +3138,7 @@ private function getRawItemDataFromDB($uniqueItemIds) { $uniqueItemIdsString = implode(',', $uniqueItemIds); $scopeQuery = "SELECT grouped_work_record_items.id as groupedWorkItemId, available, holdable, inLibraryUseOnly, locationOwnedScopes, libraryOwnedScopes, groupedStatusTbl.status as groupedStatus, statusTbl.status as status, grouped_work_record_items.groupedWorkRecordId, grouped_work_record_items.groupedWorkVariationId, grouped_work_record_items.itemId, indexed_call_number.callNumber, indexed_shelf_location.shelfLocation, numCopies, isOrderItem, dateAdded, - indexed_location_code.locationCode, indexed_sub_location_code.subLocationCode, lastCheckInDate, isVirtual + indexed_location_code.locationCode, indexed_sub_location_code.subLocationCode, lastCheckInDate, isVirtual, groupedWorkRecordEdition.edition as 'edition' FROM grouped_work_record_items LEFT JOIN indexed_status as groupedStatusTbl on groupedStatusId = groupedStatusTbl.id LEFT JOIN indexed_status as statusTbl on statusId = statusTbl.id @@ -3146,6 +3146,10 @@ private function getRawItemDataFromDB($uniqueItemIds) { LEFT JOIN indexed_shelf_location ON shelfLocationId = indexed_shelf_location.id LEFT JOIN indexed_location_code on locationCodeId = indexed_location_code.id LEFT JOIN indexed_sub_location_code on subLocationCodeId = indexed_sub_location_code.id + LEFT JOIN ( + SELECT indexed_edition.edition, grouped_work_records.id, grouped_work_records.editionId from grouped_work_records + LEFT JOIN indexed_edition on grouped_work_records.editionId = indexed_edition.id + ) as groupedWorkRecordEdition on groupedWorkRecordId = groupedWorkRecordEdition.id where grouped_work_record_items.id IN ($uniqueItemIdsString)"; $results = $aspen_db->query($scopeQuery, PDO::FETCH_ASSOC); $scopedItems = $results->fetchAll(); diff --git a/code/web/sys/Grouping/Item.php b/code/web/sys/Grouping/Item.php index ba33343575..4d59020370 100644 --- a/code/web/sys/Grouping/Item.php +++ b/code/web/sys/Grouping/Item.php @@ -25,6 +25,8 @@ class Grouping_Item { public $locallyOwned; /** @var bool */ public $holdable; + /** @var string */ + public $edition; /** * @var bool */ @@ -81,6 +83,7 @@ public function __construct($itemDetails, $scopingInfo, $searchLocation, $librar $this->isOrderItem = (bool)$itemDetails['isOrderItem']; $this->isEContent = $itemDetails['isEcontent']; $this->eContentSource = $itemDetails['eContentSource']; + $this->edition = $itemDetails['edition']; if ($this->isEContent && !empty($itemDetails['localUrl'])) { $this->_relatedUrls[] = [ 'source' => $itemDetails['eContentSource'], @@ -294,6 +297,7 @@ public function getSummary(): array { 'subLocation' => $this->subLocation, 'itemId' => $this->itemId, 'variationId' => $this->variationId, + 'edition' => $this->edition, 'actions' => $this->getActions(), ]; return $itemSummaryInfo; From 71154e4463ad2552389489921a406d07cd3ee623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Wed, 28 Aug 2024 11:53:37 +0100 Subject: [PATCH 02/11] feat: display edition on where is it modal adds a record's edition to the modal that opens upon the 'Where is it?' button being clicked on the search page. For records that do not have edition information attached to them, displays 'unknown' instead --- .../themes/responsive/GroupedWork/copyDetails.tpl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl index d18a11c6ba..9f14954ed6 100644 --- a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl +++ b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl @@ -4,6 +4,7 @@ {translate text="Available Copies" isPublicFacing=true} + {translate text="Edition" isPublicFacing=true} {translate text="Location" isPublicFacing=true} {translate text="Call #" isPublicFacing=true} @@ -21,6 +22,13 @@ {else} {translate text="%1% of %2%" 1=$item.availableCopies 2=$item.totalCopies isPublicFacing=true}{if !empty($item.availableCopies)} {/if} {/if} + + {if !empty($item.edition)} + {$item.edition} + {else} + {translate text='unknown' isPublicFacing=true} + {/if} + {$item.shelfLocation} {if empty($item.isEContent)} From 88cdb4981ec545bc81fd8d37a1c9903809dea233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Wed, 28 Aug 2024 17:30:23 +0100 Subject: [PATCH 03/11] feat: book cover thumbnails In the 'Where is it?' modal, also display the cover for each record found. Only do so if Show Covers for Editions is enabled in Grouped Work Display Setting. --- .../themes/responsive/GroupedWork/copyDetails.tpl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl index 9f14954ed6..84b52be22b 100644 --- a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl +++ b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl @@ -3,6 +3,9 @@ + {if !empty($showEditionCovers) && $showEditionCovers == 1} + + {/if} @@ -13,6 +16,11 @@ {assign var=numRowsShown value=0} {foreach from=$summary item="item"} + {if !empty($showEditionCovers) && $showEditionCovers == 1} + + {/if} {if $item.onOrderCopies > 0} {if !empty($showOnOrderCounts)} From af422649495e134854eb365d51a134916875b9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Wed, 4 Sep 2024 08:32:41 +0100 Subject: [PATCH 04/11] feat: in the absence of edition info, display nothing --- .../web/interface/themes/responsive/GroupedWork/copyDetails.tpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl index 84b52be22b..310cacdabf 100644 --- a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl +++ b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl @@ -33,8 +33,6 @@ From fb61809f6e6ab6b19ab237a357550f81b85b631c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Thu, 5 Sep 2024 10:34:37 +0100 Subject: [PATCH 05/11] feat: "Show Editions in the Where is it popup" setting Adds the "Show Editions in the Where is it popup" setting to Grouped Work Display Settings. This toggles the boolean value of the separateItemsByEditionInWhereIsIt column added to grouped_work_display_settings. It will later allow the user to set the "Where is it?" popup to be divided into sections by editions, so that edition information and covers can be displayed. To test, choose a Grouped Work Display Setting profile to edit (eg. public). First check that its separateItemsByEditionInWhereIsIt value is set to 0 (intended default) in the db. Then navigate to Grouped Work Display Settings > > Searching > Search Results, and ensure that the "Show Editions in the Where is it popup" checkbox displays and is toggled off. Hover over the interrogation mark to get an explanation of the expected behaviour change. Toggle on the setting, and save your changes. In the db, check that the value of separateItemsByEditionInWhereIsIt for the setting profile you edited is now set to 1. --- .../web/sys/DBMaintenance/version_updates/24.10.00.php | 8 ++++++++ code/web/sys/Grouping/GroupedWorkDisplaySetting.php | 10 ++++++++++ code/web/sys/Interface.php | 3 +++ 3 files changed, 21 insertions(+) diff --git a/code/web/sys/DBMaintenance/version_updates/24.10.00.php b/code/web/sys/DBMaintenance/version_updates/24.10.00.php index 117fe3172d..d7722be316 100644 --- a/code/web/sys/DBMaintenance/version_updates/24.10.00.php +++ b/code/web/sys/DBMaintenance/version_updates/24.10.00.php @@ -167,6 +167,14 @@ function getUpdates24_10_00(): array { ], //chloe - PTFS-Europe + 'add_separate_items_by_edition_in_where_is_it' => [ + 'title' => 'Add Separate Items By Edition in Where is it', + 'description' => 'Add the separateItemsByEditionInWhereIsIt column to grouped_work_display_settings in order for the "Show Editions in the Where is it popup" setting to be added', + 'continueOnError' => true, + 'sql' => [ + 'ALTER TABLE grouped_work_display_settings ADD COLUMN separateItemsByEditionInWhereIsIt TINYINT(1) DEFAULT 0', + ], + ], // add_separate_items_by_edition_in_where_is_it //pedro - PTFS-Europe diff --git a/code/web/sys/Grouping/GroupedWorkDisplaySetting.php b/code/web/sys/Grouping/GroupedWorkDisplaySetting.php index 5593f80e02..3c915476af 100644 --- a/code/web/sys/Grouping/GroupedWorkDisplaySetting.php +++ b/code/web/sys/Grouping/GroupedWorkDisplaySetting.php @@ -31,6 +31,7 @@ class GroupedWorkDisplaySetting extends DataObject { public $alwaysFlagNewTitles; public $showRelatedRecordLabels; public $showEditionCovers; + public $separateItemsByEditionInWhereIsIt; //Contents of search public $includeOutOfSystemExternalLinks; @@ -266,6 +267,14 @@ static function getObjectStructure($context = ''): array { 'default' => true, 'hideInLists' => true, ], + 'separateItemsByEditionInWhereIsIt' => [ + 'property' => 'separateItemsByEditionInWhereIsIt', + 'type' => 'checkbox', + 'label' => 'Show Editions in the Where is it popup', + 'description' => 'Divide the Where is it popup table into edition sections so that edition information can be displayed. If Show Covers for Editions is toggled on, also include edition covers as thumbnails.', + 'default' => false, + 'hideInLists' => true + ] ], ], 'searchFacetsSection' => [ @@ -921,6 +930,7 @@ public static function getDefaultDisplaySettings() : GroupedWorkDisplaySetting { $defaultDisplaySettings->alwaysFlagNewTitles = false; $defaultDisplaySettings->showRelatedRecordLabels = true; $defaultDisplaySettings->showEditionCovers = true; + $defaultDisplaySettings->separateItemsByEditionInWhereIsIt = false; $defaultDisplaySettings->availabilityToggleLabelSuperScope = 'Entire Collection'; $defaultDisplaySettings->availabilityToggleLabelLocal = ''; $defaultDisplaySettings->availabilityToggleLabelAvailable = 'Available Now'; diff --git a/code/web/sys/Interface.php b/code/web/sys/Interface.php index 885de79b28..63cded7ab5 100644 --- a/code/web/sys/Interface.php +++ b/code/web/sys/Interface.php @@ -627,6 +627,7 @@ function loadDisplayOptions($fromBookCoverProcessing = false) { $this->assign('alwaysShowSearchResultsMainDetails', $groupedWorkDisplaySettings->alwaysShowSearchResultsMainDetails); $this->assign('showRelatedRecordLabels', $groupedWorkDisplaySettings->showRelatedRecordLabels); $this->assign('showEditionCovers', $groupedWorkDisplaySettings->showEditionCovers); + $this->assign('separateItemsByEditionInWhereIsIt', $groupedWorkDisplaySettings->separateItemsByEditionInWhereIsIt); $this->assign('showExpirationWarnings', $library->showExpirationWarnings); $this->assign('expiredMessage', $library->expiredMessage); $this->assign('expirationNearMessage', $library->expirationNearMessage); @@ -682,6 +683,7 @@ function loadDisplayOptions($fromBookCoverProcessing = false) { $this->assign('showStandardReviews', $groupedWorkDisplaySettings->showStandardReviews); $this->assign('showRelatedRecordLabels', $groupedWorkDisplaySettings->showRelatedRecordLabels); $this->assign('showEditionCovers', $groupedWorkDisplaySettings->showEditionCovers); + $this->assign('separateItemsByEditionInWhereIsIt', $groupedWorkDisplaySettings->separateItemsByEditionInWhereIsIt); } else { // library only $groupedWorkDisplaySettings = $library->getGroupedWorkDisplaySettings(); $this->assign('showFavorites', $library->showFavorites); @@ -697,6 +699,7 @@ function loadDisplayOptions($fromBookCoverProcessing = false) { $this->assign('showStandardReviews', $groupedWorkDisplaySettings->showStandardReviews); $this->assign('showRelatedRecordLabels', $groupedWorkDisplaySettings->showRelatedRecordLabels); $this->assign('showEditionCovers', $groupedWorkDisplaySettings->showEditionCovers); + $this->assign('separateItemsByEditionInWhereIsIt', $groupedWorkDisplaySettings->separateItemsByEditionInWhereIsIt); } if ($showStaffView == 2) { $showStaffView = UserAccount::isStaff(); From 45fbf7094e4db678f52bce73c0be287eed4eb2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Thu, 5 Sep 2024 13:11:15 +0100 Subject: [PATCH 06/11] feat: template structure for copyDetails with separation by edition --- .../responsive/GroupedWork/copyDetails.tpl | 143 ++++++++++++------ 1 file changed, 96 insertions(+), 47 deletions(-) diff --git a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl index 310cacdabf..e1457623b1 100644 --- a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl +++ b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl @@ -1,49 +1,98 @@ {strip} -
-
{translate text="Available Copies" isPublicFacing=true} {translate text="Edition" isPublicFacing=true} {translate text="Location" isPublicFacing=true}
+ + {translate text="%1% on order" 1=$item.onOrderCopies isPublicFacing=true} {if !empty($item.edition)} {$item.edition} - {else} - {translate text='unknown' isPublicFacing=true} {/if} {$item.shelfLocation}
- - - {if !empty($showEditionCovers) && $showEditionCovers == 1} - - {/if} - - - - - - - - {assign var=numRowsShown value=0} - {foreach from=$summary item="item"} - - {if !empty($showEditionCovers) && $showEditionCovers == 1} - - {/if} - {if $item.onOrderCopies > 0} - {if !empty($showOnOrderCounts)} - - {else} - - {/if} - {else} - - {/if} - - - - - {/foreach} - -
{translate text="Available Copies" isPublicFacing=true}{translate text="Edition" isPublicFacing=true}{translate text="Location" isPublicFacing=true}{translate text="Call #" isPublicFacing=true}
- - {translate text="%1% on order" 1=$item.onOrderCopies isPublicFacing=true}{translate text="Copies on order" isPublicFacing=true}{translate text="%1% of %2%" 1=$item.availableCopies 2=$item.totalCopies isPublicFacing=true}{if !empty($item.availableCopies)} {/if} - {if !empty($item.edition)} - {$item.edition} - {/if} - {$item.shelfLocation} - {if empty($item.isEContent)} - {$item.callNumber} - {/if} -
- + {if !empty($separateItemsByEditionInWhereIsIt) && $separateItemsByEditionInWhereIsIt == 1 && !empty($summaryList)} +
+ + + + {if !empty($showEditionCovers) && $showEditionCovers == 1}{/if} + + + + + + + + {foreach $summaryList item="item"} + + {if !empty($showEditionCovers) && $showEditionCovers == 1} + + {/if} + + + {foreach from=$item['summary'] item="item"} + + {if !empty($showEditionCovers) && $showEditionCovers == 1} + + {/if} + + {if $item.onOrderCopies > 0} + {if !empty($showOnOrderCounts)} + + {else} + + {/if} + {else} + + {/if} + + + + {/foreach} + {/foreach} + +
{translate text="Edition" isPublicFacing=true}{translate text="Available Copies" isPublicFacing=true}{translate text="Location" isPublicFacing=true}{translate text="Call #" isPublicFacing=true}
+ + + {if !empty($item['edition'])} + {$item['edition']} + {else} + {translate text="Unknown edition" isPublicFacing=true} + {/if} +
{translate text="%1% on order" 1=$item.onOrderCopies isPublicFacing=true}{translate text="Copies on order" isPublicFacing=true}{translate text="%1% of %2%" 1=$item.availableCopies 2=$item.totalCopies isPublicFacing=true}{if !empty($item.availableCopies)} + {/if} + {$item.shelfLocation} + {if empty($item.isEContent)} + {$item.callNumber} + {/if} +
+
+ {else} +
+ + + + + + + + + + {assign var=numRowsShown value=0} + {foreach from=$summary item="item"} + + {if $item.onOrderCopies > 0} + {if !empty($showOnOrderCounts)} + + {else} + + {/if} + {else} + + {/if} + + + + {/foreach} + +
{translate text="Available Copies" isPublicFacing=true}{translate text="Location" isPublicFacing=true}{translate text="Call #" isPublicFacing=true}
{translate text="%1% on order" 1=$item.onOrderCopies isPublicFacing=true}{translate text="Copies on order" isPublicFacing=true}{translate text="%1% of %2%" 1=$item.availableCopies 2=$item.totalCopies isPublicFacing=true}{if !empty($item.availableCopies)} + {/if} + {$item.shelfLocation} + {if empty($item.isEContent)} + {$item.callNumber} + {/if} +
+
+ {/if} {/strip} \ No newline at end of file From 00a0e4960c64553ca2feb628fdf5eaa749306946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 6 Sep 2024 13:05:20 +0100 Subject: [PATCH 07/11] feat: display copies per edition per location in Where is it popup In search results, for the list of records grouped into a specific title, display each of them in a separate section of the Where is it popup. Each section includes a header containing edition information, then lists the available copies of this editions, grouped by the location they are found at. This ultimately allows edition information to be displayed within the Where is it popup (as per the enhancement request). Test plan: In Aspen Administration > Grouped Work Display Settings > Search Results - have "Show Editions in the Where is it popup" toggled on - have "Copy Information to show" set to something that allows for "Where is it" links to display - (if you'd like for covers to be included, have "Show Covers for Editions" toggled on) Run a search in Library Catalog, and open "Where is it?" links on various titles. Notice that the table displayed in the popup is now subvided in 'edition' sections. These sections contain a list of copies grouped by location and their summary information. (Toggled off "Show Edditions in the Where is it popup" to see the original behaviour and table structure.) Note: this does not affect "Where is it?" popups opened for individual records. --- .../responsive/GroupedWork/copyDetails.tpl | 2 +- code/web/services/GroupedWork/AJAX.php | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl index e1457623b1..d4a4bd1f1c 100644 --- a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl +++ b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl @@ -17,7 +17,7 @@ {if !empty($showEditionCovers) && $showEditionCovers == 1} - + {/if} diff --git a/code/web/services/GroupedWork/AJAX.php b/code/web/services/GroupedWork/AJAX.php index a7fafbd316..284770133d 100644 --- a/code/web/services/GroupedWork/AJAX.php +++ b/code/web/services/GroupedWork/AJAX.php @@ -1542,6 +1542,7 @@ function getCopyDetails() : array { $id = $_REQUEST['id']; $recordDriver = new GroupedWorkDriver($id); $interface->assign('recordDriver', $recordDriver); + $separateItemsByEditionInWhereIsIt = $interface->getVariable('separateItemsByEditionInWhereIsIt'); $recordId = $_REQUEST['recordId']; $selectedFormat = urldecode($_REQUEST['format']); @@ -1555,6 +1556,7 @@ function getCopyDetails() : array { $interface->assign('itemSummaryId', $id); $interface->assign('relatedManifestation', $relatedManifestation); + $summaryList = []; if ($recordId != $id) { $record = $recordDriver->getRelatedRecord($recordId); $summary = null; @@ -1570,6 +1572,7 @@ function getCopyDetails() : array { break; } } + $interface->assign('summary', $summary); } else { foreach ($relatedManifestation->getVariations() as $variation) { if ($recordId == $id . '_' . $variation->label) { @@ -1577,12 +1580,24 @@ function getCopyDetails() : array { break; } } + $interface->assign('summary', $summary); } } else { - $summary = $relatedManifestation->getItemSummary(); + if(!empty($separateItemsByEditionInWhereIsIt) && $separateItemsByEditionInWhereIsIt == 1) { + foreach ($recordDriver->getRelatedRecords() as $relatedRecord) { + $item = []; + $item['summary'] = $relatedRecord->getItemSummary(); + $item['editionCoverUrl'] = $relatedRecord->getBookcoverUrl('small'); + $item['edition'] = $relatedRecord->edition; + array_push($summaryList, $item); + } + $interface->assign('summaryList', $summaryList); + } else { + $summary = $relatedManifestation->getItemSummary(); + $interface->assign('summary', $summary); + } } - $interface->assign('summary', $summary); - + $modalBody = $interface->fetch('GroupedWork/copyDetails.tpl'); return [ 'title' => translate([ From f56faa3a1270ba6133d14aa292fcbecb2a737fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 6 Sep 2024 14:23:23 +0100 Subject: [PATCH 08/11] feat: new setting description is consistent with others --- code/web/sys/Grouping/GroupedWorkDisplaySetting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/web/sys/Grouping/GroupedWorkDisplaySetting.php b/code/web/sys/Grouping/GroupedWorkDisplaySetting.php index 3c915476af..cec570d4b8 100644 --- a/code/web/sys/Grouping/GroupedWorkDisplaySetting.php +++ b/code/web/sys/Grouping/GroupedWorkDisplaySetting.php @@ -271,7 +271,7 @@ static function getObjectStructure($context = ''): array { 'property' => 'separateItemsByEditionInWhereIsIt', 'type' => 'checkbox', 'label' => 'Show Editions in the Where is it popup', - 'description' => 'Divide the Where is it popup table into edition sections so that edition information can be displayed. If Show Covers for Editions is toggled on, also include edition covers as thumbnails.', + 'description' => 'Turn on to divide the Where is it popup table into edition sections so that edition information can be displayed. If Show Covers for Editions is toggled on, also include edition covers as thumbnails.', 'default' => false, 'hideInLists' => true ] From e48242d447a750599fcb6af6a1094dc082e606f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 6 Sep 2024 17:15:56 +0100 Subject: [PATCH 09/11] feat: display edition info for individual records in Where is it popup The 'Where is it?' link also appear for individual records, a list of which can be displayed for a specific title by selecting the 'Show Edition(s)' button. This applies the changes in 'feat: display copies per edition per location in Where is it popup' to 'Where is it?' popups opened through links on individual records, allowing for edition information to be shown. Test plan: same as for 'feat: display copies per edition per location in Where is it popup', but focusing on 'Where is it' links on individual records. --- code/web/services/GroupedWork/AJAX.php | 82 ++++++++++++++++++-------- 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/code/web/services/GroupedWork/AJAX.php b/code/web/services/GroupedWork/AJAX.php index 284770133d..e65fe18f4c 100644 --- a/code/web/services/GroupedWork/AJAX.php +++ b/code/web/services/GroupedWork/AJAX.php @@ -1535,7 +1535,7 @@ function uploadCoverByURL() : array { } /** @noinspection PhpUnused */ - function getCopyDetails() : array { + function getCopyDetails(): array { global $interface; require_once ROOT_DIR . '/RecordDrivers/GroupedWorkDriver.php'; @@ -1556,34 +1556,38 @@ function getCopyDetails() : array { $interface->assign('itemSummaryId', $id); $interface->assign('relatedManifestation', $relatedManifestation); - $summaryList = []; - if ($recordId != $id) { - $record = $recordDriver->getRelatedRecord($recordId); - $summary = null; - if ($record != null) { - foreach ($relatedManifestation->getVariations() as $variation) { - foreach ($variation->getRecords() as $recordWithVariation) { - if ($recordWithVariation->id == $recordId) { - $summary = $recordWithVariation->getItemSummary(); + // show the editions and group the copies at given locations by edition + if (!empty($separateItemsByEditionInWhereIsIt) && $separateItemsByEditionInWhereIsIt == 1) { + $summaryList = []; + if ($recordId != $id) { + $record = $recordDriver->getRelatedRecord($recordId); + $summary = null; + if ($record != null) { + foreach ($relatedManifestation->getVariations() as $variation) { + foreach ($variation->getRecords() as $recordWithVariation) { + if ($recordWithVariation->id == $recordId) { + $item = []; + $item['summary'] = $recordWithVariation->getItemSummary(); + $item['editionCoverUrl'] = $recordWithVariation->getBookcoverUrl('small'); + $item['edition'] = $recordWithVariation->edition; + array_push($summaryList, $item); + break; + } + } + if (!empty($summary)) { break; } } - if (!empty($summary)) { - break; + } else { + // if there is no recordId, then do not attempt to look for edition information, and only display summary information + foreach ($relatedManifestation->getVariations() as $variation) { + if ($recordId == $id . '_' . $variation->label) { + $summary = $variation->getItemSummary(); + break; + } } } - $interface->assign('summary', $summary); } else { - foreach ($relatedManifestation->getVariations() as $variation) { - if ($recordId == $id . '_' . $variation->label) { - $summary = $variation->getItemSummary(); - break; - } - } - $interface->assign('summary', $summary); - } - } else { - if(!empty($separateItemsByEditionInWhereIsIt) && $separateItemsByEditionInWhereIsIt == 1) { foreach ($recordDriver->getRelatedRecords() as $relatedRecord) { $item = []; $item['summary'] = $relatedRecord->getItemSummary(); @@ -1591,13 +1595,39 @@ function getCopyDetails() : array { $item['edition'] = $relatedRecord->edition; array_push($summaryList, $item); } - $interface->assign('summaryList', $summaryList); + } + $interface->assign('summaryList', $summaryList); + } else { + // only group copies by location, irrespective of edition (default) + if ($recordId != $id) { + $record = $recordDriver->getRelatedRecord($recordId); + $summary = null; + if ($record != null) { + foreach ($relatedManifestation->getVariations() as $variation) { + foreach ($variation->getRecords() as $recordWithVariation) { + if ($recordWithVariation->id == $recordId) { + $summary = $recordWithVariation->getItemSummary(); + break; + } + } + if (!empty($summary)) { + break; + } + } + } else { + foreach ($relatedManifestation->getVariations() as $variation) { + if ($recordId == $id . '_' . $variation->label) { + $summary = $variation->getItemSummary(); + break; + } + } + } } else { $summary = $relatedManifestation->getItemSummary(); - $interface->assign('summary', $summary); } + $interface->assign('summary', $summary); } - + $modalBody = $interface->fetch('GroupedWork/copyDetails.tpl'); return [ 'title' => translate([ From 71a4cd294ada9f127c8583c23d3a023fbdba4f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 6 Sep 2024 17:22:07 +0100 Subject: [PATCH 10/11] feat: minor styling of edition section for clarity --- .../themes/responsive/GroupedWork/copyDetails.tpl | 13 +++++++------ code/web/interface/themes/responsive/css/main.css | 3 +++ .../themes/responsive/css/results-list.less | 3 +++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl index d4a4bd1f1c..7e356d7e3a 100644 --- a/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl +++ b/code/web/interface/themes/responsive/GroupedWork/copyDetails.tpl @@ -14,19 +14,20 @@ {foreach $summaryList item="item"} - + {if !empty($showEditionCovers) && $showEditionCovers == 1} - + - + {/if} - + {if !empty($item['edition'])} {$item['edition']} {else} - {translate text="Unknown edition" isPublicFacing=true} + {translate text="-" isPublicFacing=true} {/if} - + + {foreach from=$item['summary'] item="item"} diff --git a/code/web/interface/themes/responsive/css/main.css b/code/web/interface/themes/responsive/css/main.css index eaaf5699ba..f9f2000999 100644 --- a/code/web/interface/themes/responsive/css/main.css +++ b/code/web/interface/themes/responsive/css/main.css @@ -10382,6 +10382,9 @@ a.browse-thumbnail.active { .related_record_status.availableOther { color: #c62828; } +.itemSummaryTable tr.sectionHeader { + border-top: solid #505050 4px; +} .itemSummaryTable tr.available { font-weight: bold; } diff --git a/code/web/interface/themes/responsive/css/results-list.less b/code/web/interface/themes/responsive/css/results-list.less index 4d5ece28de..77716e2826 100644 --- a/code/web/interface/themes/responsive/css/results-list.less +++ b/code/web/interface/themes/responsive/css/results-list.less @@ -232,6 +232,9 @@ .related_record_status.availableOther{ color: #c62828; } +.itemSummaryTable tr.sectionHeader { + border-top: solid #505050 4px; +} .itemSummaryTable tr.available{ font-weight: bold; } From 5e4470a36af96e93da217173dfd9877a752feea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Tue, 1 Oct 2024 11:27:02 +0100 Subject: [PATCH 11/11] docs: update release note This enhancement patch modifies the 'Where is it?' modal to add edition information as well as book cover thumbnails Test plan Checking that the setting displays properly 1) navigate to Aspen Administration > Catalog/ Grouped Works > Grouped Work Display > setting in use > Searching> Search Results 2) notice that a new 'Show Editions in the Where is it popup' setting is displayed 3) hover over the interrogation mark, and notice its description explain its behaviour (changes the structure of the table show on the 'Where is it' modal by breaking it down into 'edition' section, which is what allows edition info to be shown) Checking functionality: The following steps(4 and 5) should be tried out for the configurations A, B, and C listed below (in 'Grouped Work Display',as above): steps: 4) run a search 5) open and close the 'Where is it?' links on various search results also open 'Show Edition(s) for various search results, and open the 'Where is it?' links found there to ascertain that default behaviour has not been affected (should be identical to testing without the patch): A) 'Show Editions in the Where is it popup': off 'Show Covers for Editions': off 'Copy Information to show': 'Show first 3 available copied & Where Is It link always' or 'Show Where is it link only' -> The 'Where is it' table should display copies per location irrespective of edition to test the feature including edition cover thumbnails: B) 'Show Editions in the Where is it popup': on 'Show Covers for Editions': on 'Copy Information to show': 'Show first 3 available copied & Where Is It link always' or 'Show Where is it link only' -> The 'Where is it' table should include edition sections with headers showing edition info and cover to test the feature without edition cover thumbnails: C) 'Show Editions in the Where is it popup': on 'Show Covers for Editions': off 'Copy Information to show': 'Show first 3 available copied & Where Is It link always' or 'Show Where is it link only' -> The 'Where is it' table should include edition sections with headers showing edition info Note: when opening 'Show Edition(s)' on various search results, and testing the 'Where is it?' links within, check that they are made of only one section, match the selected edition, and contain all relevant copy summary information. --- code/web/release_notes/24.10.00.MD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/web/release_notes/24.10.00.MD b/code/web/release_notes/24.10.00.MD index 31d480015b..2dabb46b28 100644 --- a/code/web/release_notes/24.10.00.MD +++ b/code/web/release_notes/24.10.00.MD @@ -107,8 +107,8 @@ - When the cron runs for the first time after a library enables cookieStorageConsent, users who have not opted in to localAnalyticsTracking will have their data cleared from the user_usage statistics tables. (*AB*) // chloe - PTFS-E -## Aspen Usage Data -- added usage graphs and raw data tables for the Axis360, Aspen API, and SideLoads usage dashboards, all of which include a CSV download feature. (*CZ*) +- Added a 'Show Editions in the Where is it popup' setting to Aspen Administration > Catalog/Grouped Works > Grouped Work Display > ... > Searching> Search Results, which groups copies in the 'Where is it?' popup by edition, displaying each edition's name and book cover thumbnail in the popup (visibility toggled on/off by 'Show Covers for Editions') (*CZ*)## Aspen Usage Data +- Added usage graphs and raw data tables for the Axis360, Aspen API, and SideLoads usage dashboards, all of which include a CSV download feature. (*CZ*) // pedro - PTFS-E // lucas - Theke