/** * Get cell actions associated with this row/column combination * @param $row GridRow * @param $column GridColumn * @return array an array of LinkAction instances */ function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) { if ($column->getId() == 'title') { $submission = $row->getData(); $router = $request->getRouter(); $dispatcher = $router->getDispatcher(); $title = $submission->getLocalizedTitle(); if (empty($title)) { $title = __('common.untitled'); } $contextId = $submission->getContextId(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($contextId); if ($submission->getSubmissionProgress() > 0) { $url = $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'submission', 'wizard', $submission->getSubmissionProgress(), array('submissionId' => $submission->getId())); } else { list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); $url = $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId()); } import('lib.pkp.classes.linkAction.request.RedirectAction'); $action = new LinkAction('itemWorkflow', new RedirectAction($url), $title); return array($action); } return parent::getCellActions($request, $row, $column, $position); }
/** * Construct a URL for the notification based on its type and associated object * @copydoc INotificationInfoProvider::getNotificationContents() */ public function getNotificationUrl($request, $notification) { $dispatcher = Application::getDispatcher(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($notification->getContextId()); switch ($notification->getType()) { case NOTIFICATION_TYPE_ALL_REVIEWS_IN: case NOTIFICATION_TYPE_ALL_REVISIONS_IN: assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId())); $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); $reviewRound = $reviewRoundDao->getById($notification->getAssocId()); assert(is_a($reviewRound, 'ReviewRound')); $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($reviewRound->getSubmissionId()); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); if ($page == 'workflow') { $stageId = $reviewRound->getStageId(); $operation = WorkflowStageDAO::getPathFromId($stageId); } return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId()); case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT: case NOTIFICATION_TYPE_INDEX_ASSIGNMENT: case NOTIFICATION_TYPE_APPROVE_SUBMISSION: assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId())); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', 'access', $notification->getAssocId()); case NOTIFICATION_TYPE_REVIEWER_COMMENT: assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ASSIGNMENT && is_numeric($notification->getAssocId())); $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */ $reviewAssignment = $reviewAssignmentDao->getById($notification->getAssocId()); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); $operation = $reviewAssignment->getStageId() == WORKFLOW_STAGE_ID_INTERNAL_REVIEW ? WORKFLOW_STAGE_PATH_INTERNAL_REVIEW : WORKFLOW_STAGE_PATH_EXTERNAL_REVIEW; return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', $operation, $reviewAssignment->getSubmissionId()); case NOTIFICATION_TYPE_REVIEW_ASSIGNMENT: $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */ $reviewAssignment = $reviewAssignmentDao->getById($notification->getAssocId()); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'reviewer', 'submission', $reviewAssignment->getSubmissionId()); case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT: assert($notification->getAssocType() == ASSOC_TYPE_ANNOUNCEMENT); $announcementDao = DAORegistry::getDAO('AnnouncementDAO'); /* @var $announcementDao AnnouncementDAO */ $announcement = $announcementDao->getById($notification->getAssocId()); /* @var $announcement Announcement */ $context = $contextDao->getById($announcement->getAssocId()); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'announcement', 'view', array($notification->getAssocId())); case NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD: return __('notification.type.configurePaymentMethod'); } return $this->getByDelegate($notification->getType(), $notification->getAssocType(), $notification->getAssocId(), __FUNCTION__, array($request, $notification)); }
/** * @copydoc NotificationManagerDelegate::getNotificationUrl() */ public function getNotificationUrl($request, $notification) { assert($notification->getAssocType() == ASSOC_TYPE_QUERY); $queryDao = DAORegistry::getDAO('QueryDAO'); $query = $queryDao->getById($notification->getAssocId()); assert(is_a($query, 'Query')); $submission = $this->getQuerySubmission($query); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $notification->getUserId()); $router = $request->getRouter(); $dispatcher = $router->getDispatcher(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($submission->getContextId()); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId()); }
/** * @copydoc NotificationManagerDelegate::getNotificationUrl() */ public function getNotificationUrl($request, $notification) { $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($notification->getAssocId()); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); if ($page == 'workflow') { $stageData = $this->_getStageDataByType(); $operation = $stageData['path']; } $router = $request->getRouter(); $dispatcher = $router->getDispatcher(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($submission->getContextId()); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId()); }
/** * Get cell actions associated with this row/column combination * @param $row GridRow * @param $column GridColumn * @return array an array of LinkAction instances */ function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) { if ($column->getId() == 'title') { $submission = $row->getData(); if (is_a($submission, 'ReviewerSubmission')) { // Reviewer: Add a review link action. return array($this->_getCellLinkAction($request, 'reviewer', 'submission', $submission)); } else { // Get the right page and operation (authordashboard or workflow). list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); // Return redirect link action. return array($this->_getCellLinkAction($request, $page, $operation, $submission)); } // This should be unreachable code. assert(false); } return parent::getCellActions($request, $row, $column, $position); }
/** * 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(); } }
/** * @copydoc INotificationInfoProvider::getNotificationUrl() */ public function getNotificationUrl($request, $notification) { switch ($notification->getType()) { case NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS: $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($notification->getAssocId()); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); $router = $request->getRouter(); $dispatcher = $router->getDispatcher(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($submission->getContextId()); // this will probably be authorDashboard/submission, but the possibility exists that an editor is // revising a submission without being an author in the stage assignments. return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId()); default: return ''; } }
/** * Construct a URL for the notification based on its type and associated object * @copydoc INotificationInfoProvider::getNotificationContents() */ public function getNotificationUrl($request, $notification) { $dispatcher = Application::getDispatcher(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($notification->getContextId()); switch ($notification->getType()) { case NOTIFICATION_TYPE_ALL_REVIEWS_IN: case NOTIFICATION_TYPE_ALL_REVISIONS_IN: assert($notification->getAssocType() == ASSOC_TYPE_REVIEW_ROUND && is_numeric($notification->getAssocId())); $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); $reviewRound = $reviewRoundDao->getById($notification->getAssocId()); assert(is_a($reviewRound, 'ReviewRound')); $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($reviewRound->getSubmissionId()); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); if ($page == 'workflow') { $stageId = $reviewRound->getStageId(); $operation = WorkflowStageDAO::getPathFromId($stageId); } return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submission->getId()); case NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT: case NOTIFICATION_TYPE_INDEX_ASSIGNMENT: case NOTIFICATION_TYPE_APPROVE_SUBMISSION: assert($notification->getAssocType() == ASSOC_TYPE_SUBMISSION && is_numeric($notification->getAssocId())); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'workflow', 'access', $notification->getAssocId()); case NOTIFICATION_TYPE_AUDITOR_REQUEST: case NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT: assert($notification->getAssocType() == ASSOC_TYPE_SIGNOFF); $signoffDao = DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */ $signoff = $signoffDao->getById($notification->getAssocId()); assert(is_a($signoff, 'Signoff') && $signoff->getAssocType() == ASSOC_TYPE_SUBMISSION_FILE); $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ $submissionFile = $submissionFileDao->getLatestRevision($signoff->getAssocId()); assert(is_a($submissionFile, 'SubmissionFile')); $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($submissionFile->getSubmissionId()); // Get correct page (author dashboard or workflow), based // on user roles (if only author, go to author dashboard). import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); // If workflow, get the correct operation (stage). if ($page == 'workflow') { $stageId = $signoffDao->getStageIdBySymbolic($signoff->getSymbolic()); $operation = WorkflowStageDAO::getPathFromId($stageId); } return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), $page, $operation, $submissionFile->getSubmissionId()); case NOTIFICATION_TYPE_REVIEW_ASSIGNMENT: $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */ $reviewAssignment = $reviewAssignmentDao->getById($notification->getAssocId()); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'reviewer', 'submission', $reviewAssignment->getSubmissionId()); case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT: assert($notification->getAssocType() == ASSOC_TYPE_ANNOUNCEMENT); $announcementDao = DAORegistry::getDAO('AnnouncementDAO'); /* @var $announcementDao AnnouncementDAO */ $announcement = $announcementDao->getById($notification->getAssocId()); /* @var $announcement Announcement */ $context = $contextDao->getById($announcement->getAssocId()); return $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'announcement', 'view', array($notification->getAssocId())); case NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD: return __('notification.type.configurePaymentMethod'); } return $this->getByDelegate($notification->getType(), $notification->getAssocType(), $notification->getAssocId(), __FUNCTION__, array($request, $notification)); }
/** * Initialize form data from the associated author. * @param $args array * @param $request PKPRequest */ function initData($args, $request) { $userDao = DAORegistry::getDAO('UserDAO'); $user = $request->getUser(); $context = $request->getContext(); $signoff = $this->getSignoff(); $auditorId = $signoff->getUserId(); $auditor = $userDao->getById($auditorId); $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($this->getSubmissionId()); $email = $this->_getMailTemplate($submission); // Format the review due date $signoffDueDate = strtotime($signoff->getDateUnderway()); $dateFormatShort = Config::getVar('general', 'date_format_short'); if ($signoffDueDate == -1) { $signoffDueDate = $dateFormatShort; } else { $signoffDueDate = strftime($dateFormatShort, $signoffDueDate); } import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $auditor->getId()); $dispatcher = $request->getDispatcher(); $auditUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('submissionId' => $submission->getId())); $paramArray = array('reviewerName' => $auditor->getFullName(), 'reviewDueDate' => $signoffDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'auditorUserName' => $auditor->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $auditor->getUsername(), array('confirm' => Validation::generatePasswordResetHash($auditor->getId()))), 'submissionReviewUrl' => $auditUrl, 'contextName' => $context->getLocalizedName(), 'submissionTitle' => $submission->getLocalizedTitle()); $email->assignParams($paramArray); $this->setData('submissionId', $submission->getId()); $this->setData('stageId', $this->getStageId()); $this->setData('signoffId', $signoff->getId()); $this->setData('signoff', $signoff); $this->setData('auditorName', $auditor->getFullName()); $this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature')); }
/** * Send a message to a user. * @param $userId int the user id to send email to. * @param $submission Submission * @param $request PKPRequest */ function sendMessage($userId, $submission, $request) { $template = $this->getData('template'); $fromUser = $request->getUser(); $email = $this->_getMailTemplate($submission, $template, false); $email->setReplyTo($fromUser->getEmail(), $fromUser->getFullName()); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); $dispatcher = $request->getDispatcher(); $userDao = DAORegistry::getDAO('UserDAO'); $user = $userDao->getById($userId); if (isset($user)) { $email->addRecipient($user->getEmail(), $user->getFullName()); $email->setBody($this->getData('message')); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $user->getId()); $submissionUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('submissionId' => $submission->getId())); // Parameters for various emails $email->assignParams(array('copyeditorName' => $user->getFullName(), 'copyeditorUsername' => $user->getUsername(), 'submissionCopyeditingUrl' => $submissionUrl, 'layoutEditorName' => $user->getFullName(), 'submissionUrl' => $submissionUrl, 'layoutEditorUsername' => $user->getUsername(), 'editorialContactName' => $user->getFullname(), 'indexerName' => $user->getFullName(), 'indexerUsername' => $user->getUsername(), 'editorUsername' => $user->getUsername())); $this->_createNotifications($request, $submission, $user, $template); $email->send($request); // remove the INDEX_ and LAYOUT_ tasks if a user has sent the appropriate _COMPLETE email switch ($template) { case 'LAYOUT_COMPLETE': $this->_removeUploadTaskNotification($submission, NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT, $request); break; case 'INDEX_COMPLETE': $this->_removeUploadTaskNotification($submission, NOTIFICATION_TYPE_INDEX_ASSIGNMENT, $request); break; } } }
/** * Get cell actions associated with this row/column combination * @param $row GridRow * @param $column GridColumn * @return array an array of LinkAction instances */ function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) { $submission = $row->getData(); $user = $request->getUser(); switch ($column->getId()) { case 'editor': $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /* @var $stageAssignmentDao StageAssignmentDAO */ $editorAssignments = $stageAssignmentDao->getEditorsAssignedToStage($submission->getId(), $submission->getStageId()); $assignment = current($editorAssignments); if (!$assignment) { return array(); } $userDao = DAORegistry::getDAO('UserDAO'); /* @var $userDao UserDAO */ $editor = $userDao->getById($assignment->getUserId()); import('lib.pkp.classes.linkAction.request.NullAction'); return array(new LinkAction('editor', new NullAction(), $editor->getInitials(), null, $editor->getFullName())); case 'stage': $stageId = $submission->getStageId(); $stage = null; if ($submission->getSubmissionProgress() > 0) { // Submission process not completed. $stage = __('submissions.incomplete'); } switch ($submission->getStatus()) { case STATUS_DECLINED: $stage = __('submission.status.declined'); break; case STATUS_PUBLISHED: $stage = __('submission.status.published'); break; } $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); if (!$stage) { $stage = __(WorkflowStageDAO::getTranslationKeyFromId($stageId)); } $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignment = $reviewAssignmentDao->getLastReviewRoundReviewAssignmentByReviewer($submission->getId(), $user->getId()); if (is_a($reviewAssignment, 'ReviewAssignment')) { // Reviewer: Add a review link action. return array($this->_getCellLinkAction($request, 'reviewer', 'submission', $submission, $stage)); } else { // Get the right page and operation (authordashboard or workflow). list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission); // Return redirect link action. return array($this->_getCellLinkAction($request, $page, $operation, $submission, $stage)); } } return parent::getCellActions($request, $row, $column, $position); }
/** * Assign user to copyedit the selected files * @see Form::execute() */ function execute($request) { // Decode the "files" list import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler'); ListbuilderHandler::unpack($request, $this->getData('files')); // Send the message to the user $submission = $this->getSubmission(); import('lib.pkp.classes.mail.SubmissionMailTemplate'); $email = new SubmissionMailTemplate($submission, 'AUDITOR_REQUEST', null, null, null, false); $email->setBody($this->getData('personalMessage')); $userDao = DAORegistry::getDAO('UserDAO'); /* @var $userDao UserDAO */ // FIXME: How to validate user IDs? $user = $userDao->getById($this->getData('userId')); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $user->getId()); $dispatcher = $request->getDispatcher(); $auditUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('submissionId' => $submission->getId())); // Other parameters assigned above; see bug #7090. $email->assignParams(array('auditorName' => $user->getFullName(), 'auditorUserName' => $user->getUsername(), 'auditUrl' => $auditUrl)); $email->addRecipient($user->getEmail(), $user->getFullName()); $email->setEventType($this->getEventType()); if (!$this->getData('skipEmail')) { $email->send($request); } }