/** * Confirm that the uploaded file is a revision of an * earlier uploaded file. * @param $args array * @param $request Request * @return JSONMessage JSON object */ function confirmRevision($args, $request) { // Instantiate the revision confirmation form. $submission = $this->getSubmission(); import('lib.pkp.controllers.wizard.fileUpload.form.SubmissionFilesUploadConfirmationForm'); // FIXME?: need assocType and assocId? Not sure if they would be used, so not adding now. $reviewRound = $this->getReviewRound(); $confirmationForm = new SubmissionFilesUploadConfirmationForm($request, $submission->getId(), $this->getStageId(), $this->getFileStage(), $reviewRound); $confirmationForm->readInputData(); // Validate the form and revise the file. if ($confirmationForm->validate($request)) { if (is_a($uploadedFile = $confirmationForm->execute($request), 'SubmissionFile')) { // Go to the meta-data editing step. return new JSONMessage(true, '', '0', $this->_getUploadedFileInfo($uploadedFile)); } else { return new JSONMessage(false, __('common.uploadFailed')); } } else { return new JSONMessage(false, array_pop($confirmationForm->getErrorsArray())); } }
/** * Confirm that the uploaded file is a revision of an * earlier uploaded file. * @param $args array * @param $request Request * @return string a serialized JSON object */ function confirmRevision($args, &$request) { // Instantiate the revision confirmation form. $monograph =& $this->getMonograph(); import('controllers.wizard.fileUpload.form.SubmissionFilesUploadConfirmationForm'); $confirmationForm = new SubmissionFilesUploadConfirmationForm($request, $monograph->getId(), $this->getStageId(), $this->getFileStage()); $confirmationForm->readInputData(); // Validate the form and revise the file. if ($confirmationForm->validate($request)) { if (is_a($uploadedFile =& $confirmationForm->execute(), 'MonographFile')) { // Go to the meta-data editing step. $json = new JSON(true, '', false, '0', $this->_getUploadedFileInfo($uploadedFile)); } else { $json = new JSON(false, Locale::translate('common.uploadFailed')); } } else { $json = new JSON(false, array_pop($confirmationForm->getErrorsArray())); } return $json->getString(); }