first commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file controllers/grid/files/copyedit/CopyeditFilesGridDataProvider.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class CopyeditFilesGridDataProvider
|
||||
*
|
||||
* @ingroup controllers_grid_files_copyedit
|
||||
*
|
||||
* @brief Provide access to copyedited files management.
|
||||
*/
|
||||
|
||||
namespace PKP\controllers\grid\files\copyedit;
|
||||
|
||||
use PKP\controllers\grid\files\fileList\linkAction\SelectFilesLinkAction;
|
||||
use PKP\controllers\grid\files\SubmissionFilesGridDataProvider;
|
||||
use PKP\submissionFile\SubmissionFile;
|
||||
|
||||
class CopyeditFilesGridDataProvider extends SubmissionFilesGridDataProvider
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(SubmissionFile::SUBMISSION_FILE_COPYEDIT);
|
||||
}
|
||||
|
||||
//
|
||||
// Overridden public methods from FilesGridDataProvider
|
||||
//
|
||||
/**
|
||||
* @copydoc FilesGridDataProvider::getSelectAction()
|
||||
*/
|
||||
public function getSelectAction($request)
|
||||
{
|
||||
return new SelectFilesLinkAction(
|
||||
$request,
|
||||
[
|
||||
'submissionId' => $this->getSubmission()->getId(),
|
||||
'stageId' => $this->getStageId()
|
||||
],
|
||||
__('editor.submission.uploadSelectFiles')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file controllers/grid/files/copyedit/CopyeditFilesGridHandler.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class CopyeditFilesGridHandler
|
||||
*
|
||||
* @ingroup controllers_grid_files_copyedit
|
||||
*
|
||||
* @brief Handle the copyedited files grid
|
||||
*/
|
||||
|
||||
namespace PKP\controllers\grid\files\copyedit;
|
||||
|
||||
use APP\core\Application;
|
||||
use PKP\controllers\grid\files\copyedit\form\ManageCopyeditFilesForm;
|
||||
use PKP\controllers\grid\files\fileList\FileListGridHandler;
|
||||
use PKP\controllers\grid\files\FilesGridCapabilities;
|
||||
use PKP\core\JSONMessage;
|
||||
use PKP\core\PKPRequest;
|
||||
use PKP\security\Role;
|
||||
|
||||
class CopyeditFilesGridHandler extends FileListGridHandler
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
* FILE_GRID_* capabilities set.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
new CopyeditFilesGridDataProvider(),
|
||||
null
|
||||
);
|
||||
$this->addRoleAssignment(
|
||||
[
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_MANAGER,
|
||||
Role::ROLE_ID_SITE_ADMIN,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
],
|
||||
[
|
||||
'fetchGrid', 'fetchRow',
|
||||
]
|
||||
);
|
||||
$this->addRoleAssignment(
|
||||
[
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_MANAGER,
|
||||
Role::ROLE_ID_SITE_ADMIN,
|
||||
Role::ROLE_ID_ASSISTANT
|
||||
],
|
||||
[
|
||||
'selectFiles'
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->setTitle('submission.copyedited');
|
||||
}
|
||||
|
||||
//
|
||||
// Public handler methods
|
||||
//
|
||||
/**
|
||||
* @copydoc GridHandler::initialize()
|
||||
*
|
||||
* @param null|mixed $args
|
||||
*/
|
||||
public function initialize($request, $args = null)
|
||||
{
|
||||
if (0 != count(array_intersect(
|
||||
$this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES),
|
||||
[Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_SUB_EDITOR]
|
||||
// Authors may also view this grid, and shouldn't be able to do anything (just view).
|
||||
))) {
|
||||
$this->setCapabilities(new FilesGridCapabilities(FilesGridCapabilities::FILE_GRID_EDIT | FilesGridCapabilities::FILE_GRID_MANAGE | FilesGridCapabilities::FILE_GRID_VIEW_NOTES | FilesGridCapabilities::FILE_GRID_DELETE));
|
||||
}
|
||||
parent::initialize($request, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form to allow the user to select files from previous stages
|
||||
*
|
||||
* @param array $args
|
||||
* @param PKPRequest $request
|
||||
*
|
||||
* @return JSONMessage JSON object
|
||||
*/
|
||||
public function selectFiles($args, $request)
|
||||
{
|
||||
$manageCopyeditFilesForm = new ManageCopyeditFilesForm($this->getSubmission()->getId());
|
||||
$manageCopyeditFilesForm->initData();
|
||||
return new JSONMessage(true, $manageCopyeditFilesForm->fetch($request));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file controllers/grid/files/copyedit/ManageCopyeditFilesGridHandler.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ManageCopyeditFilesGridHandler
|
||||
*
|
||||
* @ingroup controllers_grid_files_copyedit
|
||||
*
|
||||
* @brief Handle the copyedited file selection grid
|
||||
*/
|
||||
|
||||
namespace PKP\controllers\grid\files\copyedit;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\notification\NotificationManager;
|
||||
use PKP\controllers\grid\files\copyedit\form\ManageCopyeditFilesForm;
|
||||
use PKP\controllers\grid\files\FilesGridCapabilities;
|
||||
use PKP\controllers\grid\files\SelectableSubmissionFileListCategoryGridHandler;
|
||||
use PKP\controllers\grid\files\SubmissionFilesCategoryGridDataProvider;
|
||||
use PKP\core\JSONMessage;
|
||||
use PKP\core\PKPRequest;
|
||||
use PKP\notification\PKPNotification;
|
||||
use PKP\security\Role;
|
||||
use PKP\submissionFile\SubmissionFile;
|
||||
|
||||
class ManageCopyeditFilesGridHandler extends SelectableSubmissionFileListCategoryGridHandler
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
new SubmissionFilesCategoryGridDataProvider(SubmissionFile::SUBMISSION_FILE_COPYEDIT),
|
||||
WORKFLOW_STAGE_ID_EDITING,
|
||||
FilesGridCapabilities::FILE_GRID_ADD | FilesGridCapabilities::FILE_GRID_DELETE | FilesGridCapabilities::FILE_GRID_VIEW_NOTES | FilesGridCapabilities::FILE_GRID_EDIT
|
||||
);
|
||||
|
||||
$this->addRoleAssignment(
|
||||
[
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_MANAGER,
|
||||
Role::ROLE_ID_SITE_ADMIN,
|
||||
Role::ROLE_ID_ASSISTANT
|
||||
],
|
||||
[
|
||||
'fetchGrid', 'fetchCategory', 'fetchRow',
|
||||
'addFile',
|
||||
'downloadFile',
|
||||
'deleteFile',
|
||||
'updateCopyeditFiles'
|
||||
]
|
||||
);
|
||||
|
||||
// Set the grid title.
|
||||
$this->setTitle('submission.copyedited');
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Public handler methods
|
||||
//
|
||||
/**
|
||||
* Save 'manage copyedited files' form
|
||||
*
|
||||
* @param array $args
|
||||
* @param PKPRequest $request
|
||||
*
|
||||
* @return JSONMessage JSON object
|
||||
*/
|
||||
public function updateCopyeditFiles($args, $request)
|
||||
{
|
||||
$submission = $this->getSubmission();
|
||||
|
||||
$manageCopyeditFilesForm = new ManageCopyeditFilesForm($submission->getId());
|
||||
$manageCopyeditFilesForm->readInputData();
|
||||
|
||||
if ($manageCopyeditFilesForm->validate()) {
|
||||
$manageCopyeditFilesForm->execute(
|
||||
$this->getGridCategoryDataElements($request, $this->getStageId())
|
||||
);
|
||||
|
||||
if ($submission->getStageId() == WORKFLOW_STAGE_ID_EDITING ||
|
||||
$submission->getStageId() == WORKFLOW_STAGE_ID_PRODUCTION) {
|
||||
$notificationMgr = new NotificationManager();
|
||||
$notificationMgr->updateNotification(
|
||||
$request,
|
||||
[
|
||||
PKPNotification::NOTIFICATION_TYPE_ASSIGN_COPYEDITOR,
|
||||
PKPNotification::NOTIFICATION_TYPE_AWAITING_COPYEDITS,
|
||||
],
|
||||
null,
|
||||
Application::ASSOC_TYPE_SUBMISSION,
|
||||
$submission->getId()
|
||||
);
|
||||
}
|
||||
|
||||
// Let the calling grid reload itself
|
||||
return \PKP\db\DAO::getDataChangedEvent();
|
||||
} else {
|
||||
return new JSONMessage(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file controllers/grid/files/copyedit/form/ManageCopyeditFilesForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ManageCopyeditFilesForm
|
||||
*
|
||||
* @ingroup controllers_grid_files_copyedit
|
||||
*
|
||||
* @brief Form to add files to the copyedited files grid
|
||||
*/
|
||||
|
||||
namespace PKP\controllers\grid\files\copyedit\form;
|
||||
|
||||
use PKP\controllers\grid\files\form\ManageSubmissionFilesForm;
|
||||
use PKP\submissionFile\SubmissionFile;
|
||||
|
||||
class ManageCopyeditFilesForm extends ManageSubmissionFilesForm
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int $submissionId Submission ID.
|
||||
*/
|
||||
public function __construct($submissionId)
|
||||
{
|
||||
parent::__construct($submissionId, 'controllers/grid/files/copyedit/manageCopyeditFiles.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save selection of copyedited files
|
||||
*
|
||||
* @param array $stageSubmissionFiles List of submission files in this stage.
|
||||
* @param int $fileStage SubmissionFile::SUBMISSION_FILE_...
|
||||
*/
|
||||
public function execute($stageSubmissionFiles = null, $fileStage = null, ...$functionArgs)
|
||||
{
|
||||
parent::execute($stageSubmissionFiles, SubmissionFile::SUBMISSION_FILE_COPYEDIT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user