Skip to content

Commit

Permalink
pkp#10680 Add description field to library files (pkp#10710)
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored Jan 14, 2025
1 parent d617258 commit 53e4857
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/context/LibraryFileDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function newDataObject()
*/
public function getLocaleFieldNames(): array
{
return ['name'];
return ['name', 'description'];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/files/form/LibraryFileForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ public function fetch($request, $template = null, $display = false): ?string
*/
public function readInputData(): void
{
$this->readUserVars(['libraryFileName', 'fileType', 'publicAccess']);
$this->readUserVars(['libraryFileName', 'description', 'fileType', 'publicAccess']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function initData()
$this->_data = [
'submissionId' => $this->libraryFile->getSubmissionId(),
'libraryFileName' => $this->libraryFile->getName(null), // Localized
'description' => $this->libraryFile->getData('description'), // Localized
'libraryFile' => $this->libraryFile // For read-only info
];
}
Expand All @@ -66,6 +67,7 @@ public function initData()
public function execute(...$functionArgs)
{
$this->libraryFile->setName($this->getData('libraryFileName'), null); // Localized
$this->libraryFile->setData('description', $this->getData('description'), null); // Localized
$this->libraryFile->setType($this->getData('fileType'));

$libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); /** @var LibraryFileDAO $libraryFileDao */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function execute(...$functionArgs)
assert(isset($libraryFile));
$libraryFile->setContextId($this->contextId);
$libraryFile->setName($this->getData('libraryFileName'), null); // Localized
$libraryFile->setData('description', $this->getData('description'), null); // Localized
$libraryFile->setType($this->getData('fileType'));
$libraryFile->setSubmissionId($this->getData('submissionId'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function initData(): void
{
$this->_data = [
'libraryFileName' => $this->libraryFile->getName(null), // Localized
'description' => $this->libraryFile->getData('description'), // Localized
'libraryFile' => $this->libraryFile, // For read-only info
'publicAccess' => $this->libraryFile->getPublicAccess() ? true : false,
'temporaryFileId' => null,
Expand Down Expand Up @@ -93,6 +94,7 @@ public function execute(...$functionArgs)
$temporaryFileManager->deleteById($this->getData('temporaryFileId'), $userId);
}
$this->libraryFile->setName($this->getData('libraryFileName'), null); // Localized
$this->libraryFile->setData('description', $this->getData('description'), null); // Localized
$this->libraryFile->setType($this->getData('fileType'));
$this->libraryFile->setPublicAccess($this->getData('publicAccess'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function execute(...$functionArgs)
assert(isset($libraryFile));
$libraryFile->setContextId($this->contextId);
$libraryFile->setName($this->getData('libraryFileName'), null); // Localized
$libraryFile->setData('description', $this->getData('description'), null); // Localized
$libraryFile->setType($this->getData('fileType'));
$libraryFile->setPublicAccess($this->getData('publicAccess'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="description"}
{fbvFormSection title="common.description" required=true}
{fbvElement type="textarea" multilingual="true" id="description" value=$description}
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="file"}
{fbvFormSection title="common.file"}
<table id="fileInfo" class="data" width="100%">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="description"}
{fbvFormSection title="common.description" required=true}
{fbvElement type="textarea" multilingual="true" id="description" value=$description}
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="file"}
{fbvFormSection title="common.file" required=true}
{include file="controllers/fileUploadContainer.tpl" id="plupload"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="description"}
{fbvFormSection title="common.description" required=true}
{fbvElement type="textarea" multilingual="true" id="description" value=$description}
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="file"}
{fbvFormSection title="common.file"}
<table id="fileInfo" class="data" width="100%">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="description"}
{fbvFormSection title="common.description" required=true}
{fbvElement type="textarea" multilingual="true" id="description" value=$description}
{/fbvFormSection}
{/fbvFormArea}

{fbvFormArea id="file"}
{fbvFormSection title="common.file" required=true}
{include file="controllers/fileUploadContainer.tpl" id="plupload"}
Expand Down

0 comments on commit 53e4857

Please sign in to comment.