From 59eb9f1b345c3706b6630e7932cbef3fa577f116 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Wed, 12 Jun 2024 11:54:03 -0300 Subject: [PATCH 1/2] pkp/pkp-lib#9927 add cover image to onix export data --- .../onix30/filter/MonographONIX30XmlFilter.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php b/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php index 0566beee530..f8cfd5da974 100644 --- a/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php +++ b/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php @@ -480,6 +480,17 @@ public function createProductNode($doc, $submission, $publicationFormat) $textContentNode->appendChild($this->_buildTextNode($doc, 'ContentAudience', '00')); // Any audience $textContentNode->appendChild($this->_buildTextNode($doc, 'Text', $abstract)); // Any audience + $supportingResourceNode = $doc->createElementNS($deployment->getNamespace(), 'SupportingResource'); + $collateralDetailNode->appendChild($supportingResourceNode); + $supportingResourceNode->appendChild($this->_buildTextNode($doc, 'ResourceContentType', '01')); // Front cover + $supportingResourceNode->appendChild($this->_buildTextNode($doc, 'ContentAudience', '00')); // Any audience + $supportingResourceNode->appendChild($this->_buildTextNode($doc, 'ResourceMode', '03')); // A still image + + $resourceVersionNode = $doc->createElementNS($deployment->getNamespace(), 'ResourceVersion'); + $supportingResourceNode->appendChild($resourceVersionNode); + $resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceForm', '01')); // Linkable resource + $resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceLink', $publication->getLocalizedCoverImageUrl($context->getId()))); + /* --- Publishing Detail --- */ $publishingDetailNode = $doc->createElementNS($deployment->getNamespace(), 'PublishingDetail'); From 61f1933b7a70025ea37462e4646571c7209ec092 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Thu, 13 Jun 2024 18:07:42 -0300 Subject: [PATCH 2/2] pkp/pkp-lib#9927 set optional locale param for getLocalizedCoverImageUrl --- classes/publication/Publication.php | 7 ++++--- .../onix30/filter/MonographONIX30XmlFilter.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/publication/Publication.php b/classes/publication/Publication.php index 74027d4abed..e21def25782 100644 --- a/classes/publication/Publication.php +++ b/classes/publication/Publication.php @@ -49,12 +49,13 @@ public function getEditorString() * Get the URL to a localized cover image * * @param int $contextId - * + * @param string $preferredLocale Return the cover image in a specified locale. + * * @return string */ - public function getLocalizedCoverImageUrl($contextId) + public function getLocalizedCoverImageUrl($contextId, $preferredLocale = null) { - $coverImage = $this->getLocalizedData('coverImage'); + $coverImage = $this->getLocalizedData('coverImage', $preferredLocale); if (!$coverImage) { return Application::get()->getRequest()->getBaseUrl() . '/templates/images/book-default.png'; diff --git a/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php b/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php index f8cfd5da974..c9e2a5fa2a9 100644 --- a/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php +++ b/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php @@ -489,7 +489,7 @@ public function createProductNode($doc, $submission, $publicationFormat) $resourceVersionNode = $doc->createElementNS($deployment->getNamespace(), 'ResourceVersion'); $supportingResourceNode->appendChild($resourceVersionNode); $resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceForm', '01')); // Linkable resource - $resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceLink', $publication->getLocalizedCoverImageUrl($context->getId()))); + $resourceVersionNode->appendChild($this->_buildTextNode($doc, 'ResourceLink', $publication->getLocalizedCoverImageUrl($context->getId(), $publication->getData('locale')))); /* --- Publishing Detail --- */