/**
  * 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);
 }
 /**
  * @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);
 }
 /**
  * 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 GridCellProvider::getTemplateVarsFromRowColumn()
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $monograph = $row->getData();
     switch ($column->getId()) {
         case 'id':
             return array('label' => $monograph->getId());
         case 'title':
             // Delegate to the submission grid cell provider that holds the logic
             // for the submission title plus author name.
             $user = Application::getRequest()->getUser();
             import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
             $submissionsListCellProvider = new SubmissionsListGridCellProvider($user);
             return $submissionsListCellProvider->getTemplateVarsFromRowColumn($row, $column);
         case 'isFeatured':
             $featureDao = DAORegistry::getDAO('FeatureDAO');
             return array('selected' => $featureDao->isFeatured($monograph->getId(), $this->_assocType, $this->_assocId));
         case 'isNewRelease':
             $newReleaseDao = DAORegistry::getDAO('NewReleaseDAO');
             return array('selected' => $newReleaseDao->isNewRelease($monograph->getId(), $this->_assocType, $this->_assocId));
     }
     return parent::getTemplateVarsFromRowColumn($row, $column);
 }
 /**
  * @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 LegacyLinkAction instances
  */
 function getCellActions(&$request, &$row, &$column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     if ($column->getId() == 'title') {
         $monograph =& $row->getData();
         $router =& $request->getRouter();
         $dispatcher =& $router->getDispatcher();
         $title = $monograph->getLocalizedTitle();
         if (empty($title)) {
             $title = Locale::translate('common.untitled');
         }
         $pressId = $monograph->getPressId();
         $pressDao = DAORegistry::getDAO('PressDAO');
         $press = $pressDao->getPress($pressId);
         $action = new LegacyLinkAction('details', LINK_ACTION_MODE_LINK, LINK_ACTION_TYPE_NOTHING, $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'authorDashboard', null, $monograph->getId()), null, $title);
         return array($action);
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
 /**
  * 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);
 }
 /**
  * Get cell actions associated with this row/column combination
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LegacyLinkAction instances
  */
 function getCellActions(&$request, &$row, &$column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     if ($column->getId() == 'title') {
         $monograph =& $row->getData();
         $router =& $request->getRouter();
         $dispatcher =& $router->getDispatcher();
         $title = $monograph->getLocalizedTitle();
         if (empty($title)) {
             $title = Locale::translate('common.untitled');
         }
         $pressId = $monograph->getPressId();
         $pressDao = DAORegistry::getDAO('PressDAO');
         $press = $pressDao->getPress($pressId);
         $stageId = $monograph->getCurrentStageId();
         $monographId = $monograph->getId();
         $user =& $request->getUser();
         switch ($stageId) {
             case WORKFLOW_STAGE_ID_SUBMISSION:
             default:
                 $url = $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'workflow', 'submission', $monographId);
                 break;
             case WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
             case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
                 // If user is reviewer for submission, send to review wizard; Else they are an editor in the review stage
                 $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
                 $reviewAssignment =& $reviewAssignmentDao->getReviewAssignment($monographId, $user->getId(), $monograph->getCurrentRound(), $stageId == WORKFLOW_STAGE_ID_INTERNAL_REVIEW ? REVIEW_TYPE_INTERNAL : REVIEW_TYPE_EXTERNAL);
                 if (isset($reviewAssignment)) {
                     $url = $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, array('monographId' => $monographId, 'reviewId' => $reviewAssignment->getId()));
                 } else {
                     $url = $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'workflow', 'review', array($monographId));
                 }
                 break;
             case WORKFLOW_STAGE_ID_EDITING:
                 $url = $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'workflow', 'copyediting', $monograph->getId());
                 break;
             case WORKFLOW_STAGE_ID_PRODUCTION:
                 $url = $dispatcher->url($request, ROUTE_PAGE, $press->getPath(), 'workflow', 'production', $monograph->getId());
                 break;
         }
         $action = new LegacyLinkAction('details', LINK_ACTION_MODE_LINK, LINK_ACTION_TYPE_NOTHING, $url, null, $title);
         return array($action);
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
 /**
  * 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);
 }
Esempio n. 13
0
 /**
  * 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));
 }
 /**
  * @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 '';
     }
 }
 /**
  * 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'));
     }
 }
Esempio n. 16
0
 /**
  * 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'));
 }
 /**
  * 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);
 }
 /**
  * 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;
         }
     }
 }
 /**
  * @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 '';
     }
 }
 /**
  * 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;
             }
             $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);
 }
Esempio n. 22
0
 /**
  * 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();
     }
 }
Esempio n. 23
0
 /**
  * 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);
     }
 }