addRoleAssignment( [Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN], [ 'fetchGrid', 'fetchCategory', 'fetchRow', 'addFile', 'downloadFile', 'deleteFile', 'updateProofFiles', ] ); // Set the grid title. $this->setTitle('submission.pageProofs'); } /** * @copydoc PKPHandler::authorize() */ public function authorize($request, &$args, $roleAssignments) { $this->addPolicy(new SubmissionAccessPolicy($request, $args, $roleAssignments)); $this->addPolicy(new PublicationAccessPolicy($request, $args, $roleAssignments)); $this->addPolicy(new RepresentationRequiredPolicy($request, $args)); return parent::authorize($request, $args, $roleAssignments); } /** * Get the grid request parameters. * * @return array */ public function getRequestArgs() { $publication = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_PUBLICATION); $representation = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_REPRESENTATION); return array_merge( parent::getRequestArgs(), [ 'publicationId' => $publication->getId(), 'representationId' => $representation->getId() ] ); } // // Public handler methods // /** * Save 'manage proof files' form * * @param array $args * @param PKPRequest $request * * @return JSONMessage JSON object */ public function updateProofFiles($args, $request) { $submission = $this->getSubmission(); $publication = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_PUBLICATION); $representation = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_REPRESENTATION); $manageProofFilesForm = new ManageProofFilesForm($submission->getId(), $publication->getId(), $representation->getId()); $manageProofFilesForm->readInputData(); if ($manageProofFilesForm->validate()) { $manageProofFilesForm->execute( $this->getGridCategoryDataElements($request, $this->getStageId()), SubmissionFile::SUBMISSION_FILE_PROOF ); // Let the calling grid reload itself return \PKP\db\DAO::getDataChangedEvent(); } else { return new JSONMessage(false); } } }