diff --git a/classes/form/UploadImageForm.inc.php b/classes/form/UploadImageForm.inc.php index 3dbee30..280dcea 100644 --- a/classes/form/UploadImageForm.inc.php +++ b/classes/form/UploadImageForm.inc.php @@ -108,6 +108,7 @@ function initData() { $this->setData('coverImage', $coverImage); $this->setData('imageAltText', $coverImage['altText'] ?? ''); + $this->setData('coverImageName', $coverImage['uploadName'] ?? ''); } /** @@ -130,7 +131,7 @@ function deleteCoverImage($request) { // Remove cover image and alt text from article settings $locale = Locale::getLocale(); $this->publication->setData('coverImage', []); - Repo::publication()->edit($this->publication); + Repo::publication()->edit($this->publication, []); // Remove the file $publicFileManager = new PublicFileManager(); @@ -166,13 +167,14 @@ function execute(...$functionArgs) { $newFileName = 'article_' . $this->submissionId . '_cover_' . $locale . $fileManager->getImageExtension($temporaryFile->getFileType()); + $publicFileManager = new PublicFileManager(); if ($publicFileManager->copyContextFile($this->context->getId(), $temporaryFile->getFilePath(), $newFileName)) { $this->publication->setData('coverImage', [ 'altText' => $this->getData('imageAltText'), 'uploadName' => $newFileName, ], $locale); - Repo::publication()->edit($this->publication); + Repo::publication()->edit($this->publication, []); // Clean up the temporary file. $this->removeTemporaryFile($this->request); @@ -183,7 +185,7 @@ function execute(...$functionArgs) { $coverImage = $this->publication->getData('coverImage'); $coverImage[$locale]['altText'] = $this->getData('imageAltText'); $this->publication->setData('coverImage', $coverImage); - Repo::publication()->edit($this->publication); + Repo::publication()->edit($this->publication, []); return DAO::getDataChangedEvent(); } return new JSONMessage(false, __('common.uploadFailed')); diff --git a/templates/uploadImageForm.tpl b/templates/uploadImageForm.tpl index 793ab3b..e15d0c9 100644 --- a/templates/uploadImageForm.tpl +++ b/templates/uploadImageForm.tpl @@ -54,7 +54,7 @@ {if $coverImage != ''}