/** * @see Form::execute() */ function execute($args, &$request) { // Retrieve the submission. $seriesEditorSubmission =& $this->getSeriesEditorSubmission(); // Record the decision. $decision = $this->getDecision(); import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $seriesEditorAction->recordDecision($seriesEditorSubmission, $decision); // Identify email key and status of round. switch ($decision) { case SUBMISSION_EDITOR_DECISION_ACCEPT: $emailKey = 'EDITOR_DECISION_ACCEPT'; $status = REVIEW_ROUND_STATUS_ACCEPTED; // Move to the editing stage. $seriesEditorAction->incrementWorkflowStage($seriesEditorSubmission, WORKFLOW_STAGE_ID_EDITING); break; case SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW: $emailKey = 'EDITOR_DECISION_SEND_TO_EXTERNAL'; $status = REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL; // Move to the external review stage. $seriesEditorAction->incrementWorkflowStage($seriesEditorSubmission, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW); // Create an initial external review round. $this->_initiateReviewRound($seriesEditorSubmission, REVIEW_TYPE_EXTERNAL, 1); break; default: // Unsupported decision. assert(false); } // Send email to the author. $this->_sendReviewMailToAuthor($seriesEditorSubmission, $status, $emailKey, $request); }
/** * @see Form::execute() */ function execute($args, &$request) { // Retrieve the submission. $seriesEditorSubmission =& $this->getSeriesEditorSubmission(); // Record the decision. $decision = $this->getDecision(); import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $seriesEditorAction->recordDecision($seriesEditorSubmission, $decision); // Identify email key and status of round. switch ($decision) { case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS: $emailKey = 'SUBMISSION_UNSUITABLE'; $status = REVIEW_ROUND_STATUS_REVISIONS_REQUESTED; break; case SUBMISSION_EDITOR_DECISION_RESUBMIT: $emailKey = 'EDITOR_DECISION_RESUBMIT'; $status = REVIEW_ROUND_STATUS_RESUBMITTED; break; case SUBMISSION_EDITOR_DECISION_DECLINE: $emailKey = 'SUBMISSION_UNSUITABLE'; $status = REVIEW_ROUND_STATUS_DECLINED; break; default: // Unsupported decision. assert(false); } // Send email to the author. $this->_sendReviewMailToAuthor($seriesEditorSubmission, $status, $emailKey, $request); }
/** * @see Form::execute() */ function execute($args, &$request) { // Retrieve the submission. $seriesEditorSubmission =& $this->getSeriesEditorSubmission(); // Move to the internal review stage. import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $seriesEditorAction->incrementWorkflowStage($seriesEditorSubmission, WORKFLOW_STAGE_ID_INTERNAL_REVIEW); // Create an initial internal review round. $this->_initiateReviewRound($seriesEditorSubmission, REVIEW_TYPE_INTERNAL, 1, REVIEW_ROUND_STATUS_PENDING_REVIEWERS); }
/** * @see Form::execute() * @return integer The new review round number */ function execute($args, &$request) { // Retrieve the submission. $seriesEditorSubmission =& $this->getSeriesEditorSubmission(); // Record the decision. import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $seriesEditorAction->recordDecision($seriesEditorSubmission, SUBMISSION_EDITOR_DECISION_RESUBMIT); // Create a new review round. $newRound = $seriesEditorSubmission->getCurrentRound() + 1; $this->_initiateReviewRound($seriesEditorSubmission, $seriesEditorSubmission->getCurrentReviewType(), $newRound, REVIEW_ROUND_STATUS_PENDING_REVIEWERS); return $newRound; }
/** * Start new review round * @param $args array * @param $request PKPRequest * @return int The new review round number * @see Form::execute() */ function execute($args, &$request) { import('classes.submission.seriesEditor.SeriesEditorAction'); $monograph =& $this->getMonograph(); $seriesEditorSubmissionDao =& DAORegistry::getDAO('SeriesEditorSubmissionDAO'); $seriesEditorSubmission =& $seriesEditorSubmissionDao->getSeriesEditorSubmission($monograph->getId()); // 1. Record the decision SeriesEditorAction::recordDecision($seriesEditorSubmission, SUBMISSION_EDITOR_DECISION_RESUBMIT); // 2. Create a new internal review round // FIXME #6102: What to do with reviewType? $newRound = $seriesEditorSubmission->getCurrentRound() ? $seriesEditorSubmission->getCurrentRound() + 1 : 1; $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO'); $reviewRoundDao->build($monograph->getId(), REVIEW_TYPE_INTERNAL, $newRound, 1, REVIEW_ROUND_STATUS_PENDING_REVIEWERS); $seriesEditorSubmission->setCurrentRound($newRound); $seriesEditorSubmissionDao->updateSeriesEditorSubmission($seriesEditorSubmission); // 3. Add the selected files to the new round $selectedFiles = $this->getData('selectedFiles'); $filesWithRevisions = array(); if (is_array($selectedFiles)) { foreach ($selectedFiles as $selectedFile) { $filesWithRevisions[] = explode("-", $selectedFile); } $reviewRoundDAO =& DAORegistry::getDAO('ReviewRoundDAO'); $reviewRoundDAO->setFilesForReview($monograph->getId(), REVIEW_TYPE_INTERNAL, $newRound, $filesWithRevisions); } return $newRound; }
/** * Assigns a reviewer to a submission. * @param $seriesEditorSubmission object * @param $reviewerId int */ function addReviewer($seriesEditorSubmission, $reviewerId, $reviewType, $round = null, $reviewDueDate = null, $responseDueDate = null) { $seriesEditorSubmissionDao =& DAORegistry::getDAO('SeriesEditorSubmissionDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $user =& Request::getUser(); $reviewer =& $userDao->getUser($reviewerId); // Check to see if the requested reviewer is not already // assigned to review this monograph. if ($round == null) { $round = $seriesEditorSubmission->getCurrentRound(); } $assigned = $seriesEditorSubmissionDao->reviewerExists($seriesEditorSubmission->getId(), $reviewerId, $reviewType, $round); // Only add the reviewer if he has not already // been assigned to review this monograph. if (!$assigned && isset($reviewer) && !HookRegistry::call('SeriesEditorAction::addReviewer', array(&$seriesEditorSubmission, $reviewerId))) { $reviewAssignment = new ReviewAssignment(); $reviewAssignment->setSubmissionId($seriesEditorSubmission->getId()); $reviewAssignment->setReviewerId($reviewerId); $reviewAssignment->setDateAssigned(Core::getCurrentDate()); $reviewAssignment->setReviewType($reviewType); $reviewAssignment->setRound($round); // Assign review form automatically if needed $pressId = $seriesEditorSubmission->getPressId(); $seriesDao =& DAORegistry::getDAO('SeriesDAO'); $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO'); $submissionId = $seriesEditorSubmission->getId(); $series =& $seriesDao->getById($submissionId, $pressId); $seriesEditorSubmission->addReviewAssignment($reviewAssignment, $reviewType, $round); $seriesEditorSubmissionDao->updateSeriesEditorSubmission($seriesEditorSubmission); $reviewAssignment = $reviewAssignmentDao->getReviewAssignment($seriesEditorSubmission->getId(), $reviewerId, $round, $reviewType); $press =& Request::getPress(); $settingsDao =& DAORegistry::getDAO('PressSettingsDAO'); $settings =& $settingsDao->getPressSettings($press->getId()); if (isset($reviewDueDate)) { SeriesEditorAction::setDueDate($seriesEditorSubmission->getId(), $reviewAssignment->getId(), $reviewDueDate); } if (isset($responseDueDate)) { SeriesEditorAction::setResponseDueDate($seriesEditorSubmission->getId(), $reviewAssignment->getId(), $responseDueDate); } // Add log import('classes.monograph.log.MonographLog'); import('classes.monograph.log.MonographEventLogEntry'); MonographLog::logEvent($seriesEditorSubmission->getId(), MONOGRAPH_LOG_REVIEW_ASSIGN, MONOGRAPH_LOG_TYPE_REVIEW, $reviewAssignment->getId(), 'log.review.reviewerAssigned', array('reviewerName' => $reviewer->getFullName(), 'monographId' => $seriesEditorSubmission->getId(), 'reviewType' => $reviewType, 'round' => $round)); } }
/** * Import all free-text/review form reviews to paste into message * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function importPeerReviews($args, &$request) { $monographId = $request->getUserVar('monographId'); $seriesEditorSubmissionDao =& DAORegistry::getDAO('SeriesEditorSubmissionDAO'); $seriesEditorSubmission =& $seriesEditorSubmissionDao->getSeriesEditorSubmission($monographId); import('classes.submission.seriesEditor.SeriesEditorAction'); $peerReviews = SeriesEditorAction::getPeerReviews($seriesEditorSubmission); if (empty($peerReviews)) { $json = new JSON('false', Locale::translate('editor.review.noReviews')); } else { $json = new JSON('true', $peerReviews); } return $json->getString(); }
/** * Save review assignment * @param $args array * @param $request PKPRequest */ function execute($args, &$request) { $seriesEditorSubmissionDao =& DAORegistry::getDAO('SeriesEditorSubmissionDAO'); $submission =& $seriesEditorSubmissionDao->getSeriesEditorSubmission($this->getMonographId()); $press =& $request->getPress(); $reviewType = $this->getData('reviewType'); $round = $this->getData('round'); $reviewDueDate = $this->getData('reviewDueDate'); $responseDueDate = $this->getData('responseDueDate'); $selectionType = (int) $this->getData('selectionType'); if ($selectionType == REVIEWER_SELECT_CREATE) { $userDao =& DAORegistry::getDAO('UserDAO'); $user = new User(); $user->setFirstName($this->getData('firstname')); $user->setMiddleName($this->getData('middlename')); $user->setLastName($this->getData('lastname')); $user->setEmail($this->getData('email')); $authDao =& DAORegistry::getDAO('AuthSourceDAO'); $auth =& $authDao->getDefaultPlugin(); $user->setAuthId($auth ? $auth->getAuthId() : 0); $user->setUsername($this->getData('username')); $password = Validation::generatePassword(); if (isset($auth)) { $user->setPassword($password); // FIXME Check result and handle failures $auth->doCreateUser($user); $user->setAuthId($auth->authId); $user->setPassword(Validation::encryptCredentials($user->getId(), Validation::generatePassword())); // Used for PW reset hash only } else { $user->setPassword(Validation::encryptCredentials($this->getData('username'), $password)); } $user->setDateRegistered(Core::getCurrentDate()); $reviewerId = $userDao->insertUser($user); // Add reviewer interests to interests table $interestDao =& DAORegistry::getDAO('InterestDAO'); $interests = Request::getUserVar('interestsKeywords'); $interests = array_map('urldecode', $interests); // The interests are coming in encoded -- Decode them for DB storage if (empty($interests)) { $interests = array(); } elseif (!is_array($interests)) { $interests = array($interests); } $interestDao->insertInterests($interests, $reviewerId, true); // Assign the selected user group ID to the user $userGroupDao =& DAORegistry::getDAO('UserGroupDAO'); /* @var $userGroupDao UserGroupDAO */ $userGroupId = (int) $this->getData('userGroupId'); $userGroupDao->assignUserToGroup($reviewerId, $userGroupId); if ($this->getData('sendNotify')) { // Send welcome email to user import('classes.mail.MailTemplate'); $mail = new MailTemplate('REVIEWER_REGISTER'); $mail->setFrom($press->getSetting('contactEmail'), $press->getSetting('contactName')); $mail->assignParams(array('username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName())); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } } elseif ($selectionType == REVIEWER_SELECT_ENROLL) { // Assign a reviewer user group to an existing non-reviewer $userId = $this->getData('userId'); $userGroupId = $this->getData('userGroupId'); $userGroupId = $this->getData('userGroupId'); $userGroupDao =& DAORegistry::getDAO('UserGroupDAO'); /* @var $userGroupDao UserGroupDAO */ $userGroupDao->assignUserToGroup($userId, $userGroupId); // Set the reviewerId to the userId to return to the grid $reviewerId = $userId; } else { $reviewerId = $this->getData('reviewerId'); } import('classes.submission.seriesEditor.SeriesEditorAction'); SeriesEditorAction::addReviewer($submission, $reviewerId, $reviewType, $round, $reviewDueDate, $responseDueDate); // Get the reviewAssignment object now that it has been added $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignment =& $reviewAssignmentDao->getReviewAssignment($submission->getId(), $reviewerId, $round, $reviewType); $reviewAssignment->setDateNotified(Core::getCurrentDate()); $reviewAssignment->setCancelled(0); $reviewAssignment->stampModified(); $reviewAssignmentDao->updateObject($reviewAssignment); // Update the review round status if this is the first reviewer added $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO'); $currentReviewRound =& $reviewRoundDao->build($this->getMonographId(), $submission->getCurrentReviewType(), $submission->getCurrentRound()); if ($currentReviewRound->getStatus() == REVIEW_ROUND_STATUS_PENDING_REVIEWERS) { $currentReviewRound->setStatus(REVIEW_ROUND_STATUS_PENDING_REVIEWS); $reviewRoundDao->updateObject($currentReviewRound); } return $reviewAssignment; }
/** * Delete a reviewer * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function deleteReviewer($args, &$request) { // Delete the review assignment. // NB: SeriesEditorAction::clearReview() will check that this review // id is actually attached to the monograph so no need for further // validation here. $monograph =& $this->getMonograph(); $reviewId = (int) $request->getUserVar('reviewId'); import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $result = $seriesEditorAction->clearReview($monograph->getId(), $reviewId); // Render the result. if ($result) { $json = new JSON(true); } else { $json = new JSON(false, Locale::translate('submission.submit.errorDeletingReviewer')); } return $json->getString(); }
/** * Save changes to monograph. * @return int the monograph ID */ function execute() { $monographDao =& DAORegistry::getDAO('MonographDAO'); $authorDao =& DAORegistry::getDAO('AuthorDAO'); // Update monograph $monograph =& $this->monograph; $monograph->setTitle($this->getData('title'), null); // Localized $monograph->setAbstract($this->getData('abstract'), null); // Localized if (is_array($this->getData('agenciesKeywords'))) { $monograph->setSupportingAgencies(implode(", ", $this->getData('agenciesKeywords')), null); } // Localized if (is_array($this->getData('disciplinesKeywords'))) { $monograph->setDiscipline(implode(", ", $this->getData('disciplinesKeywords')), null); } // Localized if (is_array($this->getData('keywordKeywords'))) { $monograph->setSubject(implode(", ", $this->getData('keywordKeywords')), null); } // Localized if ($monograph->getSubmissionProgress() <= $this->step) { $monograph->setDateSubmitted(Core::getCurrentDate()); $monograph->stampStatusModified(); $monograph->setSubmissionProgress(0); } // Assign the default users to the submission workflow stage import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $seriesEditorAction->assignDefaultStageParticipants($monograph, WORKFLOW_STAGE_ID_SUBMISSION); // Save the monograph $monographDao->updateMonograph($monograph); return $this->monographId; }
/** * Save editor decision * @param $args array * @param $request PKPRequest * @see Form::execute() */ function execute($args, &$request) { import('classes.submission.seriesEditor.SeriesEditorAction'); $monographDao =& DAORegistry::getDAO('MonographDAO'); $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO'); $monograph =& $this->getMonograph(); $decision = $this->getDecision(); switch ($decision) { case SUBMISSION_EDITOR_DECISION_ACCEPT: // 1. Record the decision SeriesEditorAction::recordDecision($monograph, SUBMISSION_EDITOR_DECISION_ACCEPT); // 2. select email key $emailKey = 'EDITOR_DECISION_ACCEPT'; // 3. Set status of round $status = REVIEW_ROUND_STATUS_ACCEPTED; // 4. Assign the default users to the next workflow stage Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_EDITING); $monograph->setCurrentStageId(WORKFLOW_STAGE_ID_EDITING); $monographDao->updateMonograph($monograph); break; case SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW: // 1. Record the decision SeriesEditorAction::recordDecision($monograph, SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW); // 2. Create a new external review round $reviewRoundDao->build($monograph->getId(), REVIEW_TYPE_EXTERNAL, 1, 1); // 3. Get selected files and put in review_round_files table $selectedFiles = $this->getData('selectedFiles'); $filesForReview = array(); foreach ($selectedFiles as $selectedFile) { $filesForReview[] = explode("-", $selectedFile); } $reviewRoundDao->setFilesForReview($monograph->getId(), REVIEW_TYPE_EXTERNAL, 1, $filesForReview); // 4. select email key // FIXME #6123: will we have an email key for this decision? $emailKey = 'EDITOR_DECISION_ACCEPT'; // 5. Set status of round $status = REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL; // 6. Assign the default users to the next workflow stage Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_EXTERNAL_REVIEW); $monograph->setCurrentStageId(WORKFLOW_STAGE_ID_EXTERNAL_REVIEW); $monograph->setCurrentRound(1); $monographDao->updateMonograph($monograph); break; default: // only support the three decisions above assert(false); } $currentReviewRound =& $reviewRoundDao->build($monograph->getId(), $monograph->getCurrentReviewType(), $monograph->getCurrentRound()); $currentReviewRound->setStatus($status); $reviewRoundDao->updateObject($currentReviewRound); // n. Send Personal message to author $submitter =& $monograph->getUser(); import('classes.mail.MonographMailTemplate'); $email =& new MonographMailTemplate($monograph, $emailKey, null, true); $email->setBody($this->getData('personalMessage')); $email->addRecipient($submitter->getEmail(), $submitter->getFullName()); $email->setAssoc(MONOGRAPH_EMAIL_EDITOR_NOTIFY_AUTHOR, MONOGRAPH_EMAIL_TYPE_EDITOR, $currentReviewRound->getRound()); // Attach the selected reviewer attachments $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ $selectedAttachments = $this->getData('selectedAttachments') ? $this->getData('selectedAttachments') : array(); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($monograph->getId(), $monograph->getCurrentRound()); assert(is_array($reviewIndexes)); if (is_array($selectedAttachments)) { foreach ($selectedAttachments as $attachmentId) { $monographFile =& $submissionFileDao->getLatestRevision($attachmentId); $fileName = $monographFile->getOriginalFileName(); $reviewAssignmentId = $monographFile->getAssocId(); assert($monographFile->getAssocType == ASSOC_TYPE_REVIEW_ASSIGNMENT); assert(is_numeric($reviewAssignmentId)); $email->addAttachment($monographFile->getFilePath(), String::enumerateAlphabetically($reviewIndexes[$reviewAssignmentId]) . '-' . $monographFile->getOriginalFileName()); // Update monograph to set viewable as true, so author can view the file on their submission summary page $monographFile->setViewable(true); $submissionFileDao->updateObject($monographFile); } } $email->send(); }
/** * Delete a reviewer * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function deleteReviewer($args, &$request) { // Retrieve the authorized monograph. $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH); // Identify the review assignment ID. $reviewId = (int) $request->getUserVar('reviewId'); // Delete the review assignment. // NB: SeriesEditorAction::clearReview() will check that this review // id is actually attached to the monograph so no need for further // validation here. import('classes.submission.seriesEditor.SeriesEditorAction'); $result = SeriesEditorAction::clearReview($monograph->getId(), $reviewId); // Render the result. if ($result) { $json = new JSON('true'); } else { $json = new JSON('false', Locale::translate('submission.submit.errorDeletingReviewer')); } return $json->getString(); }
/** * Promote the submission into the production stage * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function sendToProduction(&$args, &$request) { // Retrieve the submission. $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH); // Move to the production workflow stage import('classes.submission.seriesEditor.SeriesEditorAction'); $seriesEditorAction = new SeriesEditorAction(); $seriesEditorAction->incrementWorkflowStage($monograph, WORKFLOW_STAGE_ID_PRODUCTION); $json = new JSON(true); return $json->getString(); }