From 5dc46ce9b3e23b62b4e43fa1a15c9f881cd9e565 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Fri, 2 Aug 2024 10:50:23 -0300 Subject: [PATCH] pkp/pkp-lib#9925 add license data to Onix export --- .../filter/MonographONIX30XmlFilter.php | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php b/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php index 46b58182dc..1a046e9e9d 100644 --- a/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php +++ b/plugins/importexport/onix30/filter/MonographONIX30XmlFilter.php @@ -248,6 +248,28 @@ public function createProductNode($doc, $submission, $publicationFormat) $descDetailNode->appendChild($this->_buildTextNode($doc, 'EpubTechnicalProtection', $publicationFormat->getTechnicalProtectionCode())); } + /* --- License information --- */ + + $publication = $submission->getCurrentPublication(); + + if ($publication->isCCLicense()) { + $licenseOpts = Application::getCCLicenseOptions(); + $licenseUrl = $publication->getData('licenseUrl'); + if (array_key_exists($licenseUrl, $licenseOpts)) { + $licenseName = (__($licenseOpts[$licenseUrl], [], $publication->getData('locale'))); + + $epubLicenseNode = $doc->createElementNS($deployment->getNamespace(), 'EpubLicense'); + $descDetailNode->appendChild($epubLicenseNode); + $epubLicenseNode->appendChild($this->_buildTextNode($doc, 'EpubLicenseName', $licenseName)); + + $epubLicenseExpressionNode = $doc->createElementNS($deployment->getNamespace(), 'EpubLicenseExpression'); + $epubLicenseNode->appendChild($epubLicenseExpressionNode); + + $epubLicenseExpressionNode->appendChild($this->_buildTextNode($doc, 'EpubLicenseExpressionType', '02')); + $epubLicenseExpressionNode->appendChild($this->_buildTextNode($doc, 'EpubLicenseExpressionLink', $licenseUrl)); + } + } + /* --- Collection information, first for series and then for product --- */ /* --- Series information, if this monograph is part of one. --- */ @@ -300,7 +322,6 @@ public function createProductNode($doc, $submission, $publicationFormat) $productTitleDetailNode->appendChild($titleElementNode); - $publication = $submission->getCurrentPublication(); if (!$publication->getLocalizedData('prefix') || !$publication->getLocalizedData('title')) { $titleElementNode->appendChild($this->_buildTextNode($doc, 'TitleText', trim($publication->getLocalizedData('prefix') ?? $publication->getLocalizedTitle()))); } else {