Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
SubmissionEditHandler.inc.php
1 <?php
2 
17 define('SECTION_EDITOR_ACCESS_EDIT', 0x00001);
18 define('SECTION_EDITOR_ACCESS_REVIEW', 0x00002);
19 
20 import('pages.sectionEditor.SectionEditorHandler');
21 
26  function SubmissionEditHandler() {
27  parent::SectionEditorHandler();
28  }
29 
36  function _getFrom($default = 'submissionEditing') {
37  $from = Request::getUserVar('from');
38  if (!in_array($from, array('submission', 'submissionEditing'))) return $default;
39  return $from;
40  }
41 
47  function submission($args, &$request) {
48  $articleId = (int) array_shift($args);
49  $this->validate($articleId);
50  $journal =& $request->getJournal();
52 
53  // FIXME? For comments.readerComments under Status and
54  // author.submit.selectPrincipalContact under Metadata
55  AppLocale::requireComponents(LOCALE_COMPONENT_PKP_READER, LOCALE_COMPONENT_OJS_AUTHOR);
56 
57  $this->setupTemplate(true, $articleId);
58 
59  $user =& $request->getUser();
60 
61  $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
62  $journalSettings = $journalSettingsDao->getJournalSettings($journal->getId());
63 
64  $roleDao =& DAORegistry::getDAO('RoleDAO');
65  $isEditor = $roleDao->userHasRole($journal->getId(), $user->getId(), ROLE_ID_EDITOR);
66 
67  $sectionDao =& DAORegistry::getDAO('SectionDAO');
68  $section =& $sectionDao->getSection($submission->getSectionId());
69 
70  $enableComments = $journal->getSetting('enableComments');
71 
72  $templateMgr =& TemplateManager::getManager();
73 
74  $templateMgr->assign_by_ref('submission', $submission);
75  $templateMgr->assign_by_ref('section', $section);
76  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
77  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
78  $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
79  $templateMgr->assign_by_ref('journalSettings', $journalSettings);
80  $templateMgr->assign('userId', $user->getId());
81  $templateMgr->assign('isEditor', $isEditor);
82  $templateMgr->assign('enableComments', $enableComments);
83 
84  $sectionDao =& DAORegistry::getDAO('SectionDAO');
85  $templateMgr->assign_by_ref('sections', $sectionDao->getSectionTitles($journal->getId()));
86  if ($enableComments) {
87  import('classes.article.Article');
88  $templateMgr->assign('commentsStatus', $submission->getCommentsStatus());
89  $templateMgr->assign_by_ref('commentsStatusOptions', Article::getCommentsStatusOptions());
90  }
91 
92  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
93  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getId());
94  if ($publishedArticle) {
95  $issueDao =& DAORegistry::getDAO('IssueDAO');
96  $issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
97  $templateMgr->assign_by_ref('issue', $issue);
98  $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
99  }
100 
101  if ($isEditor) {
102  $templateMgr->assign('helpTopicId', 'editorial.editorsRole.submissionSummary');
103  }
104 
105  // Set up required Payment Related Information
106  import('classes.payment.ojs.OJSPaymentManager');
107  $paymentManager = new OJSPaymentManager($request);
108  if ( $paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
109  $templateMgr->assign('authorFees', true);
110  $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
111 
112  if ( $paymentManager->submissionEnabled() ) {
113  $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDao->getSubmissionCompletedPayment ( $journal->getId(), $articleId ));
114  }
115 
116  if ( $paymentManager->fastTrackEnabled() ) {
117  $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDao->getFastTrackCompletedPayment ( $journal->getId(), $articleId ));
118  }
119 
120  if ( $paymentManager->publicationEnabled() ) {
121  $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment ( $journal->getId(), $articleId ));
122  }
123  }
124 
125  $templateMgr->assign('canEditMetadata', true);
126 
127  $templateMgr->display('sectionEditor/submission.tpl');
128  }
129 
135  function submissionRegrets($args, &$request) {
136  $articleId = (int) array_shift($args);
137  $this->validate($articleId);
138  $journal =& $request->getJournal();
140  $this->setupTemplate(true, $articleId, 'review');
141 
142  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
143  $cancelsAndRegrets = $reviewAssignmentDao->getCancelsAndRegrets($articleId);
144  $reviewFilesByRound = $reviewAssignmentDao->getReviewFilesByRound($articleId);
145 
146  $reviewAssignments =& $submission->getReviewAssignments();
147  $editorDecisions = $submission->getDecisions();
148  $numRounds = $submission->getCurrentRound();
149 
150  $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
151  $reviewFormResponses = array();
152  if (isset($reviewAssignments[$numRounds-1])) {
153  foreach ($reviewAssignments[$numRounds-1] as $reviewAssignment) {
154  $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
155  }
156  }
157 
158  $templateMgr =& TemplateManager::getManager();
159 
160  $templateMgr->assign_by_ref('submission', $submission);
161  $templateMgr->assign_by_ref('reviewAssignments', $reviewAssignments);
162  $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
163  $templateMgr->assign_by_ref('cancelsAndRegrets', $cancelsAndRegrets);
164  $templateMgr->assign_by_ref('reviewFilesByRound', $reviewFilesByRound);
165  $templateMgr->assign_by_ref('editorDecisions', $editorDecisions);
166  $templateMgr->assign('numRounds', $numRounds);
167  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
168 
169  $templateMgr->assign_by_ref('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
170 
171  import('classes.submission.reviewAssignment.ReviewAssignment');
172  $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
173  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
174 
175  $templateMgr->display('sectionEditor/submissionRegrets.tpl');
176  }
177 
183  function submissionReview($args, &$request) {
184  $articleId = isset($args[0]) ? (int) $args[0] : 0;
185  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
186  $journal =& Request::getJournal();
188  $this->setupTemplate(true, $articleId);
189 
190  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_MANAGER);
191 
192  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
193  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
194  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
195 
196  // Setting the round.
197  $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
198 
199  $sectionDao =& DAORegistry::getDAO('SectionDAO');
200  $sections =& $sectionDao->getJournalSections($journal->getId());
201 
202  $showPeerReviewOptions = $round == $submission->getCurrentRound() && $submission->getReviewFile() != null ? true : false;
203 
204  $editorDecisions = $submission->getDecisions($round);
205  $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
206 
207  $editAssignments =& $submission->getEditAssignments();
208  $allowRecommendation = $submission->getCurrentRound() == $round && $submission->getReviewFileId() != null && !empty($editAssignments);
209  $allowResubmit = $lastDecision == SUBMISSION_EDITOR_DECISION_RESUBMIT && $sectionEditorSubmissionDao->getMaxReviewRound($articleId) == $round ? true : false;
210  $allowCopyedit = $lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT && $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) == null ? true : false;
211 
212  // Prepare an array to store the 'Notify Reviewer' email logs
213  $notifyReviewerLogs = array();
214  foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
215  $notifyReviewerLogs[$reviewAssignment->getId()] = array();
216  }
217 
218  // Parse the list of email logs and populate the array.
219  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
220  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
221  foreach ($emailLogEntries->toArray() as $emailLog) {
222  if ($emailLog->getEventType() == ARTICLE_EMAIL_REVIEW_NOTIFY_REVIEWER) {
223  if (isset($notifyReviewerLogs[$emailLog->getAssocId()]) && is_array($notifyReviewerLogs[$emailLog->getAssocId()])) {
224  array_push($notifyReviewerLogs[$emailLog->getAssocId()], $emailLog);
225  }
226  }
227  }
228 
229  // get journal published review form titles
230  $reviewFormTitles =& $reviewFormDao->getTitlesByAssocId(ASSOC_TYPE_JOURNAL, $journal->getId(), 1);
231 
232  $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
233  $reviewFormResponses = array();
234 
235  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
236  $reviewFormTitles = array();
237 
238  foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
239  $reviewForm =& $reviewFormDao->getReviewForm($reviewAssignment->getReviewFormId());
240  if ($reviewForm) {
241  $reviewFormTitles[$reviewForm->getId()] = $reviewForm->getLocalizedTitle();
242  }
243  unset($reviewForm);
244  $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
245  }
246 
247  $templateMgr =& TemplateManager::getManager();
248 
249  $templateMgr->assign_by_ref('submission', $submission);
250  $templateMgr->assign_by_ref('reviewIndexes', $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round));
251  $templateMgr->assign('round', $round);
252  $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
253  $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
254  $templateMgr->assign('reviewFormTitles', $reviewFormTitles);
255  $templateMgr->assign_by_ref('notifyReviewerLogs', $notifyReviewerLogs);
256  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
257  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
258  $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
259  $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
260  $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
261  $templateMgr->assign_by_ref('editorFile', $submission->getEditorFile());
262  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
263  $templateMgr->assign('showPeerReviewOptions', $showPeerReviewOptions);
264  $templateMgr->assign_by_ref('sections', $sections->toArray());
265  $templateMgr->assign('editorDecisionOptions',SectionEditorSubmission::getEditorDecisionOptions());
266  $templateMgr->assign_by_ref('lastDecision', $lastDecision);
267 
268  import('classes.submission.reviewAssignment.ReviewAssignment');
269  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
270  $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
271 
272  $templateMgr->assign('allowRecommendation', $allowRecommendation);
273  $templateMgr->assign('allowResubmit', $allowResubmit);
274  $templateMgr->assign('allowCopyedit', $allowCopyedit);
275 
276  $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.review');
277  $templateMgr->display('sectionEditor/submissionReview.tpl');
278  }
279 
285  function submissionEditing($args, $request) {
286  $articleId = isset($args[0]) ? (int) $args[0] : 0;
287  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
288  $journal =& $request->getJournal();
290  $this->setupTemplate(true, $articleId);
291 
292  $useCopyeditors = $journal->getSetting('useCopyeditors');
293  $useLayoutEditors = $journal->getSetting('useLayoutEditors');
294  $useProofreaders = $journal->getSetting('useProofreaders');
295 
296  // check if submission is accepted
297  $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
298  $editorDecisions = $submission->getDecisions($round);
299  $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
300  $submissionAccepted = ($lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT) ? true : false;
301 
302  $templateMgr =& TemplateManager::getManager();
303 
304  $templateMgr->assign_by_ref('submission', $submission);
305  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
306  $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
307  $templateMgr->assign_by_ref('initialCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
308  $templateMgr->assign_by_ref('editorAuthorCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_AUTHOR'));
309  $templateMgr->assign_by_ref('finalCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_FINAL'));
310  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
311  $templateMgr->assign_by_ref('copyeditor', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
312 
313  $roleDao =& DAORegistry::getDAO('RoleDAO');
314  $user =& Request::getUser();
315  $templateMgr->assign('isEditor', $roleDao->userHasRole($journal->getId(), $user->getId(), ROLE_ID_EDITOR));
316 
317  import('classes.issue.IssueAction');
318  $templateMgr->assign('issueOptions', IssueAction::getIssueOptions());
319  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
320  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getId());
321  $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
322 
323  $templateMgr->assign('useCopyeditors', $useCopyeditors);
324  $templateMgr->assign('useLayoutEditors', $useLayoutEditors);
325  $templateMgr->assign('useProofreaders', $useProofreaders);
326  $templateMgr->assign('submissionAccepted', $submissionAccepted);
327 
328  // Set up required Payment Related Information
329  import('classes.payment.ojs.OJSPaymentManager');
330  $paymentManager = new OJSPaymentManager($request);
331  $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
332 
333  $publicationFeeEnabled = $paymentManager->publicationEnabled();
334  $templateMgr->assign('publicationFeeEnabled', $publicationFeeEnabled);
335  if ( $publicationFeeEnabled ) {
336  $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment ( $journal->getId(), $articleId ));
337  }
338 
339  $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.editing');
340  $templateMgr->display('sectionEditor/submissionEditing.tpl');
341  }
342 
348  function submissionHistory($args, &$request) {
349  $articleId = (int) array_shift($args);
350  $this->validate($articleId);
351  $this->setupTemplate(true, $articleId);
352 
353  $templateMgr =& TemplateManager::getManager();
355  $templateMgr->assign_by_ref('submission', $submission);
356 
357  // Notes
358  $noteDao =& DAORegistry::getDAO('NoteDAO');
359  $submissionNotes =& $noteDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
360  $templateMgr->assign_by_ref('submissionNotes', $submissionNotes);
361 
362  // Event log
363  $eventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
364  $rangeInfo =& $this->getRangeInfo('eventLogEntries');
365  $eventLogEntries =& $eventLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
366  $templateMgr->assign_by_ref('eventLogEntries', $eventLogEntries);
367  unset($rangeInfo);
368 
369  // Email log
370  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
371  $rangeInfo =& $this->getRangeInfo('emailLogEntries');
372  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
373  $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
374  unset($rangeInfo);
375 
376  $templateMgr->assign('isEditor', Validation::isEditor());
377  $templateMgr->display('sectionEditor/submissionHistory.tpl');
378  }
379 
385  function submissionCitations($args, $request) {
386  // Authorize the request.
387  $articleId = isset($args[0]) ? (int) $args[0] : 0;
388  $this->validate($articleId);
389 
390  // Prepare the view.
391  $this->setupTemplate(true, $articleId);
392 
393  // Insert the citation editing assistant into the view.
395 
396  // Render the view.
397  $templateMgr =& TemplateManager::getManager();
398  $templateMgr->display('sectionEditor/submissionCitations.tpl');
399  }
400 
406  function changeSection($args, &$request) {
407  $articleId = (int) $request->getUserVar('articleId');
408  $this->validate($articleId);
410 
411  $sectionId = $request->getUserVar('sectionId');
412 
414 
415  $request->redirect(null, null, 'submission', $articleId);
416  }
417 
423  function recordDecision($args, $request) {
424  $articleId = $request->getUserVar('articleId');
425  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
427 
428  $decision = $request->getUserVar('decision');
429 
430  switch ($decision) {
431  case SUBMISSION_EDITOR_DECISION_ACCEPT:
432  case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
433  case SUBMISSION_EDITOR_DECISION_RESUBMIT:
434  case SUBMISSION_EDITOR_DECISION_DECLINE:
435  SectionEditorAction::recordDecision($submission, $decision, $request);
436  break;
437  }
438 
439  $request->redirect(null, null, 'submissionReview', $articleId);
440  }
441 
442  //
443  // Peer Review
444  //
445 
451  function selectReviewer($args, &$request) {
452  $articleId = (int) array_shift($args);
453  $reviewerId = (int) array_shift($args);
454 
455  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
456  $journal =& $request->getJournal();
458 
459  $sort = $request->getUserVar('sort');
460  $sort = isset($sort) ? $sort : 'reviewerName';
461  $sortDirection = $request->getUserVar('sortDirection');
462  $sortDirection = (isset($sortDirection) && ($sortDirection == SORT_DIRECTION_ASC || $sortDirection == SORT_DIRECTION_DESC)) ? $sortDirection : SORT_DIRECTION_ASC;
463 
464  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
465 
466  if ($reviewerId) {
467  // Assign reviewer to article
468  SectionEditorAction::addReviewer($submission, $reviewerId, null, $request);
469  $request->redirect(null, null, 'submissionReview', $articleId);
470 
471  // FIXME: Prompt for due date.
472  } else {
473  $this->setupTemplate(true, $articleId, 'review');
474 
475  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
476 
477  $searchType = null;
478  $searchMatch = null;
479  $search = $searchQuery = $request->getUserVar('search');
480  $searchInitial = $request->getUserVar('searchInitial');
481  if (!empty($search)) {
482  $searchType = $request->getUserVar('searchField');
483  $searchMatch = $request->getUserVar('searchMatch');
484 
485  } elseif (!empty($searchInitial)) {
486  $searchInitial = String::strtoupper($searchInitial);
487  $searchType = USER_FIELD_INITIAL;
488  $search = $searchInitial;
489  }
490 
491  $rangeInfo =& $this->getRangeInfo('reviewers');
492  $reviewers = $sectionEditorSubmissionDao->getReviewersForArticle($journal->getId(), $articleId, $submission->getCurrentRound(), $searchType, $search, $searchMatch, $rangeInfo, $sort, $sortDirection); /* @var $reviewers DAOResultFactory */
493 
494  $journal = $request->getJournal();
495  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
496 
497  $templateMgr =& TemplateManager::getManager();
498 
499  $templateMgr->assign('searchField', $searchType);
500  $templateMgr->assign('searchMatch', $searchMatch);
501  $templateMgr->assign('search', $searchQuery);
502  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
503 
504  $templateMgr->assign_by_ref('reviewers', $reviewers);
505  $templateMgr->assign('articleId', $articleId);
506  $templateMgr->assign('reviewerStatistics', $sectionEditorSubmissionDao->getReviewerStatistics($journal->getId()));
507  $templateMgr->assign('fieldOptions', array(
508  USER_FIELD_INTERESTS => 'user.interests',
509  USER_FIELD_FIRSTNAME => 'user.firstName',
510  USER_FIELD_LASTNAME => 'user.lastName',
511  USER_FIELD_USERNAME => 'user.username',
512  USER_FIELD_EMAIL => 'user.email'
513  ));
514  $templateMgr->assign('completedReviewCounts', $reviewAssignmentDao->getCompletedReviewCounts($journal->getId()));
515  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
516  $templateMgr->assign('averageQualityRatings', $reviewAssignmentDao->getAverageQualityRatings($journal->getId()));
517 
518  $templateMgr->assign('helpTopicId', 'journal.roles.reviewer');
519  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
520  $templateMgr->assign('reviewerDatabaseLinks', $journal->getSetting('reviewerDatabaseLinks'));
521  $templateMgr->assign('sort', $sort);
522  $templateMgr->assign('sortDirection', $sortDirection);
523  $templateMgr->display('sectionEditor/selectReviewer.tpl');
524  }
525  }
526 
532  function createReviewer($args, &$request) {
533  $articleId = isset($args[0]) ? (int) $args[0] : 0;
534  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
536 
537  import('classes.sectionEditor.form.CreateReviewerForm');
538  $createReviewerForm = new CreateReviewerForm($articleId);
539  $this->setupTemplate(true, $articleId);
540 
541  if (isset($args[1]) && $args[1] === 'create') {
542  $createReviewerForm->readInputData();
543  if ($createReviewerForm->validate()) {
544  // Create a user and enroll them as a reviewer.
545  $newUserId = $createReviewerForm->execute();
546  $request->redirect(null, null, 'selectReviewer', array($articleId, $newUserId));
547  } else {
548  $createReviewerForm->display($args, $request);
549  }
550  } else {
551  // Display the "create user" form.
552  if ($createReviewerForm->isLocaleResubmit()) {
553  $createReviewerForm->readInputData();
554  } else {
555  $createReviewerForm->initData();
556  }
557  $createReviewerForm->display($args, $request);
558  }
559  }
560 
567  function suggestUsername($args, &$request) {
568  parent::validate();
569  $suggestion = Validation::suggestUsername(
570  $request->getUserVar('firstName'),
571  $request->getUserVar('lastName')
572  );
573  echo $suggestion;
574  }
575 
581  function enrollSearch($args, $request) {
582  $articleId = isset($args[0]) ? (int) $args[0] : 0;
583  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
584  AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER); // manager.people.enrollment, manager.people.enroll
586 
587  $roleDao =& DAORegistry::getDAO('RoleDAO');
588  $roleId = $roleDao->getRoleIdFromPath('reviewer');
589 
590  $user =& $request->getUser();
591 
592  $rangeInfo = $this->getRangeInfo('users');
593  $templateMgr =& TemplateManager::getManager();
594  $this->setupTemplate(true);
595 
596  $searchType = null;
597  $searchMatch = null;
598  $search = $searchQuery = $request->getUserVar('search');
599  $searchInitial = $request->getUserVar('searchInitial');
600  if (!empty($search)) {
601  $searchType = $request->getUserVar('searchField');
602  $searchMatch = $request->getUserVar('searchMatch');
603 
604  } elseif (!empty($searchInitial)) {
605  $searchInitial = String::strtoupper($searchInitial);
606  $searchType = USER_FIELD_INITIAL;
607  $search = $searchInitial;
608  }
609 
610  $userDao =& DAORegistry::getDAO('UserDAO');
611  $users =& $userDao->getUsersByField($searchType, $searchMatch, $search, false, $rangeInfo);
612 
613  $templateMgr->assign('searchField', $searchType);
614  $templateMgr->assign('searchMatch', $searchMatch);
615  $templateMgr->assign('search', $searchQuery);
616  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
617 
618  $templateMgr->assign('articleId', $articleId);
619  $templateMgr->assign('fieldOptions', Array(
620  USER_FIELD_INTERESTS => 'user.interests',
621  USER_FIELD_FIRSTNAME => 'user.firstName',
622  USER_FIELD_LASTNAME => 'user.lastName',
623  USER_FIELD_USERNAME => 'user.username',
624  USER_FIELD_EMAIL => 'user.email'
625  ));
626  $templateMgr->assign('roleId', $roleId);
627  $templateMgr->assign_by_ref('users', $users);
628  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
629 
630  $templateMgr->assign('helpTopicId', 'journal.roles.index');
631  $templateMgr->display('sectionEditor/searchUsers.tpl');
632  }
633 
639  function enroll($args, &$request) {
640  $articleId = isset($args[0]) ? (int) $args[0] : 0;
641  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
642  $journal =& $request->getJournal();
644 
645  $roleDao =& DAORegistry::getDAO('RoleDAO');
646  $roleId = $roleDao->getRoleIdFromPath('reviewer');
647 
648  $users = $request->getUserVar('users');
649  if (!is_array($users) && $request->getUserVar('userId') != null) $users = array($request->getUserVar('userId'));
650 
651  // Enroll reviewer
652  for ($i=0; $i<count($users); $i++) {
653  if (!$roleDao->userHasRole($journal->getId(), $users[$i], $roleId)) {
654  $role = new Role();
655  $role->setJournalId($journal->getId());
656  $role->setUserId($users[$i]);
657  $role->setRoleId($roleId);
658 
659  $roleDao->insertRole($role);
660  }
661  }
662  $request->redirect(null, null, 'selectReviewer', $articleId);
663  }
664 
670  function notifyReviewer($args, $request) {
671  $articleId = (int) $request->getUserVar('articleId');
672  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
674 
675  $reviewId = (int) $request->getUserVar('reviewId');
676 
677  $send = $request->getUserVar('send')?true:false;
678  $this->setupTemplate(true, $articleId, 'review');
679 
680  if (SectionEditorAction::notifyReviewer($submission, $reviewId, $send, $request)) {
681  $request->redirect(null, null, 'submissionReview', $articleId);
682  }
683  }
684 
690  function clearReview($args, $request) {
691  $articleId = (int) array_shift($args);
692  $reviewId = (int) array_shift($args);
693  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
695 
696  SectionEditorAction::clearReview($submission, $reviewId, $request);
697 
698  $request->redirect(null, null, 'submissionReview', $articleId);
699  }
700 
706  function cancelReview($args, $request) {
707  $articleId = (int) $request->getUserVar('articleId');
708  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
710 
711  $reviewId = (int) $request->getUserVar('reviewId');
712 
713  $send = $request->getUserVar('send')?true:false;
714  $this->setupTemplate(true, $articleId, 'review');
715 
716  if (SectionEditorAction::cancelReview($submission, $reviewId, $send, $request)) {
717  $request->redirect(null, null, 'submissionReview', $articleId);
718  }
719  }
720 
726  function remindReviewer($args, $request) {
727  $articleId = (int) $request->getUserVar('articleId');
728  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
730 
731  $reviewId = (int) $request->getUserVar('reviewId');
732  $this->setupTemplate(true, $articleId, 'review');
733 
734  if (SectionEditorAction::remindReviewer($submission, $reviewId, $request->getUserVar('send'), $request)) {
735  $request->redirect(null, null, 'submissionReview', $articleId);
736  }
737  }
738 
739  /*
740  * Reassign a reviewer to the current round of review
741  * @param $args array
742  * @param $request object
743  */
744  function reassignReviewer($args, $request) {
745  $articleId = isset($args[0]) ? (int) $args[0] : 0;
746  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
747  $userId = isset($args[1]) ? (int) $args[1] : 0;
748 
749  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
750  $submission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
751  $round = $submission->getCurrentRound();
752 
753  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
754  $reviewAssignment =& $reviewAssignmentDao->getReviewAssignment($articleId, $userId, $submission->getCurrentRound()); /* @var $reviewAssignment ReviewAssignment */
755  if($reviewAssignment && !$reviewAssignment->getDateCompleted() && $reviewAssignment->getDeclined()) {
756  $reviewAssignment->setDeclined(false);
757  $reviewAssignment->setDateAssigned(Core::getCurrentDate());
758  $reviewAssignment->setDateNotified(null);
759  $reviewAssignment->setDateConfirmed(null);
760  $reviewAssignment->setRound($submission->getCurrentRound());
761 
762  $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
763  }
764  $request->redirect(null, null, 'submissionReview', $articleId);
765  }
766 
772  function thankReviewer($args, &$request) {
773  $articleId = (int) $request->getUserVar('articleId');
774  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
776 
777  $reviewId = (int) $request->getUserVar('reviewId');
778 
779  $send = $request->getUserVar('send')?true:false;
780  $this->setupTemplate(true, $articleId, 'review');
781 
782  if (SectionEditorAction::thankReviewer($submission, $reviewId, $send, $request)) {
783  $request->redirect(null, null, 'submissionReview', $articleId);
784  }
785  }
786 
792  function rateReviewer($args, &$request) {
793  $articleId = (int) $request->getUserVar('articleId');
794  $reviewId = (int) $request->getUserVar('reviewId');
795  $quality = (int) $request->getUserVar('quality');
796 
797  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
798  $this->setupTemplate(true, $articleId, 'review');
799 
800  SectionEditorAction::rateReviewer($articleId, $reviewId, $quality, $request);
801 
802  $request->redirect(null, null, 'submissionReview', $articleId);
803  }
804 
810  function confirmReviewForReviewer($args, &$request) {
811  $articleId = (int) array_shift($args);
812  $reviewId = (int) array_shift($args);
813 
814  $accept = $request->getUserVar('accept')?true:false;
815  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
817 
818  SectionEditorAction::confirmReviewForReviewer($reviewId, $accept, $request);
819  $request->redirect(null, null, 'submissionReview', $articleId);
820  }
821 
827  function uploadReviewForReviewer($args, &$request) {
828  $articleId = (int) $request->getUserVar('articleId');
829  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
831 
832  $reviewId = (int) $request->getUserVar('reviewId');
833 
835  $request->redirect(null, null, 'submissionReview', $articleId);
836  }
837 
843  function makeReviewerFileViewable($args, &$request) {
844  $articleId = $request->getUserVar('articleId');
845  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
847 
848  $reviewId = $request->getUserVar('reviewId');
849  $fileId = $request->getUserVar('fileId');
850  $revision = $request->getUserVar('revision');
851  $viewable = $request->getUserVar('viewable');
852 
853  SectionEditorAction::makeReviewerFileViewable($articleId, $reviewId, $fileId, $revision, $viewable);
854 
855  $request->redirect(null, null, 'submissionReview', $articleId);
856  }
857 
863  function setDueDate($args, &$request) {
864  $articleId = (int) array_shift($args);
865  $reviewId = (int) array_shift($args);
866 
867  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
869 
870  $dueDate = $request->getUserVar('dueDate');
871  $numWeeks = $request->getUserVar('numWeeks');
872 
873  if ($dueDate != null || $numWeeks != null) {
874  SectionEditorAction::setDueDate($articleId, $reviewId, $dueDate, $numWeeks, false, $request);
875  $request->redirect(null, null, 'submissionReview', $articleId);
876  } else {
877  $this->setupTemplate(true, $articleId, 'review');
878  $journal =& $request->getJournal();
879 
880  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
881  $reviewAssignment = $reviewAssignmentDao->getById($reviewId);
882 
883  $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
884  $settings =& $settingsDao->getJournalSettings($journal->getId());
885 
886  $templateMgr =& TemplateManager::getManager();
887 
888  if ($reviewAssignment->getDateDue() != null) {
889  $templateMgr->assign('dueDate', $reviewAssignment->getDateDue());
890  }
891 
892  $numWeeksPerReview = $settings['numWeeksPerReview'] == null ? 0 : $settings['numWeeksPerReview'];
893 
894  $templateMgr->assign('articleId', $articleId);
895  $templateMgr->assign('reviewId', $reviewId);
896  $templateMgr->assign('todaysDate', date('Y-m-d'));
897  $templateMgr->assign('numWeeksPerReview', $numWeeksPerReview);
898  $templateMgr->assign('actionHandler', 'setDueDate');
899 
900  $templateMgr->display('sectionEditor/setDueDate.tpl');
901  }
902  }
903 
909  function enterReviewerRecommendation($args, &$request) {
910  $articleId = $request->getUserVar('articleId');
911  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
913 
914  $reviewId = $request->getUserVar('reviewId');
915 
916  $recommendation = $request->getUserVar('recommendation');
917 
918  if ($recommendation != null) {
919  SectionEditorAction::setReviewerRecommendation($this->submission, $reviewId, $recommendation, SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT, $request);
920  $request->redirect(null, null, 'submissionReview', $articleId);
921  } else {
922  $this->setupTemplate(true, $articleId, 'review');
923 
924  $templateMgr =& TemplateManager::getManager();
925 
926  $templateMgr->assign('articleId', $articleId);
927  $templateMgr->assign('reviewId', $reviewId);
928 
929  import('classes.submission.reviewAssignment.ReviewAssignment');
930  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
931 
932  $templateMgr->display('sectionEditor/reviewerRecommendation.tpl');
933  }
934  }
935 
941  function userProfile($args, &$request) {
942  parent::validate();
943  $this->setupTemplate(true);
944 
945  $templateMgr =& TemplateManager::getManager();
946  $templateMgr->assign('currentUrl', $request->url(null, $request->getRequestedPage()));
947 
948  $userDao =& DAORegistry::getDAO('UserDAO');
949  $userId = isset($args[0]) ? $args[0] : 0;
950  if (is_numeric($userId)) {
951  $userId = (int) $userId;
952  $user = $userDao->getUser($userId);
953  } else {
954  $user = $userDao->getUserByUsername($userId);
955  }
956 
957 
958  if ($user == null) {
959  // Non-existent user requested
960  $templateMgr->assign('pageTitle', 'manager.people');
961  $templateMgr->assign('errorMsg', 'manager.people.invalidUser');
962  $templateMgr->display('common/error.tpl');
963 
964  } else {
965  $site =& $request->getSite();
966  $journal =& $request->getJournal();
967 
968  $countryDao =& DAORegistry::getDAO('CountryDAO');
969  $country = null;
970  if ($user->getCountry() != '') {
971  $country = $countryDao->getCountry($user->getCountry());
972  }
973  $templateMgr->assign('country', $country);
974 
975  $templateMgr->assign('userInterests', $user->getInterestString());
976 
977  $templateMgr->assign_by_ref('user', $user);
978  $templateMgr->assign('localeNames', AppLocale::getAllLocales());
979  $templateMgr->assign('helpTopicId', 'journal.roles.index');
980  $templateMgr->display('sectionEditor/userProfile.tpl');
981  }
982  }
983 
989  function viewMetadata($args, &$request) {
990  $articleId = (int) array_shift($args);
991  $journal =& $request->getJournal();
992 
993  $this->validate($articleId);
994  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_AUTHOR);
996  $this->setupTemplate(true, $articleId, 'summary');
997 
999  }
1000 
1006  function saveMetadata($args, &$request) {
1007  $articleId = $request->getUserVar('articleId');
1008  $this->validate($articleId);
1009  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_AUTHOR);
1011  $this->setupTemplate(true, $articleId, 'summary');
1012 
1014  $request->redirect(null, null, 'submission', $articleId);
1015  }
1016  }
1017 
1023  function removeArticleCoverPage($args, &$request) {
1024  $articleId = isset($args[0]) ? (int)$args[0] : 0;
1025  $this->validate($articleId);
1026 
1027  $formLocale = $args[1];
1028  if (!AppLocale::isLocaleValid($formLocale)) {
1029  $request->redirect(null, null, 'viewMetadata', $articleId);
1030  }
1031 
1034  $request->redirect(null, null, 'viewMetadata', $articleId);
1035  }
1036  }
1037 
1038  //
1039  // Review Form
1040  //
1041 
1047  function previewReviewForm($args, &$request) {
1048  parent::validate();
1049  $this->setupTemplate(true);
1050 
1051  $reviewId = (int) array_shift($args);
1052  $reviewFormId = (int) array_shift($args);
1053 
1054  $journal =& $request->getJournal();
1055  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
1056  $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_JOURNAL, $journal->getId());
1057  $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
1058  $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
1059  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
1060  $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
1061 
1062  $templateMgr =& TemplateManager::getManager();
1063  $templateMgr->assign('pageTitle', 'manager.reviewForms.preview');
1064  $templateMgr->assign_by_ref('reviewForm', $reviewForm);
1065  $templateMgr->assign('reviewFormElements', $reviewFormElements);
1066  $templateMgr->assign('reviewId', $reviewId);
1067  $templateMgr->assign('articleId', $reviewAssignment->getSubmissionId());
1068  //$templateMgr->assign('helpTopicId','journal.managementPages.reviewForms');
1069  $templateMgr->display('sectionEditor/previewReviewForm.tpl');
1070  }
1071 
1077  function clearReviewForm($args, &$request) {
1078  $articleId = isset($args[0]) ? (int) $args[0] : 0;
1079  $reviewId = isset($args[1]) ? (int) $args[1] : null;
1080  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1082 
1084 
1085  $request->redirect(null, null, 'submissionReview', $articleId);
1086  }
1087 
1093  function selectReviewForm($args, &$request) {
1094  $articleId = isset($args[0]) ? (int) $args[0] : 0;
1095  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1097 
1098  $reviewId = isset($args[1]) ? (int) $args[1] : null;
1099  $reviewFormId = isset($args[2]) ? (int) $args[2] : null;
1100 
1101  if ($reviewFormId != null) {
1102  SectionEditorAction::addReviewForm($submission, $reviewId, $reviewFormId);
1103  $request->redirect(null, null, 'submissionReview', $articleId);
1104  } else {
1105  $journal =& $request->getJournal();
1106  $rangeInfo =& $this->getRangeInfo('reviewForms');
1107  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
1108  $reviewForms =& $reviewFormDao->getActiveByAssocId(ASSOC_TYPE_JOURNAL, $journal->getId(), $rangeInfo);
1109  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
1110  $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
1111 
1112  $this->setupTemplate(true, $articleId, 'review');
1113  $templateMgr =& TemplateManager::getManager();
1114 
1115  $templateMgr->assign('articleId', $articleId);
1116  $templateMgr->assign('reviewId', $reviewId);
1117  $templateMgr->assign('assignedReviewFormId', $reviewAssignment->getReviewFormId());
1118  $templateMgr->assign_by_ref('reviewForms', $reviewForms);
1119  //$templateMgr->assign('helpTopicId','journal.managementPages.reviewForms');
1120  $templateMgr->display('sectionEditor/selectReviewForm.tpl');
1121  }
1122  }
1123 
1129  function viewReviewFormResponse($args, &$request) {
1130  $articleId = (int) array_shift($args);
1131  $reviewId = (int) array_shift($args);
1132 
1133  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1134  $this->setupTemplate(true, $articleId, 'editing');
1135 
1137  }
1138 
1139  //
1140  // Editor Review
1141  //
1142 
1148  function editorReview($args, $request) {
1149  $articleId = $request->getUserVar('articleId');
1150  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1152 
1153  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
1154 
1155  $redirectTarget = 'submissionReview';
1156 
1157  // If the Upload button was pressed.
1158  $submit = $request->getUserVar('submit');
1159  if ($submit != null) {
1161  }
1162 
1163  if ($request->getUserVar('setCopyeditFile')) {
1164  // If the Send To Copyedit button was pressed
1165  $file = explode(',', $request->getUserVar('editorDecisionFile'));
1166  if (isset($file[0]) && isset($file[1])) {
1167  $round = $submission->getCurrentRound();
1168  if ($submission->getMostRecentEditorDecisionComment()) {
1169  // The conditions are met for being able
1170  // to send a file to copyediting.
1171  SectionEditorAction::setCopyeditFile($submission, $file[0], $file[1], $request);
1172  }
1173  $redirectTarget = 'submissionEditing';
1174  }
1175 
1176  } else if ($request->getUserVar('resubmit')) {
1177  // If the Resubmit button was pressed
1178  $file = explode(',', $request->getUserVar('editorDecisionFile'));
1179  if (isset($file[0]) && isset($file[1])) {
1180  SectionEditorAction::resubmitFile($submission, $file[0], $file[1], $request);
1181  }
1182  }
1183 
1184  $request->redirect(null, null, $redirectTarget, $articleId);
1185  }
1186 
1187  //
1188  // Copyedit
1189  //
1190 
1196  function selectCopyeditor($args, $request) {
1197  $articleId = (int) array_shift($args);
1198  $userId = (int) array_shift($args);
1199 
1200  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1201  $journal =& $request->getJournal();
1203 
1204  $roleDao =& DAORegistry::getDAO('RoleDAO');
1205 
1206  if ($roleDao->userHasRole($journal->getId(), $userId, ROLE_ID_COPYEDITOR)) {
1208  $request->redirect(null, null, 'submissionEditing', $articleId);
1209  } else {
1210  $this->setupTemplate(true, $articleId, 'editing');
1211 
1212  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
1213 
1214  $searchType = null;
1215  $searchMatch = null;
1216  $search = $searchQuery = $request->getUserVar('search');
1217  $searchInitial = $request->getUserVar('searchInitial');
1218  if (!empty($search)) {
1219  $searchType = $request->getUserVar('searchField');
1220  $searchMatch = $request->getUserVar('searchMatch');
1221 
1222  } elseif (!empty($searchInitial)) {
1223  $searchInitial = String::strtoupper($searchInitial);
1224  $searchType = USER_FIELD_INITIAL;
1225  $search = $searchInitial;
1226  }
1227 
1228  $copyeditors = $roleDao->getUsersByRoleId(ROLE_ID_COPYEDITOR, $journal->getId(), $searchType, $search, $searchMatch);
1229  $copyeditorStatistics = $sectionEditorSubmissionDao->getCopyeditorStatistics($journal->getId());
1230 
1231  $templateMgr =& TemplateManager::getManager();
1232 
1233  $templateMgr->assign('searchField', $searchType);
1234  $templateMgr->assign('searchMatch', $searchMatch);
1235  $templateMgr->assign('search', $searchQuery);
1236  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
1237 
1238  $templateMgr->assign_by_ref('users', $copyeditors);
1239  $templateMgr->assign('currentUser', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
1240  $templateMgr->assign_by_ref('statistics', $copyeditorStatistics);
1241  $templateMgr->assign('pageSubTitle', 'editor.article.selectCopyeditor');
1242  $templateMgr->assign('pageTitle', 'user.role.copyeditors');
1243  $templateMgr->assign('actionHandler', 'selectCopyeditor');
1244  $templateMgr->assign('fieldOptions', array(
1245  USER_FIELD_FIRSTNAME => 'user.firstName',
1246  USER_FIELD_LASTNAME => 'user.lastName',
1247  USER_FIELD_USERNAME => 'user.username',
1248  USER_FIELD_EMAIL => 'user.email'
1249  ));
1250  $templateMgr->assign('articleId', $articleId);
1251 
1252  $templateMgr->assign('helpTopicId', 'journal.roles.copyeditor');
1253  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
1254  $templateMgr->display('sectionEditor/selectUser.tpl');
1255  }
1256  }
1257 
1263  function notifyCopyeditor($args, $request) {
1264  $articleId = (int) $request->getUserVar('articleId');
1265  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1267 
1268  $send = $request->getUserVar('send')?true:false;
1269  $this->setupTemplate(true, $articleId, 'editing');
1270 
1271  if (SectionEditorAction::notifyCopyeditor($submission, $send, $request)) {
1272  $request->redirect(null, null, 'submissionEditing', $articleId);
1273  }
1274  }
1275 
1281  function initiateCopyedit($args, $request) {
1282  $articleId = (int) $request->getUserVar('articleId');
1283  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1284 
1286  $request->redirect(null, null, 'submissionEditing', $articleId);
1287  }
1288 
1294  function thankCopyeditor($args, $request) {
1295  $articleId = (int) $request->getUserVar('articleId');
1296  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1297  $send = $request->getUserVar('send')?true:false;
1298  $this->setupTemplate(true, $articleId, 'editing');
1299 
1300  if (SectionEditorAction::thankCopyeditor($this->submission, $send, $request)) {
1301  $request->redirect(null, null, 'submissionEditing', $articleId);
1302  }
1303  }
1304 
1310  function notifyAuthorCopyedit($args, $request) {
1311  $articleId = (int) $request->getUserVar('articleId');
1312  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1313  $send = $request->getUserVar('send')?true:false;
1314  $this->setupTemplate(true, $articleId, 'editing');
1315 
1316  if (SectionEditorAction::notifyAuthorCopyedit($this->submission, $send, $request)) {
1317  $request->redirect(null, null, 'submissionEditing', $articleId);
1318  }
1319  }
1320 
1326  function thankAuthorCopyedit($args, $request) {
1327  $articleId = (int) $request->getUserVar('articleId');
1328  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1329  $send = $request->getUserVar('send')?true:false;
1330  $this->setupTemplate(true, $articleId, 'editing');
1331 
1332  if (SectionEditorAction::thankAuthorCopyedit($this->submission, $send, $request)) {
1333  $request->redirect(null, null, 'submissionEditing', $articleId);
1334  }
1335  }
1336 
1342  function notifyFinalCopyedit($args, $request) {
1343  $articleId = (int) $request->getUserVar('articleId');
1344  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1345  $send = $request->getUserVar('send')?true:false;
1346  $this->setupTemplate(true, $articleId, 'editing');
1347 
1348  if (SectionEditorAction::notifyFinalCopyedit($this->submission, $send, $request)) {
1349  $request->redirect(null, null, 'submissionEditing', $articleId);
1350  }
1351  }
1352 
1358  function completeCopyedit($args, $request) {
1359  $articleId = (int) $request->getUserVar('articleId');
1360  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1362  $request->redirect(null, null, 'submissionEditing', $articleId);
1363  }
1364 
1370  function completeFinalCopyedit($args, $request) {
1371  $articleId = (int) $request->getUserVar('articleId');
1372  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1374  $request->redirect(null, null, 'submissionEditing', $articleId);
1375  }
1376 
1382  function thankFinalCopyedit($args, $request) {
1383  $articleId = $request->getUserVar('articleId');
1384  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1385  $send = $request->getUserVar('send')?true:false;
1386  $this->setupTemplate(true, $articleId, 'editing');
1387 
1388  if (SectionEditorAction::thankFinalCopyedit($this->submission, $send, $request)) {
1389  $request->redirect(null, null, 'submissionEditing', $articleId);
1390  }
1391  }
1392 
1398  function uploadReviewVersion($args, $request) {
1399  $articleId = $request->getUserVar('articleId');
1400  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1402  $request->redirect(null, null, 'submissionReview', $articleId);
1403  }
1404 
1410  function uploadCopyeditVersion($args, $request) {
1411  $articleId = $request->getUserVar('articleId');
1412  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1413  $copyeditStage = $request->getUserVar('copyeditStage');
1415 
1416  $request->redirect(null, null, 'submissionEditing', $articleId);
1417  }
1418 
1424  function addSuppFile($args, $request) {
1425  $articleId = (int) array_shift($args);
1426  $journal =& $request->getJournal();
1427 
1428  $this->validate($articleId);
1430  $this->setupTemplate(true, $articleId, 'summary');
1431 
1432  import('classes.submission.form.SuppFileForm');
1433 
1434  $submitForm = new SuppFileForm($submission, $journal);
1435 
1436  if ($submitForm->isLocaleResubmit()) {
1437  $submitForm->readInputData();
1438  } else {
1439  $submitForm->initData();
1440  }
1441  $submitForm->display();
1442  }
1443 
1449  function editSuppFile($args, $request) {
1450  $articleId = (int) array_shift($args);
1451  $suppFileId = (int) array_shift($args);
1452  $journal =& $request->getJournal();
1453 
1454  $this->validate($articleId);
1456 
1457  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
1458  $suppFile =& $suppFileDao->getSuppFile($suppFileId, $articleId);
1459  if (!$suppFile) {
1460  $request->redirect(null, null, 'submissionEditing', $articleId);
1461  }
1462 
1463  $this->setupTemplate(true, $articleId, 'summary');
1464 
1465  import('classes.submission.form.SuppFileForm');
1466  $submitForm = new SuppFileForm($submission, $journal, $suppFileId);
1467  if ($submitForm->isLocaleResubmit()) {
1468  $submitForm->readInputData();
1469  } else {
1470  $submitForm->initData();
1471  }
1472  $submitForm->display();
1473  }
1474 
1480  function setSuppFileVisibility($args, $request) {
1481  $articleId = (int) $request->getUserVar('articleId');
1482  $this->validate($articleId);
1484 
1485  $suppFileId = (int) $request->getUserVar('fileId');
1486  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
1487  $suppFile = $suppFileDao->getSuppFile($suppFileId, $articleId);
1488 
1489  if (isset($suppFile) && $suppFile != null) {
1490  $suppFile->setShowReviewers($request->getUserVar('show')==1?1:0);
1491  $suppFileDao->updateSuppFile($suppFile);
1492  }
1493  $request->redirect(null, null, 'submissionReview', $articleId);
1494  }
1495 
1501  function saveSuppFile($args, $request) {
1502  $articleId = $request->getUserVar('articleId');
1503  $this->validate($articleId);
1504  $this->setupTemplate(true, $articleId, 'summary');
1506 
1507  $suppFileId = (int) array_shift($args);
1508  $journal =& $request->getJournal();
1509 
1510  import('classes.submission.form.SuppFileForm');
1511 
1512  $submitForm = new SuppFileForm($submission, $journal, $suppFileId);
1513  $submitForm->readInputData();
1514 
1515  if ($submitForm->validate()) {
1516  $submitForm->execute();
1517 
1518  // Send a notification to associated users
1519  import('classes.notification.NotificationManager');
1520  $notificationManager = new NotificationManager();
1521  $articleDao =& DAORegistry::getDAO('ArticleDAO');
1522  $article =& $articleDao->getArticle($articleId);
1523  $notificationUsers = $article->getAssociatedUserIds(true, false);
1524  foreach ($notificationUsers as $userRole) {
1525  $notificationManager->createNotification(
1526  $request, $userRole['id'], NOTIFICATION_TYPE_SUPP_FILE_MODIFIED,
1527  $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()
1528  );
1529  }
1530 
1531  $request->redirect(null, null, $this->_getFrom(), $articleId);
1532  } else {
1533  $submitForm->display();
1534  }
1535  }
1536 
1542  function deleteArticleFile($args, &$request) {
1543  $articleId = (int) array_shift($args);
1544  $fileId = (int) array_shift($args);
1545  $revisionId = (int) array_shift($args);
1546 
1547  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1548  SectionEditorAction::deleteArticleFile($this->submission, $fileId, $revisionId);
1549 
1550  $request->redirect(null, null, 'submissionReview', $articleId);
1551  }
1552 
1558  function deleteSuppFile($args, $request) {
1559  $articleId = (int) array_shift($args);
1560  $suppFileId = (int) array_shift($args);
1561  $this->validate($articleId);
1562  SectionEditorAction::deleteSuppFile($this->submission, $suppFileId);
1563  $request->redirect(null, null, $this->_getFrom(), $articleId);
1564  }
1565 
1571  function archiveSubmission($args, $request) {
1572  $articleId = (int) array_shift($args);
1573  $this->validate($articleId);
1575  $request->redirect(null, null, 'submission', $articleId);
1576  }
1577 
1583  function restoreToQueue($args, $request) {
1584  $articleId = (int) array_shift($args);
1585  $this->validate($articleId);
1587  $request->redirect(null, null, 'submissionEditing', $articleId);
1588  }
1589 
1595  function unsuitableSubmission($args, $request) {
1596  $articleId = $request->getUserVar('articleId');
1597  $this->validate($articleId);
1598  $send = $request->getUserVar('send')?true:false;
1599  $this->setupTemplate(true, $articleId, 'summary');
1600 
1601  if (SectionEditorAction::unsuitableSubmission($this->submission, $send, $request)) {
1602  $request->redirect(null, null, 'submission', $articleId);
1603  }
1604  }
1605 
1610  function updateSection($args, &$request) {
1611  $articleId = (int) array_shift($args);
1612  $this->validate($articleId);
1613  SectionEditorAction::updateSection($this->submission, $request->getUserVar('section'));
1614  $request->redirect(null, null, 'submission', $articleId);
1615  }
1616 
1622  function updateCommentsStatus($args, &$request) {
1623  $articleId = (int) array_shift($args);
1624  $this->validate($articleId);
1625  SectionEditorAction::updateCommentsStatus($this->submission, $request->getUserVar('commentsStatus'));
1626  $request->redirect(null, null, 'submission', $articleId);
1627  }
1628 
1629  //
1630  // Layout Editing
1631  //
1632 
1638  function uploadLayoutFile($args, &$request) {
1639  $layoutFileType = $request->getUserVar('layoutFileType');
1640  if ($layoutFileType == 'submission') {
1641  $this->_uploadLayoutVersion($request);
1642 
1643  } else if ($layoutFileType == 'galley') {
1644  $this->_uploadGalley('layoutFile', $request);
1645 
1646  } else if ($layoutFileType == 'supp') {
1647  $this->_uploadSuppFile('layoutFile', $request);
1648 
1649  } else {
1650  $request->redirect(null, null, $this->_getFrom(), $request->getUserVar('articleId'));
1651  }
1652  }
1653 
1658  function _uploadLayoutVersion(&$request) {
1659  $articleId = (int) $request->getUserVar('articleId');
1660  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1662  $request->redirect(null, null, 'submissionEditing', $articleId);
1663  }
1664 
1670  function deleteArticleImage($args, &$request) {
1671  $articleId = (int) array_shift($args);
1672  $galleyId = (int) array_shift($args);
1673  $fileId = (int) array_shift($args);
1674  $revision = (int) array_shift($args);
1675  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1676  SectionEditorAction::deleteArticleImage($this->submission, $fileId, $revision);
1677  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1678  }
1679 
1685  function assignLayoutEditor($args, $request) {
1686  $articleId = (int) array_shift($args);
1687  $editorId = (int) array_shift($args);
1688  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1689  $journal =& $request->getJournal();
1691 
1692  $roleDao =& DAORegistry::getDAO('RoleDAO');
1693  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
1694 
1695  if ($editorId && $roleDao->userHasRole($journal->getId(), $editorId, ROLE_ID_LAYOUT_EDITOR)) {
1697  $request->redirect(null, null, 'submissionEditing', $articleId);
1698  } else {
1699  $searchType = null;
1700  $searchMatch = null;
1701  $search = $searchQuery = $request->getUserVar('search');
1702  $searchInitial = $request->getUserVar('searchInitial');
1703  if (!empty($search)) {
1704  $searchType = $request->getUserVar('searchField');
1705  $searchMatch = $request->getUserVar('searchMatch');
1706 
1707  } elseif (!empty($searchInitial)) {
1708  $searchInitial = String::strtoupper($searchInitial);
1709  $searchType = USER_FIELD_INITIAL;
1710  $search = $searchInitial;
1711  }
1712 
1713  $layoutEditors = $roleDao->getUsersByRoleId(ROLE_ID_LAYOUT_EDITOR, $journal->getId(), $searchType, $search, $searchMatch);
1714 
1715  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
1716  $layoutEditorStatistics = $sectionEditorSubmissionDao->getLayoutEditorStatistics($journal->getId());
1717 
1718  $this->setupTemplate(true, $articleId, 'editing');
1719 
1720  $templateMgr =& TemplateManager::getManager();
1721 
1722  $templateMgr->assign('searchField', $searchType);
1723  $templateMgr->assign('searchMatch', $searchMatch);
1724  $templateMgr->assign('search', $searchQuery);
1725  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
1726  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
1727 
1728  $templateMgr->assign('pageTitle', 'user.role.layoutEditors');
1729  $templateMgr->assign('pageSubTitle', 'editor.article.selectLayoutEditor');
1730  $templateMgr->assign('actionHandler', 'assignLayoutEditor');
1731  $templateMgr->assign('articleId', $articleId);
1732  $templateMgr->assign_by_ref('users', $layoutEditors);
1733 
1734  $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
1735  if ($layoutSignoff) {
1736  $templateMgr->assign('currentUser', $layoutSignoff->getUserId());
1737  }
1738 
1739  $templateMgr->assign('fieldOptions', Array(
1740  USER_FIELD_FIRSTNAME => 'user.firstName',
1741  USER_FIELD_LASTNAME => 'user.lastName',
1742  USER_FIELD_USERNAME => 'user.username',
1743  USER_FIELD_EMAIL => 'user.email'
1744  ));
1745  $templateMgr->assign('statistics', $layoutEditorStatistics);
1746  $templateMgr->assign('helpTopicId', 'journal.roles.layoutEditor');
1747  $templateMgr->display('sectionEditor/selectUser.tpl');
1748  }
1749  }
1750 
1756  function notifyLayoutEditor($args, $request) {
1757  $articleId = (int) $request->getUserVar('articleId');
1758  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1759  $send = $request->getUserVar('send')?true:false;
1760  $this->setupTemplate(true, $articleId, 'editing');
1761  if (SectionEditorAction::notifyLayoutEditor($this->submission, $send, $request)) {
1762  $request->redirect(null, null, 'submissionEditing', $articleId);
1763  }
1764  }
1765 
1771  function thankLayoutEditor($args, $request) {
1772  $articleId = $request->getUserVar('articleId');
1773  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1775 
1776  $send = $request->getUserVar('send')?true:false;
1777  $this->setupTemplate(true, $articleId, 'editing');
1778 
1779  if (SectionEditorAction::thankLayoutEditor($submission, $send, $request)) {
1780  $request->redirect(null, null, 'submissionEditing', $articleId);
1781  }
1782  }
1783 
1789  function _uploadGalley($fileName = null, $request) {
1790  $articleId = $request->getUserVar('articleId');
1791  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1792 
1793  import('classes.submission.form.ArticleGalleyForm');
1794  $galleyForm = new ArticleGalleyForm($articleId);
1795  $galleyId = $galleyForm->execute($fileName, $request->getUserVar('createRemote'));
1796 
1797  Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
1798  }
1799 
1805  function editGalley($args, $request) {
1806  $articleId = (int) array_shift($args);
1807  $galleyId = (int) array_shift($args);
1808  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1809 
1810  $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
1811  $galley =& $galleyDao->getGalley($galleyId, $articleId);
1812  if (!$galley) {
1813  $request->redirect(null, null, 'submissionEditing', $articleId);
1814  }
1815 
1816  $this->setupTemplate(true, $articleId, 'editing');
1817 
1818  import('classes.submission.form.ArticleGalleyForm');
1819  $submitForm = new ArticleGalleyForm($articleId, $galleyId);
1820  if ($submitForm->isLocaleResubmit()) {
1821  $submitForm->readInputData();
1822  } else {
1823  $submitForm->initData();
1824  }
1825  $submitForm->display();
1826  }
1827 
1833  function saveGalley($args, $request) {
1834  $articleId = (int) array_shift($args);
1835  $galleyId = (int) array_shift($args);
1836  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1837  $this->setupTemplate(true, $articleId, 'editing');
1839 
1840  import('classes.submission.form.ArticleGalleyForm');
1841 
1842  $submitForm = new ArticleGalleyForm($articleId, $galleyId);
1843 
1844  $submitForm->readInputData();
1845  if ($submitForm->validate()) {
1846  $submitForm->execute();
1847 
1848  // Send a notification to associated users
1849  import('classes.notification.NotificationManager');
1850  $notificationManager = new NotificationManager();
1851  $articleDao =& DAORegistry::getDAO('ArticleDAO');
1852  $article =& $articleDao->getArticle($articleId);
1853  $notificationUsers = $article->getAssociatedUserIds(true, false);
1854  foreach ($notificationUsers as $userRole) {
1855  $notificationManager->createNotification(
1856  $request, $userRole['id'], NOTIFICATION_TYPE_GALLEY_MODIFIED,
1857  $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()
1858  );
1859  }
1860 
1861  if ($request->getUserVar('uploadImage')) {
1862  $submitForm->uploadImage();
1863  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1864  } else if(($deleteImage = $request->getUserVar('deleteImage')) && count($deleteImage) == 1) {
1865  list($imageId) = array_keys($deleteImage);
1866  $submitForm->deleteImage($imageId);
1867  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1868  }
1869  $request->redirect(null, null, 'submissionEditing', $articleId);
1870  } else {
1871  $submitForm->display();
1872  }
1873  }
1874 
1880  function orderGalley($args, &$request) {
1881  $articleId = (int) $request->getUserVar('articleId');
1882  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1883  SectionEditorAction::orderGalley($this->submission, $request->getUserVar('galleyId'), $request->getUserVar('d'));
1884  $request->redirect(null, null, 'submissionEditing', $articleId);
1885  }
1886 
1892  function deleteGalley($args, &$request) {
1893  $articleId = (int) array_shift($args);
1894  $galleyId = (int) array_shift($args);
1895  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1896  SectionEditorAction::deleteGalley($this->submission, $galleyId);
1897  $request->redirect(null, null, 'submissionEditing', $articleId);
1898  }
1899 
1905  function proofGalley($args, &$request) {
1906  $articleId = (int) array_shift($args);
1907  $galleyId = (int) array_shift($args);
1908  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1909  $this->setupTemplate();
1910 
1911  $templateMgr =& TemplateManager::getManager();
1912  $templateMgr->assign('articleId', $articleId);
1913  $templateMgr->assign('galleyId', $galleyId);
1914  $templateMgr->display('submission/layout/proofGalley.tpl');
1915  }
1916 
1922  function proofGalleyTop($args, &$request) {
1923  $articleId = (int) array_shift($args);
1924  $galleyId = (int) array_shift($args);
1925  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1926  $this->setupTemplate();
1927 
1928  $templateMgr =& TemplateManager::getManager();
1929  $templateMgr->assign('articleId', $articleId);
1930  $templateMgr->assign('galleyId', $galleyId);
1931  $templateMgr->assign('backHandler', 'submissionEditing');
1932  $templateMgr->display('submission/layout/proofGalleyTop.tpl');
1933  }
1934 
1940  function proofGalleyFile($args, &$request) {
1941  $articleId = (int) array_shift($args);
1942  $galleyId = (int) array_shift($args);
1943  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1944 
1945  $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
1946  $galley =& $galleyDao->getGalley($galleyId, $articleId);
1947 
1948  import('classes.file.ArticleFileManager'); // FIXME
1949 
1950  if (isset($galley)) {
1951  if ($galley->isHTMLGalley()) {
1952  $templateMgr =& TemplateManager::getManager();
1953  $templateMgr->assign_by_ref('galley', $galley);
1954  if ($galley->isHTMLGalley() && $styleFile =& $galley->getStyleFile()) {
1955  $templateMgr->addStyleSheet(Request::url(null, 'article', 'viewFile', array(
1956  $articleId, $galleyId, $styleFile->getFileId()
1957  )));
1958  }
1959  $templateMgr->display('submission/layout/proofGalleyHTML.tpl');
1960 
1961  } else {
1962  // View non-HTML file inline
1963  $this->viewFile(array($articleId, $galley->getFileId()), $request);
1964  }
1965  }
1966  }
1967 
1973  function _uploadSuppFile($fileName = null, $request) {
1974  $articleId = $request->getUserVar('articleId');
1975  $this->validate($articleId);
1977  $journal =& $request->getJournal();
1978 
1979  import('classes.submission.form.SuppFileForm');
1980 
1981  $suppFileForm = new SuppFileForm($submission, $journal);
1982  $suppFileForm->setData('title', array($submission->getLocale() => __('common.untitled')));
1983  $suppFileId = $suppFileForm->execute($fileName, $request->getUserVar('createRemote'));
1984 
1985  $request->redirect(null, null, 'editSuppFile', array($articleId, $suppFileId));
1986  }
1987 
1993  function orderSuppFile($args, &$request) {
1994  $articleId = $request->getUserVar('articleId');
1995  $this->validate($articleId);
1996  SectionEditorAction::orderSuppFile($this->submission, $request->getUserVar('suppFileId'), $request->getUserVar('d'));
1997  $request->redirect(null, null, 'submissionEditing', $articleId);
1998  }
1999 
2000 
2001  //
2002  // Submission History (FIXME Move to separate file?)
2003  //
2004 
2010  function submissionEventLog($args, &$request) {
2011  $articleId = (int) array_shift($args);
2012  $logId = (int) array_shift($args);
2013  $this->validate($articleId);
2015  $this->setupTemplate(true, $articleId, 'history');
2016 
2017  $templateMgr =& TemplateManager::getManager();
2018 
2019  $templateMgr->assign('isEditor', Validation::isEditor());
2020  $templateMgr->assign_by_ref('submission', $submission);
2021 
2022  if ($logId) {
2023  $logDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2024  $logEntry =& $logDao->getById($logId, ASSOC_TYPE_ARTICLE, $articleId);
2025  }
2026 
2027  if (isset($logEntry)) {
2028  $templateMgr->assign('logEntry', $logEntry);
2029  $templateMgr->display('sectionEditor/submissionEventLogEntry.tpl');
2030 
2031  } else {
2032  $rangeInfo =& $this->getRangeInfo('eventLogEntries');
2033  $eventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2034  $eventLogEntries =& $eventLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
2035  $templateMgr->assign('eventLogEntries', $eventLogEntries);
2036  $templateMgr->display('sectionEditor/submissionEventLog.tpl');
2037  }
2038  }
2039 
2045  function clearSubmissionEventLog($args, &$request) {
2046  $articleId = (int) array_shift($args);
2047  $logId = (int) array_shift($args);
2048  $this->validate($articleId);
2049  $logDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2050  if ($logId) {
2051  $logDao->deleteObject($logId, ASSOC_TYPE_ARTICLE, $articleId);
2052  } else {
2053  $logDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2054  }
2055  $request->redirect(null, null, 'submissionEventLog', $articleId);
2056  }
2057 
2063  function submissionEmailLog($args, $request) {
2064  $articleId = (int) array_shift($args);
2065  $logId = (int) array_shift($args);
2066 
2067  $this->validate($articleId);
2069  $this->setupTemplate(true, $articleId, 'history');
2070 
2071  $templateMgr =& TemplateManager::getManager();
2072 
2073  $templateMgr->assign('isEditor', Validation::isEditor());
2074  $templateMgr->assign_by_ref('submission', $submission);
2075 
2076  $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
2077  import('classes.file.ArticleFileManager');
2078  $templateMgr->assign('attachments', $articleFileDao->getArticleFilesByAssocId($logId, ARTICLE_FILE_ATTACHMENT));
2079 
2080  if ($logId) {
2081  $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2082  $logEntry =& $logDao->getById($logId, ASSOC_TYPE_ARTICLE, $articleId);
2083  }
2084 
2085  if (isset($logEntry)) {
2086  $templateMgr->assign_by_ref('logEntry', $logEntry);
2087  $templateMgr->display('sectionEditor/submissionEmailLogEntry.tpl');
2088  } else {
2089  $rangeInfo =& $this->getRangeInfo('emailLogEntries');
2090 
2091  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2092  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
2093  $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
2094  $templateMgr->display('sectionEditor/submissionEmailLog.tpl');
2095  }
2096  }
2097 
2103  function clearSubmissionEmailLog($args, &$request) {
2104  $articleId = (int) array_shift($args);
2105  $logId = (int) array_shift($args);
2106  $this->validate($articleId);
2107 
2108  $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2109  if ($logId) {
2110  $logDao->deleteObject($logId, ASSOC_TYPE_ARTICLE, $articleId);
2111  } else {
2112  $logDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2113  }
2114  $request->redirect(null, null, 'submissionEmailLog', $articleId);
2115  }
2116 
2117  //
2118  // Submission Notes Functions
2119  //
2120 
2126  function addSubmissionNote($args, $request) {
2127  $articleId = (int) $request->getUserVar('articleId');
2128  $this->validate($articleId);
2129  SectionEditorAction::addSubmissionNote($articleId, $request);
2130  $request->redirect(null, null, 'submissionNotes', $articleId);
2131  }
2132 
2139  function removeSubmissionNote($args, $request) {
2140  $articleId = (int) $request->getUserVar('articleId');
2141  $noteId = (int) $request->getUserVar('noteId');
2142  $fileId = (int) $request->getUserVar('fileId');
2143  $this->validate($articleId);
2144  SectionEditorAction::removeSubmissionNote($articleId, $noteId, $fileId);
2145  $request->redirect(null, null, 'submissionNotes', $articleId);
2146  }
2147 
2154  function updateSubmissionNote($args, $request) {
2155  $articleId = (int) $request->getUserVar('articleId');
2156  $this->validate($articleId);
2157  SectionEditorAction::updateSubmissionNote($articleId, $request);
2158  $request->redirect(null, null, 'submissionNotes', $articleId);
2159  }
2160 
2166  function clearAllSubmissionNotes($args, &$request) {
2167  $articleId = (int) $request->getUserVar('articleId');
2168  $this->validate($articleId);
2170  $request->redirect(null, null, 'submissionNotes', $articleId);
2171  }
2172 
2178  function submissionNotes($args, &$request) {
2179  $articleId = (int) array_shift($args);
2180  $noteViewType = array_shift($args); // May be null/empty
2181  $noteId = (int) array_shift($args);
2182 
2183  $this->validate($articleId);
2184  $this->setupTemplate(true, $articleId, 'history');
2186 
2187  $rangeInfo =& $this->getRangeInfo('submissionNotes');
2188  $noteDao =& DAORegistry::getDAO('NoteDAO');
2189 
2190  // submission note edit
2191  if ($noteViewType == 'edit') {
2192  $note = $noteDao->getById($noteId);
2193  }
2194 
2195  $templateMgr =& TemplateManager::getManager();
2196 
2197  $templateMgr->assign('articleId', $articleId);
2198  $templateMgr->assign_by_ref('submission', $submission);
2199  $templateMgr->assign('noteViewType', $noteViewType);
2200  if (isset($note)) {
2201  $templateMgr->assign_by_ref('articleNote', $note);
2202  }
2203 
2204  if ($noteViewType == 'edit' || $noteViewType == 'add') {
2205  $templateMgr->assign('showBackLink', true);
2206  } else {
2207  $submissionNotes =& $noteDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2208  $templateMgr->assign_by_ref('submissionNotes', $submissionNotes);
2209  }
2210 
2211  $templateMgr->display('sectionEditor/submissionNotes.tpl');
2212  }
2213 
2214 
2215  //
2216  // Misc
2217  //
2218 
2224  function downloadFile($args, &$request) {
2225  $articleId = (int) array_shift($args);
2226  $fileId = (int) array_shift($args);
2227  $revision = array_shift($args); // May be null
2228 
2229  $this->validate($articleId);
2230  if (!SectionEditorAction::downloadFile($articleId, $fileId, $revision)) {
2231  $request->redirect(null, null, 'submission', $articleId);
2232  }
2233  }
2234 
2240  function viewFile($args, &$request) {
2241  $articleId = (int) array_shift($args);
2242  $fileId = (int) array_shift($args);
2243  $revision = array_shift($args); // May be null
2244 
2245  $this->validate($articleId);
2246  if (!SectionEditorAction::viewFile($articleId, $fileId, $revision)) {
2247  $request->redirect(null, null, 'submission', $articleId);
2248  }
2249  }
2250 
2251 
2252  //
2253  // Proofreading
2254  //
2255 
2261  function selectProofreader($args, $request) {
2262  $articleId = (int) array_shift($args);
2263  $userId = (int) array_shift($args);
2264 
2265  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2266  $journal =& $request->getJournal();
2268 
2269  $roleDao =& DAORegistry::getDAO('RoleDAO');
2270  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2271 
2272  if ($userId && $articleId && $roleDao->userHasRole($journal->getId(), $userId, ROLE_ID_PROOFREADER)) {
2273  import('classes.submission.proofreader.ProofreaderAction');
2275  $request->redirect(null, null, 'submissionEditing', $articleId);
2276  } else {
2277  $this->setupTemplate(true, $articleId, 'editing');
2278 
2279  $searchType = null;
2280  $searchMatch = null;
2281  $search = $searchQuery = $request->getUserVar('search');
2282  $searchInitial = $request->getUserVar('searchInitial');
2283  if (!empty($search)) {
2284  $searchType = $request->getUserVar('searchField');
2285  $searchMatch = $request->getUserVar('searchMatch');
2286 
2287  } elseif (!empty($searchInitial)) {
2288  $searchInitial = String::strtoupper($searchInitial);
2289  $searchType = USER_FIELD_INITIAL;
2290  $search = $searchInitial;
2291  }
2292 
2293  $proofreaders = $roleDao->getUsersByRoleId(ROLE_ID_PROOFREADER, $journal->getId(), $searchType, $search, $searchMatch);
2294 
2295  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
2296  $proofreaderStatistics = $sectionEditorSubmissionDao->getProofreaderStatistics($journal->getId());
2297 
2298  $templateMgr =& TemplateManager::getManager();
2299 
2300  $templateMgr->assign('searchField', $searchType);
2301  $templateMgr->assign('searchMatch', $searchMatch);
2302  $templateMgr->assign('search', $searchQuery);
2303  $templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
2304 
2305  $templateMgr->assign_by_ref('users', $proofreaders);
2306 
2307  $proofSignoff = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2308  if ($proofSignoff) {
2309  $templateMgr->assign('currentUser', $proofSignoff->getUserId());
2310  }
2311  $templateMgr->assign('statistics', $proofreaderStatistics);
2312  $templateMgr->assign('fieldOptions', Array(
2313  USER_FIELD_FIRSTNAME => 'user.firstName',
2314  USER_FIELD_LASTNAME => 'user.lastName',
2315  USER_FIELD_USERNAME => 'user.username',
2316  USER_FIELD_EMAIL => 'user.email'
2317  ));
2318  $templateMgr->assign('articleId', $articleId);
2319  $templateMgr->assign('pageSubTitle', 'editor.article.selectProofreader');
2320  $templateMgr->assign('pageTitle', 'user.role.proofreaders');
2321  $templateMgr->assign('actionHandler', 'selectProofreader');
2322 
2323  $templateMgr->assign('helpTopicId', 'journal.roles.proofreader');
2324  $templateMgr->display('sectionEditor/selectUser.tpl');
2325  }
2326  }
2327 
2333  function notifyAuthorProofreader($args, $request) {
2334  $articleId = (int) $request->getUserVar('articleId');
2335  $send = $request->getUserVar('send');
2336  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2337  $this->setupTemplate(true, $articleId, 'editing');
2338 
2339  import('classes.submission.proofreader.ProofreaderAction');
2340  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_AUTHOR_REQUEST', $request, $send?'':$request->url(null, null, 'notifyAuthorProofreader'))) {
2341  $request->redirect(null, null, 'submissionEditing', $articleId);
2342  }
2343  }
2344 
2350  function thankAuthorProofreader($args, $request) {
2351  $articleId = (int) $request->getUserVar('articleId');
2352  $send = $request->getUserVar('send');
2353  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2354  $this->setupTemplate(true, $articleId, 'editing');
2355 
2356  import('classes.submission.proofreader.ProofreaderAction');
2357  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_AUTHOR_ACK', $request, $send?'':$request->url(null, null, 'thankAuthorProofreader'))) {
2358  $request->redirect(null, null, 'submissionEditing', $articleId);
2359  }
2360  }
2361 
2367  function editorInitiateProofreader($args, &$request) {
2368  $articleId = $request->getUserVar('articleId');
2369  $user =& $request->getUser();
2370  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2371 
2372  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2373  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2374  if (!$signoff->getUserId()) {
2375  $signoff->setUserId($user->getId());
2376  }
2377  $signoff->setDateNotified(Core::getCurrentDate());
2378  $signoffDao->updateObject($signoff);
2379 
2380  $request->redirect(null, null, 'submissionEditing', $articleId);
2381  }
2382 
2388  function editorCompleteProofreader($args, &$request) {
2389  $articleId = $request->getUserVar('articleId');
2390  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2391  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2392  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2393  $signoff->setDateCompleted(Core::getCurrentDate());
2394  $signoffDao->updateObject($signoff);
2395  $request->redirect(null, null, 'submissionEditing', $articleId);
2396  }
2397 
2403  function notifyProofreader($args, $request) {
2404  $articleId = (int) $request->getUserVar('articleId');
2405  $send = $request->getUserVar('send');
2406  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2407  $this->setupTemplate(true, $articleId, 'editing');
2408 
2409  import('classes.submission.proofreader.ProofreaderAction');
2410  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_REQUEST', $request, $send?'':$request->url(null, null, 'notifyProofreader'))) {
2411  $request->redirect(null, null, 'submissionEditing', $articleId);
2412  }
2413  }
2414 
2420  function thankProofreader($args, $request) {
2421  $articleId = (int) $request->getUserVar('articleId');
2422  $send = $request->getUserVar('send');
2423  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2424  $this->setupTemplate(true, $articleId, 'editing');
2425 
2426  import('classes.submission.proofreader.ProofreaderAction');
2427  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_ACK', $request, $send?'':$request->url(null, null, 'thankProofreader'))) {
2428  $request->redirect(null, null, 'submissionEditing', $articleId);
2429  }
2430  }
2431 
2437  function editorInitiateLayoutEditor($args, &$request) {
2438  $articleId = (int) $request->getUserVar('articleId');
2439  $user =& $request->getUser();
2440  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2441 
2442  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2443  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2444  if (!$signoff->getUserId()) {
2445  $signoff->setUserId($user->getId());
2446  }
2447  $signoff->setDateNotified(Core::getCurrentDate());
2448  $signoff->setDateUnderway(null);
2449  $signoff->setDateCompleted(null);
2450  $signoff->setDateAcknowledged(null);
2451  $signoffDao->updateObject($signoff);
2452 
2453  $request->redirect(null, null, 'submissionEditing', $articleId);
2454  }
2455 
2461  function editorCompleteLayoutEditor($args, &$request) {
2462  $articleId = $request->getUserVar('articleId');
2463  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2464 
2465  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2466  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2467  $signoff->setDateCompleted(Core::getCurrentDate());
2468  $signoffDao->updateObject($signoff);
2469 
2470  $request->redirect(null, null, 'submissionEditing', $articleId);
2471  }
2472 
2478  function notifyLayoutEditorProofreader($args, $request) {
2479  $articleId = (int) $request->getUserVar('articleId');
2480  $send = $request->getUserVar('send');
2481  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2482  $this->setupTemplate(true, $articleId, 'editing');
2483 
2484  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2485  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2486  $signoff->setDateNotified(Core::getCurrentDate());
2487  $signoff->setDateUnderway(null);
2488  $signoff->setDateCompleted(null);
2489  $signoff->setDateAcknowledged(null);
2490  $signoffDao->updateObject($signoff);
2491 
2492  import('classes.submission.proofreader.ProofreaderAction');
2493  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_LAYOUT_REQUEST', $request, $send?'':$request->url(null, null, 'notifyLayoutEditorProofreader'))) {
2494  $request->redirect(null, null, 'submissionEditing', $articleId);
2495  }
2496  }
2497 
2503  function thankLayoutEditorProofreader($args, $request) {
2504  $articleId = (int) $request->getUserVar('articleId');
2505  $send = $request->getUserVar('send');
2506  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2507  $this->setupTemplate(true, $articleId, 'editing');
2508 
2509  import('classes.submission.proofreader.ProofreaderAction');
2510  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_LAYOUT_ACK', $request, $send?'':$request->url(null, null, 'thankLayoutEditorProofreader'))) {
2511  $request->redirect(null, null, 'submissionEditing', $articleId);
2512  }
2513  }
2514 
2520  function scheduleForPublication($args, $request) {
2521  $articleId = (int) array_shift($args);
2522  $issueId = (int) $request->getUserVar('issueId');
2523  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2524 
2525  $journal =& $request->getJournal();
2527 
2528  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
2529  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
2530  $sectionDao =& DAORegistry::getDAO('SectionDAO');
2531  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
2532 
2533  $issueDao =& DAORegistry::getDAO('IssueDAO');
2534  $issue =& $issueDao->getIssueById($issueId, $journal->getId());
2535 
2536  if ($publishedArticle) {
2537  if (!$issue || !$issue->getPublished()) {
2538  $fromIssue =& $issueDao->getIssueById($publishedArticle->getIssueId(), $journal->getId());
2539  if ($fromIssue->getPublished()) {
2540  // Insert article tombstone
2541  import('classes.article.ArticleTombstoneManager');
2542  $articleTombstoneManager = new ArticleTombstoneManager();
2543  $articleTombstoneManager->insertArticleTombstone($submission, $journal);
2544  }
2545  }
2546  }
2547 
2548  import('classes.search.ArticleSearchIndex');
2549  $articleSearchIndex = new ArticleSearchIndex();
2550 
2551  if ($issue) {
2552 
2553  // Schedule against an issue.
2554  if ($publishedArticle) {
2555  $publishedArticle->setIssueId($issueId);
2556  $publishedArticle->setSeq(REALLY_BIG_NUMBER);
2557  $publishedArticleDao->updatePublishedArticle($publishedArticle);
2558 
2559  // Re-index the published article metadata.
2560  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2561  } else {
2562  $publishedArticle = new PublishedArticle();
2563  $publishedArticle->setId($submission->getId());
2564  $publishedArticle->setIssueId($issueId);
2565  $publishedArticle->setDatePublished(Core::getCurrentDate());
2566  $publishedArticle->setSeq(REALLY_BIG_NUMBER);
2567  $publishedArticle->setAccessStatus(ARTICLE_ACCESS_ISSUE_DEFAULT);
2568 
2569  $publishedArticleDao->insertPublishedArticle($publishedArticle);
2570 
2571  // If we're using custom section ordering, and if this is the first
2572  // article published in a section, make sure we enter a custom ordering
2573  // for it. (Default at the end of the list.)
2574  if ($sectionDao->customSectionOrderingExists($issueId)) {
2575  if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) {
2576  $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER);
2577  $sectionDao->resequenceCustomSectionOrders($issueId);
2578  }
2579  }
2580 
2581  // Index the published article metadata and files for the first time.
2582  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2583  $articleSearchIndex->articleFilesChanged($publishedArticle);
2584  }
2585 
2586  } else {
2587  if ($publishedArticle) {
2588  // This was published elsewhere; make sure we don't
2589  // mess up sequencing information.
2590  $issueId = $publishedArticle->getIssueId();
2591  $publishedArticleDao->deletePublishedArticleByArticleId($articleId);
2592 
2593  // Delete the article from the search index.
2594  $articleSearchIndex->articleFileDeleted($articleId);
2595  }
2596  }
2597 
2598  // Resequence the articles.
2599  $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId);
2600 
2601  $submission->stampStatusModified();
2602 
2603  if ($issue && $issue->getPublished()) {
2604  $submission->setStatus(STATUS_PUBLISHED);
2605  // delete article tombstone
2606  $tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO');
2607  $tombstoneDao->deleteByDataObjectId($submission->getId());
2608  } else {
2609  $submission->setStatus(STATUS_QUEUED);
2610  }
2611 
2612  $sectionEditorSubmissionDao->updateSectionEditorSubmission($submission);
2613  $articleSearchIndex->articleChangesFinished();
2614 
2615  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2616  }
2617 
2623  function setDatePublished($args, $request) {
2624  $articleId = (int) array_shift($args);
2625  $issueId = (int) $request->getUserVar('issueId');
2626  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2627 
2628  $journal =& $request->getJournal();
2630 
2631  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
2632  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
2633  if ($publishedArticle) {
2634  $datePublished = $request->getUserDateVar('datePublished');
2635  $publishedArticle->setDatePublished($datePublished);
2636  $publishedArticleDao->updatePublishedArticle($publishedArticle);
2637 
2638  // Re-index the published article metadata.
2639  import('classes.search.ArticleSearchIndex');
2640  $articleSearchIndex = new ArticleSearchIndex();
2641  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2642  $articleSearchIndex->articleChangesFinished();
2643  }
2644  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2645  }
2646 
2647  //
2648  // Payments
2649  //
2650 
2656  function waiveSubmissionFee($args, $request) {
2657  $articleId = (int) array_shift($args);
2658  $markAsPaid = $request->getUserVar('markAsPaid');
2659 
2660  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2662  import('classes.payment.ojs.OJSPaymentManager');
2663  $paymentManager = new OJSPaymentManager($request);
2664  $user =& $request->getUser();
2665  $journal =& $request->getJournal();
2666 
2667  $queuedPayment =& $paymentManager->createQueuedPayment(
2668  $journal->getId(),
2669  PAYMENT_TYPE_SUBMISSION,
2670  $markAsPaid ? $submission->getUserId() : $user->getId(),
2671  $articleId,
2672  $markAsPaid ? $journal->getSetting('submissionFee') : 0,
2673  $markAsPaid ? $journal->getSetting('currency') : ''
2674  );
2675 
2676  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2677 
2678  // Since this is a waiver, fulfill the payment immediately
2679  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2680  $request->redirect(null, null, 'submission', array($articleId));
2681  }
2682 
2688  function waiveFastTrackFee($args, &$request) {
2689  $articleId = (int) array_shift($args);
2690  $markAsPaid = $request->getUserVar('markAsPaid');
2691  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2692  $journal =& $request->getJournal();
2694 
2695  import('classes.payment.ojs.OJSPaymentManager');
2696  $paymentManager = new OJSPaymentManager($request);
2697  $user =& $request->getUser();
2698 
2699  $queuedPayment =& $paymentManager->createQueuedPayment(
2700  $journal->getId(),
2701  PAYMENT_TYPE_FASTTRACK,
2702  $markAsPaid ? $submission->getUserId() : $user->getId(),
2703  $articleId,
2704  $markAsPaid ? $journal->getSetting('fastTrackFee') : 0,
2705  $markAsPaid ? $journal->getSetting('currency') : ''
2706  );
2707 
2708  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2709 
2710  // Since this is a waiver, fulfill the payment immediately
2711  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2712  $request->redirect(null, null, 'submission', array($articleId));
2713  }
2714 
2720  function waivePublicationFee($args, $request) {
2721  $articleId = (int) array_shift($args);
2722  $markAsPaid = $request->getUserVar('markAsPaid');
2723  $sendToScheduling = $request->getUserVar('sendToScheduling')?true:false;
2724 
2725  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2726  $journal =& Request::getJournal();
2728 
2729  import('classes.payment.ojs.OJSPaymentManager');
2730  $paymentManager = new OJSPaymentManager($request);
2731  $user =& $request->getUser();
2732 
2733  $queuedPayment =& $paymentManager->createQueuedPayment(
2734  $journal->getId(),
2735  PAYMENT_TYPE_PUBLICATION,
2736  $markAsPaid ? $submission->getUserId() : $user->getId(),
2737  $articleId,
2738  $markAsPaid ? $journal->getSetting('publicationFee') : 0,
2739  $markAsPaid ? $journal->getSetting('currency') : ''
2740  );
2741 
2742  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2743 
2744  // Since this is a waiver, fulfill the payment immediately
2745  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2746 
2747  if ($sendToScheduling) {
2748  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2749  } else {
2750  $request->redirect(null, null, 'submission', array($articleId));
2751  }
2752  }
2753 }
2754 
2755 ?>
rateReviewer($articleId, $reviewId, $quality, $request)
thankFinalCopyedit($sectionEditorSubmission, $send, $request)
suggestUsername($firstName, $lastName)
isLocaleValid($locale)
setupTemplate($subclass=false, $articleId=0, $parentPage=null, $showSidebar=true)
_getFrom($default= 'submissionEditing')
deleteSuppFile($article, $suppFileId)
orderGalley($article, $galleyId, $direction)
downloadFile($articleId, $fileId, $revision=null)
Definition: Action.inc.php:180
setReviewerRecommendation($article, $reviewId, $recommendation, $acceptOption, $request)
uploadReviewForReviewer($reviewId, $article, $request)
Form for section editors to create reviewers.
Article galley editing form.
isEditor($journalId=-1)
& getJournal()
Definition: Request.inc.php:42
viewMetadata($article, $journal)
Definition: Action.inc.php:59
& getRangeInfo($rangeName, $contextData=null)
removeArticleCoverPage($submission, $formLocale)
addSubmissionNote($articleId, $request)
updateCommentsStatus($submission, $commentsStatus)
Handle requests for submission tracking.
deleteGalley($article, $galleyId)
viewReviewFormResponse($sectionEditorSubmission, $reviewId)
redirect($context=null, $page=null, $op=null, $path=null, $params=null, $anchor=null)
& getCommentsStatusOptions()
getCurrentDate($ts=null)
Definition: Core.inc.php:94
proofreadEmail($articleId, $mailType, $request, $actionPath= '')
editorCompleteLayoutEditor($args, &$request)
Describes user roles within the system and the associated permissions.
Definition: Role.inc.php:30
remindReviewer($sectionEditorSubmission, $reviewId, $send, $request)
confirmReviewForReviewer($args, &$request)
viewFile($articleId, $fileId, $revision=null)
Definition: Action.inc.php:192
makeReviewerFileViewable($articleId, $reviewId, $fileId, $revision, $viewable=false)
clearAllSubmissionNotes($args, &$request)
editorInitiateProofreader($args, &$request)
resubmitFile($sectionEditorSubmission, $fileId, $revision, $request)
unsuitableSubmission($sectionEditorSubmission, $send, $request)
makeReviewerFileViewable($args, &$request)
uploadReviewVersion($sectionEditorSubmission)
selectProofreader($userId, $article, $request)
assignLayoutEditor($submission, $editorId, $request)
clearSubmissionEmailLog($args, &$request)
addReviewForm($sectionEditorSubmission, $reviewId, $reviewFormId)
uploadCopyeditVersion($sectionEditorSubmission, $copyeditStage)
removeArticleCoverPage($args, &$request)
archiveSubmission($sectionEditorSubmission, $request)
editCitations(&$request, &$submission)
deleteArticleFile($submission, $fileId, $revision)
initiateCopyedit($sectionEditorSubmission, $request)
clearReviewForm($sectionEditorSubmission, $reviewId)
deleteArticleImage($submission, $fileId, $revision)
notifyReviewer($sectionEditorSubmission, $reviewId, $send, $request)
orderSuppFile($article, $suppFileId, $direction)
enterReviewerRecommendation($args, &$request)
confirmReviewForReviewer($reviewId, $accept, $request)
Published article class.
& getDAO($name, $dbconn=null)
uploadReviewForReviewer($args, &$request)
editorInitiateLayoutEditor($args, &$request)
notifyCopyeditor($sectionEditorSubmission, $send, $request)
thankCopyeditor($sectionEditorSubmission, $send, $request)
uploadEditorVersion($sectionEditorSubmission, $request)
cancelReview($sectionEditorSubmission, $reviewId, $send, $request)
url($journalPath=null, $page=null, $op=null, $path=null, $params=null, $anchor=null, $escape=false)
Definition: Request.inc.php:88
removeSubmissionNote($articleId, $noteId, $fileId)
setCopyeditFile($sectionEditorSubmission, $fileId, $revision, $request)
notifyAuthorCopyedit($sectionEditorSubmission, $send, $request)
_uploadSuppFile($fileName=null, $request)
strtoupper($string)
Definition: String.inc.php:242
addReviewer($sectionEditorSubmission, $reviewerId, $round, $request)
changeSection($sectionEditorSubmission, $sectionId)
Class defining basic operations for article tombstones.
notifyFinalCopyedit($sectionEditorSubmission, $send, $request)
thankLayoutEditorProofreader($args, $request)
Handle requests for section editor functions.
notifyLayoutEditor($submission, $send, $request)
thankReviewer($sectionEditorSubmission, $reviewId, $send, $request)
Class to maintain the article search index.
completeCopyedit($sectionEditorSubmission, $request)
selectCopyeditor($sectionEditorSubmission, $copyeditorId, $request)
viewReviewFormResponse($args, &$request)
thankLayoutEditor($submission, $send, $request)
notifyLayoutEditorProofreader($args, $request)
completeFinalCopyedit($sectionEditorSubmission, $request)
updateSection($submission, $sectionId)
recordDecision(&$sectionEditorSubmission, $decision, $request)
_uploadGalley($fileName=null, $request)
Provides payment management functions.
setDueDate($articleId, $reviewId, $dueDate, $numWeeks, $logEntry, $request)
updateSubmissionNote($articleId, $request)
thankAuthorCopyedit($sectionEditorSubmission, $send, $request)
Supplementary file form.
saveMetadata($article, &$request)
Definition: Action.inc.php:77
validate($articleId=null, $access=null)
clearSubmissionEventLog($args, &$request)
clearReview($sectionEditorSubmission, $reviewId, $request)
restoreToQueue($sectionEditorSubmission, $request)
editorCompleteProofreader($args, &$request)