getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) { // Cannot edit a director decision comment. Request::redirect(null, null, Request::getRequestedPage()); } PresenterAction::editComment($presenterSubmission, $comment); } /** * Save comment. */ function saveComment() { PresenterHandler::validate(); PresenterHandler::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, $presenterSubmission) = TrackSubmissionHandler::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()); } PresenterAction::saveComment($presenterSubmission, $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); } } /** * Delete comment. */ function deleteComment($args) { PresenterHandler::validate(); PresenterHandler::setupTemplate(true); $paperId = $args[0]; $commentId = $args[1]; $paperCommentDao = &DAORegistry::getDAO('PaperCommentDAO'); $comment = &$paperCommentDao->getPaperCommentById($commentId); list($conference, $schedConf, $presenterSubmission) = TrackSubmissionHandler::validate($paperId); list($comment) = SubmissionCommentsHandler::validate($commentId); PresenterAction::deleteComment($commentId); // Redirect back to initial comments page 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(); $isValid = true; $paperCommentDao = &DAORegistry::getDAO('PaperCommentDAO'); $user = &Request::getUser(); $comment = &$paperCommentDao->getPaperCommentById($commentId); if ($comment == null) { $isValid = false; } else if ($comment->getAuthorId() != $user->getUserId()) { $isValid = false; } if (!$isValid) { Request::redirect(null, null, Request::getRequestedPage()); } return array($comment); } } ?>