/** * Display a step for the submission wizard. * Displays submission index page if a valid step is not specified. * @param $args array * @param $request Request */ function step($args, $request) { $step = isset($args[0]) ? (int) $args[0] : 1; $context = $request->getContext(); $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $this->setupTemplate($request); if ($step < $this->_getStepCount()) { $formClass = "SubmissionSubmitStep{$step}Form"; import("classes.submission.form.{$formClass}"); $submitForm = new $formClass($context, $submission); if ($submitForm->isLocaleResubmit()) { $submitForm->readInputData(); } else { $submitForm->initData(); } $json = new JSONMessage(true, $submitForm->fetch($request)); return $json->getString(); $submitForm->display($request); } elseif ($step == $this->_getStepCount()) { $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('context', $context); // Retrieve the correct url for author review his submission. import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); $router = $request->getRouter(); $dispatcher = $router->getDispatcher(); $reviewSubmissionUrl = $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId()); $templateMgr->assign('reviewSubmissionUrl', $reviewSubmissionUrl); $templateMgr->assign('submissionId', $submission->getId()); $templateMgr->assign('submitStep', $step); $templateMgr->assign('submissionProgress', $submission->getSubmissionProgress()); // If the expedited process is available, show it. import('lib.pkp.classes.workflow.linkAction.ExpediteSubmissionLinkAction'); if (ExpediteSubmissionLinkAction::canExpedite($request->getUser(), $context)) { $templateMgr->assign('canExpedite', true); $templateMgr->assign('expediteLinkAction', new ExpediteSubmissionLinkAction($request, $submission->getId())); } $json = new JSONMessage(true, $templateMgr->fetch('submission/form/complete.tpl')); return $json->getString(); } }
/** * Fetch JSON-encoded editor decision options. * @param $args array * @param $request Request * @return JSONMessage JSON object */ function editorDecisionActions($args, $request) { AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR); $reviewRoundId = (int) $request->getUserVar('reviewRoundId'); // Prepare the action arguments. $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); $actionArgs = array('submissionId' => $submission->getId(), 'stageId' => (int) $stageId); // If a review round was specified, include it in the args; // must also check that this is the last round or decisions // cannot be recorded. if ($reviewRoundId) { $actionArgs['reviewRoundId'] = $reviewRoundId; $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); $lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId); } // If a review round was specified, // If there is an editor assigned, retrieve stage decisions. $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); if ($stageAssignmentDao->editorAssignedToStage($submission->getId(), $stageId) && (!$reviewRoundId || $reviewRoundId == $lastReviewRound->getId())) { import('classes.workflow.EditorDecisionActionsManager'); $decisions = EditorDecisionActionsManager::getStageDecisions($stageId); } else { $decisions = array(); // None available } // Iterate through the editor decisions and create a link action for each decision. $editorActions = array(); // If we're in Submission stage and could expedite, show action. import('lib.pkp.classes.workflow.linkAction.ExpediteSubmissionLinkAction'); if ($stageId == WORKFLOW_STAGE_ID_SUBMISSION && ExpediteSubmissionLinkAction::canExpedite($request->getUser(), $request->getContext())) { $editorActions[] = new ExpediteSubmissionLinkAction($request, $submission->getId()); } $dispatcher = $request->getDispatcher(); import('lib.pkp.classes.linkAction.request.AjaxModal'); foreach ($decisions as $decision => $action) { $actionArgs['decision'] = $decision; $editorActions[] = new LinkAction($action['name'], new AjaxModal($dispatcher->url($request, ROUTE_COMPONENT, null, 'modals.editorDecision.EditorDecisionHandler', $action['operation'], null, $actionArgs), __($action['title']), $action['titleIcon']), __($action['title'])); } // Assign the actions to the template. $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('editorActions', $editorActions); $templateMgr->assign('stageId', $stageId); return $templateMgr->fetchJson('workflow/editorialLinkActions.tpl'); }