Skip to content

Commit

Permalink
#10680 Add description field to library files (#10708)
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored Jan 14, 2025
1 parent a3cf578 commit 45d3f11
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.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function newDataObject() {
* @return array
*/
function getLocaleFieldNames() {
return ['name'];
return ['name', 'description'];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/files/form/LibraryFileForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function fetch($request, $template = null, $display = false) {
* @see Form::readInputData()
*/
function readInputData() {
$this->readUserVars(array('libraryFileName', 'fileType', 'publicAccess'));
$this->readUserVars(array('libraryFileName', 'description', 'fileType', 'publicAccess'));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function initData() {
$this->_data = array(
'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 @@ -56,6 +57,7 @@ function initData() {
*/
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 @@ -69,6 +69,7 @@ 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 @@ -53,6 +53,7 @@ function readInputData() {
function initData() {
$this->_data = array(
'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 @@ -84,6 +85,7 @@ 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'));
$this->libraryFile->setPublicAccess($this->getData('publicAccess'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ 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 45d3f11

Please sign in to comment.