Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
author/SubmissionCommentsHandler.inc.php
1 <?php
2 
16 import('pages.author.TrackSubmissionHandler');
17 
20  var $comment;
21 
26  parent::AuthorHandler();
27  }
28 
34  function viewEditorDecisionComments($args, $request) {
35  $articleId = (int) array_shift($args);
36  $this->validate($request, $articleId);
37  $this->setupTemplate($request, true);
39  }
40 
46  function viewCopyeditComments($args, $request) {
47  $articleId = (int) array_shift($args);
48  $this->validate($request, $articleId);
49  $this->setupTemplate($request, true);
50  AuthorAction::viewCopyeditComments($this->submission);
51  }
52 
58  function postCopyeditComment($args, $request) {
59  $articleId = (int) $request->getUserVar('articleId');
60  $this->validate($request, $articleId);
61  $this->setupTemplate($request, true);
62 
63  // If the user pressed the "Save and email" button, then email the comment.
64  $emailComment = $request->getUserVar('saveAndEmail') != null ? true : false;
65 
66  if (AuthorAction::postCopyeditComment($this->submission, $emailComment, $request)) {
67  AuthorAction::viewCopyeditComments($this->submission);
68  }
69  }
70 
76  function viewProofreadComments($args, $request) {
77  $articleId = (int) array_shift($args);
78  $this->validate($request, $articleId);
79  $this->setupTemplate($request, true);
80  AuthorAction::viewProofreadComments($this->submission);
81  }
82 
88  function postProofreadComment($args, $request) {
89  $articleId = (int) $request->getUserVar('articleId');
90  $this->validate($request, $articleId);
91  $this->setupTemplate($request, true);
92 
93  // If the user pressed the "Save and email" button, then email the comment.
94  $emailComment = $request->getUserVar('saveAndEmail') != null ? true : false;
95 
96  if (AuthorAction::postProofreadComment($this->submission, $emailComment, $request)) {
97  AuthorAction::viewProofreadComments($this->submission);
98  }
99  }
100 
106  function viewLayoutComments($args, $request) {
107  $articleId = (int) array_shift($args);
108  $this->validate($request, $articleId);
109  $this->setupTemplate($request, true);
110  AuthorAction::viewLayoutComments($this->submission);
111 
112  }
113 
119  function postLayoutComment($args, $request) {
120  $articleId = (int) $request->getUserVar('articleId');
121  $this->validate($request, $articleId);
122  $this->setupTemplate($request, true);
123 
124  // If the user pressed the "Save and email" button, then email the comment.
125  $emailComment = $request->getUserVar('saveAndEmail') != null ? true : false;
126 
127  if (AuthorAction::postLayoutComment($this->submission, $emailComment, $request)) {
128  AuthorAction::viewLayoutComments($this->submission);
129  }
130  }
131 
137  function emailEditorDecisionComment($args, $request) {
138  $articleId = (int) $request->getUserVar('articleId');
139  $this->setupTemplate($request, true);
140  $this->validate($request, $articleId);
141  if (AuthorAction::emailEditorDecisionComment($this->submission, $request->getUserVar('send'), $request)) {
142  $request->redirect(null, null, 'submissionReview', array($articleId));
143  }
144  }
145 
151  function editComment($args, $request) {
152  $articleId = (int) array_shift($args);
153  $commentId = array_shift($args);
154 
155  $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
156  $this->validate($request, $articleId);
157  $this->setupTemplate($request, true);
158  if ($this->comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
159  // Cannot edit an editor decision comment.
160  $request->redirect(null, $request->getRequestedPage());
161  }
162  AuthorAction::editComment($this->submission, $this->comment);
163  }
164 
170  function saveComment($args, $request) {
171  $articleId = (int) $request->getUserVar('articleId');
172  $commentId = (int) $request->getUserVar('commentId');
173 
174  $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
175  $this->validate($request, $articleId);
176  $this->setupTemplate($request, true);
177 
178  // If the user pressed the "Save and email" button, then email the comment.
179  $emailComment = $request->getUserVar('saveAndEmail') != null ? true : false;
180 
181  if ($this->comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
182  // Cannot edit an editor decision comment.
183  $request->redirect(null, $request->getRequestedPage());
184  }
185 
186  AuthorAction::saveComment($this->submission, $this->comment, $emailComment, $request);
187 
188  // refresh the comment
189  $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
190  $comment =& $articleCommentDao->getArticleCommentById($commentId);
191 
192  // Redirect back to initial comments page
193  if ($this->comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
194  $request->redirect(null, null, 'viewEditorDecisionComments', $articleId);
195  } else if ($this->comment->getCommentType() == COMMENT_TYPE_COPYEDIT) {
196  $request->redirect(null, null, 'viewCopyeditComments', $articleId);
197  } else if ($this->comment->getCommentType() == COMMENT_TYPE_LAYOUT) {
198  $request->redirect(null, null, 'viewLayoutComments', $articleId);
199  } else if ($this->comment->getCommentType() == COMMENT_TYPE_PROOFREAD) {
200  $request->redirect(null, null, 'viewProofreadComments', $articleId);
201  }
202  }
203 
209  function deleteComment($args, $request) {
210  $articleId = (int) array_shift($args);
211  $commentId = (int) array_shift($args);
212 
213  $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId));
214  $this->validate($request, $articleId);
215  $this->setupTemplate($request, true);
216 
217  AuthorAction::deleteComment($commentId);
218 
219  // Redirect back to initial comments page
220  if ($this->comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) {
221  $request->redirect(null, null, 'viewEditorDecisionComments', $articleId);
222  } else if ($this->comment->getCommentType() == COMMENT_TYPE_COPYEDIT) {
223  $request->redirect(null, null, 'viewCopyeditComments', $articleId);
224  } else if ($this->comment->getCommentType() == COMMENT_TYPE_LAYOUT) {
225  $request->redirect(null, null, 'viewLayoutComments', $articleId);
226  } else if ($this->comment->getCommentType() == COMMENT_TYPE_PROOFREAD) {
227  $request->redirect(null, null, 'viewProofreadComments', $articleId);
228  }
229  }
230 }
231 
232 ?>
setupTemplate($subclass=false, $articleId=0, $parentPage=null, $showSidebar=true)
postCopyeditComment($article, $emailComment, $request)
emailEditorDecisionComment($authorSubmission, $send, $request)
viewProofreadComments($article)
saveComment($article, &$comment, $emailComment, $request)
Definition: Action.inc.php:260
postProofreadComment($article, $emailComment, $request)
Class to validate that a comment exists (by id) and that the current user has access.
Handle requests for submission comments.
validate(&$request, $articleId=null, $reason=null)
editComment($article, $comment)
Definition: Action.inc.php:246
addCheck(&$handlerValidator)
postLayoutComment($article, $emailComment, $request)
Handle requests for journal author functions.
& getDAO($name, $dbconn=null)
viewCopyeditComments($article)
viewEditorDecisionComments($article)
deleteComment($commentId, $user=null)
Definition: Action.inc.php:296
viewLayoutComments($article)