From 435c82fcba9e9ddea80a846efc024afa951c1f6b Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Tue, 21 Oct 2025 09:55:37 -0400 Subject: [PATCH 1/8] IIIF V3 Working Version --- .../src/DigLib/Controller/VuDLController.php | 28 +- .../src/DigLib/IIIF/ManifestGenerator.php | 354 +++++++----------- themes/vudiglib/js/vudl/uv-setup-v4.js | 79 ++-- themes/vudiglib/templates/vudl/viewer.phtml | 12 +- 4 files changed, 197 insertions(+), 276 deletions(-) mode change 100644 => 100755 module/DigLib/src/DigLib/Controller/VuDLController.php mode change 100644 => 100755 module/DigLib/src/DigLib/IIIF/ManifestGenerator.php mode change 100644 => 100755 themes/vudiglib/js/vudl/uv-setup-v4.js mode change 100644 => 100755 themes/vudiglib/templates/vudl/viewer.phtml diff --git a/module/DigLib/src/DigLib/Controller/VuDLController.php b/module/DigLib/src/DigLib/Controller/VuDLController.php old mode 100644 new mode 100755 index 9951fde..9699ad0 --- a/module/DigLib/src/DigLib/Controller/VuDLController.php +++ b/module/DigLib/src/DigLib/Controller/VuDLController.php @@ -1,6 +1,7 @@ $current['title'], - 'value' => $this->formatManifestMetadataValues($key, $value), + 'label' => ['en' =>[$current['title']]], + 'value' => ['en' =>[$this->formatManifestMetadataValues($key, $value)]], ]; } } @@ -220,13 +221,13 @@ protected function extractManifestMetadata($id, $details) $recordUrl = $this->getUri('record', ['id' => $id]); $persistUrl = $this->getUri('vudl-record', ['id' => $id]); $sortedRetVal[] = [ - 'label' => 'About', - 'value' => '' + 'label' => ['en' =>['About']], + 'value' => ['en' =>['' . 'More Details
' . 'Permanent Link' - . '
', + . '
']], ]; return $sortedRetVal; @@ -305,16 +306,30 @@ protected function getImageDetailsForCanvas($raw, $imageServerBase) * ID generation) * @param array $raw Raw data to format into canvas * @param string $type Type of list ('image' or 'audio') + * @param array $outline Outline data * * @return array */ - protected function getSingleCanvas($id, $i, $raw, $type) + protected function getSingleCanvas($id, $i, $raw, $type, $list, $outline) { + + if ($type == 'audio') { + $preferredType = 'Sound'; + $preferredRendering = 'audio/mp3'; + } elseif ($type == 'video') { + $preferredType = 'MovingImage'; + $preferredRendering = 'video/mp4'; + } else { + $preferredType = 'foaf:Document'; + $preferredRendering = 'application/pdf'; + } + $canvasUrl = $this->getUri( 'vudl-record-canvas', ['id' => $id, 'canvas' => 'p' . $i] ); - $canvasType = 'sc:Canvas'; + + $canvasType = 'Canvas'; if ($type === 'image') { $imageServerBase = $this->config->Images->serverUrl ?? false; if (!$imageServerBase) { @@ -325,26 +340,32 @@ protected function getSingleCanvas($id, $i, $raw, $type) $content = [ 'height' => $height, 'width' => $width, - 'images' => [ - [ - '@type' => 'oa:Annotation', - 'motivation' => 'sc:painting', - 'resource' => [ - '@id' => $imageUrl, - '@type' => 'dctypes:Image', - 'format' => $mimeType, - 'service' => [ - '@context' => 'http://iiif.io/api/image/2/context.json', - '@id' => $imageServerBase . urlencode($raw['id']), - 'profile' => 'http://iiif.io/api/image/2/level1.json', + 'items' => [[ + + 'id' => $this->getUri('record', ['id' => $id]), + 'type' => 'AnnotationPage', + 'items' => [[ + 'id' => $imageUrl, + 'type' => 'Annotation', + 'motivation' => 'painting', + 'body' =>[ + 'id' => $imageServerBase . urlencode($raw['id']), + 'type' => 'Image', + 'format' => $mimeType, + 'service' => [[ + 'id' => $imageServerBase . urlencode($raw['id']), + 'type' => 'ImageService3', + 'profile' => 'level1', + ]], ], 'height' => $height, 'width' => $width, - ], - 'on' => $canvasUrl, + 'target' => $canvasUrl, + ] ], - ], - ]; + ] , + ], + ]; } else { // Format as a generic download: $url = $this->getUri( @@ -357,20 +378,20 @@ protected function getSingleCanvas($id, $i, $raw, $type) $content = [ 'height' => 600, 'width' => 800, - 'content' => [ + 'items' => [ [ - '@id' => $canvasUrl . '#content', - '@type' => 'sc:AnnotationPage', + 'id' => $canvasUrl . '/annotationpage', + 'type' => 'AnnotationPage', 'items' => [ [ - '@id' => $canvasUrl . '#item' . $i, - '@type' => 'sc:Annotation', + 'id' => $canvasUrl . '/annotation/' . $i, + 'type' => 'Annotation', 'motivation' => 'painting', 'body' => [ - '@id' => $url, - '@type' => 'sc:Document', - 'format' => $raw['mimetype'] ?? '', - 'label' => $raw['label'], + 'id' => $url, + 'type' => $preferredType, + 'format' => $preferredRendering ?? '', + 'label' => ['en' =>[$raw['label']]], 'description' => $description, ], 'target' => $canvasUrl, @@ -380,29 +401,28 @@ protected function getSingleCanvas($id, $i, $raw, $type) ], ]; } + return [ - '@type' => $canvasType, - '@id' => $canvasUrl, - 'label' => $raw['label'] ?? '-', - 'rendering' => $this->getCanvasRenderingData($raw), + 'type' => $canvasType, + 'id' => $canvasUrl, + 'label' => ['en' =>[$raw['label'] ]]?? '-', + 'rendering' => $this->getSequenceRenderingData($outline, $list, $raw), + 'thumbnail' => $this->getThumbnail($raw, $type), ] + $content; } /** - * Build JSON data for a single canvas. + * Find and arrange thumbnail data for canvas. * - * @param string $id Record ID - * @param int $i Position of canvas in overall array (used for canvas - * ID generation) * @param string $raw Raw data to format into canvas * @param string $type Type of list ('image' or 'audio') * * @return array */ - protected function getSingleElement($id, $i, $raw, $type) + protected function getThumbnail($raw, $type) { if ($type == 'audio') { - $elementType = 'dctypes:Sound'; + $elementType = 'Sound'; $preferredRendering = 'audio/mp3'; } elseif ($type == 'video') { $elementType = 'dctypes:MovingImage'; @@ -420,8 +440,9 @@ protected function getSingleElement($id, $i, $raw, $type) } } $bestRendering = $foundMatch ? $i : 0; - $id = $renderings[$bestRendering]['@id'] . '#element'; + $id = $renderings[$bestRendering]['id'] . '#element'; $format = $renderings[$bestRendering]['format']; + $extras = []; if (in_array('THUMBNAIL', $raw['datastreams'])) { $extras['thumbnail'] = $this->getUri( @@ -439,13 +460,14 @@ protected function getSingleElement($id, $i, $raw, $type) $extras['thumbnail'] = $this->getUri('home') . 'themes/vudiglib/images/vudl/' . $thumbFilename; } - return [ - '@id' => $id, - 'format' => $format, - '@type' => $elementType, - 'label' => $raw['label'] ?? '-', - 'rendering' => $renderings, - ] + $extras; + + $thumb[] = [ + 'id' => $extras['thumbnail'], + 'type' => 'Image', + 'format' => 'image/png', + ]; + + return $thumb; } /** @@ -605,50 +627,6 @@ protected function getListForCanvas($outline) return current($outline['lists']) ?: []; } - /** - * Build JSON canvas data. - * - * @param string $id Record ID - * @param array $list List data - * - * @return array - */ - protected function getAllCanvasData($id, $list) - { - $retVal = []; - foreach ($list as $i => $current) { - $retVal[] = $this->getSingleCanvas( - $id, - $i, - $current, - $this->getListType($list) - ); - } - return $retVal; - } - - /** - * Build JSON element data. - * - * @param string $id Record ID - * @param array $list List data - * - * @return array - */ - protected function getAllElementData($id, $list) - { - $retVal = []; - foreach ($list as $i => $current) { - $retVal[] = $this->getSingleElement( - $id, - $i, - $current, - $this->getListType($list) - ); - } - return $retVal; - } - /** * Get the array representing a single rendering. * @@ -661,9 +639,10 @@ protected function getAllElementData($id, $list) protected function getSingleRendering($url, $mime, $label = '') { return [ - '@id' => $url, + 'type' => 'rendering', + 'id' => $url, 'format' => $mime, - 'label' => empty($label) ? "Download as {$mime}" : $label, + 'label' => ['en' =>[empty($label) ? "Download as {$mime}" : $label]], ]; } @@ -759,7 +738,7 @@ protected function getMasterRenderings($list) * * @return array */ - protected function getSequenceRenderingData($outline, $canvasList) + protected function getSequenceRenderingData($outline, $canvasList, $raw) { $renderings = []; $hasMixedList = $hasImageList = false; @@ -774,7 +753,7 @@ protected function getSequenceRenderingData($outline, $canvasList) $hasMixedList = true; } } elseif ($this->isPdfList($list) && $this->isPdfList($canvasList)) { - $filtered = $this->filterPdfList($list); + $filtered = $this->filterPdfList($list); if (count($filtered['other']) > 0) { $renderings = array_merge( $renderings, @@ -791,23 +770,10 @@ protected function getSequenceRenderingData($outline, $canvasList) $hasImageList = true; } } + $CanvasRenderings = $this->getCanvasRenderingData($raw); + $retVal = array_merge($CanvasRenderings, $renderings); // If we don't have an image list, we don't need alternate renderings: - return ($hasImageList || $hasMixedList) ? $renderings : []; - } - - /** - * Get a string label for a list. - * - * @param array $list List - * - * @return string - */ - protected function getLabelForList($list) - { - if ($this->isImageList($list)) { - return 'Pages'; - } - return 'Contents'; + return $retVal; } /** @@ -825,18 +791,18 @@ protected function getPlaceholderCanvas($id) ); $placeholderImage = 'http://digital.library.villanova.edu/placeholder.jpg'; return [ - '@type' => 'sc:Canvas', - '@id' => $canvasUrl, - 'label' => 'Placeholder image', + 'type' => 'Canvas', + 'id' => $canvasUrl, + 'label' => ['en' =>['Placeholder image']], 'height' => 600, 'width' => 600, 'images' => [ [ - '@type' => 'oa:Annotation', - 'motivation' => 'sc:painting', - 'resource' => [ - '@id' => $placeholderImage, - '@type' => 'dcTypes:Image', + 'type' => 'AnnotationPage', + 'motivation' => 'painting', + 'items' => [ + 'id' => $placeholderImage, + 'type' => 'dcTypes:Image', 'height' => 600, 'width' => 600, ], @@ -860,67 +826,39 @@ protected function getPlaceholderSequence($id) . 'for non-IIIF content (e.g., audio, video) and is unfortunately ' . 'incompatible with IIIF viewers.'; return [ - '@type' => 'sc:Sequence', - 'label' => $label, + 'type' => 'item', + 'label' => ['en' =>[$label]], 'compatibilityHint' => 'displayIfContentUnsupported', 'canvases' => [ $this->getPlaceholderCanvas($id) ], ]; } /** - * Build JSON sequence data. + * Build JSON items data. * * @param string $id Record ID * @param array $outline Outline data * * @return array */ - protected function getSequenceData($id, $outline) + protected function getItems($id, $outline) { $list = $this->getListForCanvas($outline); - $listType = $this->getListType($list); - if ($listType === 'image') { - $type = 'sc:Sequence'; - $sequenceKey = 'sequences'; - $extras = [ - 'viewingDirection' => 'left-to-right', - 'viewingHint' => 'paged', - 'canvases' => $this->getAllCanvasData($id, $list), - ]; - } elseif ($listType !== 'unknown') { - $type = 'ixif:MediaSequence'; - $sequenceKey = 'mediaSequences'; - $extras = [ - 'elements' => $this->getAllElementData($id, $list), - ]; - } else { - $type = 'sc:Sequence'; - $sequenceKey = 'sequences'; - $extras = [ - 'canvases' => $this->getAllCanvasData($id, $list), - ]; + $type = $this->getListType($list); + + $items = []; + foreach ($list as $i => $current) { + $items[] = $this->getSingleCanvas( + $id, + $i, + $current, + $type, + $list, + $outline + ); } - $globalRenderings = $this->getSequenceRenderingData($outline, $list); - $retVal = [ - '@type' => $type, - 'label' => $this->getLabelForList($list), - ] + $extras; - - // Handle global renderings differently for image lists vs. IxIF lists: - if ($this->isImageList($list)) { - $retVal['rendering'] = $globalRenderings; - } elseif (isset($retVal['elements'])) { - foreach ($retVal['elements'] as $i => $element) { - $retVal['elements'][$i]['rendering'] - = array_merge($element['rendering'], $globalRenderings); - } - } - $finalArray = [ $sequenceKey => [ $retVal ] ]; - if ($sequenceKey != 'sequences') { - $finalArray['sequences'] = $this->getPlaceholderSequence($id); - } - return $finalArray; + return $items; } /** @@ -943,52 +881,6 @@ protected function getManifestContext($outline) } } - /** - * Format parent IDs into URIs for 'within' section. - * - * @param array $ids IDs to reformat - * - * @return array - */ - protected function getParentData($ids) - { - $uris = []; - foreach ($ids as $id) { - $uris[] = $this->getUri('collection', ['id' => $id, 'tab' => 'IIIF']); - } - return count($uris) == 1 ? $uris[0] : $uris; - } - - /** - * Get data to build a IIIF canvas. - * - * @param string $id Record ID - * @param int $canvas Canvas index to look up - * @param array $outline Outline data - * - * @return array - */ - public function getCanvasData($id, $canvas, $outline) - { - $base = ['@context' => self::IIIF_CONTEXT]; - - // Special case: placeholder canvas: - if ($canvas === 'Placeholder') { - return $base + $this->getPlaceholderCanvas($id); - } - - // Standard case: - $list = $this->getListForCanvas($outline); - return isset($list[$canvas]) - ? $base + $this->getSingleCanvas( - $id, - $canvas, - $list[$canvas], - $this->getListType($list) - ) - : []; - } - /** * Get "related link" information pointing to record view page. * @@ -999,8 +891,10 @@ public function getCanvasData($id, $canvas, $outline) protected function getRelated($id) { return [ - '@id' => $this->getUri('vudl-record', compact('id')), + 'id' => $this->getUri('vudl-record', compact('id')), + 'type' => 'Text', 'format' => 'text/html', + 'label' => ['en'=>['More Details']] ]; } @@ -1082,13 +976,13 @@ protected function getRequiredStatement($license) . '" alt="' . htmlspecialchars($licenseData['alt']) . '">' : htmlspecialchars($licenseData['text']); return [ - 'label' => 'ATTRIBUTION', - 'value' => 'Digital Library@Villanova University' + 'label' => ['en'=>['ATTRIBUTION']], + 'value' => ['en'=>['Digital Library@Villanova University' . '

Disclaimers:
' . $this->getDisclaimers() . '

' . 'License:
' . '' . $linkContent . '' - . '
', + . '
']], ]; } @@ -1108,21 +1002,27 @@ public function getManifestData($id, $outline, $parents = []) [$license] = $this->connector->getCopyright($id, $this->getLicenses()); return [ '@context' => $this->getManifestContext($outline), - '@type' => 'sc:Manifest', - '@id' => $uri, - - 'label' => $details['title']['value'] ?? 'Untitled', + 'type' => 'Manifest', + 'id' => $uri, + 'label' => [ + 'en' => [ + $details['title']['value'] ?? 'Untitled' + ] + ], 'metadata' => $this->extractManifestMetadata($id, $details), - 'description' => isset($details['description']['value']) + 'summary' => ['en'=>[ + isset($details['description']['value']) ? '

' . str_replace( ['' - : '', + : '' + ] + ], 'requiredStatement' => $this->getRequiredStatement($license), - 'related' => $this->getRelated($id), - 'within' => $this->getParentData($parents), - ] + $this->getSequenceData($id, $outline); + 'seeAlso' => [$this->getRelated($id)], + 'items' => $this->getItems($id, $outline), + ]; } } diff --git a/themes/vudiglib/js/vudl/uv-setup-v4.js b/themes/vudiglib/js/vudl/uv-setup-v4.js old mode 100644 new mode 100755 index 388d68d..d758c9a --- a/themes/vudiglib/js/vudl/uv-setup-v4.js +++ b/themes/vudiglib/js/vudl/uv-setup-v4.js @@ -32,17 +32,7 @@ function setupUV4(configUri, phpData, uvOptions) { uvIsLoaded = true; loadingModal.close(); - - // Resizing - - resizeUV(window.innerWidth, window.innerHeight); - window.addEventListener( - "resize", - function () { - resizeUV(window.innerWidth, window.innerHeight); - }, - { passive: true }, - ); + resizeUV(); // Firefox audio bug @@ -106,7 +96,7 @@ function setupUV4(configUri, phpData, uvOptions) { function getRenderings(json) { if (json && typeof json === "object") { // Fix for multi-pdf - if (json["@type"] === "foaf:Document") { + if (json["type"] === "foaf:Document") { return []; } // Match? @@ -138,7 +128,7 @@ function setupUV4(configUri, phpData, uvOptions) { for (const render of renderings) { transcripts.push({ label: render.label, - href: render["@id"], + href: render["id"], hint: transcriptTypes[render.format], }); } @@ -178,6 +168,8 @@ function setupUV4(configUri, phpData, uvOptions) { const formatItem = document.querySelector( ".item._format, .item._language", ); + //console.log(document); + //console.log(formatItem); if (formatItem) { formatItem.parentNode.insertBefore(item, formatItem); } else { @@ -210,13 +202,13 @@ function setupUV4(configUri, phpData, uvOptions) { uv.on(UV.Events.CONFIGURE, async function uvConfigEvent(event) { const { cb } = event; - const configPromise = run(async (resolve) => { + const configPromise = new Promise(async (resolve) => { const res = await fetch(configUri); - const config = await res.json(); + const localConfig = await res.json(); // Theater Mode for videos if ("mediaElementCenterPanel" in event.config.modules) { - Object.assign(config, { + merge(localConfig, { modules: { footerPanel: { content: { @@ -228,7 +220,7 @@ function setupUV4(configUri, phpData, uvOptions) { }); } - return config; + resolve(localConfig); // this is merged with the base config }); cb(configPromise); @@ -430,32 +422,39 @@ document.addEventListener("click", (event) => { // Resize functions const $UV = $("#uv"); -// #todo -// : without container, UV resizes on the next resize event -// : is this a bug -const $container = $("#uv > div"); -function setUVWidth(innerWidth) { - const padding = 0; - - $UV.width(innerWidth - padding); - $container.width(innerWidth - padding); +function resizeUV() { + $UV.height(window.innerHeight - $UV.offset().top); uv.resize(); } -function resizeUV(innerWidth, innerHeight) { - let height = innerHeight - $UV.offset().top; - - // Adjust for custom padding - if ( - $UV[0].className.indexOf("pdfjs-off") > -1 && - $UV.find(".uv-pdf-extension").length > 0 - ) { - height -= 32; +window.addEventListener("resize", resizeUV); + +// Utils + +function merge(target, ...sources) { + if (sources.length > 1) { + return sources.reduce((merged, source) => merge(merged, source), target); } - if (height < 300) { - height = innerHeight - 50; + + // https://github.com/lukeed/dset/blob/master/src/merge.js#L1C33-L16C2 + function deepSet(target, source) { + if (typeof target !== 'object' || typeof source !== 'object')  { + return source; + } + + if (Array.isArray(target) && Array.isArray(source)) { + for (let i = 0; i < source.length; i++) { + target[i] = deepSet(target[i], source[i]); + } + return target; + } + + for (const key in source) { + if (!source.hasOwnProperty(key)) break; + target[key] = deepSet(target[key], source[key]); + } + + return target; } - $UV.height(height); - $container.height(height); - setUVWidth(innerWidth); + return deepSet(structuredClone(target), sources[0]); } diff --git a/themes/vudiglib/templates/vudl/viewer.phtml b/themes/vudiglib/templates/vudl/viewer.phtml old mode 100644 new mode 100755 index bac9bf1..89ee533 --- a/themes/vudiglib/templates/vudl/viewer.phtml +++ b/themes/vudiglib/templates/vudl/viewer.phtml @@ -1,4 +1,5 @@ headTitle($this->title . ' - ' . $this->itemTitle); @@ -10,7 +11,6 @@ $this->headLink()->appendStylesheet("$uvbase/uv.css"); // Customizations - $this->headLink()->appendStylesheet('vudl-viewer.css'); $this->headLink()->appendStylesheet('uv-custom-v4.css'); // $this->headScript()->appendFile("$uvbase/lib/offlinenojquery.js"); // $this->headScript()->appendFile("$uvbase/helpers.js"); @@ -36,7 +36,7 @@ render('vudl/navigation.phtml'); ?> -

+
- metadata as $data): ?> + metadata as $data): ?> - - + +
@@ -112,4 +112,4 @@ setupUV4(configUri, phpData, {$viewerOptions}); JS; echo $this->inlineScript(\Laminas\View\Helper\HeadScript::SCRIPT, $js, 'SET'); -?> \ No newline at end of file +?> From 3e9bd1bd95b3fae7ce7e9f66e5a0180323a91565 Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Wed, 22 Oct 2025 11:17:44 -0400 Subject: [PATCH 2/8] IIIF V3 Working Version --- .../src/DigLib/Controller/VuDLController.php | 42 +++--------- .../src/DigLib/IIIF/ManifestGenerator.php | 67 ++++++++++--------- themes/vudiglib/js/vudl/uv-setup-v4.js | 2 - themes/vudiglib/templates/vudl/viewer.phtml | 3 +- 4 files changed, 46 insertions(+), 68 deletions(-) diff --git a/module/DigLib/src/DigLib/Controller/VuDLController.php b/module/DigLib/src/DigLib/Controller/VuDLController.php index 9699ad0..05212cb 100755 --- a/module/DigLib/src/DigLib/Controller/VuDLController.php +++ b/module/DigLib/src/DigLib/Controller/VuDLController.php @@ -1,7 +1,6 @@ ['en' =>[$current['title']]], - 'value' => ['en' =>[$this->formatManifestMetadataValues($key, $value)]], + 'label' => ['en' => [$current['title']]], + 'value' => ['en' => [$this->formatManifestMetadataValues($key, $value)]], ]; } } @@ -221,8 +220,8 @@ protected function extractManifestMetadata($id, $details) $recordUrl = $this->getUri('record', ['id' => $id]); $persistUrl = $this->getUri('vudl-record', ['id' => $id]); $sortedRetVal[] = [ - 'label' => ['en' =>['About']], - 'value' => ['en' =>['' + 'label' => ['en' => ['About']], + 'value' => ['en' => ['' . 'More Details
' . ' ['en' => [empty($label) ? "Download as {$mime}" : $label]], ]; } @@ -735,6 +737,7 @@ protected function getMasterRenderings($list) * * @param array $outline Outline data. * @param array $canvasList List chosen as primary canvas list for manifest + * @param array $raw Raw data. * * @return array */ @@ -753,7 +756,7 @@ protected function getSequenceRenderingData($outline, $canvasList, $raw) $hasMixedList = true; } } elseif ($this->isPdfList($list) && $this->isPdfList($canvasList)) { - $filtered = $this->filterPdfList($list); + $filtered = $this->filterPdfList($list); if (count($filtered['other']) > 0) { $renderings = array_merge( $renderings, @@ -793,7 +796,7 @@ protected function getPlaceholderCanvas($id) return [ 'type' => 'Canvas', 'id' => $canvasUrl, - 'label' => ['en' =>['Placeholder image']], + 'label' => ['en' => ['Placeholder image']], 'height' => 600, 'width' => 600, 'images' => [ @@ -827,7 +830,7 @@ protected function getPlaceholderSequence($id) . 'incompatible with IIIF viewers.'; return [ 'type' => 'item', - 'label' => ['en' =>[$label]], + 'label' => ['en' => [$label]], 'compatibilityHint' => 'displayIfContentUnsupported', 'canvases' => [ $this->getPlaceholderCanvas($id) ], ]; @@ -845,7 +848,7 @@ protected function getItems($id, $outline) { $list = $this->getListForCanvas($outline); $type = $this->getListType($list); - + $items = []; foreach ($list as $i => $current) { $items[] = $this->getSingleCanvas( @@ -894,7 +897,7 @@ protected function getRelated($id) 'id' => $this->getUri('vudl-record', compact('id')), 'type' => 'Text', 'format' => 'text/html', - 'label' => ['en'=>['More Details']] + 'label' => ['en' => ['More Details']], ]; } @@ -976,8 +979,8 @@ protected function getRequiredStatement($license) . '" alt="' . htmlspecialchars($licenseData['alt']) . '">' : htmlspecialchars($licenseData['text']); return [ - 'label' => ['en'=>['ATTRIBUTION']], - 'value' => ['en'=>['Digital Library@Villanova University' + 'label' => ['en' => ['ATTRIBUTION']], + 'value' => ['en' => ['Digital Library@Villanova University' . '

Disclaimers:
' . $this->getDisclaimers() . '

' . 'License:
' @@ -1006,19 +1009,19 @@ public function getManifestData($id, $outline, $parents = []) 'id' => $uri, 'label' => [ 'en' => [ - $details['title']['value'] ?? 'Untitled' - ] + $details['title']['value'] ?? 'Untitled', + ], ], 'metadata' => $this->extractManifestMetadata($id, $details), - 'summary' => ['en'=>[ + 'summary' => ['en' => [ isset($details['description']['value']) ? '

' . str_replace( ['' - : '' - ] + : '', + ], ], 'requiredStatement' => $this->getRequiredStatement($license), 'seeAlso' => [$this->getRelated($id)], diff --git a/themes/vudiglib/js/vudl/uv-setup-v4.js b/themes/vudiglib/js/vudl/uv-setup-v4.js index d758c9a..de2a768 100755 --- a/themes/vudiglib/js/vudl/uv-setup-v4.js +++ b/themes/vudiglib/js/vudl/uv-setup-v4.js @@ -168,8 +168,6 @@ function setupUV4(configUri, phpData, uvOptions) { const formatItem = document.querySelector( ".item._format, .item._language", ); - //console.log(document); - //console.log(formatItem); if (formatItem) { formatItem.parentNode.insertBefore(item, formatItem); } else { diff --git a/themes/vudiglib/templates/vudl/viewer.phtml b/themes/vudiglib/templates/vudl/viewer.phtml index 89ee533..8f7f7a7 100755 --- a/themes/vudiglib/templates/vudl/viewer.phtml +++ b/themes/vudiglib/templates/vudl/viewer.phtml @@ -1,5 +1,4 @@ headTitle($this->title . ' - ' . $this->itemTitle); @@ -62,7 +61,7 @@

- metadata as $data): ?> + metadata as $data): ?> From ad0f3d9bfde43fa9563150e759f870740f548237 Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Thu, 23 Oct 2025 13:28:46 -0400 Subject: [PATCH 3/8] IIIF V3 Ammended --- .../src/DigLib/IIIF/ManifestGenerator.php | 132 ++++++++---------- themes/vudiglib/templates/vudl/viewer.phtml | 14 +- 2 files changed, 69 insertions(+), 77 deletions(-) diff --git a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php index 01d83ce..46d8915 100755 --- a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php +++ b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php @@ -201,9 +201,10 @@ protected function extractManifestMetadata($id, $details) foreach ($details as $key => $current) { if (!in_array($key, $skip)) { $value = (array)$current['value']; + $formatValues = $this->formatManifestMetadataValues($key, $value); $retVal[$key] = [ 'label' => ['en' => [$current['title']]], - 'value' => ['en' => [$this->formatManifestMetadataValues($key, $value)]], + 'value' => ['en' => [$formatValues]], ]; } } @@ -301,8 +302,7 @@ protected function getImageDetailsForCanvas($raw, $imageServerBase) * Build JSON data for a single canvas. * * @param string $id Record ID - * @param int $i Position of canvas in overall array (used for canvas - * ID generation) + * @param int $i Position of canvas in overall array (used for canvas ID generation) * @param array $raw Raw data to format into canvas * @param string $type Type of list ('image' or 'audio') * @param array $list List to check @@ -312,18 +312,6 @@ protected function getImageDetailsForCanvas($raw, $imageServerBase) */ protected function getSingleCanvas($id, $i, $raw, $type, $list, $outline) { - - if ($type == 'audio') { - $preferredType = 'Sound'; - $preferredRendering = 'audio/mp3'; - } elseif ($type == 'video') { - $preferredType = 'MovingImage'; - $preferredRendering = 'video/mp4'; - } else { - $preferredType = 'foaf:Document'; - $preferredRendering = 'application/pdf'; - } - $canvasUrl = $this->getUri( 'vudl-record-canvas', ['id' => $id, 'canvas' => 'p' . $i] @@ -340,35 +328,48 @@ protected function getSingleCanvas($id, $i, $raw, $type, $list, $outline) $content = [ 'height' => $height, 'width' => $width, - 'items' => [[ - + 'items' => [ + [ 'id' => $this->getUri('record', ['id' => $id]), 'type' => 'AnnotationPage', - 'items' => [[ - 'id' => $imageUrl, - 'type' => 'Annotation', - 'motivation' => 'painting', - 'body' => [ - 'id' => $imageServerBase . urlencode($raw['id']), - 'type' => 'Image', - 'format' => $mimeType, - 'service' => [[ + 'items' => [ + [ + 'id' => $imageUrl, + 'type' => 'Annotation', + 'motivation' => 'painting', + 'body' => [ 'id' => $imageServerBase . urlencode($raw['id']), - 'type' => 'ImageService3', - 'profile' => 'level1', - ]], + 'type' => 'Image', + 'format' => $mimeType, + 'service' => [ + [ + 'id' => $imageServerBase . urlencode($raw['id']), + 'type' => 'ImageService3', + 'profile' => 'level1', + ] + ], + ], + 'height' => $height, + 'width' => $width, + 'target' => $canvasUrl, + 'thumbnail' => $this->getThumbnail($raw, $type), ], - 'height' => $height, - 'width' => $width, - 'target' => $canvasUrl, - 'thumbnail' => $this->getThumbnail($raw, $type), - ], ], - ], + ], ], ]; } else { // Format as a generic download: + if ($type == 'audio') { + $preferredType = 'Sound'; + $preferredRendering = 'audio/mp3'; + } elseif ($type == 'video') { + $preferredType = 'MovingImage'; + $preferredRendering = 'video/mp4'; + } else { + $preferredType = 'foaf:Document'; + $preferredRendering = 'application/pdf'; + } $url = $this->getUri( 'files', ['type' => 'MASTER', 'id' => $raw['id']] @@ -381,11 +382,13 @@ protected function getSingleCanvas($id, $i, $raw, $type, $list, $outline) 'width' => 800, 'items' => [ [ - 'id' => $canvasUrl . '/annotationpage', + //'id' => $canvasUrl . '/annotationpage', + 'id' => $canvasUrl . '#content', 'type' => 'AnnotationPage', 'items' => [ [ - 'id' => $canvasUrl . '/annotation/' . $i, + //'id' => $canvasUrl . '/annotation/' . $i, + 'id' => $canvasUrl . '#item' . $i, 'type' => 'Annotation', 'motivation' => 'painting', 'body' => [ @@ -403,7 +406,6 @@ protected function getSingleCanvas($id, $i, $raw, $type, $list, $outline) ], ]; } - return [ 'type' => $canvasType, 'id' => $canvasUrl, @@ -445,9 +447,8 @@ protected function getThumbnail($raw, $type) $id = $renderings[$bestRendering]['id'] . '#element'; $format = $renderings[$bestRendering]['format']; - $extras = []; if (in_array('THUMBNAIL', $raw['datastreams'])) { - $extras['thumbnail'] = $this->getUri( + $getThumb = $this->getUri( 'files', ['type' => 'THUMBNAIL', 'id' => $raw['id']] ); @@ -459,17 +460,19 @@ protected function getThumbnail($raw, $type) } else { $thumbFilename = 'default.png'; } - $extras['thumbnail'] = $this->getUri('home') + $getThumb = $this->getUri('home') . 'themes/vudiglib/images/vudl/' . $thumbFilename; } - $thumb[] = [ - 'id' => $extras['thumbnail'], - 'type' => 'Image', - 'format' => 'image/png', + $thumbnail = [ + [ + 'id' => $getThumb, + 'type' => 'Image', + 'format' => 'image/png', + ] ]; - return $thumb; + return $thumbnail; } /** @@ -743,39 +746,25 @@ protected function getMasterRenderings($list) */ protected function getSequenceRenderingData($outline, $canvasList, $raw) { - $renderings = []; - $hasMixedList = $hasImageList = false; foreach ($outline['lists'] as $list) { if ($this->isAudioList($list) && $this->isAudioList($canvasList)) { $filtered = $this->filterAudioList($list); if (count($filtered['other']) > 0) { - $renderings = array_merge( - $renderings, - $this->getMasterRenderings($filtered['other']) - ); - $hasMixedList = true; + $renderings = $this->getMasterRenderings($filtered['other']); } } elseif ($this->isPdfList($list) && $this->isPdfList($canvasList)) { $filtered = $this->filterPdfList($list); if (count($filtered['other']) > 0) { - $renderings = array_merge( - $renderings, - $this->getMasterRenderings($filtered['other']) - ); - $hasMixedList = true; + $renderings = $this->getMasterRenderings($filtered['other']); } } elseif (!$this->isImageList($list)) { - $renderings = array_merge( - $renderings, - $this->getMasterRenderings($list) - ); + $renderings = $this->getMasterRenderings($list); } else { - $hasImageList = true; + $renderings = []; } } - $CanvasRenderings = $this->getCanvasRenderingData($raw); - $retVal = array_merge($CanvasRenderings, $renderings); - // If we don't have an image list, we don't need alternate renderings: + $canvasRenderings = $this->getCanvasRenderingData($raw); + $retVal = array_merge($canvasRenderings, $renderings); return $retVal; } @@ -978,14 +967,15 @@ protected function getRequiredStatement($license) ? '' . htmlspecialchars($licenseData['alt']) . '' : htmlspecialchars($licenseData['text']); - return [ - 'label' => ['en' => ['ATTRIBUTION']], - 'value' => ['en' => ['Digital Library@Villanova University' + $value = 'Digital Library@Villanova University' . '

Disclaimers:
' . $this->getDisclaimers() . '

' . 'License:
' . '' . $linkContent . '' - . '
']], + . '
'; + return [ + 'label' => ['en' => ['ATTRIBUTION']], + 'value' => ['en' => [$value]], ]; } @@ -1011,7 +1001,7 @@ public function getManifestData($id, $outline, $parents = []) 'en' => [ $details['title']['value'] ?? 'Untitled', ], - ], + ], 'metadata' => $this->extractManifestMetadata($id, $details), 'summary' => ['en' => [ isset($details['description']['value']) diff --git a/themes/vudiglib/templates/vudl/viewer.phtml b/themes/vudiglib/templates/vudl/viewer.phtml index f27e879..ed98050 100755 --- a/themes/vudiglib/templates/vudl/viewer.phtml +++ b/themes/vudiglib/templates/vudl/viewer.phtml @@ -61,12 +61,14 @@
- metadata as $data): ?> - - - - - + + metadata as $data): ?> + + + + + +
From 5955b41c2f05280cedba70617d09ade3277cfb46 Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Mon, 27 Oct 2025 14:03:02 -0400 Subject: [PATCH 4/8] additional polish for IIIF 3 Manifest Generator. --- .../src/DigLib/IIIF/ManifestGenerator.php | 238 ++++++++++-------- themes/vudiglib/templates/vudl/viewer.phtml | 8 +- 2 files changed, 144 insertions(+), 102 deletions(-) diff --git a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php index 46d8915..3b5f052 100755 --- a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php +++ b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php @@ -220,17 +220,16 @@ protected function extractManifestMetadata($id, $details) // Add some useful links to the bottom: $recordUrl = $this->getUri('record', ['id' => $id]); $persistUrl = $this->getUri('vudl-record', ['id' => $id]); - $sortedRetVal[] = [ - 'label' => ['en' => ['About']], - 'value' => ['en' => ['' + $value = '' . 'More Details
' . 'Permanent Link' - . '
']], + . '
'; + return [ + 'label' => ['en' => ['About']], + 'value' => ['en' => [$value]], ]; - - return $sortedRetVal; } /** @@ -299,7 +298,7 @@ protected function getImageDetailsForCanvas($raw, $imageServerBase) } /** - * Build JSON data for a single canvas. + * Build JSON data for a non-image canvas. * * @param string $id Record ID * @param int $i Position of canvas in overall array (used for canvas ID generation) @@ -310,104 +309,128 @@ protected function getImageDetailsForCanvas($raw, $imageServerBase) * * @return array */ - protected function getSingleCanvas($id, $i, $raw, $type, $list, $outline) + protected function getAVCanvas($id, $i, $raw, $type, $list, $outline) { $canvasUrl = $this->getUri( 'vudl-record-canvas', ['id' => $id, 'canvas' => 'p' . $i] ); - - $canvasType = 'Canvas'; - if ($type === 'image') { - $imageServerBase = $this->config->Images->serverUrl ?? false; - if (!$imageServerBase) { - throw new \Exception('Must set image server base URL.'); - } - [$width, $height, $imageUrl, $mimeType] - = $this->getImageDetailsForCanvas($raw, $imageServerBase); - $content = [ - 'height' => $height, - 'width' => $width, - 'items' => [ - [ - 'id' => $this->getUri('record', ['id' => $id]), - 'type' => 'AnnotationPage', - 'items' => [ - [ - 'id' => $imageUrl, - 'type' => 'Annotation', - 'motivation' => 'painting', - 'body' => [ - 'id' => $imageServerBase . urlencode($raw['id']), - 'type' => 'Image', - 'format' => $mimeType, - 'service' => [ - [ - 'id' => $imageServerBase . urlencode($raw['id']), - 'type' => 'ImageService3', - 'profile' => 'level1', - ] - ], - ], - 'height' => $height, - 'width' => $width, - 'target' => $canvasUrl, - 'thumbnail' => $this->getThumbnail($raw, $type), + + // Format as a generic download: + if ($type == 'audio') { + $preferredType = 'Sound'; + $preferredRendering = 'audio/mp3'; + } elseif ($type == 'video') { + $preferredType = 'MovingImage'; + $preferredRendering = 'video/mp4'; + } else { + $preferredType = 'foaf:Document'; + $preferredRendering = 'application/pdf'; + } + $url = $this->getUri( + 'files', + ['type' => 'MASTER', 'id' => $raw['id']] + ); + $description = isset($raw['sizebytes_str']) + ? ($raw['sizebytes_str'] / 1024) . 'k' + : ''; + $content = [ + 'height' => 600, + 'width' => 800, + 'items' => [ + [ + 'id' => $canvasUrl . '#content', + 'type' => 'AnnotationPage', + 'items' => [ + [ + 'id' => $canvasUrl . '#item' . $i, + 'type' => 'Annotation', + 'motivation' => 'painting', + 'body' => [ + 'id' => $url, + 'type' => $preferredType, + 'format' => $preferredRendering ?? '', + 'label' => ['en' => [$raw['label']]], + 'description' => $description, ], + 'target' => $canvasUrl, + 'thumbnail' => $this->getThumbnail($raw, $type), ], ], ], - ]; - } else { - // Format as a generic download: - if ($type == 'audio') { - $preferredType = 'Sound'; - $preferredRendering = 'audio/mp3'; - } elseif ($type == 'video') { - $preferredType = 'MovingImage'; - $preferredRendering = 'video/mp4'; - } else { - $preferredType = 'foaf:Document'; - $preferredRendering = 'application/pdf'; - } - $url = $this->getUri( - 'files', - ['type' => 'MASTER', 'id' => $raw['id']] - ); - $description = isset($raw['sizebytes_str']) - ? ($raw['sizebytes_str'] / 1024) . 'k' - : ''; - $content = [ - 'height' => 600, - 'width' => 800, - 'items' => [ - [ - //'id' => $canvasUrl . '/annotationpage', - 'id' => $canvasUrl . '#content', - 'type' => 'AnnotationPage', - 'items' => [ - [ - //'id' => $canvasUrl . '/annotation/' . $i, - 'id' => $canvasUrl . '#item' . $i, - 'type' => 'Annotation', - 'motivation' => 'painting', - 'body' => [ - 'id' => $url, - 'type' => $preferredType, - 'format' => $preferredRendering ?? '', - 'label' => ['en' => [$raw['label']]], - 'description' => $description, + ], + ]; + + return [ + 'type' => 'Canvas', + 'id' => $canvasUrl, + 'label' => ['en' => [$raw['label'] ]] ?? '-', + 'rendering' => $this->getSequenceRenderingData($outline, $list, $raw), + 'thumbnail' => $this->getThumbnail($raw, $type), + ] + $content; + } + + /** + * Build JSON data for an image canvas. + * + * @param string $id Record ID + * @param int $i Position of canvas in overall array (used for canvas ID generation) + * @param array $raw Raw data to format into canvas + * @param string $type Type of list ('image' or 'audio') + * @param array $list List to check + * @param array $outline Outline data + * + * @return array + */ + protected function getImageCanvas($id, $i, $raw, $type, $list, $outline) + { + $canvasUrl = $this->getUri( + 'vudl-record-canvas', + ['id' => $id, 'canvas' => 'p' . $i] + ); + + $imageServerBase = $this->config->Images->serverUrl ?? false; + if (!$imageServerBase) { + throw new \Exception('Must set image server base URL.'); + } + [$width, $height, $imageUrl, $mimeType] + = $this->getImageDetailsForCanvas($raw, $imageServerBase); + $content = [ + 'height' => $height, + 'width' => $width, + 'items' => [ + [ + 'id' => $this->getUri('record', ['id' => $id]), + 'type' => 'AnnotationPage', + 'items' => [ + [ + 'id' => $imageUrl, + 'type' => 'Annotation', + 'motivation' => 'painting', + 'body' => [ + 'id' => $imageServerBase . urlencode($raw['id']), + 'type' => 'Image', + 'format' => $mimeType, + 'service' => [ + [ + 'id' => $imageServerBase . urlencode($raw['id']), + 'type' => 'ImageService3', + 'profile' => 'level1', + ], ], - 'target' => $canvasUrl, - 'thumbnail' => $this->getThumbnail($raw, $type), ], + 'height' => $height, + 'width' => $width, + 'target' => $canvasUrl, + 'thumbnail' => $this->getThumbnail($raw, $type), ], ], ], - ]; - } + ], + ]; + return [ - 'type' => $canvasType, + 'type' => 'Canvas', 'id' => $canvasUrl, 'label' => ['en' => [$raw['label'] ]] ?? '-', 'rendering' => $this->getSequenceRenderingData($outline, $list, $raw), @@ -464,15 +487,13 @@ protected function getThumbnail($raw, $type) . 'themes/vudiglib/images/vudl/' . $thumbFilename; } - $thumbnail = [ + return [ [ 'id' => $getThumb, 'type' => 'Image', 'format' => 'image/png', - ] + ], ]; - - return $thumbnail; } /** @@ -746,19 +767,29 @@ protected function getMasterRenderings($list) */ protected function getSequenceRenderingData($outline, $canvasList, $raw) { + $renderings = []; foreach ($outline['lists'] as $list) { if ($this->isAudioList($list) && $this->isAudioList($canvasList)) { $filtered = $this->filterAudioList($list); if (count($filtered['other']) > 0) { - $renderings = $this->getMasterRenderings($filtered['other']); + $renderings = array_merge( + $renderings, + $this->getMasterRenderings($filtered['other']) + ); } } elseif ($this->isPdfList($list) && $this->isPdfList($canvasList)) { $filtered = $this->filterPdfList($list); if (count($filtered['other']) > 0) { - $renderings = $this->getMasterRenderings($filtered['other']); + $renderings = array_merge( + $renderings, + $this->getMasterRenderings($filtered['other']) + ); } } elseif (!$this->isImageList($list)) { - $renderings = $this->getMasterRenderings($list); + $renderings = array_merge( + $renderings, + $this->getMasterRenderings($list) + ); } else { $renderings = []; } @@ -840,7 +871,8 @@ protected function getItems($id, $outline) $items = []; foreach ($list as $i => $current) { - $items[] = $this->getSingleCanvas( + if($type==='image'){ + $items[] = $this->getImageCanvas( $id, $i, $current, @@ -848,6 +880,16 @@ protected function getItems($id, $outline) $list, $outline ); + } else { + $items[] = $this->getAVCanvas( + $id, + $i, + $current, + $type, + $list, + $outline + ); + } } return $items; diff --git a/themes/vudiglib/templates/vudl/viewer.phtml b/themes/vudiglib/templates/vudl/viewer.phtml index ed98050..d428902 100755 --- a/themes/vudiglib/templates/vudl/viewer.phtml +++ b/themes/vudiglib/templates/vudl/viewer.phtml @@ -61,14 +61,14 @@
- - metadata as $data): ?> + metadata as $data): ?> + - - + +
From aa52d52e154856b57076e6ec41767f36a547ef5f Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Mon, 27 Oct 2025 14:42:57 -0400 Subject: [PATCH 5/8] Fixed perms! --- module/DigLib/src/DigLib/Controller/VuDLController.php | 0 module/DigLib/src/DigLib/IIIF/ManifestGenerator.php | 0 themes/vudiglib/js/vudl/uv-setup-v4.js | 0 themes/vudiglib/templates/vudl/viewer.phtml | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 module/DigLib/src/DigLib/Controller/VuDLController.php mode change 100755 => 100644 module/DigLib/src/DigLib/IIIF/ManifestGenerator.php mode change 100755 => 100644 themes/vudiglib/js/vudl/uv-setup-v4.js mode change 100755 => 100644 themes/vudiglib/templates/vudl/viewer.phtml diff --git a/module/DigLib/src/DigLib/Controller/VuDLController.php b/module/DigLib/src/DigLib/Controller/VuDLController.php old mode 100755 new mode 100644 diff --git a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php old mode 100755 new mode 100644 diff --git a/themes/vudiglib/js/vudl/uv-setup-v4.js b/themes/vudiglib/js/vudl/uv-setup-v4.js old mode 100755 new mode 100644 diff --git a/themes/vudiglib/templates/vudl/viewer.phtml b/themes/vudiglib/templates/vudl/viewer.phtml old mode 100755 new mode 100644 From 19504d35cfc49ce7d875c619a9871b03d5c6c33f Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Mon, 3 Nov 2025 09:27:22 -0500 Subject: [PATCH 6/8] Additional polish on IIIF 3.0 manifest generator --- .../src/DigLib/IIIF/ManifestGenerator.php | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php index 3b5f052..c835879 100644 --- a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php +++ b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php @@ -309,14 +309,13 @@ protected function getImageDetailsForCanvas($raw, $imageServerBase) * * @return array */ - protected function getAVCanvas($id, $i, $raw, $type, $list, $outline) + protected function getNonImageCanvas($id, $i, $raw, $type, $list, $outline) { $canvasUrl = $this->getUri( 'vudl-record-canvas', ['id' => $id, 'canvas' => 'p' . $i] ); - - // Format as a generic download: + if ($type == 'audio') { $preferredType = 'Sound'; $preferredRendering = 'audio/mp3'; @@ -324,6 +323,7 @@ protected function getAVCanvas($id, $i, $raw, $type, $list, $outline) $preferredType = 'MovingImage'; $preferredRendering = 'video/mp4'; } else { + // Format as a generic download: $preferredType = 'foaf:Document'; $preferredRendering = 'application/pdf'; } @@ -428,7 +428,7 @@ protected function getImageCanvas($id, $i, $raw, $type, $list, $outline) ], ], ]; - + return [ 'type' => 'Canvas', 'id' => $canvasUrl, @@ -790,8 +790,6 @@ protected function getSequenceRenderingData($outline, $canvasList, $raw) $renderings, $this->getMasterRenderings($list) ); - } else { - $renderings = []; } } $canvasRenderings = $this->getCanvasRenderingData($raw); @@ -871,17 +869,17 @@ protected function getItems($id, $outline) $items = []; foreach ($list as $i => $current) { - if($type==='image'){ + if ($type === 'image') { $items[] = $this->getImageCanvas( - $id, - $i, - $current, - $type, - $list, - $outline - ); + $id, + $i, + $current, + $type, + $list, + $outline + ); } else { - $items[] = $this->getAVCanvas( + $items[] = $this->getNonImageCanvas( $id, $i, $current, From 3d2e4ded8abc216894ccf93c158e0462e814b3a0 Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Mon, 3 Nov 2025 11:25:14 -0500 Subject: [PATCH 7/8] fixed bug in manifest generator that prevented metadata from being recorded --- module/DigLib/src/DigLib/IIIF/ManifestGenerator.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php index c835879..ea80e68 100644 --- a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php +++ b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php @@ -217,6 +217,8 @@ protected function extractManifestMetadata($id, $details) foreach ($retVal as $current) { $sortedRetVal[] = $current; } + // var_export($sortedRetVal); + // die; // Add some useful links to the bottom: $recordUrl = $this->getUri('record', ['id' => $id]); $persistUrl = $this->getUri('vudl-record', ['id' => $id]); @@ -226,10 +228,11 @@ protected function extractManifestMetadata($id, $details) . 'Permanent Link' . ''; - return [ + $sortedRetVal[] = [ 'label' => ['en' => ['About']], 'value' => ['en' => [$value]], ]; + return $sortedRetVal; } /** From 0c2e5bfe2973d3bbf47ab1607a66584891cd5a16 Mon Sep 17 00:00:00 2001 From: Jason Benson Date: Mon, 3 Nov 2025 11:27:27 -0500 Subject: [PATCH 8/8] forgot to remove an uneeded comment --- module/DigLib/src/DigLib/IIIF/ManifestGenerator.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php index ea80e68..d0dc5fa 100644 --- a/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php +++ b/module/DigLib/src/DigLib/IIIF/ManifestGenerator.php @@ -217,8 +217,6 @@ protected function extractManifestMetadata($id, $details) foreach ($retVal as $current) { $sortedRetVal[] = $current; } - // var_export($sortedRetVal); - // die; // Add some useful links to the bottom: $recordUrl = $this->getUri('record', ['id' => $id]); $persistUrl = $this->getUri('vudl-record', ['id' => $id]);