/**
  * Save comment.
  */
 function saveComment()
 {
     AuthorHandler::validate();
     AuthorHandler::setupTemplate(true);
     $articleId = Request::getUserVar('articleId');
     $commentId = Request::getUserVar('commentId');
     // If the user pressed the "Save and email" button, then email the comment.
     $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
     list($journal, $authorSubmission) = TrackSubmissionHandler::validate($articleId);
     list($comment) = SubmissionCommentsHandler::validate($commentId);
     if ($comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
         // Cannot edit an editor decision comment.
         Request::redirect(null, Request::getRequestedPage());
     }
     AuthorAction::saveComment($authorSubmission, $comment, $emailComment);
     $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
     $comment =& $articleCommentDao->getArticleCommentById($commentId);
     // Redirect back to initial comments page
     if ($comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
         Request::redirect(null, null, 'viewEditorDecisionComments', $articleId);
     } else {
         if ($comment->getCommentType() == COMMENT_TYPE_COPYEDIT) {
             Request::redirect(null, null, 'viewCopyeditComments', $articleId);
         } else {
             if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) {
                 Request::redirect(null, null, 'viewLayoutComments', $articleId);
             } else {
                 if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) {
                     Request::redirect(null, null, 'viewProofreadComments', $articleId);
                 }
             }
         }
     }
 }
 /**
  * Save comment.
  * @param $args array
  * @param $request object
  */
 function saveComment($args, $request)
 {
     $articleId = (int) $request->getUserVar('articleId');
     $commentId = (int) $request->getUserVar('commentId');
     $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
     $this->validate($request, $articleId);
     $this->setupTemplate($request, true);
     // If the user pressed the "Save and email" button, then email the comment.
     $emailComment = $request->getUserVar('saveAndEmail') != null ? true : false;
     if ($this->comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
         // Cannot edit an editor decision comment.
         $request->redirect(null, $request->getRequestedPage());
     }
     AuthorAction::saveComment($this->submission, $this->comment, $emailComment, $request);
     // refresh the comment
     $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
     $comment =& $articleCommentDao->getArticleCommentById($commentId);
     // Redirect back to initial comments page
     if ($this->comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
         $request->redirect(null, null, 'viewEditorDecisionComments', $articleId);
     } else {
         if ($this->comment->getCommentType() == COMMENT_TYPE_COPYEDIT) {
             $request->redirect(null, null, 'viewCopyeditComments', $articleId);
         } else {
             if ($this->comment->getCommentType() == COMMENT_TYPE_LAYOUT) {
                 $request->redirect(null, null, 'viewLayoutComments', $articleId);
             } else {
                 if ($this->comment->getCommentType() == COMMENT_TYPE_PROOFREAD) {
                     $request->redirect(null, null, 'viewProofreadComments', $articleId);
                 }
             }
         }
     }
 }
 /**
  * Save comment.
  */
 function saveComment()
 {
     $paperId = Request::getUserVar('paperId');
     $commentId = Request::getUserVar('commentId');
     // If the user pressed the "Save and email" button, then email the comment.
     $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
     $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
     $this->validate();
     $comment =& $this->comment;
     $this->setupTemplate(true);
     $trackSubmissionHandler = new TrackSubmissionHandler();
     $trackSubmissionHandler->validate($paperId);
     $authorSubmission =& $trackSubmissionHandler->submission;
     if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
         // Cannot edit a director decision comment.
         Request::redirect(null, null, Request::getRequestedPage());
     }
     AuthorAction::saveComment($authorSubmission, $comment, $emailComment);
     $paperCommentDao =& DAORegistry::getDAO('PaperCommentDAO');
     $comment =& $paperCommentDao->getPaperCommentById($commentId);
     // Redirect back to initial comments page
     if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
         Request::redirect(null, null, null, 'viewDirectorDecisionComments', $paperId);
     }
 }