Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#10680 Add description field to library files #10708

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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