/**
  * Save comment.
  */
 function saveComment($args, $request)
 {
     $paperId = (int) $request->getUserVar('paperId');
     $commentId = (int) $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($request);
     $comment =& $this->comment;
     $this->setupTemplate($request, true);
     $submissionEditHandler = new SubmissionEditHandler();
     $submissionEditHandler->validate($request, $paperId);
     $paperDao = DAORegistry::getDAO('PaperDAO');
     $submission =& $paperDao->getPaper($paperId);
     if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
         // Cannot edit a director decision comment.
         $request->redirect(null, null, $request->getRequestedPage());
     }
     // Save the comment.
     TrackDirectorAction::saveComment($request, $submission, $comment, $emailComment);
     // refresh the comment
     $paperCommentDao = DAORegistry::getDAO('PaperCommentDAO');
     $comment =& $paperCommentDao->getPaperCommentById($commentId);
     // Redirect back to initial comments page
     if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) {
         $request->redirect(null, null, null, 'viewPeerReviewComments', array($paperId, $comment->getAssocId()));
     } else {
         if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) {
             $request->redirect(null, null, null, 'viewDirectorDecisionComments', $paperId);
         }
     }
 }