From 8d4cf6be7705d4eb2f28bf8846bf19e07a7474f9 Mon Sep 17 00:00:00 2001 From: Withanage Date: Wed, 7 Sep 2022 14:30:52 +0200 Subject: [PATCH 1/6] https://github.com/pkp/texture/issues/110 add createGally support --- TexturePlugin.inc.php | 10 +- .../TextureHandler.inc.php | 12 +- .../form/TextureArticleGalleyForm.inc.php | 133 +++++++++++------- 3 files changed, 95 insertions(+), 60 deletions(-) rename TextureHandler.inc.php => controllers/TextureHandler.inc.php (98%) diff --git a/TexturePlugin.inc.php b/TexturePlugin.inc.php index 4c56138..7786f4b 100644 --- a/TexturePlugin.inc.php +++ b/TexturePlugin.inc.php @@ -102,7 +102,7 @@ public function callbackLoadHandler($hookName, $args) { case 'texture/media': define('HANDLER_CLASS', 'TextureHandler'); define('TEXTURE_PLUGIN_NAME', $this->getName()); - $args[2] = $this->getPluginPath() . '/' . 'TextureHandler.inc.php'; + $args[2] = $this->getPluginPath() .DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR. 'TextureHandler.inc.php'; break; } @@ -137,12 +137,12 @@ public function templateFetchCallback($hookName, $params) { if (strtolower($fileExtension) == 'text/xml') { import('lib.pkp.classes.linkAction.request.OpenWindowAction'); $this->_editWithTextureAction($row, $dispatcher, $request, $submissionFile, $stageId); - //$this->_createGalleyAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage); - //$this->_exportAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage); + $this->_createGalleyAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage); + #$this->_exportAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage); } elseif (strtolower($fileExtension) == TEXTURE_DAR_FILE_TYPE) { - $this->_extractAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage, TEXTURE_DAR_FILE_TYPE); + // $this->_extractAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage, TEXTURE_DAR_FILE_TYPE); } elseif (strtolower($fileExtension) == TEXTURE_ZIP_FILE_TYPE) { - $this->_extractAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage, TEXTURE_ZIP_FILE_TYPE); + // $this->_extractAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage, TEXTURE_ZIP_FILE_TYPE); } elseif (strtolower($fileExtension) == TEXTURE_HTML_FILE_TYPE) { import('lib.pkp.classes.linkAction.request.OpenWindowAction'); $this->_createGalleyAction($row, $dispatcher, $request, $submissionFile, $stageId, $fileStage); diff --git a/TextureHandler.inc.php b/controllers/TextureHandler.inc.php similarity index 98% rename from TextureHandler.inc.php rename to controllers/TextureHandler.inc.php index d3f1a9b..0e1af96 100755 --- a/TextureHandler.inc.php +++ b/controllers/TextureHandler.inc.php @@ -96,7 +96,7 @@ public function extract($args, $request) { $user = $request->getUser(); $zipType = $request->getUserVar("zipType"); $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); - $archivePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'texture-' . $zipType . '-archive' . mt_rand(); + $archivePath = TextureHandler . inc . 'texture-' . $zipType . '-archive' . mt_rand(); $image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe'); $html_types = array('html'); @@ -110,7 +110,7 @@ public function extract($args, $request) { $genreDAO = DAORegistry::getDAO('GenreDAO'); $genre = $genreDAO->getByKey('SUBMISSION', $submission->getData('contextId')); $fileStage = $submissionFile->getFileStage(); - $sourceFileId = $submissionFile->getData('submissionFileId'); + $sourceFileId = $submissionFile->getData('fileId'); if ($zipType == TEXTURE_DAR_FILE_TYPE) { $manifestFileDom = new DOMDocument(); $darManifestFilePath = $archivePath . DIRECTORY_SEPARATOR . DAR_MANIFEST_FILE; @@ -559,7 +559,7 @@ public function json($args, $request) { } elseif (!empty($resources) && isset($resources[DAR_MANUSCRIPT_FILE]) && is_object($resources[DAR_MANUSCRIPT_FILE])) { - $this->_updateManuscriptFile($request, $resources, $submission, $submissionFile); + $this->updateManuscriptFile($request, $resources, $submission, $submissionFile); } else { return new JSONMessage(false); } @@ -579,7 +579,7 @@ public function json($args, $request) { * @param $submissionFile SubmissionFile * @return SubmissionFile */ - protected function _updateManuscriptFile($request, $resources, $submission, $submissionFile) { + protected function updateManuscriptFile($request, $resources, $submission, $submissionFile) { $modifiedDocument = new DOMDocument('1.0', 'utf-8'); $modifiedData = $resources[DAR_MANUSCRIPT_FILE]->data; @@ -593,6 +593,10 @@ protected function _updateManuscriptFile($request, $resources, $submission, $sub $origDocument = new DOMDocument('1.0', 'utf-8'); $origDocument->loadXML($manuscriptXml); + + # add license + + $body = $origDocument->documentElement->getElementsByTagName('body')->item(0); $origDocument->documentElement->removeChild($body); diff --git a/controllers/grid/form/TextureArticleGalleyForm.inc.php b/controllers/grid/form/TextureArticleGalleyForm.inc.php index 86660cb..83e778b 100644 --- a/controllers/grid/form/TextureArticleGalleyForm.inc.php +++ b/controllers/grid/form/TextureArticleGalleyForm.inc.php @@ -16,7 +16,8 @@ import('lib.pkp.classes.form.Form'); -class TextureArticleGalleyForm extends Form { +class TextureArticleGalleyForm extends Form +{ /** @var the $_submission */ var $_submission = null; @@ -31,7 +32,8 @@ class TextureArticleGalleyForm extends Form { * @param $publication * @param $submission Submission */ - function __construct($request, $plugin, $publication, $submission) { + function __construct($request, $plugin, $publication, $submission) + { $this->_submission = $submission; $this->_publication = $publication; @@ -52,9 +54,7 @@ function __construct($request, $plugin, $publication, $submission) { 'required', 'editor.issues.galleyLocaleRequired' ), - function ($galleyLocale) use ($journal) { - return in_array($galleyLocale, $journal->getSupportedSubmissionLocaleNames()); - } + ); } @@ -63,7 +63,8 @@ function ($galleyLocale) use ($journal) { * @param $request * @return string */ - function fetch($request, $template = null, $display = false) { + function fetch($request, $template = null, $display = false) + { $journal = $request->getJournal(); $templateMgr = TemplateManager::getManager($request); @@ -83,7 +84,8 @@ function fetch($request, $template = null, $display = false) { /** * Assign form data to user-submitted data. */ - function readInputData() { + function readInputData() + { $this->readUserVars( array( 'label', @@ -98,69 +100,98 @@ function readInputData() { * Create article galley and dependent files * @return ArticleGalley The resulting article galley. */ - function execute(...$functionArgs) { + function execute(...$functionArgs) + { + $request = Application::get()->getRequest(); + $locale = AppLocale::getLocale(); + + $sourceFile = Services::get('submissionFile')->get($this->getData('submissionFileId')); + + $submissionDir = Services::get('submissionFile')->getSubmissionDir($this->getSubmission()->getData('contextId'), $this->getSubmission()->getId()); + $files_dir = Config::getVar('files', 'files_dir') . DIRECTORY_SEPARATOR; + $newFileId = Services::get('file')->add( + $files_dir . $sourceFile->getData('path'), + $files_dir . $submissionDir . DIRECTORY_SEPARATOR . uniqid() . '.xml' + ); + + $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); + $newSubmissionFile = $submissionFileDao->newDataObject(); + + $newSubmissionFile->setAllData( + [ + 'fileId' => $newFileId, + 'assocType' => $sourceFile->getData('assocType'), + 'assocId' => $sourceFile->getData('assocId'), + 'fileStage' => SUBMISSION_FILE_PROOF, + 'mimetype' => $sourceFile->getData('mimetype'), + 'locale' => $sourceFile->getData('locale'), + 'genreId' => $sourceFile->getData('genreId'), + 'name' => $sourceFile->getLocalizedData('name'), + 'submissionId' => $this->getSubmission()->getId() + ] + ); - $context = Application::getRequest()->getJournal(); - $submissionId = $this->_submission->getId(); + $newSubmissionFile = Services::get('submissionFile')->add($newSubmissionFile, $request); + + // Associate XML file into galley // Create new galley $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); $articleGalley = $articleGalleyDao->newDataObject(); $articleGalley->setData('publicationId', $this->_publication->getId()); $articleGalley->setLabel($this->getData('label')); $articleGalley->setLocale($this->getData('galleyLocale')); - $newGalleyId = $articleGalleyDao->insertObject($articleGalley); + $articleGalley->setFileId($newSubmissionFile->getData('id')); - $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); - $fileStage = $this->getData('fileStage'); - $submissionFile = $submissionFileDao->getLatestRevision( $this->getData('submissionFileId'), $fileStage, $submissionId); - - // Create galley XML file from the production XML source file - import('lib.pkp.classes.file.SubmissionFileManager'); - $submissionFileManager = new SubmissionFileManager($context->getId(), $submissionFile); - $fileId = $submissionFile->getData('submissionFileId'); - $revision = $submissionFile->getRevision(); - $genreDAO = DAORegistry::getDAO('GenreDAO'); - $genre = $genreDAO->getByKey('SUBMISSION', $this->_submission->getData('contextId')); - - - list($newFileId, $newRevision) = $submissionFileManager->copyFileToFileStage($fileId, $revision, $fileStage, null, true); - $newSubmissionFile = $submissionFileDao->getLatestRevision($newFileId, $fileStage, $submissionId); - $newSubmissionFile->setAssocType(ASSOC_TYPE_REPRESENTATION); - $newSubmissionFile->setAssocId($newGalleyId); - $newSubmissionFile->setGenreId($genre->getId()); - $newSubmissionFile->setFileStage(SUBMISSION_FILE_PROOF); - $submissionFileDao->updateObject($newSubmissionFile); + Services::get('galley')->add($articleGalley, $request); - // Associate XML file into galley - if ($articleGalley) { - $articleGalley->setFileId($newSubmissionFile->getFileId()); - $articleGalleyDao->updateObject($articleGalley); - } // Get dependent files of the XML source file - $dependentFiles = $submissionFileDao->getLatestRevisionsByAssocId( - ASSOC_TYPE_SUBMISSION_FILE, - $submissionFile->getData('submissionFileId'), - $submissionFile->getData(), - SUBMISSION_FILE_DEPENDENT - ); - // Copy dependent files to the galley XML file + $dependentFiles = Services::get('submissionFile')->getMany([ + 'assocTypes' => [ASSOC_TYPE_SUBMISSION_FILE], + 'assocIds' => [$sourceFile->getData('id')], + 'submissionIds' => [$this->getSubmission()->getId()], + 'fileStages' => [SUBMISSION_FILE_DEPENDENT], + 'includeDependentFiles' => true, + ]); + + foreach ($dependentFiles as $dependentFile) { - $dependentFileId = $dependentFile->getFileId(); - $dependentFileRevision = $dependentFile->getRevision(); - $dependentFileStage = $dependentFile->getFileStage(); - - list($newDependentFileId, $newDependentFileRevision) = $submissionFileManager->copyFileToFileStage($dependentFileId, $dependentFileRevision, $dependentFileStage, null, true); - $newDependentFile = $submissionFileDao->getLatestRevision($newDependentFileId, SUBMISSION_FILE_DEPENDENT, $submissionId); - $newDependentFile->setAssocId($newFileId); - $submissionFileDao->updateObject($newDependentFile); + + $newDependentFileId = Services::get('file')->add( + $files_dir . $dependentFile->getData('path'), + $files_dir . $submissionDir . DIRECTORY_SEPARATOR . uniqid() . '.xml' + ); + + $newDependentFile = $submissionFileDao->newDataObject(); + + $newDependentFile->setAllData( + [ + 'fileId' => $newDependentFileId, + 'assocType' => $dependentFile->getData('assocType'), + 'assocId' => $newSubmissionFile->getData('id'), + 'fileStage' => SUBMISSION_FILE_DEPENDENT, + 'mimetype' => $dependentFile->getData('mimetype'), + 'locale' => $dependentFile->getData('locale'), + 'genreId' => $dependentFile->getData('genreId'), + 'name' => $dependentFile->getLocalizedData('name'), + 'submissionId' => $this->getSubmission()->getId() + ] + ); + + Services::get('submissionFile')->add($newDependentFile, $request); + } return $articleGalley; } + function getSubmission() + { + return $this->_submission; + } + } From 69e690caf8229c1955358b44662e51ffe898054f Mon Sep 17 00:00:00 2001 From: Withanage Date: Wed, 7 Sep 2022 17:08:32 +0200 Subject: [PATCH 2/6] https://github.com/pkp/texture/issues/110 add automated cc-by license --- controllers/TextureHandler.inc.php | 1 - .../form/TextureArticleGalleyForm.inc.php | 61 +++++++++++++++++-- locale/en_US/locale.po | 7 +++ templates/TextureArticleGalley.tpl | 10 ++- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/controllers/TextureHandler.inc.php b/controllers/TextureHandler.inc.php index 0e1af96..d8baaf8 100755 --- a/controllers/TextureHandler.inc.php +++ b/controllers/TextureHandler.inc.php @@ -594,7 +594,6 @@ protected function updateManuscriptFile($request, $resources, $submission, $subm $origDocument->loadXML($manuscriptXml); - # add license $body = $origDocument->documentElement->getElementsByTagName('body')->item(0); diff --git a/controllers/grid/form/TextureArticleGalleyForm.inc.php b/controllers/grid/form/TextureArticleGalleyForm.inc.php index 83e778b..9373b07 100644 --- a/controllers/grid/form/TextureArticleGalleyForm.inc.php +++ b/controllers/grid/form/TextureArticleGalleyForm.inc.php @@ -91,7 +91,8 @@ function readInputData() 'label', 'galleyLocale', 'submissionFileId', - 'fileStage' + 'fileStage', + 'createLicense' ) ); } @@ -103,17 +104,66 @@ function readInputData() function execute(...$functionArgs) { $request = Application::get()->getRequest(); - $locale = AppLocale::getLocale(); $sourceFile = Services::get('submissionFile')->get($this->getData('submissionFileId')); $submissionDir = Services::get('submissionFile')->getSubmissionDir($this->getSubmission()->getData('contextId'), $this->getSubmission()->getId()); $files_dir = Config::getVar('files', 'files_dir') . DIRECTORY_SEPARATOR; + + + $origDocument = new DOMDocument('1.0', 'utf-8'); + $sourceFileContent = Services::get('file')->fs->read($sourceFile->getData('path')); + $origDocument->loadXML($sourceFileContent); + + $xpath = new DOMXpath($origDocument); + + # add license + $permissions = $xpath->query("//article/front/article-meta/permissions"); + foreach ($permissions as $permission) { + $origDocument->documentElement->removeChild($permission); + } + + // add licnese + $articleMeta = $xpath->query("//article/front/article-meta"); + if($this->getData('createLicense') and count($articleMeta) > 0) { + + $permissionNode = $origDocument->createElement('permissions'); + + $copyrightStatementNode = $origDocument->createElement('copyright-statement','© 2021 The Author(s)'); + $permissionNode->appendChild($copyrightStatementNode); + + $copyrightYearNode = $origDocument->createElement('copyright-year','2021'); + $permissionNode->appendChild($copyrightYearNode); + + $copyrightLicenseNode = $origDocument->createElement('copyright-license'); + $copyrightLicenseNode->setAttribute('license-type','open-access'); + $copyrightLicenseNode->setAttribute('xlink:href','http://creativecommons.org/licenses/by/4.0/'); + $copyrightLicenseNode->setAttribute('xml:lang','en'); + + $copyrightLicensePNode = $origDocument->createElement('license-p'); + + $inlineGraphicNode = $origDocument->createElement('inline-graphic'); + $inlineGraphicNode->setAttribute('xlink:href','http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg'); + $copyrightLicensePNode->appendChild($inlineGraphicNode); + $licensePTextNode = $origDocument->createTextNode("This work is published under the Creative Commons License 4.0 (CC BY 4.0)."); + $copyrightLicensePNode->appendChild($licensePTextNode); + $copyrightLicenseNode->appendChild($copyrightLicensePNode); + $permissionNode->appendChild($copyrightLicenseNode); + $articleMeta[0]->appendChild($permissionNode); + } + + + + + $tmpfname = tempnam(sys_get_temp_dir(), 'texture-update-xml'); + file_put_contents($tmpfname, $origDocument->saveXML()); + + $newFileId = Services::get('file')->add( - $files_dir . $sourceFile->getData('path'), + $tmpfname, $files_dir . $submissionDir . DIRECTORY_SEPARATOR . uniqid() . '.xml' ); - + unlink($tmpfname); $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); $newSubmissionFile = $submissionFileDao->newDataObject(); @@ -132,6 +182,9 @@ function execute(...$functionArgs) ); + + + $newSubmissionFile = Services::get('submissionFile')->add($newSubmissionFile, $request); // Associate XML file into galley diff --git a/locale/en_US/locale.po b/locale/en_US/locale.po index 279f74f..fc7b683 100644 --- a/locale/en_US/locale.po +++ b/locale/en_US/locale.po @@ -46,3 +46,10 @@ msgstr "No valid DAR file" msgid "plugins.generic.texture.notification.extracted" msgstr "File extraction successful" + + +msgid "plugins.generic.texture.createGalley.customModifications" +msgstr "Custom modifications" + +msgid "plugins.generic.texture.createGalley.license" +msgstr "Add License (CC BY 4.0) " diff --git a/templates/TextureArticleGalley.tpl b/templates/TextureArticleGalley.tpl index 0ceb25b..d390041 100644 --- a/templates/TextureArticleGalley.tpl +++ b/templates/TextureArticleGalley.tpl @@ -16,7 +16,7 @@ -
+ {csrf} @@ -28,6 +28,14 @@ {fbvElement type="select" id="galleyLocale" label="common.language" from=$supportedLocales selected=$galleyLocale|default:$formLocale size=$fbvStyles.size.MEDIUM translate=false inline=true required=true} {/fbvFormSection} + + {fbvFormSection list="true" title="plugins.generic.texture.createGalley.customModifications"} + {fbvElement type="checkbox" id="createLicense" checked=false label="plugins.generic.texture.createGalley.license"} + + {/fbvFormSection} + + + {/fbvFormArea} {fbvFormButtons submitText="common.save"} From a1acab3880bdfecfa71fc5ea9bac3b7056088ee2 Mon Sep 17 00:00:00 2001 From: Withanage Date: Thu, 8 Sep 2022 16:06:22 +0200 Subject: [PATCH 3/6] https://github.com/pkp/texture/issues/112 Create License automatically from Distribution settings by galley creation --- controllers/TextureHandler.inc.php | 2 +- .../form/TextureArticleGalleyForm.inc.php | 109 +++++++++++++----- locale/en_US/locale.po | 13 ++- templates/TextureArticleGalley.tpl | 18 ++- 4 files changed, 109 insertions(+), 33 deletions(-) diff --git a/controllers/TextureHandler.inc.php b/controllers/TextureHandler.inc.php index d8baaf8..c311013 100755 --- a/controllers/TextureHandler.inc.php +++ b/controllers/TextureHandler.inc.php @@ -96,7 +96,7 @@ public function extract($args, $request) { $user = $request->getUser(); $zipType = $request->getUserVar("zipType"); $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); - $archivePath = TextureHandler . inc . 'texture-' . $zipType . '-archive' . mt_rand(); + $archivePath = '';//TextureHandler . inc . 'texture-' . $zipType . '-archive' . mt_rand(); $image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe'); $html_types = array('html'); diff --git a/controllers/grid/form/TextureArticleGalleyForm.inc.php b/controllers/grid/form/TextureArticleGalleyForm.inc.php index 9373b07..314dd52 100644 --- a/controllers/grid/form/TextureArticleGalleyForm.inc.php +++ b/controllers/grid/form/TextureArticleGalleyForm.inc.php @@ -65,16 +65,19 @@ function __construct($request, $plugin, $publication, $submission) */ function fetch($request, $template = null, $display = false) { - $journal = $request->getJournal(); + $context = $request->getJournal(); $templateMgr = TemplateManager::getManager($request); $templateMgr->assign(array( - 'supportedLocales' => $journal->getSupportedSubmissionLocaleNames(), + 'supportedLocales' => $context->getSupportedSubmissionLocaleNames(), 'submissionId' => $this->_submission->getId(), 'stageId' => $request->getUserVar('stageId'), 'fileStage' => $request->getUserVar('fileStage'), 'submissionFileId' => $request->getUserVar('submissionFileId'), 'publicationId' => $this->_publication->getId(), + 'datePublished' => $this->_publication->getData('datePublished'), + 'publisherInstitution' => $context->getData('publisherInstitution'), + 'onlineIssn' => $context->getData('onlineIssn') )); @@ -92,7 +95,12 @@ function readInputData() 'galleyLocale', 'submissionFileId', 'fileStage', - 'createLicense' + 'createJournalMeta', + 'createFpage', + 'createLpage', + 'datePublished', + 'onlineIssn', + 'publisherInstitution' ) ); } @@ -104,7 +112,7 @@ function readInputData() function execute(...$functionArgs) { $request = Application::get()->getRequest(); - + $context = $request->getJournal(); $sourceFile = Services::get('submissionFile')->get($this->getData('submissionFileId')); $submissionDir = Services::get('submissionFile')->getSubmissionDir($this->getSubmission()->getData('contextId'), $this->getSubmission()->getId()); @@ -125,34 +133,84 @@ function execute(...$functionArgs) // add licnese $articleMeta = $xpath->query("//article/front/article-meta"); - if($this->getData('createLicense') and count($articleMeta) > 0) { + $licenseUrl = $context->getData('licenseUrl'); + if (count($articleMeta) > 0 and $licenseUrl) { + $copyrightYear = date('Y'); + switch ($context->getData('copyrightYearBasis')) { + case 'submission': + $copyrightYear = date('Y', strtotime($this->_publication->getData('datePublished'))); + break; + case 'issue': + if ($this->_publication->getData('issueId')) { + $issueDao =& DAORegistry::getDAO('IssueDAO'); + $issue = $issueDao->getBySubmissionId($this->_submission->getId()); + if ($issue && $issue->getDatePublished()) { + $copyrightYear = date('Y', strtotime($issue->getDatePublished())); + } + } + break; + } + + PKPString::regexp_match_get('/http[s]?:(www\.)?\/\/creativecommons.org\/licenses\/([a-z]+(-[a-z]+)*)\/(\d.0)\/*([a-z]*).*/i', $licenseUrl, $matches); + if (count($matches) > 5 and $matches[2] and $matches[4]) { + $permissionNode = $origDocument->createElement('permissions'); + $copyrightStatementNode = $origDocument->createElement('copyright-statement', '© ' . $copyrightYear . ' The Author(s)'); + $permissionNode->appendChild($copyrightStatementNode); + $copyrightYearNode = $origDocument->createElement('copyright-year', $copyrightYear); + $permissionNode->appendChild($copyrightYearNode); + + $copyrightLicenseNode = $origDocument->createElement('copyright-license'); + $copyrightLicenseNode->setAttribute('license-type', 'open-access'); + $copyrightLicenseNode->setAttribute('xlink:href', $licenseUrl); + $copyrightLicenseNode->setAttribute('xml:lang', 'en'); + + $copyrightLicensePNode = $origDocument->createElement('license-p'); + + $inlineGraphicNode = $origDocument->createElement('inline-graphic'); + $inlineGraphicNode->setAttribute('xlink:href', 'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/' . $matches[2] . '.svg'); + $copyrightLicensePNode->appendChild($inlineGraphicNode); + + $countryCode = $matches[5] ? strtoupper($matches[5]) : ''; + $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); + $country = $isoCodes->getCountries()->getByAlpha2($countryCode) ? $isoCodes->getCountries()->getByAlpha2($countryCode)->getName() : ''; + $licensePTextNode = $origDocument->createTextNode("This work is published under the Creative Commons {$country} License {$matches[4]} (CC BY {$matches[4]} {$countryCode})."); + + $copyrightLicensePNode->appendChild($licensePTextNode); + $copyrightLicenseNode->appendChild($copyrightLicensePNode); + $permissionNode->appendChild($copyrightLicenseNode); + $articleMeta[0]->appendChild($permissionNode); + } + } - $permissionNode = $origDocument->createElement('permissions'); + // add date - $copyrightStatementNode = $origDocument->createElement('copyright-statement','© 2021 The Author(s)'); - $permissionNode->appendChild($copyrightStatementNode); + // add journal meta + $journalMeta = $xpath->query("//article/front/journal-meta"); + foreach ($journalMeta as $journalMetaEntry) { + $origDocument->documentElement->removeChild($journalMetaEntry); + } - $copyrightYearNode = $origDocument->createElement('copyright-year','2021'); - $permissionNode->appendChild($copyrightYearNode); + if ($this->getData('createJournalMeta') and count($journalMeta) > 0) { - $copyrightLicenseNode = $origDocument->createElement('copyright-license'); - $copyrightLicenseNode->setAttribute('license-type','open-access'); - $copyrightLicenseNode->setAttribute('xlink:href','http://creativecommons.org/licenses/by/4.0/'); - $copyrightLicenseNode->setAttribute('xml:lang','en'); + $journalMeta = $origDocument->createElement('journal-meta'); - $copyrightLicensePNode = $origDocument->createElement('license-p'); + $journalIdType = $origDocument->createElement('journal-id', $context->getLocalizedAcronym()); + $journalIdType->setAttribute('journal-id-type', 'publisher-id'); + $journalMeta->appendChild($journalIdType); + $issn = new $origDocument->createElement('issn'); + $issn->setAttribute('pub-type', 'epub'); - $inlineGraphicNode = $origDocument->createElement('inline-graphic'); - $inlineGraphicNode->setAttribute('xlink:href','http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg'); - $copyrightLicensePNode->appendChild($inlineGraphicNode); - $licensePTextNode = $origDocument->createTextNode("This work is published under the Creative Commons License 4.0 (CC BY 4.0)."); - $copyrightLicensePNode->appendChild($licensePTextNode); - $copyrightLicenseNode->appendChild($copyrightLicensePNode); - $permissionNode->appendChild($copyrightLicenseNode); - $articleMeta[0]->appendChild($permissionNode); } - + /*** + * + * XXX + * XXX-XXX + * + * TIB Open Publishing + * + * + */ $tmpfname = tempnam(sys_get_temp_dir(), 'texture-update-xml'); @@ -182,9 +240,6 @@ function execute(...$functionArgs) ); - - - $newSubmissionFile = Services::get('submissionFile')->add($newSubmissionFile, $request); // Associate XML file into galley diff --git a/locale/en_US/locale.po b/locale/en_US/locale.po index fc7b683..c1e5d28 100644 --- a/locale/en_US/locale.po +++ b/locale/en_US/locale.po @@ -51,5 +51,14 @@ msgstr "File extraction successful" msgid "plugins.generic.texture.createGalley.customModifications" msgstr "Custom modifications" -msgid "plugins.generic.texture.createGalley.license" -msgstr "Add License (CC BY 4.0) " +msgid "plugins.generic.texture.createGalley.fpage" +msgstr "First page" + +msgid "plugins.generic.texture.createGalley.lpage" +msgstr "Last page" + +msgid "plugins.generic.texture.createGalley.datePublished" +msgstr "Published date" + +msgid "plugins.generic.texture.createGalley.journalMeta" +msgstr "Add Journal metadata" diff --git a/templates/TextureArticleGalley.tpl b/templates/TextureArticleGalley.tpl index d390041..f14bb47 100644 --- a/templates/TextureArticleGalley.tpl +++ b/templates/TextureArticleGalley.tpl @@ -29,13 +29,25 @@ {/fbvFormSection} - {fbvFormSection list="true" title="plugins.generic.texture.createGalley.customModifications"} - {fbvElement type="checkbox" id="createLicense" checked=false label="plugins.generic.texture.createGalley.license"} + {fbvFormSection title="plugins.generic.texture.createGalley.customModifications"} - {/fbvFormSection} + {fbvFormSection list="true"} + {fbvElement type="checkbox" id="createJournalMeta" checked=false label="plugins.generic.texture.createGalley.journalMeta"} + {/fbvFormSection} + + {fbvFormSection} + {fbvElement type="text" label="plugins.generic.texture.createGalley.fpage" name="createFpage" id="createFpage" maxlength="4" inline=true size=$fbvStyles.size.SMALL required=true} + {fbvElement type="text" label="plugins.generic.texture.createGalley.lpage" name="createPpage" id="createPpage" maxlength="4" inline=true size=$fbvStyles.size.SMALL required=true} + {/fbvFormSection} + + {fbvFormSection} + {fbvElement type="text" label="plugins.generic.texture.createGalley.datePublished" name="createPpage" id="createDatePublished" value=$datePublished maxlength="10" inline=true size=$fbvStyles.size.SMALL required=true} + {/fbvFormSection} + {/fbvFormSection} + {/fbvFormArea} {fbvFormButtons submitText="common.save"} From ef39e9325807a66497a5b47da51d16c3ed3186ce Mon Sep 17 00:00:00 2001 From: Withanage Date: Fri, 9 Sep 2022 14:21:31 +0200 Subject: [PATCH 4/6] https://github.com/pkp/texture/issues/113 Texture Refactor JATS handling --- classes/DAR.inc.php | 257 ------------------------------------------- classes/JATS.inc.php | 94 ++++++++++++++++ 2 files changed, 94 insertions(+), 257 deletions(-) delete mode 100755 classes/DAR.inc.php create mode 100644 classes/JATS.inc.php diff --git a/classes/DAR.inc.php b/classes/DAR.inc.php deleted file mode 100755 index 520741a..0000000 --- a/classes/DAR.inc.php +++ /dev/null @@ -1,257 +0,0 @@ -fs->read($submissionFile->getData('path')); - $manuscript = $dar->createManuscript($manuscript); - - $contents = $dar->createManifest($manuscript, $assets); - $mediaInfos = $dar->createMediaInfo($request, $assets); - - $resources = array( - DAR_MANIFEST_FILE => array( - 'encoding' => 'utf8', - 'data' => $contents, - 'size' => strlen($contents), - 'createdAt' => 0, - 'updatedAt' => 0, - ), - DAR_MANUSCRIPT_FILE => array( - 'encoding' => 'utf8', - 'data' => $manuscript, - 'size' => strlen($manuscript), - 'createdAt' => 0, - 'updatedAt' => 0, - ), - ); - $mediaBlob = array( - 'version' => 1, - 'resources' => array_merge($resources, $mediaInfos) - ); - return $mediaBlob; - } - - - public function createManuscript($manuscript) { - $domImpl = new DOMImplementation(); - $dtd = $domImpl->createDocumentType("article", "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN", "JATS-archivearticle1.dtd"); - $editableManuscriptDom = $domImpl->createDocument("", "", $dtd); - $editableManuscriptDom->encoding = 'UTF-8'; - - - $manuscriptXmlDom = new DOMDocument; - $manuscriptXmlDom->loadXML($manuscript); - - $xpath = new DOMXpath($manuscriptXmlDom); - - - $editableManuscriptDom->article = $editableManuscriptDom->createElement('article'); - foreach ($xpath->query('namespace::*', $manuscriptXmlDom->documentElement) as $node) { - $nodeName = $node->nodeName; - $nodeValue = $node->nodeValue; - if ($nodeName !== "xmlns:xlink") { - $editableManuscriptDom->article->setAttribute($nodeName, $nodeValue); - } - - } - $editableManuscriptDom->article->setAttributeNS( - "http://www.w3.org/2000/xmlns/", - "xmlns:xlink", - "http://www.w3.org/1999/xlink" - ); - $editableManuscriptDom->article->setAttribute("article-type", "research-article"); - - $editableManuscriptDom->appendChild($editableManuscriptDom->article); - - $this->createEmptyMetadata($editableManuscriptDom); - - $manuscriptBody = $xpath->query("/article/body"); - foreach ($manuscriptBody as $content) { - $node = $editableManuscriptDom->importNode($content, true); - $editableManuscriptDom->documentElement->appendChild($node); - } - - $refTypes = array("mixed-citation", "element-citation"); - foreach ($refTypes as $ref) { - foreach ($xpath->query("/article/back/ref-list/ref/" . $ref . "") as $content) { - if (empty($content->getAttribute("publication-type"))) { - $content->setAttribute('publication-type', 'journal'); - } - } - } - $manuscriptBack = $xpath->query("/article/back"); - foreach ($manuscriptBack as $content) { - $node = $editableManuscriptDom->importNode($content, true); - $editableManuscriptDom->documentElement->appendChild($node); - } - - return $editableManuscriptDom->saveXML(); - } - - /** - * build DAR_MANIFEST_FILE from xml document - * - * @param $document string raw XML - * @param $assets array list of figure metadata - * @return mixed - */ - public function createManifest($manuscriptXml, &$assets) { - - $dom = new DOMDocument(); - if (!$dom->loadXML($manuscriptXml)) { - fatalError("Unable to load XML document content in DOM in order to generate manifest XML."); - } - - $k = 0; - $assets = array(); - $figElements = $dom->getElementsByTagName('fig'); - foreach ($figElements as $figure) { - $pos = $k + 1; - $figItem = $figElements->item($k); - $graphic = $figItem->getElementsByTagName('graphic'); - if (sizeof($graphic) > 0) { - - // figure without graphic? - if (!$figItem || !$graphic) { - continue; - } - - // get fig id - $figId = null; - if ($figItem->hasAttribute('id')) { - $figId = $figItem->getAttribute('id'); - } else { - $figId = "ojs-fig-{$pos}"; - } - - // get path - $figGraphPath = $graphic->item(0)->getAttribute('xlink:href'); - - // save assets - $assets[] = array( - 'id' => $figId, - 'type' => 'image/jpg', - 'path' => $figGraphPath, - ); - } - $k++; - } - - $sxml = simplexml_load_string(''); - foreach ($assets as $asset) { - $assetNode = $sxml->assets->addChild('asset'); - $assetNode->addAttribute('id', $asset['id']); - $assetNode->addAttribute('type', $asset['type']); - $assetNode->addAttribute('path', $asset['path']); - } - - return $sxml->asXML(); - } - - /** - * Build media info - * - * @param $request PKPRquest - * @param $assets array - * @return array - */ - public function createMediaInfo($request, $assets) { - - $infos = array(); - $router = $request->getRouter(); - $dispatcher = $router->getDispatcher(); - - $submissionFileId = $request->getUserVar('submissionFileId'); - $stageId = $request->getUserVar('stageId'); - $submissionId = $request->getUserVar('submissionId'); - // build mapping to assets file paths - - $dependentFilesIterator = Services::get('submissionFile')->getMany([ - 'assocTypes' => [ASSOC_TYPE_SUBMISSION_FILE], - 'assocIds' => [$submissionFileId], - 'submissionIds' => [$submissionId], - 'fileStages' => [SUBMISSION_FILE_DEPENDENT], - 'includeDependentFiles' => true, - ]); - - foreach ($dependentFilesIterator as $asset) { - $url = $dispatcher->url($request, ROUTE_PAGE, null, 'texture', 'media', null, array( - 'submissionId' => $submissionId, - 'stageId' => $stageId, - 'assocId' => $submissionFileId, - 'fileId' => $asset->getData('fileId') - - )); - - $infos[$asset->getLocalizedData('name')] = array( - 'encoding' => 'url', - 'data' => $url - ); - - } - return $infos; - } - - /** - * @param DOMDocument $dom - */ - protected function createEmptyMetadata(DOMDocument $dom): void { - $dom->front = $dom->createElement('front'); - $dom->article->appendChild($dom->front); - - $dom->articleMeta = $dom->createElement('article-meta'); - $dom->front->appendChild($dom->articleMeta); - - $dom->titleGroup = $dom->createElement('title-group'); - $dom->articleTitle = $dom->createElement('article-title'); - - $dom->titleGroup->appendChild($dom->articleTitle); - $dom->articleMeta->appendChild($dom->titleGroup); - - - $dom->abstract = $dom->createElement('abstract'); - $dom->articleMeta->appendChild($dom->abstract); - } - - /** - * @param $submissionId - * @param $fileId - * @return array - */ - public function getDependentFilePaths($submissionId, $fileId): array { - - import('lib.pkp.classes.submission.SubmissionFile'); // Constants - $dependentFiles = Services::get('submissionFile')->getMany([ - 'assocTypes' => [ASSOC_TYPE_SUBMISSION_FILE], - 'assocIds' => [$fileId], - 'submissionIds' => [$submissionId], - 'fileStages' => [SUBMISSION_FILE_DEPENDENT], - 'includeDependentFiles' => true, - ]); - - $assetsFilePaths = array(); - foreach ($dependentFiles as $dFile) { - $assetsFilePaths[$dFile->getOriginalFileName()] = $dFile->getFilePath(); - } - return $assetsFilePaths; - } - -} diff --git a/classes/JATS.inc.php b/classes/JATS.inc.php new file mode 100644 index 0000000..05db9ac --- /dev/null +++ b/classes/JATS.inc.php @@ -0,0 +1,94 @@ +query("//article/front/journal-meta"); + foreach ($journalMeta as $journalMetaEntry) { + $origDocument->documentElement->removeChild($journalMetaEntry); + } + $articleMeta = $xpath->query("//article/front/article-meta"); + if (count($articleMeta) == 1) { + if (count($journalMeta) == 0) { + + $journalMeta = $origDocument->createElement('journal-meta'); + + $journalIdType = $origDocument->createElement('journal-id', $context->getLocalizedAcronym()); + $journalIdType->setAttribute('journal-id-type', 'publisher-id'); + $journalMeta->appendChild($journalIdType); + $issn = $origDocument->createElement('issn', $context->getData('onlineIssn')); + $issn->setAttribute('pub-type', 'epub'); + $journalMeta->appendChild($issn); + $publisher = $origDocument->createElement('publisher'); + $publisherName = $origDocument->createElement('publisher-name', $context->getData('publisherInstitution')); + $publisher->appendChild($publisherName); + $journalMeta->appendChild($publisher); + + $articleMeta->item(0)->parentNode->insertBefore($journalMeta, $articleMeta->item(0)); + + } + + } + } + + public static function setLicense(DOMDocument $origDocument, $context , $copyrightYear): void + { + + + $xpath = new DOMXpath($origDocument); + $permissions = $xpath->query("//article/front/article-meta/permissions"); + foreach ($permissions as $permission) { + $origDocument->documentElement->removeChild($permission); + } + + + $articleMeta = $xpath->query("//article/front/article-meta"); + $licenseUrl = $context->getData('licenseUrl'); + if (count($articleMeta) > 0 and $licenseUrl) { + + + PKPString::regexp_match_get('/http[s]?:(www\.)?\/\/creativecommons.org\/licenses\/([a-z]+(-[a-z]+)*)\/(\d.0)\/*([a-z]*).*/i', $licenseUrl, $matches); + if (count($matches) > 5 and $matches[2] and $matches[4]) { + $permissionNode = $origDocument->createElement('permissions'); + $copyrightStatementNode = $origDocument->createElement('copyright-statement', '© ' . $copyrightYear . ' The Author(s)'); + $permissionNode->appendChild($copyrightStatementNode); + $copyrightYearNode = $origDocument->createElement('copyright-year', $copyrightYear); + $permissionNode->appendChild($copyrightYearNode); + + $copyrightLicenseNode = $origDocument->createElement('copyright-license'); + $copyrightLicenseNode->setAttribute('license-type', 'open-access'); + $copyrightLicenseNode->setAttribute('xlink:href', $licenseUrl); + $copyrightLicenseNode->setAttribute('xml:lang', 'en'); + + $copyrightLicensePNode = $origDocument->createElement('license-p'); + + $inlineGraphicNode = $origDocument->createElement('inline-graphic'); + $inlineGraphicNode->setAttribute('xlink:href', 'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/' . $matches[2] . '.svg'); + $copyrightLicensePNode->appendChild($inlineGraphicNode); + + $countryCode = $matches[5] ? strtoupper($matches[5]) : ''; + $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); + $country = $isoCodes->getCountries()->getByAlpha2($countryCode) ? $isoCodes->getCountries()->getByAlpha2($countryCode)->getName() : ''; + $licensePTextNode = $origDocument->createTextNode("This work is published under the Creative Commons {$country} License {$matches[4]} (CC BY {$matches[4]} {$countryCode})."); + + $copyrightLicensePNode->appendChild($licensePTextNode); + $copyrightLicenseNode->appendChild($copyrightLicensePNode); + $permissionNode->appendChild($copyrightLicenseNode); + $articleMeta[0]->appendChild($permissionNode); + } + } + + } +} From 24add6cabad480ea157f00d24df4fc29c344b69a Mon Sep 17 00:00:00 2001 From: Withanage Date: Tue, 13 Sep 2022 14:32:33 +0200 Subject: [PATCH 5/6] https://github.com/pkp/texture/issues/114 Create Publication date and Publication History for article metadata --- classes/DAR.inc.php | 257 ++++++++++++++++++ classes/JATS.inc.php | 176 +++++++++--- .../form/TextureArticleGalleyForm.inc.php | 208 ++++---------- locale/en_US/locale.po | 6 + templates/TextureArticleGalley.tpl | 8 +- 5 files changed, 460 insertions(+), 195 deletions(-) create mode 100644 classes/DAR.inc.php diff --git a/classes/DAR.inc.php b/classes/DAR.inc.php new file mode 100644 index 0000000..520741a --- /dev/null +++ b/classes/DAR.inc.php @@ -0,0 +1,257 @@ +fs->read($submissionFile->getData('path')); + $manuscript = $dar->createManuscript($manuscript); + + $contents = $dar->createManifest($manuscript, $assets); + $mediaInfos = $dar->createMediaInfo($request, $assets); + + $resources = array( + DAR_MANIFEST_FILE => array( + 'encoding' => 'utf8', + 'data' => $contents, + 'size' => strlen($contents), + 'createdAt' => 0, + 'updatedAt' => 0, + ), + DAR_MANUSCRIPT_FILE => array( + 'encoding' => 'utf8', + 'data' => $manuscript, + 'size' => strlen($manuscript), + 'createdAt' => 0, + 'updatedAt' => 0, + ), + ); + $mediaBlob = array( + 'version' => 1, + 'resources' => array_merge($resources, $mediaInfos) + ); + return $mediaBlob; + } + + + public function createManuscript($manuscript) { + $domImpl = new DOMImplementation(); + $dtd = $domImpl->createDocumentType("article", "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN", "JATS-archivearticle1.dtd"); + $editableManuscriptDom = $domImpl->createDocument("", "", $dtd); + $editableManuscriptDom->encoding = 'UTF-8'; + + + $manuscriptXmlDom = new DOMDocument; + $manuscriptXmlDom->loadXML($manuscript); + + $xpath = new DOMXpath($manuscriptXmlDom); + + + $editableManuscriptDom->article = $editableManuscriptDom->createElement('article'); + foreach ($xpath->query('namespace::*', $manuscriptXmlDom->documentElement) as $node) { + $nodeName = $node->nodeName; + $nodeValue = $node->nodeValue; + if ($nodeName !== "xmlns:xlink") { + $editableManuscriptDom->article->setAttribute($nodeName, $nodeValue); + } + + } + $editableManuscriptDom->article->setAttributeNS( + "http://www.w3.org/2000/xmlns/", + "xmlns:xlink", + "http://www.w3.org/1999/xlink" + ); + $editableManuscriptDom->article->setAttribute("article-type", "research-article"); + + $editableManuscriptDom->appendChild($editableManuscriptDom->article); + + $this->createEmptyMetadata($editableManuscriptDom); + + $manuscriptBody = $xpath->query("/article/body"); + foreach ($manuscriptBody as $content) { + $node = $editableManuscriptDom->importNode($content, true); + $editableManuscriptDom->documentElement->appendChild($node); + } + + $refTypes = array("mixed-citation", "element-citation"); + foreach ($refTypes as $ref) { + foreach ($xpath->query("/article/back/ref-list/ref/" . $ref . "") as $content) { + if (empty($content->getAttribute("publication-type"))) { + $content->setAttribute('publication-type', 'journal'); + } + } + } + $manuscriptBack = $xpath->query("/article/back"); + foreach ($manuscriptBack as $content) { + $node = $editableManuscriptDom->importNode($content, true); + $editableManuscriptDom->documentElement->appendChild($node); + } + + return $editableManuscriptDom->saveXML(); + } + + /** + * build DAR_MANIFEST_FILE from xml document + * + * @param $document string raw XML + * @param $assets array list of figure metadata + * @return mixed + */ + public function createManifest($manuscriptXml, &$assets) { + + $dom = new DOMDocument(); + if (!$dom->loadXML($manuscriptXml)) { + fatalError("Unable to load XML document content in DOM in order to generate manifest XML."); + } + + $k = 0; + $assets = array(); + $figElements = $dom->getElementsByTagName('fig'); + foreach ($figElements as $figure) { + $pos = $k + 1; + $figItem = $figElements->item($k); + $graphic = $figItem->getElementsByTagName('graphic'); + if (sizeof($graphic) > 0) { + + // figure without graphic? + if (!$figItem || !$graphic) { + continue; + } + + // get fig id + $figId = null; + if ($figItem->hasAttribute('id')) { + $figId = $figItem->getAttribute('id'); + } else { + $figId = "ojs-fig-{$pos}"; + } + + // get path + $figGraphPath = $graphic->item(0)->getAttribute('xlink:href'); + + // save assets + $assets[] = array( + 'id' => $figId, + 'type' => 'image/jpg', + 'path' => $figGraphPath, + ); + } + $k++; + } + + $sxml = simplexml_load_string(''); + foreach ($assets as $asset) { + $assetNode = $sxml->assets->addChild('asset'); + $assetNode->addAttribute('id', $asset['id']); + $assetNode->addAttribute('type', $asset['type']); + $assetNode->addAttribute('path', $asset['path']); + } + + return $sxml->asXML(); + } + + /** + * Build media info + * + * @param $request PKPRquest + * @param $assets array + * @return array + */ + public function createMediaInfo($request, $assets) { + + $infos = array(); + $router = $request->getRouter(); + $dispatcher = $router->getDispatcher(); + + $submissionFileId = $request->getUserVar('submissionFileId'); + $stageId = $request->getUserVar('stageId'); + $submissionId = $request->getUserVar('submissionId'); + // build mapping to assets file paths + + $dependentFilesIterator = Services::get('submissionFile')->getMany([ + 'assocTypes' => [ASSOC_TYPE_SUBMISSION_FILE], + 'assocIds' => [$submissionFileId], + 'submissionIds' => [$submissionId], + 'fileStages' => [SUBMISSION_FILE_DEPENDENT], + 'includeDependentFiles' => true, + ]); + + foreach ($dependentFilesIterator as $asset) { + $url = $dispatcher->url($request, ROUTE_PAGE, null, 'texture', 'media', null, array( + 'submissionId' => $submissionId, + 'stageId' => $stageId, + 'assocId' => $submissionFileId, + 'fileId' => $asset->getData('fileId') + + )); + + $infos[$asset->getLocalizedData('name')] = array( + 'encoding' => 'url', + 'data' => $url + ); + + } + return $infos; + } + + /** + * @param DOMDocument $dom + */ + protected function createEmptyMetadata(DOMDocument $dom): void { + $dom->front = $dom->createElement('front'); + $dom->article->appendChild($dom->front); + + $dom->articleMeta = $dom->createElement('article-meta'); + $dom->front->appendChild($dom->articleMeta); + + $dom->titleGroup = $dom->createElement('title-group'); + $dom->articleTitle = $dom->createElement('article-title'); + + $dom->titleGroup->appendChild($dom->articleTitle); + $dom->articleMeta->appendChild($dom->titleGroup); + + + $dom->abstract = $dom->createElement('abstract'); + $dom->articleMeta->appendChild($dom->abstract); + } + + /** + * @param $submissionId + * @param $fileId + * @return array + */ + public function getDependentFilePaths($submissionId, $fileId): array { + + import('lib.pkp.classes.submission.SubmissionFile'); // Constants + $dependentFiles = Services::get('submissionFile')->getMany([ + 'assocTypes' => [ASSOC_TYPE_SUBMISSION_FILE], + 'assocIds' => [$fileId], + 'submissionIds' => [$submissionId], + 'fileStages' => [SUBMISSION_FILE_DEPENDENT], + 'includeDependentFiles' => true, + ]); + + $assetsFilePaths = array(); + foreach ($dependentFiles as $dFile) { + $assetsFilePaths[$dFile->getOriginalFileName()] = $dFile->getFilePath(); + } + return $assetsFilePaths; + } + +} diff --git a/classes/JATS.inc.php b/classes/JATS.inc.php index 05db9ac..60b1690 100644 --- a/classes/JATS.inc.php +++ b/classes/JATS.inc.php @@ -1,6 +1,5 @@ query("//article/front/article-meta/permissions"); - foreach ($permissions as $permission) { - $origDocument->documentElement->removeChild($permission); - } + $xpath = new DOMXpath($origDocument); + $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); + $history = $xpath->query("//article/front/article-meta/history"); - $articleMeta = $xpath->query("//article/front/article-meta"); - $licenseUrl = $context->getData('licenseUrl'); - if (count($articleMeta) > 0 and $licenseUrl) { + foreach ($history as $item) { + $item->parentNode->removeChild($item); + } + $history = $origDocument->createElement('history'); + $dateReceived = $submission->getData('dateSubmitted'); + if ($dateReceived) { + $dateReceived = self::getDate($origDocument, $dateReceived, 'received'); + $history->appendChild($dateReceived); + } + $dateAccepted = null; + $decisions = $editDecisionDao->getEditorDecisions($submission->getId()); + foreach ($decisions as $decision) { + if ($decision['stageId'] == WORKFLOW_STAGE_ID_EXTERNAL_REVIEW && $decision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) + $dateAccepted = $decision['dateDecided']; + } + if ($dateAccepted) { + $history->appendChild(self::getDate($origDocument, $dateAccepted, 'accepted')); + } - PKPString::regexp_match_get('/http[s]?:(www\.)?\/\/creativecommons.org\/licenses\/([a-z]+(-[a-z]+)*)\/(\d.0)\/*([a-z]*).*/i', $licenseUrl, $matches); - if (count($matches) > 5 and $matches[2] and $matches[4]) { - $permissionNode = $origDocument->createElement('permissions'); - $copyrightStatementNode = $origDocument->createElement('copyright-statement', '© ' . $copyrightYear . ' The Author(s)'); - $permissionNode->appendChild($copyrightStatementNode); - $copyrightYearNode = $origDocument->createElement('copyright-year', $copyrightYear); - $permissionNode->appendChild($copyrightYearNode); + if ($datePublished) { + $history->appendChild(self::getDate($origDocument, $datePublished, 'published')); + } - $copyrightLicenseNode = $origDocument->createElement('copyright-license'); - $copyrightLicenseNode->setAttribute('license-type', 'open-access'); - $copyrightLicenseNode->setAttribute('xlink:href', $licenseUrl); - $copyrightLicenseNode->setAttribute('xml:lang', 'en'); - $copyrightLicensePNode = $origDocument->createElement('license-p'); + $articleMeta = $xpath->query("//article/front/article-meta"); + if ($articleMeta) + $articleMeta->item(0)->appendChild($history); + + + } - $inlineGraphicNode = $origDocument->createElement('inline-graphic'); - $inlineGraphicNode->setAttribute('xlink:href', 'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/' . $matches[2] . '.svg'); - $copyrightLicensePNode->appendChild($inlineGraphicNode); - $countryCode = $matches[5] ? strtoupper($matches[5]) : ''; - $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); - $country = $isoCodes->getCountries()->getByAlpha2($countryCode) ? $isoCodes->getCountries()->getByAlpha2($countryCode)->getName() : ''; - $licensePTextNode = $origDocument->createTextNode("This work is published under the Creative Commons {$country} License {$matches[4]} (CC BY {$matches[4]} {$countryCode})."); + public static function getJournalMetaPubDate(DOMDocument $origDocument, $context, $submission, $datePublished, $firstPage = null, $lastPage=null): void + { + $xpath = new DOMXpath($origDocument); + $timestamp = strtotime($datePublished); - $copyrightLicensePNode->appendChild($licensePTextNode); - $copyrightLicenseNode->appendChild($copyrightLicensePNode); - $permissionNode->appendChild($copyrightLicenseNode); - $articleMeta[0]->appendChild($permissionNode); - } - } + $issueDao = DAORegistry::getDAO('IssueDAO'); - } + $pubDate = $xpath->query("//article/front/article-meta/pub-date"); + + foreach ($pubDate as $item) { + $item->parentNode->removeChild($item); + } + + $pubDate = $origDocument->createElement('pub-date'); + $pubDate->setAttribute('pub-type','epub'); + $day = $origDocument->createElement('day', date('d', $timestamp)); + $pubDate->appendChild($day); + $month = $origDocument->createElement('month', date('m', $timestamp)); + $pubDate->appendChild($month); + $year = $origDocument->createElement('year', date('Y', $timestamp)); + $pubDate->appendChild($year); + + $issue = $issueDao->getBySubmissionId($submission->getId(), $context->getId()); + $volume = $origDocument->createElement('volume', $issue->getVolume()); + $pubDate->appendChild($volume); + + if ($firstPage) { + $pubDate->appendChild($origDocument->createElement('fpage',$firstPage)); + } + if ($lastPage) { + $pubDate->appendChild($origDocument->createElement('lpage',$lastPage)); + } + $articleMeta = $xpath->query("//article/front/article-meta"); + if ($articleMeta) + $articleMeta->item(0)->appendChild($pubDate); + + + } + + + public static function getArticleMetaCCBYLicense(DOMDocument $origDocument, $context, $copyrightYear = null): void + { + + + $xpath = new DOMXpath($origDocument); + $permissions = $xpath->query("//article/front/article-meta/permissions"); + foreach ($permissions as $permission) { + $origDocument->documentElement->removeChild($permission); + } + + + $articleMeta = $xpath->query("//article/front/article-meta"); + $licenseUrl = $context->getData('licenseUrl'); + if (count($articleMeta) > 0 and $licenseUrl) { + + + PKPString::regexp_match_get('/http[s]?:(www\.)?\/\/creativecommons.org\/licenses\/([a-z]+(-[a-z]+)*)\/(\d.0)\/*([a-z]*).*/i', $licenseUrl, $matches); + if (count($matches) > 5 and $matches[2] and $matches[4]) { + + if (!$$copyrightYear) $copyrightYear = date('Y'); + + $permissionNode = $origDocument->createElement('permissions'); + $copyrightStatementNode = $origDocument->createElement('copyright-statement', '© ' . $copyrightYear . ' The Author(s)'); + $permissionNode->appendChild($copyrightStatementNode); + $copyrightYearNode = $origDocument->createElement('copyright-year', $copyrightYear); + $permissionNode->appendChild($copyrightYearNode); + + $copyrightLicenseNode = $origDocument->createElement('copyright-license'); + $copyrightLicenseNode->setAttribute('license-type', 'open-access'); + $copyrightLicenseNode->setAttribute('xlink:href', $licenseUrl); + $copyrightLicenseNode->setAttribute('xml:lang', 'en'); + + $copyrightLicensePNode = $origDocument->createElement('license-p'); + + $inlineGraphicNode = $origDocument->createElement('inline-graphic'); + $inlineGraphicNode->setAttribute('xlink:href', 'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/' . $matches[2] . '.svg'); + $copyrightLicensePNode->appendChild($inlineGraphicNode); + + $countryCode = $matches[5] ? strtoupper($matches[5]) : ''; + $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); + $country = $isoCodes->getCountries()->getByAlpha2($countryCode) ? $isoCodes->getCountries()->getByAlpha2($countryCode)->getName() : ''; + $licensePTextNode = $origDocument->createTextNode("This work is published under the Creative Commons {$country} License {$matches[4]} (CC BY {$matches[4]} {$countryCode})."); + + $copyrightLicensePNode->appendChild($licensePTextNode); + $copyrightLicenseNode->appendChild($copyrightLicensePNode); + $permissionNode->appendChild($copyrightLicenseNode); + $articleMeta[0]->appendChild($permissionNode); + } + } + + } + + public static function getDate(\DOMDocument $origDocument, string $dateAndTime, $type =null): DOMElement + { + $timestamp = strtotime($dateAndTime); + $date = $origDocument->createElement('date'); + if ($type) $date->setAttribute('type', $type); + $date->setAttribute('iso-8601-date', date('Y-m-d', $timestamp)); + $day = $origDocument->createElement('day', date('d', $timestamp)); + $date->appendChild($day); + $month = $origDocument->createElement('month', date('m', $timestamp)); + $date->appendChild($month); + $year = $origDocument->createElement('year', date('Y', $timestamp)); + $date->appendChild($year); + return $date; + + } } diff --git a/controllers/grid/form/TextureArticleGalleyForm.inc.php b/controllers/grid/form/TextureArticleGalleyForm.inc.php index 314dd52..463e944 100644 --- a/controllers/grid/form/TextureArticleGalleyForm.inc.php +++ b/controllers/grid/form/TextureArticleGalleyForm.inc.php @@ -14,6 +14,8 @@ * @brief Article galley editing form. */ + +import('plugins.generic.texture.classes.JATS'); import('lib.pkp.classes.form.Form'); class TextureArticleGalleyForm extends Form @@ -47,13 +49,7 @@ function __construct($request, $plugin, $publication, $submission) // Ensure a locale is provided and valid $journal = $request->getJournal(); - $this->addCheck( - new FormValidator( - $this, - 'galleyLocale', - 'required', - 'editor.issues.galleyLocaleRequired' - ), + $this->addCheck(new FormValidator($this, 'galleyLocale', 'required', 'editor.issues.galleyLocaleRequired'), ); } @@ -68,16 +64,7 @@ function fetch($request, $template = null, $display = false) $context = $request->getJournal(); $templateMgr = TemplateManager::getManager($request); - $templateMgr->assign(array( - 'supportedLocales' => $context->getSupportedSubmissionLocaleNames(), - 'submissionId' => $this->_submission->getId(), - 'stageId' => $request->getUserVar('stageId'), - 'fileStage' => $request->getUserVar('fileStage'), - 'submissionFileId' => $request->getUserVar('submissionFileId'), - 'publicationId' => $this->_publication->getId(), - 'datePublished' => $this->_publication->getData('datePublished'), - 'publisherInstitution' => $context->getData('publisherInstitution'), - 'onlineIssn' => $context->getData('onlineIssn') + $templateMgr->assign(array('supportedLocales' => $context->getSupportedSubmissionLocaleNames(), 'submissionId' => $this->_submission->getId(), 'stageId' => $request->getUserVar('stageId'), 'fileStage' => $request->getUserVar('fileStage'), 'submissionFileId' => $request->getUserVar('submissionFileId'), 'publicationId' => $this->_publication->getId(), 'datePublished' => $this->_publication->getData('datePublished'), 'publisherInstitution' => $context->getData('publisherInstitution'), 'onlineIssn' => $context->getData('onlineIssn') )); @@ -89,20 +76,7 @@ function fetch($request, $template = null, $display = false) */ function readInputData() { - $this->readUserVars( - array( - 'label', - 'galleyLocale', - 'submissionFileId', - 'fileStage', - 'createJournalMeta', - 'createFpage', - 'createLpage', - 'datePublished', - 'onlineIssn', - 'publisherInstitution' - ) - ); + $this->readUserVars(array('label', 'galleyLocale', 'submissionFileId', 'fileStage', 'createArticlelMetaLicense', 'createArticlelMetaHistory', 'createJournalMeta', 'createFpage', 'createLpage', 'createDatePublished', 'onlineIssn', 'publisherInstitution')); } /** @@ -111,166 +85,65 @@ function readInputData() */ function execute(...$functionArgs) { + $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); + $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); + $request = Application::get()->getRequest(); $context = $request->getJournal(); + $datePublished = $this->getData('createDatePublished') ? $this->getData('createDatePublished') : $this->getPublication()->getData('datePublished'); + $sourceFile = Services::get('submissionFile')->get($this->getData('submissionFileId')); $submissionDir = Services::get('submissionFile')->getSubmissionDir($this->getSubmission()->getData('contextId'), $this->getSubmission()->getId()); $files_dir = Config::getVar('files', 'files_dir') . DIRECTORY_SEPARATOR; - $origDocument = new DOMDocument('1.0', 'utf-8'); $sourceFileContent = Services::get('file')->fs->read($sourceFile->getData('path')); $origDocument->loadXML($sourceFileContent); - $xpath = new DOMXpath($origDocument); + $copyrightYear = $this->getCopyrightYear($request); - # add license - $permissions = $xpath->query("//article/front/article-meta/permissions"); - foreach ($permissions as $permission) { - $origDocument->documentElement->removeChild($permission); - } + if ($this->getData('createArticlelMetaLicense')) JATS::getArticleMetaCCBYLicense($origDocument, $context, $copyrightYear); - // add licnese - $articleMeta = $xpath->query("//article/front/article-meta"); - $licenseUrl = $context->getData('licenseUrl'); - if (count($articleMeta) > 0 and $licenseUrl) { - $copyrightYear = date('Y'); - switch ($context->getData('copyrightYearBasis')) { - case 'submission': - $copyrightYear = date('Y', strtotime($this->_publication->getData('datePublished'))); - break; - case 'issue': - if ($this->_publication->getData('issueId')) { - $issueDao =& DAORegistry::getDAO('IssueDAO'); - $issue = $issueDao->getBySubmissionId($this->_submission->getId()); - if ($issue && $issue->getDatePublished()) { - $copyrightYear = date('Y', strtotime($issue->getDatePublished())); - } - } - break; - } - - PKPString::regexp_match_get('/http[s]?:(www\.)?\/\/creativecommons.org\/licenses\/([a-z]+(-[a-z]+)*)\/(\d.0)\/*([a-z]*).*/i', $licenseUrl, $matches); - if (count($matches) > 5 and $matches[2] and $matches[4]) { - $permissionNode = $origDocument->createElement('permissions'); - $copyrightStatementNode = $origDocument->createElement('copyright-statement', '© ' . $copyrightYear . ' The Author(s)'); - $permissionNode->appendChild($copyrightStatementNode); - $copyrightYearNode = $origDocument->createElement('copyright-year', $copyrightYear); - $permissionNode->appendChild($copyrightYearNode); - - $copyrightLicenseNode = $origDocument->createElement('copyright-license'); - $copyrightLicenseNode->setAttribute('license-type', 'open-access'); - $copyrightLicenseNode->setAttribute('xlink:href', $licenseUrl); - $copyrightLicenseNode->setAttribute('xml:lang', 'en'); - - $copyrightLicensePNode = $origDocument->createElement('license-p'); - - $inlineGraphicNode = $origDocument->createElement('inline-graphic'); - $inlineGraphicNode->setAttribute('xlink:href', 'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/' . $matches[2] . '.svg'); - $copyrightLicensePNode->appendChild($inlineGraphicNode); - - $countryCode = $matches[5] ? strtoupper($matches[5]) : ''; - $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); - $country = $isoCodes->getCountries()->getByAlpha2($countryCode) ? $isoCodes->getCountries()->getByAlpha2($countryCode)->getName() : ''; - $licensePTextNode = $origDocument->createTextNode("This work is published under the Creative Commons {$country} License {$matches[4]} (CC BY {$matches[4]} {$countryCode})."); - - $copyrightLicensePNode->appendChild($licensePTextNode); - $copyrightLicenseNode->appendChild($copyrightLicensePNode); - $permissionNode->appendChild($copyrightLicenseNode); - $articleMeta[0]->appendChild($permissionNode); - } - } + if ($this->getData('createJournalMeta')) JATS::getJournalMeta($origDocument, $context); - // add date + JATS::getJournalMetaPubDate($origDocument, $context, $this->getSubmission(), $datePublished, $this->getData('createFpage') , $this->getData('createLpage')); - // add journal meta - $journalMeta = $xpath->query("//article/front/journal-meta"); - foreach ($journalMeta as $journalMetaEntry) { - $origDocument->documentElement->removeChild($journalMetaEntry); + if ($this->getData('createArticlelMetaHistory')) { + JATS::getArticleMetaHistory($origDocument, $this->getSubmission(), $datePublished); } - if ($this->getData('createJournalMeta') and count($journalMeta) > 0) { - - $journalMeta = $origDocument->createElement('journal-meta'); - - $journalIdType = $origDocument->createElement('journal-id', $context->getLocalizedAcronym()); - $journalIdType->setAttribute('journal-id-type', 'publisher-id'); - $journalMeta->appendChild($journalIdType); - $issn = new $origDocument->createElement('issn'); - $issn->setAttribute('pub-type', 'epub'); - - } - - /*** - * - * XXX - * XXX-XXX - * - * TIB Open Publishing - * - * - */ - - - $tmpfname = tempnam(sys_get_temp_dir(), 'texture-update-xml'); - file_put_contents($tmpfname, $origDocument->saveXML()); - - - $newFileId = Services::get('file')->add( - $tmpfname, - $files_dir . $submissionDir . DIRECTORY_SEPARATOR . uniqid() . '.xml' - ); - unlink($tmpfname); - $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); + $tmpFile = tempnam(sys_get_temp_dir(), 'texture-update-xml'); + file_put_contents($tmpFile, $origDocument->saveXML()); + $newFileId = Services::get('file')->add($tmpFile, $files_dir . $submissionDir . DIRECTORY_SEPARATOR . uniqid() . '.xml'); $newSubmissionFile = $submissionFileDao->newDataObject(); - $newSubmissionFile->setAllData( [ 'fileId' => $newFileId, 'assocType' => $sourceFile->getData('assocType'), 'assocId' => $sourceFile->getData('assocId'), 'fileStage' => SUBMISSION_FILE_PROOF, - 'mimetype' => $sourceFile->getData('mimetype'), - 'locale' => $sourceFile->getData('locale'), - 'genreId' => $sourceFile->getData('genreId'), - 'name' => $sourceFile->getLocalizedData('name'), - 'submissionId' => $this->getSubmission()->getId() - ] - ); - - + 'mimetype' => $sourceFile->getData('mimetype'), 'locale' => $sourceFile->getData('locale'), 'genreId' => $sourceFile->getData('genreId'), 'name' => $sourceFile->getData('name'), 'submissionId' => $this->getSubmission()->getId()]); $newSubmissionFile = Services::get('submissionFile')->add($newSubmissionFile, $request); + unlink($tmpFile); + - // Associate XML file into galley - // Create new galley - $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); $articleGalley = $articleGalleyDao->newDataObject(); $articleGalley->setData('publicationId', $this->_publication->getId()); $articleGalley->setLabel($this->getData('label')); $articleGalley->setLocale($this->getData('galleyLocale')); $articleGalley->setFileId($newSubmissionFile->getData('id')); - Services::get('galley')->add($articleGalley, $request); // Get dependent files of the XML source file - $dependentFiles = Services::get('submissionFile')->getMany([ - 'assocTypes' => [ASSOC_TYPE_SUBMISSION_FILE], - 'assocIds' => [$sourceFile->getData('id')], - 'submissionIds' => [$this->getSubmission()->getId()], - 'fileStages' => [SUBMISSION_FILE_DEPENDENT], - 'includeDependentFiles' => true, - ]); + $dependentFiles = Services::get('submissionFile')->getMany(['assocTypes' => [ASSOC_TYPE_SUBMISSION_FILE], 'assocIds' => [$sourceFile->getData('id')], 'submissionIds' => [$this->getSubmission()->getId()], 'fileStages' => [SUBMISSION_FILE_DEPENDENT], 'includeDependentFiles' => true,]); foreach ($dependentFiles as $dependentFile) { - $newDependentFileId = Services::get('file')->add( - $files_dir . $dependentFile->getData('path'), - $files_dir . $submissionDir . DIRECTORY_SEPARATOR . uniqid() . '.xml' - ); + $newDependentFileId = Services::get('file')->add($files_dir . $dependentFile->getData('path'), $files_dir . $submissionDir . DIRECTORY_SEPARATOR . uniqid() . '.xml'); $newDependentFile = $submissionFileDao->newDataObject(); @@ -283,10 +156,9 @@ function execute(...$functionArgs) 'mimetype' => $dependentFile->getData('mimetype'), 'locale' => $dependentFile->getData('locale'), 'genreId' => $dependentFile->getData('genreId'), - 'name' => $dependentFile->getLocalizedData('name'), + 'name' => $dependentFile->getData('name'), 'submissionId' => $this->getSubmission()->getId() - ] - ); + ]); Services::get('submissionFile')->add($newDependentFile, $request); @@ -300,6 +172,34 @@ function getSubmission() return $this->_submission; } + public function getCopyrightYear(Request $request) + { + $copyrightYear = null; + switch ($request->getJournal()->getData('copyrightYearBasis')) { + case 'submission': + $copyrightYear = date('Y', strtotime($this->getPublication()->getData('datePublished'))); + break; + case 'issue': + if ($this->_publication->getData('issueId')) { + $issueDao =& DAORegistry::getDAO('IssueDAO'); + $issue = $issueDao->getBySubmissionId($this->_submission->getId()); + if ($issue && $issue->getDatePublished()) { + $copyrightYear = date('Y', strtotime($issue->getDatePublished())); + } + } + break; + } + return $copyrightYear; + } + + /** + * @return Publication|null + */ + public function getPublication(): ?Publication + { + return $this->_publication; + } + } diff --git a/locale/en_US/locale.po b/locale/en_US/locale.po index c1e5d28..c3e1983 100644 --- a/locale/en_US/locale.po +++ b/locale/en_US/locale.po @@ -62,3 +62,9 @@ msgstr "Published date" msgid "plugins.generic.texture.createGalley.journalMeta" msgstr "Add Journal metadata" + +msgid "plugins.generic.texture.createGalley.createArticlelMetaLicense" +msgstr "Update Journal license" + +msgid "plugins.generic.texture.createGalley.createArticlelMetaHistory" +msgstr "Update Article publication history" diff --git a/templates/TextureArticleGalley.tpl b/templates/TextureArticleGalley.tpl index f14bb47..2722904 100644 --- a/templates/TextureArticleGalley.tpl +++ b/templates/TextureArticleGalley.tpl @@ -33,15 +33,17 @@ {fbvFormSection list="true"} {fbvElement type="checkbox" id="createJournalMeta" checked=false label="plugins.generic.texture.createGalley.journalMeta"} + {fbvElement type="checkbox" id="createArticlelMetaLicense" checked=false label="plugins.generic.texture.createGalley.createArticlelMetaLicense"} + {fbvElement type="checkbox" id="createArticlelMetaHistory" checked=false label="plugins.generic.texture.createGalley.createArticlelMetaHistory"} {/fbvFormSection} {fbvFormSection} - {fbvElement type="text" label="plugins.generic.texture.createGalley.fpage" name="createFpage" id="createFpage" maxlength="4" inline=true size=$fbvStyles.size.SMALL required=true} - {fbvElement type="text" label="plugins.generic.texture.createGalley.lpage" name="createPpage" id="createPpage" maxlength="4" inline=true size=$fbvStyles.size.SMALL required=true} + {fbvElement type="text" label="plugins.generic.texture.createGalley.fpage" name="createFpage" id="createFpage" maxlength="4" inline=true size=$fbvStyles.size.SMALL} + {fbvElement type="text" label="plugins.generic.texture.createGalley.lpage" name="createLpage" id="createLpage" maxlength="4" inline=true size=$fbvStyles.size.SMALL} {/fbvFormSection} {fbvFormSection} - {fbvElement type="text" label="plugins.generic.texture.createGalley.datePublished" name="createPpage" id="createDatePublished" value=$datePublished maxlength="10" inline=true size=$fbvStyles.size.SMALL required=true} + {fbvElement type="text" label="plugins.generic.texture.createGalley.datePublished" name="createDatePublished" id="createDatePublished" value=$datePublished maxlength="10" inline=true size=$fbvStyles.size.SMALL required=true} {/fbvFormSection} From a0b7d49a787085fd4c51bab2dae9e362a3cc80cc Mon Sep 17 00:00:00 2001 From: Withanage Date: Tue, 13 Sep 2022 15:01:40 +0200 Subject: [PATCH 6/6] https://github.com/pkp/texture/issues/114 Create Publication date and Publication History for article metadata --- texture/texture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texture/texture.js b/texture/texture.js index 5e041dc..37b98d1 100644 --- a/texture/texture.js +++ b/texture/texture.js @@ -17997,7 +17997,7 @@ // These labels are used by the AddReferenceWorkflow only config.addLabel('add-reference-title', 'Add Reference(s)'); config.addLabel('add-ref-manually', 'Or create manually'); - config.addLabel('fetch-datacite', 'Fetch from DataCite'); + config.addLabel('fetch-datacite', 'Fetch by DOI from DataCite or Crossref'); config.addLabel('enter-doi-placeholder', 'Enter one or more DOIs'); config.addLabel('import-refs', 'Import');