/** * @copydoc PKPNotificationOperationManager::getNotificationUrl() */ public function getNotificationUrl($request, $notification) { $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($notification->getAssocId()); $stageData = $this->_getStageDataByType(); $operation = $stageData['path']; import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); return SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission, $notification->getUserId(), $stageData['path']); }
/** * @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'); return SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission, $notification->getUserId()); }
/** * @copydoc PKPNotificationOperationManager::getNotificationUrl() */ function getNotificationUrl($request, $notification) { $dispatcher = Application::getDispatcher(); $contextDao = Application::getContextDAO(); $context = $contextDao->getById($notification->getContextId()); $reviewRound = $this->getReviewRound($notification->getAssocId()); $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($reviewRound->getSubmissionId()); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); return SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission); }
/** * Get cell actions associated with this row/column combination * * @copydoc GridCellProvider::getCellActions() */ function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) { $publishedSubmissionGalley = $row->getData(); $columnId = $column->getId(); assert(is_a($publishedSubmissionGalley, 'ArticleGalley') && !empty($columnId)); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $publishedSubmission = $publishedArticleDao->getPublishedArticleByArticleId($publishedSubmissionGalley->getSubmissionId()); import('lib.pkp.classes.linkAction.request.RedirectAction'); switch ($columnId) { case 'title': $this->_titleColumn = $column; $title = $publishedSubmission->getLocalizedTitle(); if (empty($title)) { $title = __('common.untitled'); } $authorsInTitle = $publishedSubmission->getShortAuthorString(); $title = $authorsInTitle . '; ' . $title; import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); return array(new LinkAction('itemWorkflow', new RedirectAction(SubmissionsListGridCellProvider::getUrlByUserRoles($request, $publishedSubmission)), $title)); case 'issue': $contextId = $publishedSubmission->getContextId(); $issueId = $publishedSubmission->getIssueId(); $issueDao = DAORegistry::getDAO('IssueDAO'); $issue = $issueDao->getById($issueId, $contextId); // Link to the issue edit modal $application = PKPApplication::getApplication(); $dispatcher = $application->getDispatcher(); import('lib.pkp.classes.linkAction.request.AjaxModal'); return array(new LinkAction('edit', new AjaxModal($dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.issues.BackIssueGridHandler', 'editIssue', null, array('issueId' => $issue->getId())), __('plugins.importexport.common.settings.DOIPluginSettings')), $issue->getIssueIdentification(), null)); case 'status': $status = $publishedSubmissionGalley->getData($this->_plugin->getDepositStatusSettingName()); $statusNames = $this->_plugin->getStatusNames(); $statusActions = $this->_plugin->getStatusActions($publishedSubmission); if ($status && array_key_exists($status, $statusActions)) { assert(array_key_exists($status, $statusNames)); return array(new LinkAction('edit', new RedirectAction($statusActions[$status], '_blank'), $statusNames[$status])); } } return parent::getCellActions($request, $row, $column, $position); }
/** * 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')); $submissionUrl = SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission, $user->getId()); // Parameters for various emails $email->assignParams(array('participantName' => $user->getFullName(), 'participantUsername' => $user->getUsername(), 'submissionUrl' => $submissionUrl, 'editorialContactName' => $user->getFullname(), 'editorUsername' => $user->getUsername())); $email->send($request); // remove the INDEX_ and LAYOUT_ tasks if a user has sent the appropriate _COMPLETE email switch ($template) { case 'COPYEDIT_REQUEST': $this->_addAssignmentTaskNotification($request, NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT, $user->getId(), $submission->getId()); break; case 'LAYOUT_REQUEST': $this->_addAssignmentTaskNotification($request, NOTIFICATION_TYPE_LAYOUT_ASSIGNMENT, $user->getId(), $submission->getId()); break; case 'INDEX_REQUEST': $this->_addAssignmentTaskNotification($request, NOTIFICATION_TYPE_INDEX_ASSIGNMENT, $user->getId(), $submission->getId()); break; } // Create a query $queryDao = DAORegistry::getDAO('QueryDAO'); $query = $queryDao->newDataObject(); $query->setAssocType(ASSOC_TYPE_SUBMISSION); $query->setAssocId($submission->getId()); $query->setStageId($this->_stageId); $query->setSequence(REALLY_BIG_NUMBER); $queryDao->insertObject($query); $queryDao->resequence(ASSOC_TYPE_SUBMISSION, $submission->getId()); // Add the current user and message recipient as participants. $queryDao->insertParticipant($query->getId(), $user->getId()); if ($user->getId() != $request->getUser()->getId()) { $queryDao->insertParticipant($query->getId(), $request->getUser()->getId()); } // Create a head note $noteDao = DAORegistry::getDAO('NoteDAO'); $headNote = $noteDao->newDataObject(); $headNote->setUserId($request->getUser()->getId()); $headNote->setAssocType(ASSOC_TYPE_QUERY); $headNote->setAssocId($query->getId()); $headNote->setDateCreated(Core::getCurrentDate()); $headNote->setTitle($email->getSubject()); $headNote->setContents($email->getBody()); $noteDao->insertObject($headNote); $notificationMgr = new NotificationManager(); $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, NOTIFICATION_TYPE_AWAITING_COPYEDITS, NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER, NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS), null, ASSOC_TYPE_SUBMISSION, $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) { $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; } if (!$stage) { $stage = __(WorkflowStageDAO::getTranslationKeyFromId($stageId)); } import('lib.pkp.classes.linkAction.request.RedirectAction'); $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignment = $reviewAssignmentDao->getLastReviewRoundReviewAssignmentByReviewer($submission->getId(), $user->getId()); if (is_a($reviewAssignment, 'ReviewAssignment') && $reviewAssignment->getStageId() == $stageId) { return array(new LinkAction('itemWorkflow', new RedirectAction($request->getDispatcher()->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', $submission->getId())), $stage)); } return array(new LinkAction('itemWorkflow', new RedirectAction(SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission)), $stage)); } 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 * @return JSONMessage JSON object */ 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(); } return new JSONMessage(true, $submitForm->fetch($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'); $reviewSubmissionUrl = SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission); $router = $request->getRouter(); $dispatcher = $router->getDispatcher(); $templateMgr->assign(array('reviewSubmissionUrl' => $reviewSubmissionUrl, 'submissionId' => $submission->getId(), 'submitStep' => $step, 'submissionProgress' => $submission->getSubmissionProgress())); return new JSONMessage(true, $templateMgr->fetch('submission/form/complete.tpl')); } }
/** * @copydoc INotificationInfoProvider::getNotificationUrl() */ public function getNotificationUrl($request, $notification) { switch ($notification->getType()) { case NOTIFICATION_TYPE_EDITOR_DECISION_INTERNAL_REVIEW: case NOTIFICATION_TYPE_EDITOR_DECISION_ACCEPT: case NOTIFICATION_TYPE_EDITOR_DECISION_EXTERNAL_REVIEW: case NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS: case NOTIFICATION_TYPE_EDITOR_DECISION_RESUBMIT: case NOTIFICATION_TYPE_EDITOR_DECISION_DECLINE: case NOTIFICATION_TYPE_EDITOR_DECISION_SEND_TO_PRODUCTION: $submissionDao = Application::getSubmissionDAO(); $submission = $submissionDao->getById($notification->getAssocId()); import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider'); return SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission, $notification->getUserId()); default: return ''; } }
/** * 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')); $submissionUrl = SubmissionsListGridCellProvider::getUrlByUserRoles($request, $submission, $user->getId()); // Parameters for various emails $email->assignParams(array('participantName' => $user->getFullName(), 'participantUsername' => $user->getUsername(), 'submissionUrl' => $submissionUrl, 'editorialContactName' => $user->getFullname(), 'editorUsername' => $user->getUsername())); $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; } } }