17 import(
'classes.handler.Handler');
18 import(
'lib.pkp.classes.core.JSONMessage');
21 import(
'classes.workflow.EditorDecisionActionsManager');
29 parent::__construct();
30 $this->
addRoleAssignment(array(ROLE_ID_SUB_EDITOR, ROLE_ID_MANAGER, ROLE_ID_ASSISTANT), array(
'fetchTab'));
40 function authorize($request, &$args, $roleAssignments) {
42 import(
'lib.pkp.classes.security.authorization.WorkflowStageAccessPolicy');
45 return parent::authorize($request, $args, $roleAssignments);
64 $templateMgr->assign(
'stageId', $stageId);
67 $templateMgr->assign(
'submission', $submission);
70 case WORKFLOW_STAGE_ID_SUBMISSION:
71 return $templateMgr->fetchJson(
'controllers/tab/workflow/submission.tpl');
72 case WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
73 case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
79 $reviewRoundsFactory = $reviewRoundDao->getBySubmissionId($submission->getId(), $selectedStageId);
80 $reviewRoundsArray = $reviewRoundsFactory->toAssociativeArray();
81 $lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $selectedStageId);
85 if ($lastReviewRound) {
86 $lastReviewRoundNumber = $lastReviewRound->getRound();
87 $lastReviewRoundId = $lastReviewRound->getId();
88 $templateMgr->assign(
'lastReviewRoundNumber', $lastReviewRoundNumber);
90 $lastReviewRoundId =
null;
94 $templateMgr->assign(
'reviewRounds', $reviewRoundsArray);
95 $templateMgr->assign(
'reviewRoundOp', $this->_identifyReviewRoundOp($stageId));
97 if ($submission->getStageId() == $selectedStageId && count($reviewRoundsArray) > 0) {
98 $dispatcher = $request->getDispatcher();
100 import(
'lib.pkp.classes.linkAction.request.AjaxModal');
105 $request, ROUTE_COMPONENT,
null,
106 'modals.editorDecision.EditorDecisionHandler',
107 'newReviewRound',
null, array(
108 'submissionId' => $submission->getId(),
109 'decision' => SUBMISSION_EDITOR_DECISION_NEW_ROUND,
110 'stageId' => $selectedStageId,
111 'reviewRoundId' => $lastReviewRoundId
114 __(
'editor.submission.newRound'),
117 __(
'editor.submission.newRound'),
120 $templateMgr->assign(
'newRoundAction', $newRoundAction);
124 return $templateMgr->fetchJson(
'controllers/tab/workflow/review.tpl');
125 case WORKFLOW_STAGE_ID_EDITING:
127 $notificationRequestOptions = array(
128 NOTIFICATION_LEVEL_NORMAL => array(
129 NOTIFICATION_TYPE_ASSIGN_COPYEDITOR => array(ASSOC_TYPE_SUBMISSION, $submission->getId()),
130 NOTIFICATION_TYPE_AWAITING_COPYEDITS => array(ASSOC_TYPE_SUBMISSION, $submission->getId())),
131 NOTIFICATION_LEVEL_TRIVIAL => array()
133 $templateMgr->assign(
'editingNotificationRequestOptions', $notificationRequestOptions);
134 return $templateMgr->fetchJson(
'controllers/tab/workflow/editorial.tpl');
135 case WORKFLOW_STAGE_ID_PRODUCTION:
139 $templateMgr->assign(
'productionNotificationRequestOptions', $notificationRequestOptions);
141 return $templateMgr->fetchJson(
'controllers/tab/workflow/production.tpl');
150 parent::setupTemplate($request);
151 AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_APP_EDITOR, LOCALE_COMPONENT_PKP_GRID, LOCALE_COMPONENT_PKP_EDITOR);
159 $templateMgr->assign(
'submission', $submission);
162 $templateMgr->assign(
'stageId', $stageId);
163 $templateMgr->assign(
'submissionStageId', $submission->getStageId());
170 $notificationRequestOptions = array(
171 NOTIFICATION_LEVEL_TASK => array(
172 $editorAssignmentNotificationType => array(ASSOC_TYPE_SUBMISSION, $submission->getId())
174 NOTIFICATION_LEVEL_TRIVIAL => array()
177 $templateMgr->assign(
'workflowNotificationRequestOptions', $notificationRequestOptions);
187 case WORKFLOW_STAGE_ID_SUBMISSION:
188 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_SUBMISSION;
189 case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
190 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EXTERNAL_REVIEW;
191 case WORKFLOW_STAGE_ID_EDITING:
192 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EDITING;
193 case WORKFLOW_STAGE_ID_PRODUCTION:
194 return NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_PRODUCTION;
211 private function _identifyStageId($request) {
212 if ($stageId = $request->getUserVar(
'stageId')) {
213 return (
int) $stageId;
222 private function _identifyReviewRoundOp($stageId) {
224 case WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
225 return 'internalReviewRound';
226 case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
227 return 'externalReviewRound';