forked from pkp/pkp-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp#7505 Initial Commit Upload - Delete - Download JATS File
- Loading branch information
Showing
8 changed files
with
602 additions
and
51 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
/** | ||
* @file classes/components/listPanels/JatsListPanel.php | ||
* | ||
* Copyright (c) 2014-2021 Simon Fraser University | ||
* Copyright (c) 2000-2021 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class JatsListPanel | ||
* | ||
* @ingroup classes_components_list | ||
* | ||
* @brief A Panel component for viewing and managing publication's JATS Files | ||
*/ | ||
|
||
namespace PKP\components\listPanels; | ||
|
||
use APP\core\Application; | ||
use APP\facades\Repo; | ||
use APP\publication\Publication; | ||
use APP\submission\Submission; | ||
use PKP\components\forms\publication\ContributorForm; | ||
use PKP\context\Context; | ||
use PKP\submissionFile\SubmissionFile; | ||
|
||
class JatsListPanel extends ListPanel | ||
{ | ||
public Submission $submission; | ||
public Publication $publication; | ||
public Context $context; | ||
public array $locales; | ||
|
||
/** Whether the user can edit the current publication */ | ||
public bool $canEditPublication; | ||
|
||
public function __construct( | ||
string $id, | ||
string $title, | ||
Submission $submission, | ||
Context $context, | ||
array $locales, | ||
bool $canEditPublication = false, | ||
Publication $publication | ||
) { | ||
parent::__construct($id, $title); | ||
$this->submission = $submission; | ||
$this->context = $context; | ||
$this->locales = $locales; | ||
$this->canEditPublication = $canEditPublication; | ||
$this->publication = $publication; | ||
} | ||
|
||
/** | ||
* @copydoc ListPanel::getConfig() | ||
*/ | ||
public function getConfig() | ||
{ | ||
$config = parent::getConfig(); | ||
|
||
// Remove some props not used in this list panel | ||
unset($config['description']); | ||
unset($config['expanded']); | ||
unset($config['headingLevel']); | ||
|
||
$config = array_merge( | ||
$config, | ||
[ | ||
'canEditPublication' => $this->canEditPublication, | ||
'publicationApiUrlFormat' => $this->getPublicationUrlFormat(), | ||
'uploadProgressLabel' => __('submission.upload.percentComplete'), | ||
'fileStage' => SubmissionFile::SUBMISSION_FILE_JATS, | ||
'i18nConfirmDeleteFileTitle' => __('publication.jats.confirmDeleteFileTitle'), | ||
'i18nDeleteFileMessage' => __('publication.jats.confirmDeleteFileMessage'), | ||
'i18nConfirmDeleteFileButton' => __('publication.jats.confirmDeleteFileButton'), | ||
'downloadDefaultJatsFileName' => Repo::submissionFile()->getDefaultJatsFileName($this->submission->getId(), $this->publication->getId()), | ||
] | ||
); | ||
|
||
return $config; | ||
} | ||
|
||
/** | ||
* Get an example of the url to a publication's API endpoint, | ||
* with a placeholder instead of the publication id, eg: | ||
* | ||
* http://example.org/api/v1/submissions/1/publications/__publicationId__ | ||
*/ | ||
protected function getPublicationUrlFormat(): string | ||
{ | ||
return Application::get()->getRequest()->getDispatcher()->url( | ||
Application::get()->getRequest(), | ||
Application::ROUTE_API, | ||
$this->context->getPath(), | ||
'submissions/' . $this->submission->getId() . '/publications/__publicationId__/jats' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.