00001 <?php
00002
00015
00016
00017
00018 import('pages.copyeditor.SubmissionCopyeditHandler');
00019
00020 class SubmissionCommentsHandler extends CopyeditorHandler {
00021
00025 function viewLayoutComments($args) {
00026 CopyeditorHandler::validate();
00027 CopyeditorHandler::setupTemplate(true);
00028
00029 $articleId = $args[0];
00030
00031 list($journal, $submission) = SubmissionCopyeditHandler::validate($articleId);
00032 CopyeditorAction::viewLayoutComments($submission);
00033
00034 }
00035
00039 function postLayoutComment() {
00040 CopyeditorHandler::validate();
00041 CopyeditorHandler::setupTemplate(true);
00042
00043 $articleId = Request::getUserVar('articleId');
00044
00045
00046 $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00047
00048 list($journal, $submission) = SubmissionCopyeditHandler::validate($articleId);
00049 if (CopyeditorAction::postLayoutComment($submission, $emailComment)) {
00050 CopyeditorAction::viewLayoutComments($submission);
00051 }
00052
00053 }
00054
00058 function viewCopyeditComments($args) {
00059 CopyeditorHandler::validate();
00060 CopyeditorHandler::setupTemplate(true);
00061
00062 $articleId = $args[0];
00063
00064 list($journal, $submission) = SubmissionCopyeditHandler::validate($articleId);
00065 CopyeditorAction::viewCopyeditComments($submission);
00066
00067 }
00068
00072 function postCopyeditComment() {
00073 CopyeditorHandler::validate();
00074 CopyeditorHandler::setupTemplate(true);
00075
00076 $articleId = Request::getUserVar('articleId');
00077
00078
00079 $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00080
00081 list($journal, $submission) = SubmissionCopyeditHandler::validate($articleId);
00082 if (CopyeditorAction::postCopyeditComment($submission, $emailComment)) {
00083 CopyeditorAction::viewCopyeditComments($submission);
00084 }
00085
00086 }
00087
00091 function editComment($args) {
00092 CopyeditorHandler::validate();
00093 CopyeditorHandler::setupTemplate(true);
00094
00095 $articleId = $args[0];
00096 $commentId = $args[1];
00097
00098 list($journal, $submission) = SubmissionCopyeditHandler::validate($articleId);
00099 list($comment) = SubmissionCommentsHandler::validate($commentId);
00100 CopyeditorAction::editComment($submission, $comment);
00101
00102 }
00103
00107 function saveComment() {
00108 CopyeditorHandler::validate();
00109 CopyeditorHandler::setupTemplate(true);
00110
00111 $articleId = Request::getUserVar('articleId');
00112 $commentId = Request::getUserVar('commentId');
00113
00114
00115 $emailComment = Request::getUserVar('saveAndEmail') != null ? true : false;
00116
00117 list($journal, $submission) = SubmissionCopyeditHandler::validate($articleId);
00118 list($comment) = SubmissionCommentsHandler::validate($commentId);
00119 CopyeditorAction::saveComment($submission, $comment, $emailComment);
00120
00121 $articleCommentDao = &DAORegistry::getDAO('ArticleCommentDAO');
00122 $comment = &$articleCommentDao->getArticleCommentById($commentId);
00123
00124
00125 if ($comment->getCommentType() == COMMENT_TYPE_COPYEDIT) {
00126 Request::redirect(null, null, 'viewCopyeditComments', $articleId);
00127 } else if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) {
00128 Request::redirect(null, null, 'viewLayoutComments', $articleId);
00129 } else if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) {
00130 Request::redirect(null, null, 'viewProofreadComments', $articleId);
00131 }
00132 }
00133
00137 function deleteComment($args) {
00138 CopyeditorHandler::validate();
00139 CopyeditorHandler::setupTemplate(true);
00140
00141 $articleId = $args[0];
00142 $commentId = $args[1];
00143
00144 list($journal, $submission) = SubmissionCopyeditHandler::validate($articleId);
00145 list($comment) = SubmissionCommentsHandler::validate($commentId);
00146 CopyeditorAction::deleteComment($commentId);
00147
00148
00149 if ($comment->getCommentType() == COMMENT_TYPE_COPYEDIT) {
00150 Request::redirect(null, null, 'viewCopyeditComments', $articleId);
00151 } else if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) {
00152 Request::redirect(null, null, 'viewLayoutComments', $articleId);
00153 } else if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) {
00154 Request::redirect(null, null, 'viewProofreadComments', $articleId);
00155 }
00156 }
00157
00158
00159
00160
00161
00165 function validate($commentId) {
00166 parent::validate();
00167
00168 $isValid = true;
00169
00170 $articleCommentDao = &DAORegistry::getDAO('ArticleCommentDAO');
00171 $user = &Request::getUser();
00172
00173 $comment = &$articleCommentDao->getArticleCommentById($commentId);
00174
00175 if ($comment == null) {
00176 $isValid = false;
00177
00178 } else if ($comment->getAuthorId() != $user->getUserId()) {
00179 $isValid = false;
00180 }
00181
00182 if (!$isValid) {
00183 Request::redirect(null, Request::getRequestedPage());
00184 }
00185
00186 return array($comment);
00187 }
00188 }
00189 ?>