getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) { // Cannot edit a director decision comment. Request::redirect(null, null, Request::getRequestedPage()); } TrackDirectorAction::editComment($submission, $comment); } /** * Save comment. */ function saveComment() { TrackDirectorHandler::validate(); TrackDirectorHandler::setupTemplate(true); $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; list($conference, $schedConf, $submission) = SubmissionEditHandler::validate($paperId); list($comment) = SubmissionCommentsHandler::validate($commentId); if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) { // Cannot edit a director decision comment. Request::redirect(null, null, Request::getRequestedPage()); } // Save the comment. TrackDirectorAction::saveComment($submission, $comment, $emailComment); $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); } } /** * Delete comment. */ function deleteComment($args) { TrackDirectorHandler::validate(); TrackDirectorHandler::setupTemplate(true); $paperId = $args[0]; $commentId = $args[1]; list($conference, $schedConf, $submission) = SubmissionEditHandler::validate($paperId); list($comment) = SubmissionCommentsHandler::validate($commentId); TrackDirectorAction::deleteComment($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); } } // // Validation // /** * Validate that the user is the presenter of the comment. */ function validate($commentId) { parent::validate(); $paperCommentDao = &DAORegistry::getDAO('PaperCommentDAO'); $user = &Request::getUser(); $comment = &$paperCommentDao->getPaperCommentById($commentId); if ( $comment == null || $comment->getAuthorId() != $user->getUserId() ) { Request::redirect(null, null, Request::getRequestedPage()); } return array($comment); } } ?>