Open Journal Systems  2.4.4
 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 
195  // Setting the round.
196  $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
197 
198  $sectionDao =& DAORegistry::getDAO('SectionDAO');
199  $sections =& $sectionDao->getJournalSections($journal->getId());
200 
201  $showPeerReviewOptions = $round == $submission->getCurrentRound() && $submission->getReviewFile() != null ? true : false;
202 
203  $editorDecisions = $submission->getDecisions($round);
204  $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
205 
206  $editAssignments =& $submission->getEditAssignments();
207  $allowRecommendation = $submission->getCurrentRound() == $round && $submission->getReviewFileId() != null && !empty($editAssignments);
208  $allowResubmit = $lastDecision == SUBMISSION_EDITOR_DECISION_RESUBMIT && $sectionEditorSubmissionDao->getMaxReviewRound($articleId) == $round ? true : false;
209  $allowCopyedit = $lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT && $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) == null ? true : false;
210 
211  // Prepare an array to store the 'Notify Reviewer' email logs
212  $notifyReviewerLogs = array();
213  foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
214  $notifyReviewerLogs[$reviewAssignment->getId()] = array();
215  }
216 
217  // Parse the list of email logs and populate the array.
218  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
219  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
220  foreach ($emailLogEntries->toArray() as $emailLog) {
221  if ($emailLog->getEventType() == ARTICLE_EMAIL_REVIEW_NOTIFY_REVIEWER) {
222  if (isset($notifyReviewerLogs[$emailLog->getAssocId()]) && is_array($notifyReviewerLogs[$emailLog->getAssocId()])) {
223  array_push($notifyReviewerLogs[$emailLog->getAssocId()], $emailLog);
224  }
225  }
226  }
227 
228  $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
229  $reviewFormResponses = array();
230 
231  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
232  $reviewFormTitles = array();
233 
234  foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
235  $reviewForm =& $reviewFormDao->getReviewForm($reviewAssignment->getReviewFormId());
236  if ($reviewForm) {
237  $reviewFormTitles[$reviewForm->getId()] = $reviewForm->getLocalizedTitle();
238  }
239  unset($reviewForm);
240  $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
241  }
242 
243  $templateMgr =& TemplateManager::getManager();
244 
245  $templateMgr->assign_by_ref('submission', $submission);
246  $templateMgr->assign_by_ref('reviewIndexes', $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round));
247  $templateMgr->assign('round', $round);
248  $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
249  $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
250  $templateMgr->assign('reviewFormTitles', $reviewFormTitles);
251  $templateMgr->assign_by_ref('notifyReviewerLogs', $notifyReviewerLogs);
252  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
253  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
254  $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
255  $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
256  $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
257  $templateMgr->assign_by_ref('editorFile', $submission->getEditorFile());
258  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
259  $templateMgr->assign('showPeerReviewOptions', $showPeerReviewOptions);
260  $templateMgr->assign_by_ref('sections', $sections->toArray());
261  $templateMgr->assign('editorDecisionOptions',SectionEditorSubmission::getEditorDecisionOptions());
262  $templateMgr->assign_by_ref('lastDecision', $lastDecision);
263 
264  import('classes.submission.reviewAssignment.ReviewAssignment');
265  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
266  $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
267 
268  $templateMgr->assign('allowRecommendation', $allowRecommendation);
269  $templateMgr->assign('allowResubmit', $allowResubmit);
270  $templateMgr->assign('allowCopyedit', $allowCopyedit);
271 
272  $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.review');
273  $templateMgr->display('sectionEditor/submissionReview.tpl');
274  }
275 
281  function submissionEditing($args, $request) {
282  $articleId = isset($args[0]) ? (int) $args[0] : 0;
283  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
284  $journal =& $request->getJournal();
286  $this->setupTemplate(true, $articleId);
287 
288  $useCopyeditors = $journal->getSetting('useCopyeditors');
289  $useLayoutEditors = $journal->getSetting('useLayoutEditors');
290  $useProofreaders = $journal->getSetting('useProofreaders');
291 
292  // check if submission is accepted
293  $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
294  $editorDecisions = $submission->getDecisions($round);
295  $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
296  $submissionAccepted = ($lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT) ? true : false;
297 
298  $templateMgr =& TemplateManager::getManager();
299 
300  $templateMgr->assign_by_ref('submission', $submission);
301  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
302  $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
303  $templateMgr->assign_by_ref('initialCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
304  $templateMgr->assign_by_ref('editorAuthorCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_AUTHOR'));
305  $templateMgr->assign_by_ref('finalCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_FINAL'));
306  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
307  $templateMgr->assign_by_ref('copyeditor', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
308 
309  $roleDao =& DAORegistry::getDAO('RoleDAO');
310  $user =& Request::getUser();
311  $templateMgr->assign('isEditor', $roleDao->userHasRole($journal->getId(), $user->getId(), ROLE_ID_EDITOR));
312 
313  import('classes.issue.IssueAction');
314  $templateMgr->assign('issueOptions', IssueAction::getIssueOptions());
315  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
316  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getId());
317  $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
318 
319  $templateMgr->assign('useCopyeditors', $useCopyeditors);
320  $templateMgr->assign('useLayoutEditors', $useLayoutEditors);
321  $templateMgr->assign('useProofreaders', $useProofreaders);
322  $templateMgr->assign('submissionAccepted', $submissionAccepted);
323  $templateMgr->assign('templates', $journal->getSetting('templates'));
324 
325  // Set up required Payment Related Information
326  import('classes.payment.ojs.OJSPaymentManager');
327  $paymentManager = new OJSPaymentManager($request);
328  $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
329 
330  $publicationFeeEnabled = $paymentManager->publicationEnabled();
331  $templateMgr->assign('publicationFeeEnabled', $publicationFeeEnabled);
332  if ( $publicationFeeEnabled ) {
333  $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment ( $journal->getId(), $articleId ));
334  }
335 
336  $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.editing');
337  $templateMgr->display('sectionEditor/submissionEditing.tpl');
338  }
339 
345  function submissionHistory($args, &$request) {
346  $articleId = (int) array_shift($args);
347  $this->validate($articleId);
348  $this->setupTemplate(true, $articleId);
349 
350  $templateMgr =& TemplateManager::getManager();
352  $templateMgr->assign_by_ref('submission', $submission);
353 
354  // Notes
355  $noteDao =& DAORegistry::getDAO('NoteDAO');
356  $submissionNotes =& $noteDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
357  $templateMgr->assign_by_ref('submissionNotes', $submissionNotes);
358 
359  // Event log
360  $eventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
361  $rangeInfo =& $this->getRangeInfo('eventLogEntries');
362  $eventLogEntries =& $eventLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
363  $templateMgr->assign_by_ref('eventLogEntries', $eventLogEntries);
364  unset($rangeInfo);
365 
366  // Email log
367  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
368  $rangeInfo =& $this->getRangeInfo('emailLogEntries');
369  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
370  $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
371  unset($rangeInfo);
372 
373  $templateMgr->assign('isEditor', Validation::isEditor());
374  $templateMgr->display('sectionEditor/submissionHistory.tpl');
375  }
376 
382  function submissionCitations($args, $request) {
383  // Authorize the request.
384  $articleId = isset($args[0]) ? (int) $args[0] : 0;
385  $this->validate($articleId);
386 
387  // Prepare the view.
388  $this->setupTemplate(true, $articleId);
389 
390  // Insert the citation editing assistant into the view.
392 
393  // Render the view.
394  $templateMgr =& TemplateManager::getManager();
395  $templateMgr->display('sectionEditor/submissionCitations.tpl');
396  }
397 
403  function changeSection($args, &$request) {
404  $articleId = (int) $request->getUserVar('articleId');
405  $this->validate($articleId);
407 
408  $sectionId = $request->getUserVar('sectionId');
409 
411 
412  $request->redirect(null, null, 'submission', $articleId);
413  }
414 
420  function recordDecision($args, $request) {
421  $articleId = $request->getUserVar('articleId');
422  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
424 
425  $decision = $request->getUserVar('decision');
426 
427  switch ($decision) {
428  case SUBMISSION_EDITOR_DECISION_ACCEPT:
429  case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
430  case SUBMISSION_EDITOR_DECISION_RESUBMIT:
431  case SUBMISSION_EDITOR_DECISION_DECLINE:
432  SectionEditorAction::recordDecision($submission, $decision, $request);
433  break;
434  }
435 
436  $request->redirect(null, null, 'submissionReview', $articleId);
437  }
438 
439  //
440  // Peer Review
441  //
442 
448  function selectReviewer($args, &$request) {
449  $articleId = (int) array_shift($args);
450  $reviewerId = (int) array_shift($args);
451 
452  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
453  $journal =& $request->getJournal();
455 
456  $sort = $request->getUserVar('sort');
457  $sort = isset($sort) ? $sort : 'reviewerName';
458  $sortDirection = $request->getUserVar('sortDirection');
459  $sortDirection = (isset($sortDirection) && ($sortDirection == SORT_DIRECTION_ASC || $sortDirection == SORT_DIRECTION_DESC)) ? $sortDirection : SORT_DIRECTION_ASC;
460 
461  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
462 
463  if ($reviewerId) {
464  // Assign reviewer to article
465  SectionEditorAction::addReviewer($submission, $reviewerId, null, $request);
466  $request->redirect(null, null, 'submissionReview', $articleId);
467 
468  // FIXME: Prompt for due date.
469  } else {
470  $this->setupTemplate(true, $articleId, 'review');
471 
472  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
473 
474  $searchType = null;
475  $searchMatch = null;
476  $search = $searchQuery = $request->getUserVar('search');
477  $searchInitial = $request->getUserVar('searchInitial');
478  if (!empty($search)) {
479  $searchType = $request->getUserVar('searchField');
480  $searchMatch = $request->getUserVar('searchMatch');
481 
482  } elseif (!empty($searchInitial)) {
483  $searchInitial = String::strtoupper($searchInitial);
484  $searchType = USER_FIELD_INITIAL;
485  $search = $searchInitial;
486  }
487 
488  $rangeInfo =& $this->getRangeInfo('reviewers');
489  $reviewers = $sectionEditorSubmissionDao->getReviewersForArticle($journal->getId(), $articleId, $submission->getCurrentRound(), $searchType, $search, $searchMatch, $rangeInfo, $sort, $sortDirection); /* @var $reviewers DAOResultFactory */
490 
491  $journal = $request->getJournal();
492  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
493 
494  $templateMgr =& TemplateManager::getManager();
495 
496  $templateMgr->assign('searchField', $searchType);
497  $templateMgr->assign('searchMatch', $searchMatch);
498  $templateMgr->assign('search', $searchQuery);
499  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
500 
501  $templateMgr->assign_by_ref('reviewers', $reviewers);
502  $templateMgr->assign('articleId', $articleId);
503  $templateMgr->assign('reviewerStatistics', $sectionEditorSubmissionDao->getReviewerStatistics($journal->getId()));
504  $templateMgr->assign('fieldOptions', array(
505  USER_FIELD_INTERESTS => 'user.interests',
506  USER_FIELD_FIRSTNAME => 'user.firstName',
507  USER_FIELD_LASTNAME => 'user.lastName',
508  USER_FIELD_USERNAME => 'user.username',
509  USER_FIELD_EMAIL => 'user.email'
510  ));
511  $templateMgr->assign('completedReviewCounts', $reviewAssignmentDao->getCompletedReviewCounts($journal->getId()));
512  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
513  $templateMgr->assign('averageQualityRatings', $reviewAssignmentDao->getAverageQualityRatings($journal->getId()));
514 
515  $templateMgr->assign('helpTopicId', 'journal.roles.reviewer');
516  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
517  $templateMgr->assign('reviewerDatabaseLinks', $journal->getSetting('reviewerDatabaseLinks'));
518  $templateMgr->assign('sort', $sort);
519  $templateMgr->assign('sortDirection', $sortDirection);
520  $templateMgr->display('sectionEditor/selectReviewer.tpl');
521  }
522  }
523 
529  function createReviewer($args, &$request) {
530  $articleId = isset($args[0]) ? (int) $args[0] : 0;
531  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
533 
534  import('classes.sectionEditor.form.CreateReviewerForm');
535  $createReviewerForm = new CreateReviewerForm($articleId);
536  $this->setupTemplate(true, $articleId);
537 
538  if (isset($args[1]) && $args[1] === 'create') {
539  $createReviewerForm->readInputData();
540  if ($createReviewerForm->validate()) {
541  // Create a user and enroll them as a reviewer.
542  $newUserId = $createReviewerForm->execute();
543  $request->redirect(null, null, 'selectReviewer', array($articleId, $newUserId));
544  } else {
545  $createReviewerForm->display($args, $request);
546  }
547  } else {
548  // Display the "create user" form.
549  if ($createReviewerForm->isLocaleResubmit()) {
550  $createReviewerForm->readInputData();
551  } else {
552  $createReviewerForm->initData();
553  }
554  $createReviewerForm->display($args, $request);
555  }
556  }
557 
564  function suggestUsername($args, &$request) {
565  parent::validate();
566  $suggestion = Validation::suggestUsername(
567  $request->getUserVar('firstName'),
568  $request->getUserVar('lastName')
569  );
570  echo $suggestion;
571  }
572 
578  function enrollSearch($args, $request) {
579  $articleId = isset($args[0]) ? (int) $args[0] : 0;
580  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
581  AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER); // manager.people.enrollment, manager.people.enroll
583 
584  $roleDao =& DAORegistry::getDAO('RoleDAO');
585  $roleId = $roleDao->getRoleIdFromPath('reviewer');
586 
587  $user =& $request->getUser();
588 
589  $rangeInfo = $this->getRangeInfo('users');
590  $templateMgr =& TemplateManager::getManager();
591  $this->setupTemplate(true);
592 
593  $searchType = null;
594  $searchMatch = null;
595  $search = $searchQuery = $request->getUserVar('search');
596  $searchInitial = $request->getUserVar('searchInitial');
597  if (!empty($search)) {
598  $searchType = $request->getUserVar('searchField');
599  $searchMatch = $request->getUserVar('searchMatch');
600 
601  } elseif (!empty($searchInitial)) {
602  $searchInitial = String::strtoupper($searchInitial);
603  $searchType = USER_FIELD_INITIAL;
604  $search = $searchInitial;
605  }
606 
607  $userDao =& DAORegistry::getDAO('UserDAO');
608  $users =& $userDao->getUsersByField($searchType, $searchMatch, $search, false, $rangeInfo);
609 
610  $templateMgr->assign('searchField', $searchType);
611  $templateMgr->assign('searchMatch', $searchMatch);
612  $templateMgr->assign('search', $searchQuery);
613  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
614 
615  $templateMgr->assign('articleId', $articleId);
616  $templateMgr->assign('fieldOptions', Array(
617  USER_FIELD_INTERESTS => 'user.interests',
618  USER_FIELD_FIRSTNAME => 'user.firstName',
619  USER_FIELD_LASTNAME => 'user.lastName',
620  USER_FIELD_USERNAME => 'user.username',
621  USER_FIELD_EMAIL => 'user.email'
622  ));
623  $templateMgr->assign('roleId', $roleId);
624  $templateMgr->assign_by_ref('users', $users);
625  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
626 
627  $templateMgr->assign('helpTopicId', 'journal.roles.index');
628  $templateMgr->display('sectionEditor/searchUsers.tpl');
629  }
630 
636  function enroll($args, &$request) {
637  $articleId = isset($args[0]) ? (int) $args[0] : 0;
638  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
639  $journal =& $request->getJournal();
641 
642  $roleDao =& DAORegistry::getDAO('RoleDAO');
643  $roleId = $roleDao->getRoleIdFromPath('reviewer');
644 
645  $users = $request->getUserVar('users');
646  if (!is_array($users) && $request->getUserVar('userId') != null) $users = array($request->getUserVar('userId'));
647 
648  // Enroll reviewer
649  for ($i=0; $i<count($users); $i++) {
650  if (!$roleDao->userHasRole($journal->getId(), $users[$i], $roleId)) {
651  $role = new Role();
652  $role->setJournalId($journal->getId());
653  $role->setUserId($users[$i]);
654  $role->setRoleId($roleId);
655 
656  $roleDao->insertRole($role);
657  }
658  }
659  $request->redirect(null, null, 'selectReviewer', $articleId);
660  }
661 
667  function notifyReviewer($args, $request) {
668  $articleId = (int) $request->getUserVar('articleId');
669  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
671 
672  $reviewId = (int) $request->getUserVar('reviewId');
673 
674  $send = $request->getUserVar('send')?true:false;
675  $this->setupTemplate(true, $articleId, 'review');
676 
677  if (SectionEditorAction::notifyReviewer($submission, $reviewId, $send, $request)) {
678  $request->redirect(null, null, 'submissionReview', $articleId);
679  }
680  }
681 
687  function clearReview($args, $request) {
688  $articleId = (int) array_shift($args);
689  $reviewId = (int) array_shift($args);
690  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
692 
693  SectionEditorAction::clearReview($submission, $reviewId, $request);
694 
695  $request->redirect(null, null, 'submissionReview', $articleId);
696  }
697 
703  function cancelReview($args, $request) {
704  $articleId = (int) $request->getUserVar('articleId');
705  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
707 
708  $reviewId = (int) $request->getUserVar('reviewId');
709 
710  $send = $request->getUserVar('send')?true:false;
711  $this->setupTemplate(true, $articleId, 'review');
712 
713  if (SectionEditorAction::cancelReview($submission, $reviewId, $send, $request)) {
714  $request->redirect(null, null, 'submissionReview', $articleId);
715  }
716  }
717 
723  function remindReviewer($args, $request) {
724  $articleId = (int) $request->getUserVar('articleId');
725  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
727 
728  $reviewId = (int) $request->getUserVar('reviewId');
729  $this->setupTemplate(true, $articleId, 'review');
730 
731  if (SectionEditorAction::remindReviewer($submission, $reviewId, $request->getUserVar('send'), $request)) {
732  $request->redirect(null, null, 'submissionReview', $articleId);
733  }
734  }
735 
736  /*
737  * Reassign a reviewer to the current round of review
738  * @param $args array
739  * @param $request object
740  */
741  function reassignReviewer($args, $request) {
742  $articleId = isset($args[0]) ? (int) $args[0] : 0;
743  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
744  $userId = isset($args[1]) ? (int) $args[1] : 0;
745 
746  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
747  $submission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
748  $round = $submission->getCurrentRound();
749 
750  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
751  $reviewAssignment =& $reviewAssignmentDao->getReviewAssignment($articleId, $userId, $submission->getCurrentRound()); /* @var $reviewAssignment ReviewAssignment */
752  if($reviewAssignment && !$reviewAssignment->getDateCompleted() && $reviewAssignment->getDeclined()) {
753  $reviewAssignment->setDeclined(false);
754  $reviewAssignment->setDateAssigned(Core::getCurrentDate());
755  $reviewAssignment->setDateNotified(null);
756  $reviewAssignment->setDateConfirmed(null);
757  $reviewAssignment->setRound($submission->getCurrentRound());
758 
759  $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
760  }
761  $request->redirect(null, null, 'submissionReview', $articleId);
762  }
763 
769  function thankReviewer($args, &$request) {
770  $articleId = (int) $request->getUserVar('articleId');
771  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
773 
774  $reviewId = (int) $request->getUserVar('reviewId');
775 
776  $send = $request->getUserVar('send')?true:false;
777  $this->setupTemplate(true, $articleId, 'review');
778 
779  if (SectionEditorAction::thankReviewer($submission, $reviewId, $send, $request)) {
780  $request->redirect(null, null, 'submissionReview', $articleId);
781  }
782  }
783 
789  function rateReviewer($args, &$request) {
790  $articleId = (int) $request->getUserVar('articleId');
791  $reviewId = (int) $request->getUserVar('reviewId');
792  $quality = (int) $request->getUserVar('quality');
793 
794  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
795  $this->setupTemplate(true, $articleId, 'review');
796 
797  SectionEditorAction::rateReviewer($articleId, $reviewId, $quality, $request);
798 
799  $request->redirect(null, null, 'submissionReview', $articleId);
800  }
801 
807  function confirmReviewForReviewer($args, &$request) {
808  $articleId = (int) array_shift($args);
809  $reviewId = (int) array_shift($args);
810 
811  $accept = $request->getUserVar('accept')?true:false;
812  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
814 
815  SectionEditorAction::confirmReviewForReviewer($reviewId, $accept, $request);
816  $request->redirect(null, null, 'submissionReview', $articleId);
817  }
818 
824  function uploadReviewForReviewer($args, &$request) {
825  $articleId = (int) $request->getUserVar('articleId');
826  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
828 
829  $reviewId = (int) $request->getUserVar('reviewId');
830 
832  $request->redirect(null, null, 'submissionReview', $articleId);
833  }
834 
840  function makeReviewerFileViewable($args, &$request) {
841  $articleId = $request->getUserVar('articleId');
842  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
844 
845  $reviewId = $request->getUserVar('reviewId');
846  $fileId = $request->getUserVar('fileId');
847  $revision = $request->getUserVar('revision');
848  $viewable = $request->getUserVar('viewable');
849 
850  SectionEditorAction::makeReviewerFileViewable($articleId, $reviewId, $fileId, $revision, $viewable);
851 
852  $request->redirect(null, null, 'submissionReview', $articleId);
853  }
854 
860  function setDueDate($args, &$request) {
861  $articleId = (int) array_shift($args);
862  $reviewId = (int) array_shift($args);
863 
864  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
866 
867  $dueDate = $request->getUserVar('dueDate');
868  $numWeeks = $request->getUserVar('numWeeks');
869 
870  if ($dueDate != null || $numWeeks != null) {
871  SectionEditorAction::setDueDate($articleId, $reviewId, $dueDate, $numWeeks, false, $request);
872  $request->redirect(null, null, 'submissionReview', $articleId);
873  } else {
874  $this->setupTemplate(true, $articleId, 'review');
875  $journal =& $request->getJournal();
876 
877  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
878  $reviewAssignment = $reviewAssignmentDao->getById($reviewId);
879 
880  $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
881  $settings =& $settingsDao->getJournalSettings($journal->getId());
882 
883  $templateMgr =& TemplateManager::getManager();
884 
885  if ($reviewAssignment->getDateDue() != null) {
886  $templateMgr->assign('dueDate', $reviewAssignment->getDateDue());
887  }
888 
889  $numWeeksPerReview = $settings['numWeeksPerReview'] == null ? 0 : $settings['numWeeksPerReview'];
890 
891  $templateMgr->assign('articleId', $articleId);
892  $templateMgr->assign('reviewId', $reviewId);
893  $templateMgr->assign('todaysDate', date('Y-m-d'));
894  $templateMgr->assign('numWeeksPerReview', $numWeeksPerReview);
895  $templateMgr->assign('actionHandler', 'setDueDate');
896 
897  $templateMgr->display('sectionEditor/setDueDate.tpl');
898  }
899  }
900 
906  function enterReviewerRecommendation($args, &$request) {
907  $articleId = $request->getUserVar('articleId');
908  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
910 
911  $reviewId = $request->getUserVar('reviewId');
912 
913  $recommendation = $request->getUserVar('recommendation');
914 
915  if ($recommendation != null) {
916  SectionEditorAction::setReviewerRecommendation($this->submission, $reviewId, $recommendation, SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT, $request);
917  $request->redirect(null, null, 'submissionReview', $articleId);
918  } else {
919  $this->setupTemplate(true, $articleId, 'review');
920 
921  $templateMgr =& TemplateManager::getManager();
922 
923  $templateMgr->assign('articleId', $articleId);
924  $templateMgr->assign('reviewId', $reviewId);
925 
926  import('classes.submission.reviewAssignment.ReviewAssignment');
927  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
928 
929  $templateMgr->display('sectionEditor/reviewerRecommendation.tpl');
930  }
931  }
932 
938  function userProfile($args, &$request) {
939  parent::validate();
940  $this->setupTemplate(true);
941 
942  $templateMgr =& TemplateManager::getManager();
943  $templateMgr->assign('currentUrl', $request->url(null, $request->getRequestedPage()));
944 
945  $userDao =& DAORegistry::getDAO('UserDAO');
946  $userId = isset($args[0]) ? $args[0] : 0;
947  if (is_numeric($userId)) {
948  $userId = (int) $userId;
949  $user = $userDao->getUser($userId);
950  } else {
951  $user = $userDao->getByUsername($userId);
952  }
953 
954 
955  if ($user == null) {
956  // Non-existent user requested
957  $templateMgr->assign('pageTitle', 'manager.people');
958  $templateMgr->assign('errorMsg', 'manager.people.invalidUser');
959  $templateMgr->display('common/error.tpl');
960 
961  } else {
962  $site =& $request->getSite();
963  $journal =& $request->getJournal();
964 
965  $countryDao =& DAORegistry::getDAO('CountryDAO');
966  $country = null;
967  if ($user->getCountry() != '') {
968  $country = $countryDao->getCountry($user->getCountry());
969  }
970  $templateMgr->assign('country', $country);
971 
972  $templateMgr->assign('userInterests', $user->getInterestString());
973 
974  $templateMgr->assign_by_ref('user', $user);
975  $templateMgr->assign('localeNames', AppLocale::getAllLocales());
976  $templateMgr->assign('helpTopicId', 'journal.roles.index');
977  $templateMgr->display('sectionEditor/userProfile.tpl');
978  }
979  }
980 
986  function viewMetadata($args, &$request) {
987  $articleId = (int) array_shift($args);
988  $journal =& $request->getJournal();
989 
990  $this->validate($articleId);
991  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_AUTHOR);
993  $this->setupTemplate(true, $articleId, 'summary');
994 
996  }
997 
1003  function saveMetadata($args, &$request) {
1004  $articleId = $request->getUserVar('articleId');
1005  $this->validate($articleId);
1006  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_AUTHOR);
1008  $this->setupTemplate(true, $articleId, 'summary');
1009 
1011  $request->redirect(null, null, 'submission', $articleId);
1012  }
1013  }
1014 
1020  function removeArticleCoverPage($args, &$request) {
1021  $articleId = isset($args[0]) ? (int)$args[0] : 0;
1022  $this->validate($articleId);
1023 
1024  $formLocale = $args[1];
1025  if (!AppLocale::isLocaleValid($formLocale)) {
1026  $request->redirect(null, null, 'viewMetadata', $articleId);
1027  }
1028 
1031  $request->redirect(null, null, 'viewMetadata', $articleId);
1032  }
1033  }
1034 
1035  //
1036  // Review Form
1037  //
1038 
1044  function previewReviewForm($args, &$request) {
1045  parent::validate();
1046  $this->setupTemplate(true);
1047 
1048  $reviewId = (int) array_shift($args);
1049  $reviewFormId = (int) array_shift($args);
1050 
1051  $journal =& $request->getJournal();
1052  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
1053  $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_JOURNAL, $journal->getId());
1054  $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
1055  $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
1056  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
1057  $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
1058 
1059  $templateMgr =& TemplateManager::getManager();
1060  $templateMgr->assign('pageTitle', 'manager.reviewForms.preview');
1061  $templateMgr->assign_by_ref('reviewForm', $reviewForm);
1062  $templateMgr->assign('reviewFormElements', $reviewFormElements);
1063  $templateMgr->assign('reviewId', $reviewId);
1064  $templateMgr->assign('articleId', $reviewAssignment->getSubmissionId());
1065  //$templateMgr->assign('helpTopicId','journal.managementPages.reviewForms');
1066  $templateMgr->display('sectionEditor/previewReviewForm.tpl');
1067  }
1068 
1074  function clearReviewForm($args, &$request) {
1075  $articleId = isset($args[0]) ? (int) $args[0] : 0;
1076  $reviewId = isset($args[1]) ? (int) $args[1] : null;
1077  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1079 
1081 
1082  $request->redirect(null, null, 'submissionReview', $articleId);
1083  }
1084 
1090  function selectReviewForm($args, &$request) {
1091  $articleId = isset($args[0]) ? (int) $args[0] : 0;
1092  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1094 
1095  $reviewId = isset($args[1]) ? (int) $args[1] : null;
1096  $reviewFormId = isset($args[2]) ? (int) $args[2] : null;
1097 
1098  if ($reviewFormId != null) {
1099  SectionEditorAction::addReviewForm($submission, $reviewId, $reviewFormId);
1100  $request->redirect(null, null, 'submissionReview', $articleId);
1101  } else {
1102  $journal =& $request->getJournal();
1103  $rangeInfo =& $this->getRangeInfo('reviewForms');
1104  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
1105  $reviewForms =& $reviewFormDao->getActiveByAssocId(ASSOC_TYPE_JOURNAL, $journal->getId(), $rangeInfo);
1106  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
1107  $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
1108 
1109  $this->setupTemplate(true, $articleId, 'review');
1110  $templateMgr =& TemplateManager::getManager();
1111 
1112  $templateMgr->assign('articleId', $articleId);
1113  $templateMgr->assign('reviewId', $reviewId);
1114  $templateMgr->assign('assignedReviewFormId', $reviewAssignment->getReviewFormId());
1115  $templateMgr->assign_by_ref('reviewForms', $reviewForms);
1116  //$templateMgr->assign('helpTopicId','journal.managementPages.reviewForms');
1117  $templateMgr->display('sectionEditor/selectReviewForm.tpl');
1118  }
1119  }
1120 
1126  function viewReviewFormResponse($args, &$request) {
1127  $articleId = (int) array_shift($args);
1128  $reviewId = (int) array_shift($args);
1129 
1130  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1131  $this->setupTemplate(true, $articleId, 'editing');
1132 
1134  }
1135 
1136  //
1137  // Editor Review
1138  //
1139 
1145  function editorReview($args, $request) {
1146  $articleId = $request->getUserVar('articleId');
1147  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1149 
1150  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
1151 
1152  $redirectTarget = 'submissionReview';
1153 
1154  // If the Upload button was pressed.
1155  $submit = $request->getUserVar('submit');
1156  if ($submit != null) {
1158  }
1159 
1160  if ($request->getUserVar('setCopyeditFile')) {
1161  // If the Send To Copyedit button was pressed
1162  $file = explode(',', $request->getUserVar('editorDecisionFile'));
1163  if (isset($file[0]) && isset($file[1])) {
1164  $round = $submission->getCurrentRound();
1165  if ($submission->getMostRecentEditorDecisionComment()) {
1166  // The conditions are met for being able
1167  // to send a file to copyediting.
1168  SectionEditorAction::setCopyeditFile($submission, $file[0], $file[1], $request);
1169  }
1170  $redirectTarget = 'submissionEditing';
1171  }
1172 
1173  } else if ($request->getUserVar('resubmit')) {
1174  // If the Resubmit button was pressed
1175  $file = explode(',', $request->getUserVar('editorDecisionFile'));
1176  if (isset($file[0]) && isset($file[1])) {
1177  SectionEditorAction::resubmitFile($submission, $file[0], $file[1], $request);
1178  }
1179  }
1180 
1181  $request->redirect(null, null, $redirectTarget, $articleId);
1182  }
1183 
1184  //
1185  // Copyedit
1186  //
1187 
1193  function selectCopyeditor($args, $request) {
1194  $articleId = (int) array_shift($args);
1195  $userId = (int) array_shift($args);
1196 
1197  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1198  $journal =& $request->getJournal();
1200 
1201  $roleDao =& DAORegistry::getDAO('RoleDAO');
1202 
1203  if ($roleDao->userHasRole($journal->getId(), $userId, ROLE_ID_COPYEDITOR)) {
1205  $request->redirect(null, null, 'submissionEditing', $articleId);
1206  } else {
1207  $this->setupTemplate(true, $articleId, 'editing');
1208 
1209  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
1210 
1211  $searchType = null;
1212  $searchMatch = null;
1213  $search = $searchQuery = $request->getUserVar('search');
1214  $searchInitial = $request->getUserVar('searchInitial');
1215  if (!empty($search)) {
1216  $searchType = $request->getUserVar('searchField');
1217  $searchMatch = $request->getUserVar('searchMatch');
1218 
1219  } elseif (!empty($searchInitial)) {
1220  $searchInitial = String::strtoupper($searchInitial);
1221  $searchType = USER_FIELD_INITIAL;
1222  $search = $searchInitial;
1223  }
1224 
1225  $copyeditors = $roleDao->getUsersByRoleId(ROLE_ID_COPYEDITOR, $journal->getId(), $searchType, $search, $searchMatch);
1226  $copyeditorStatistics = $sectionEditorSubmissionDao->getCopyeditorStatistics($journal->getId());
1227 
1228  $templateMgr =& TemplateManager::getManager();
1229 
1230  $templateMgr->assign('searchField', $searchType);
1231  $templateMgr->assign('searchMatch', $searchMatch);
1232  $templateMgr->assign('search', $searchQuery);
1233  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
1234 
1235  $templateMgr->assign_by_ref('users', $copyeditors);
1236  $templateMgr->assign('currentUser', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
1237  $templateMgr->assign_by_ref('statistics', $copyeditorStatistics);
1238  $templateMgr->assign('pageSubTitle', 'editor.article.selectCopyeditor');
1239  $templateMgr->assign('pageTitle', 'user.role.copyeditors');
1240  $templateMgr->assign('actionHandler', 'selectCopyeditor');
1241  $templateMgr->assign('fieldOptions', array(
1242  USER_FIELD_FIRSTNAME => 'user.firstName',
1243  USER_FIELD_LASTNAME => 'user.lastName',
1244  USER_FIELD_USERNAME => 'user.username',
1245  USER_FIELD_EMAIL => 'user.email'
1246  ));
1247  $templateMgr->assign('articleId', $articleId);
1248 
1249  $templateMgr->assign('helpTopicId', 'journal.roles.copyeditor');
1250  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
1251  $templateMgr->display('sectionEditor/selectUser.tpl');
1252  }
1253  }
1254 
1260  function notifyCopyeditor($args, $request) {
1261  $articleId = (int) $request->getUserVar('articleId');
1262  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1264 
1265  $send = $request->getUserVar('send')?true:false;
1266  $this->setupTemplate(true, $articleId, 'editing');
1267 
1268  if (SectionEditorAction::notifyCopyeditor($submission, $send, $request)) {
1269  $request->redirect(null, null, 'submissionEditing', $articleId);
1270  }
1271  }
1272 
1278  function initiateCopyedit($args, $request) {
1279  $articleId = (int) $request->getUserVar('articleId');
1280  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1281 
1283  $request->redirect(null, null, 'submissionEditing', $articleId);
1284  }
1285 
1291  function thankCopyeditor($args, $request) {
1292  $articleId = (int) $request->getUserVar('articleId');
1293  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1294  $send = $request->getUserVar('send')?true:false;
1295  $this->setupTemplate(true, $articleId, 'editing');
1296 
1297  if (SectionEditorAction::thankCopyeditor($this->submission, $send, $request)) {
1298  $request->redirect(null, null, 'submissionEditing', $articleId);
1299  }
1300  }
1301 
1307  function notifyAuthorCopyedit($args, $request) {
1308  $articleId = (int) $request->getUserVar('articleId');
1309  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1310  $send = $request->getUserVar('send')?true:false;
1311  $this->setupTemplate(true, $articleId, 'editing');
1312 
1313  if (SectionEditorAction::notifyAuthorCopyedit($this->submission, $send, $request)) {
1314  $request->redirect(null, null, 'submissionEditing', $articleId);
1315  }
1316  }
1317 
1323  function thankAuthorCopyedit($args, $request) {
1324  $articleId = (int) $request->getUserVar('articleId');
1325  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1326  $send = $request->getUserVar('send')?true:false;
1327  $this->setupTemplate(true, $articleId, 'editing');
1328 
1329  if (SectionEditorAction::thankAuthorCopyedit($this->submission, $send, $request)) {
1330  $request->redirect(null, null, 'submissionEditing', $articleId);
1331  }
1332  }
1333 
1339  function notifyFinalCopyedit($args, $request) {
1340  $articleId = (int) $request->getUserVar('articleId');
1341  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1342  $send = $request->getUserVar('send')?true:false;
1343  $this->setupTemplate(true, $articleId, 'editing');
1344 
1345  if (SectionEditorAction::notifyFinalCopyedit($this->submission, $send, $request)) {
1346  $request->redirect(null, null, 'submissionEditing', $articleId);
1347  }
1348  }
1349 
1355  function completeCopyedit($args, $request) {
1356  $articleId = (int) $request->getUserVar('articleId');
1357  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1359  $request->redirect(null, null, 'submissionEditing', $articleId);
1360  }
1361 
1367  function completeFinalCopyedit($args, $request) {
1368  $articleId = (int) $request->getUserVar('articleId');
1369  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1371  $request->redirect(null, null, 'submissionEditing', $articleId);
1372  }
1373 
1379  function thankFinalCopyedit($args, $request) {
1380  $articleId = $request->getUserVar('articleId');
1381  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1382  $send = $request->getUserVar('send')?true:false;
1383  $this->setupTemplate(true, $articleId, 'editing');
1384 
1385  if (SectionEditorAction::thankFinalCopyedit($this->submission, $send, $request)) {
1386  $request->redirect(null, null, 'submissionEditing', $articleId);
1387  }
1388  }
1389 
1395  function uploadReviewVersion($args, $request) {
1396  $articleId = $request->getUserVar('articleId');
1397  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1399  $request->redirect(null, null, 'submissionReview', $articleId);
1400  }
1401 
1407  function uploadCopyeditVersion($args, $request) {
1408  $articleId = $request->getUserVar('articleId');
1409  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1410  $copyeditStage = $request->getUserVar('copyeditStage');
1412 
1413  $request->redirect(null, null, 'submissionEditing', $articleId);
1414  }
1415 
1421  function addSuppFile($args, $request) {
1422  $articleId = (int) array_shift($args);
1423  $journal =& $request->getJournal();
1424 
1425  $this->validate($articleId);
1427  $this->setupTemplate(true, $articleId, 'summary');
1428 
1429  import('classes.submission.form.SuppFileForm');
1430 
1431  $submitForm = new SuppFileForm($submission, $journal);
1432 
1433  if ($submitForm->isLocaleResubmit()) {
1434  $submitForm->readInputData();
1435  } else {
1436  $submitForm->initData();
1437  }
1438  $submitForm->display();
1439  }
1440 
1446  function editSuppFile($args, $request) {
1447  $articleId = (int) array_shift($args);
1448  $suppFileId = (int) array_shift($args);
1449  $journal =& $request->getJournal();
1450 
1451  $this->validate($articleId);
1453 
1454  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
1455  $suppFile =& $suppFileDao->getSuppFile($suppFileId, $articleId);
1456  if (!$suppFile) {
1457  $request->redirect(null, null, 'submissionEditing', $articleId);
1458  }
1459 
1460  $this->setupTemplate(true, $articleId, 'summary');
1461 
1462  import('classes.submission.form.SuppFileForm');
1463  $submitForm = new SuppFileForm($submission, $journal, $suppFileId);
1464  if ($submitForm->isLocaleResubmit()) {
1465  $submitForm->readInputData();
1466  } else {
1467  $submitForm->initData();
1468  }
1469  $submitForm->display();
1470  }
1471 
1477  function setSuppFileVisibility($args, $request) {
1478  $articleId = (int) $request->getUserVar('articleId');
1479  $this->validate($articleId);
1481 
1482  $suppFileId = (int) $request->getUserVar('fileId');
1483  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
1484  $suppFile = $suppFileDao->getSuppFile($suppFileId, $articleId);
1485 
1486  if (isset($suppFile) && $suppFile != null) {
1487  $suppFile->setShowReviewers($request->getUserVar('show')==1?1:0);
1488  $suppFileDao->updateSuppFile($suppFile);
1489  }
1490  $request->redirect(null, null, 'submissionReview', $articleId);
1491  }
1492 
1498  function saveSuppFile($args, $request) {
1499  $articleId = $request->getUserVar('articleId');
1500  $this->validate($articleId);
1501  $this->setupTemplate(true, $articleId, 'summary');
1503 
1504  $suppFileId = (int) array_shift($args);
1505  $journal =& $request->getJournal();
1506 
1507  import('classes.submission.form.SuppFileForm');
1508 
1509  $submitForm = new SuppFileForm($submission, $journal, $suppFileId);
1510  $submitForm->readInputData();
1511 
1512  if ($submitForm->validate()) {
1513  $submitForm->execute();
1514 
1515  // Send a notification to associated users
1516  import('classes.notification.NotificationManager');
1517  $notificationManager = new NotificationManager();
1518  $articleDao =& DAORegistry::getDAO('ArticleDAO');
1519  $article =& $articleDao->getArticle($articleId);
1520  $notificationUsers = $article->getAssociatedUserIds(true, false);
1521  foreach ($notificationUsers as $userRole) {
1522  $notificationManager->createNotification(
1523  $request, $userRole['id'], NOTIFICATION_TYPE_SUPP_FILE_MODIFIED,
1524  $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()
1525  );
1526  }
1527 
1528  $request->redirect(null, null, $this->_getFrom(), $articleId);
1529  } else {
1530  $submitForm->display();
1531  }
1532  }
1533 
1539  function deleteArticleFile($args, &$request) {
1540  $articleId = (int) array_shift($args);
1541  $fileId = (int) array_shift($args);
1542  $revisionId = (int) array_shift($args);
1543 
1544  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1545  SectionEditorAction::deleteArticleFile($this->submission, $fileId, $revisionId);
1546 
1547  $request->redirect(null, null, 'submissionReview', $articleId);
1548  }
1549 
1555  function deleteSuppFile($args, $request) {
1556  $articleId = (int) array_shift($args);
1557  $suppFileId = (int) array_shift($args);
1558  $this->validate($articleId);
1559  SectionEditorAction::deleteSuppFile($this->submission, $suppFileId);
1560  $request->redirect(null, null, $this->_getFrom(), $articleId);
1561  }
1562 
1568  function archiveSubmission($args, $request) {
1569  $articleId = (int) array_shift($args);
1570  $this->validate($articleId);
1572  $request->redirect(null, null, 'submission', $articleId);
1573  }
1574 
1580  function restoreToQueue($args, $request) {
1581  $articleId = (int) array_shift($args);
1582  $this->validate($articleId);
1584  $request->redirect(null, null, 'submissionEditing', $articleId);
1585  }
1586 
1592  function unsuitableSubmission($args, $request) {
1593  $articleId = $request->getUserVar('articleId');
1594  $this->validate($articleId);
1595  $send = $request->getUserVar('send')?true:false;
1596  $this->setupTemplate(true, $articleId, 'summary');
1597 
1598  if (SectionEditorAction::unsuitableSubmission($this->submission, $send, $request)) {
1599  $request->redirect(null, null, 'submission', $articleId);
1600  }
1601  }
1602 
1607  function updateSection($args, &$request) {
1608  $articleId = (int) array_shift($args);
1609  $this->validate($articleId);
1610  SectionEditorAction::updateSection($this->submission, $request->getUserVar('section'));
1611  $request->redirect(null, null, 'submission', $articleId);
1612  }
1613 
1619  function updateCommentsStatus($args, &$request) {
1620  $articleId = (int) array_shift($args);
1621  $this->validate($articleId);
1622  SectionEditorAction::updateCommentsStatus($this->submission, $request->getUserVar('commentsStatus'));
1623  $request->redirect(null, null, 'submission', $articleId);
1624  }
1625 
1626  //
1627  // Layout Editing
1628  //
1629 
1635  function uploadLayoutFile($args, &$request) {
1636  $layoutFileType = $request->getUserVar('layoutFileType');
1637  if ($layoutFileType == 'submission') {
1638  $this->_uploadLayoutVersion($request);
1639 
1640  } else if ($layoutFileType == 'galley') {
1641  $this->_uploadGalley('layoutFile', $request);
1642 
1643  } else if ($layoutFileType == 'supp') {
1644  $this->_uploadSuppFile('layoutFile', $request);
1645 
1646  } else {
1647  $request->redirect(null, null, $this->_getFrom(), $request->getUserVar('articleId'));
1648  }
1649  }
1650 
1655  function _uploadLayoutVersion(&$request) {
1656  $articleId = (int) $request->getUserVar('articleId');
1657  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1659  $request->redirect(null, null, 'submissionEditing', $articleId);
1660  }
1661 
1667  function deleteArticleImage($args, &$request) {
1668  $articleId = (int) array_shift($args);
1669  $galleyId = (int) array_shift($args);
1670  $fileId = (int) array_shift($args);
1671  $revision = (int) array_shift($args);
1672  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1673  SectionEditorAction::deleteArticleImage($this->submission, $fileId, $revision);
1674  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1675  }
1676 
1682  function assignLayoutEditor($args, $request) {
1683  $articleId = (int) array_shift($args);
1684  $editorId = (int) array_shift($args);
1685  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1686  $journal =& $request->getJournal();
1688 
1689  $roleDao =& DAORegistry::getDAO('RoleDAO');
1690  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
1691 
1692  if ($editorId && $roleDao->userHasRole($journal->getId(), $editorId, ROLE_ID_LAYOUT_EDITOR)) {
1694  $request->redirect(null, null, 'submissionEditing', $articleId);
1695  } else {
1696  $searchType = null;
1697  $searchMatch = null;
1698  $search = $searchQuery = $request->getUserVar('search');
1699  $searchInitial = $request->getUserVar('searchInitial');
1700  if (!empty($search)) {
1701  $searchType = $request->getUserVar('searchField');
1702  $searchMatch = $request->getUserVar('searchMatch');
1703 
1704  } elseif (!empty($searchInitial)) {
1705  $searchInitial = String::strtoupper($searchInitial);
1706  $searchType = USER_FIELD_INITIAL;
1707  $search = $searchInitial;
1708  }
1709 
1710  $layoutEditors = $roleDao->getUsersByRoleId(ROLE_ID_LAYOUT_EDITOR, $journal->getId(), $searchType, $search, $searchMatch);
1711 
1712  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
1713  $layoutEditorStatistics = $sectionEditorSubmissionDao->getLayoutEditorStatistics($journal->getId());
1714 
1715  $this->setupTemplate(true, $articleId, 'editing');
1716 
1717  $templateMgr =& TemplateManager::getManager();
1718 
1719  $templateMgr->assign('searchField', $searchType);
1720  $templateMgr->assign('searchMatch', $searchMatch);
1721  $templateMgr->assign('search', $searchQuery);
1722  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
1723  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
1724 
1725  $templateMgr->assign('pageTitle', 'user.role.layoutEditors');
1726  $templateMgr->assign('pageSubTitle', 'editor.article.selectLayoutEditor');
1727  $templateMgr->assign('actionHandler', 'assignLayoutEditor');
1728  $templateMgr->assign('articleId', $articleId);
1729  $templateMgr->assign_by_ref('users', $layoutEditors);
1730 
1731  $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
1732  if ($layoutSignoff) {
1733  $templateMgr->assign('currentUser', $layoutSignoff->getUserId());
1734  }
1735 
1736  $templateMgr->assign('fieldOptions', Array(
1737  USER_FIELD_FIRSTNAME => 'user.firstName',
1738  USER_FIELD_LASTNAME => 'user.lastName',
1739  USER_FIELD_USERNAME => 'user.username',
1740  USER_FIELD_EMAIL => 'user.email'
1741  ));
1742  $templateMgr->assign('statistics', $layoutEditorStatistics);
1743  $templateMgr->assign('helpTopicId', 'journal.roles.layoutEditor');
1744  $templateMgr->display('sectionEditor/selectUser.tpl');
1745  }
1746  }
1747 
1753  function notifyLayoutEditor($args, $request) {
1754  $articleId = (int) $request->getUserVar('articleId');
1755  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1756  $send = $request->getUserVar('send')?true:false;
1757  $this->setupTemplate(true, $articleId, 'editing');
1758  if (SectionEditorAction::notifyLayoutEditor($this->submission, $send, $request)) {
1759  $request->redirect(null, null, 'submissionEditing', $articleId);
1760  }
1761  }
1762 
1768  function thankLayoutEditor($args, $request) {
1769  $articleId = $request->getUserVar('articleId');
1770  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1772 
1773  $send = $request->getUserVar('send')?true:false;
1774  $this->setupTemplate(true, $articleId, 'editing');
1775 
1776  if (SectionEditorAction::thankLayoutEditor($submission, $send, $request)) {
1777  $request->redirect(null, null, 'submissionEditing', $articleId);
1778  }
1779  }
1780 
1786  function _uploadGalley($fileName = null, $request) {
1787  $articleId = $request->getUserVar('articleId');
1788  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1789 
1790  import('classes.submission.form.ArticleGalleyForm');
1791  $galleyForm = new ArticleGalleyForm($articleId);
1792  $galleyId = $galleyForm->execute($fileName, $request->getUserVar('createRemote'));
1793 
1794  Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
1795  }
1796 
1802  function editGalley($args, $request) {
1803  $articleId = (int) array_shift($args);
1804  $galleyId = (int) array_shift($args);
1805  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1806 
1807  $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
1808  $galley =& $galleyDao->getGalley($galleyId, $articleId);
1809  if (!$galley) {
1810  $request->redirect(null, null, 'submissionEditing', $articleId);
1811  }
1812 
1813  $this->setupTemplate(true, $articleId, 'editing');
1814 
1815  import('classes.submission.form.ArticleGalleyForm');
1816  $submitForm = new ArticleGalleyForm($articleId, $galleyId);
1817  if ($submitForm->isLocaleResubmit()) {
1818  $submitForm->readInputData();
1819  } else {
1820  $submitForm->initData();
1821  }
1822  $submitForm->display();
1823  }
1824 
1830  function saveGalley($args, $request) {
1831  $articleId = (int) array_shift($args);
1832  $galleyId = (int) array_shift($args);
1833  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1834  $this->setupTemplate(true, $articleId, 'editing');
1836 
1837  import('classes.submission.form.ArticleGalleyForm');
1838 
1839  $submitForm = new ArticleGalleyForm($articleId, $galleyId);
1840 
1841  $submitForm->readInputData();
1842  if ($submitForm->validate()) {
1843  $submitForm->execute();
1844 
1845  // Send a notification to associated users
1846  import('classes.notification.NotificationManager');
1847  $notificationManager = new NotificationManager();
1848  $articleDao =& DAORegistry::getDAO('ArticleDAO');
1849  $article =& $articleDao->getArticle($articleId);
1850  $notificationUsers = $article->getAssociatedUserIds(true, false);
1851  foreach ($notificationUsers as $userRole) {
1852  $notificationManager->createNotification(
1853  $request, $userRole['id'], NOTIFICATION_TYPE_GALLEY_MODIFIED,
1854  $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()
1855  );
1856  }
1857 
1858  if ($request->getUserVar('uploadImage')) {
1859  $submitForm->uploadImage();
1860  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1861  } else if(($deleteImage = $request->getUserVar('deleteImage')) && count($deleteImage) == 1) {
1862  list($imageId) = array_keys($deleteImage);
1863  $submitForm->deleteImage($imageId);
1864  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1865  }
1866  $request->redirect(null, null, 'submissionEditing', $articleId);
1867  } else {
1868  $submitForm->display();
1869  }
1870  }
1871 
1877  function orderGalley($args, &$request) {
1878  $articleId = (int) $request->getUserVar('articleId');
1879  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1880  SectionEditorAction::orderGalley($this->submission, $request->getUserVar('galleyId'), $request->getUserVar('d'));
1881  $request->redirect(null, null, 'submissionEditing', $articleId);
1882  }
1883 
1889  function deleteGalley($args, &$request) {
1890  $articleId = (int) array_shift($args);
1891  $galleyId = (int) array_shift($args);
1892  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1893  SectionEditorAction::deleteGalley($this->submission, $galleyId);
1894  $request->redirect(null, null, 'submissionEditing', $articleId);
1895  }
1896 
1902  function proofGalley($args, &$request) {
1903  $articleId = (int) array_shift($args);
1904  $galleyId = (int) array_shift($args);
1905  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1906  $this->setupTemplate();
1907 
1908  $templateMgr =& TemplateManager::getManager();
1909  $templateMgr->assign('articleId', $articleId);
1910  $templateMgr->assign('galleyId', $galleyId);
1911  $templateMgr->display('submission/layout/proofGalley.tpl');
1912  }
1913 
1919  function proofGalleyTop($args, &$request) {
1920  $articleId = (int) array_shift($args);
1921  $galleyId = (int) array_shift($args);
1922  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1923  $this->setupTemplate();
1924 
1925  $templateMgr =& TemplateManager::getManager();
1926  $templateMgr->assign('articleId', $articleId);
1927  $templateMgr->assign('galleyId', $galleyId);
1928  $templateMgr->assign('backHandler', 'submissionEditing');
1929  $templateMgr->display('submission/layout/proofGalleyTop.tpl');
1930  }
1931 
1937  function proofGalleyFile($args, &$request) {
1938  $articleId = (int) array_shift($args);
1939  $galleyId = (int) array_shift($args);
1940  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1941 
1942  $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
1943  $galley =& $galleyDao->getGalley($galleyId, $articleId);
1944 
1945  import('classes.file.ArticleFileManager'); // FIXME
1946 
1947  if (isset($galley)) {
1948  if ($galley->isHTMLGalley()) {
1949  $templateMgr =& TemplateManager::getManager();
1950  $templateMgr->assign_by_ref('galley', $galley);
1951  if ($galley->isHTMLGalley() && $styleFile =& $galley->getStyleFile()) {
1952  $templateMgr->addStyleSheet(Request::url(null, 'article', 'viewFile', array(
1953  $articleId, $galleyId, $styleFile->getFileId()
1954  )));
1955  }
1956  $templateMgr->display('submission/layout/proofGalleyHTML.tpl');
1957 
1958  } else {
1959  // View non-HTML file inline
1960  $this->viewFile(array($articleId, $galley->getFileId()), $request);
1961  }
1962  }
1963  }
1964 
1970  function _uploadSuppFile($fileName = null, $request) {
1971  $articleId = $request->getUserVar('articleId');
1972  $this->validate($articleId);
1974  $journal =& $request->getJournal();
1975 
1976  import('classes.submission.form.SuppFileForm');
1977 
1978  $suppFileForm = new SuppFileForm($submission, $journal);
1979  $suppFileForm->setData('title', array($submission->getLocale() => __('common.untitled')));
1980  $suppFileId = $suppFileForm->execute($fileName, $request->getUserVar('createRemote'));
1981 
1982  $request->redirect(null, null, 'editSuppFile', array($articleId, $suppFileId));
1983  }
1984 
1990  function orderSuppFile($args, &$request) {
1991  $articleId = $request->getUserVar('articleId');
1992  $this->validate($articleId);
1993  SectionEditorAction::orderSuppFile($this->submission, $request->getUserVar('suppFileId'), $request->getUserVar('d'));
1994  $request->redirect(null, null, 'submissionEditing', $articleId);
1995  }
1996 
1997 
1998  //
1999  // Submission History (FIXME Move to separate file?)
2000  //
2001 
2007  function submissionEventLog($args, &$request) {
2008  $articleId = (int) array_shift($args);
2009  $logId = (int) array_shift($args);
2010  $this->validate($articleId);
2012  $this->setupTemplate(true, $articleId, 'history');
2013 
2014  $templateMgr =& TemplateManager::getManager();
2015 
2016  $templateMgr->assign('isEditor', Validation::isEditor());
2017  $templateMgr->assign_by_ref('submission', $submission);
2018 
2019  if ($logId) {
2020  $logDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2021  $logEntry =& $logDao->getById($logId, ASSOC_TYPE_ARTICLE, $articleId);
2022  }
2023 
2024  if (isset($logEntry)) {
2025  $templateMgr->assign('logEntry', $logEntry);
2026  $templateMgr->display('sectionEditor/submissionEventLogEntry.tpl');
2027 
2028  } else {
2029  $rangeInfo =& $this->getRangeInfo('eventLogEntries');
2030  $eventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2031  $eventLogEntries =& $eventLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
2032  $templateMgr->assign('eventLogEntries', $eventLogEntries);
2033  $templateMgr->display('sectionEditor/submissionEventLog.tpl');
2034  }
2035  }
2036 
2042  function clearSubmissionEventLog($args, &$request) {
2043  $articleId = (int) array_shift($args);
2044  $logId = (int) array_shift($args);
2045  $this->validate($articleId);
2046  $logDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2047  if ($logId) {
2048  $logDao->deleteObject($logId, ASSOC_TYPE_ARTICLE, $articleId);
2049  } else {
2050  $logDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2051  }
2052  $request->redirect(null, null, 'submissionEventLog', $articleId);
2053  }
2054 
2060  function submissionEmailLog($args, $request) {
2061  $articleId = (int) array_shift($args);
2062  $logId = (int) array_shift($args);
2063 
2064  $this->validate($articleId);
2066  $this->setupTemplate(true, $articleId, 'history');
2067 
2068  $templateMgr =& TemplateManager::getManager();
2069 
2070  $templateMgr->assign('isEditor', Validation::isEditor());
2071  $templateMgr->assign_by_ref('submission', $submission);
2072 
2073  $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
2074  import('classes.file.ArticleFileManager');
2075  $templateMgr->assign('attachments', $articleFileDao->getArticleFilesByAssocId($logId, ARTICLE_FILE_ATTACHMENT));
2076 
2077  if ($logId) {
2078  $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2079  $logEntry =& $logDao->getById($logId, ASSOC_TYPE_ARTICLE, $articleId);
2080  }
2081 
2082  if (isset($logEntry)) {
2083  $templateMgr->assign_by_ref('logEntry', $logEntry);
2084  $templateMgr->display('sectionEditor/submissionEmailLogEntry.tpl');
2085  } else {
2086  $rangeInfo =& $this->getRangeInfo('emailLogEntries');
2087 
2088  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2089  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
2090  $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
2091  $templateMgr->display('sectionEditor/submissionEmailLog.tpl');
2092  }
2093  }
2094 
2100  function clearSubmissionEmailLog($args, &$request) {
2101  $articleId = (int) array_shift($args);
2102  $logId = (int) array_shift($args);
2103  $this->validate($articleId);
2104 
2105  $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2106  if ($logId) {
2107  $logDao->deleteObject($logId, ASSOC_TYPE_ARTICLE, $articleId);
2108  } else {
2109  $logDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2110  }
2111  $request->redirect(null, null, 'submissionEmailLog', $articleId);
2112  }
2113 
2114  //
2115  // Submission Notes Functions
2116  //
2117 
2123  function addSubmissionNote($args, $request) {
2124  $articleId = (int) $request->getUserVar('articleId');
2125  $this->validate($articleId);
2126  SectionEditorAction::addSubmissionNote($articleId, $request);
2127  $request->redirect(null, null, 'submissionNotes', $articleId);
2128  }
2129 
2136  function removeSubmissionNote($args, $request) {
2137  $articleId = (int) $request->getUserVar('articleId');
2138  $noteId = (int) $request->getUserVar('noteId');
2139  $fileId = (int) $request->getUserVar('fileId');
2140  $this->validate($articleId);
2141  SectionEditorAction::removeSubmissionNote($articleId, $noteId, $fileId);
2142  $request->redirect(null, null, 'submissionNotes', $articleId);
2143  }
2144 
2151  function updateSubmissionNote($args, $request) {
2152  $articleId = (int) $request->getUserVar('articleId');
2153  $this->validate($articleId);
2154  SectionEditorAction::updateSubmissionNote($articleId, $request);
2155  $request->redirect(null, null, 'submissionNotes', $articleId);
2156  }
2157 
2163  function clearAllSubmissionNotes($args, &$request) {
2164  $articleId = (int) $request->getUserVar('articleId');
2165  $this->validate($articleId);
2167  $request->redirect(null, null, 'submissionNotes', $articleId);
2168  }
2169 
2175  function submissionNotes($args, &$request) {
2176  $articleId = (int) array_shift($args);
2177  $noteViewType = array_shift($args); // May be null/empty
2178  $noteId = (int) array_shift($args);
2179 
2180  $this->validate($articleId);
2181  $this->setupTemplate(true, $articleId, 'history');
2183 
2184  $rangeInfo =& $this->getRangeInfo('submissionNotes');
2185  $noteDao =& DAORegistry::getDAO('NoteDAO');
2186 
2187  // submission note edit
2188  if ($noteViewType == 'edit') {
2189  $note = $noteDao->getById($noteId);
2190  }
2191 
2192  $templateMgr =& TemplateManager::getManager();
2193 
2194  $templateMgr->assign('articleId', $articleId);
2195  $templateMgr->assign_by_ref('submission', $submission);
2196  $templateMgr->assign('noteViewType', $noteViewType);
2197  if (isset($note)) {
2198  $templateMgr->assign_by_ref('articleNote', $note);
2199  }
2200 
2201  if ($noteViewType == 'edit' || $noteViewType == 'add') {
2202  $templateMgr->assign('showBackLink', true);
2203  } else {
2204  $submissionNotes =& $noteDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2205  $templateMgr->assign_by_ref('submissionNotes', $submissionNotes);
2206  }
2207 
2208  $templateMgr->display('sectionEditor/submissionNotes.tpl');
2209  }
2210 
2211 
2212  //
2213  // Misc
2214  //
2215 
2221  function downloadFile($args, &$request) {
2222  $articleId = (int) array_shift($args);
2223  $fileId = (int) array_shift($args);
2224  $revision = array_shift($args); // May be null
2225 
2226  $this->validate($articleId);
2227  if (!SectionEditorAction::downloadFile($articleId, $fileId, $revision)) {
2228  $request->redirect(null, null, 'submission', $articleId);
2229  }
2230  }
2231 
2237  function viewFile($args, &$request) {
2238  $articleId = (int) array_shift($args);
2239  $fileId = (int) array_shift($args);
2240  $revision = array_shift($args); // May be null
2241 
2242  $this->validate($articleId);
2243  if (!SectionEditorAction::viewFile($articleId, $fileId, $revision)) {
2244  $request->redirect(null, null, 'submission', $articleId);
2245  }
2246  }
2247 
2248 
2249  //
2250  // Proofreading
2251  //
2252 
2258  function selectProofreader($args, $request) {
2259  $articleId = (int) array_shift($args);
2260  $userId = (int) array_shift($args);
2261 
2262  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2263  $journal =& $request->getJournal();
2265 
2266  $roleDao =& DAORegistry::getDAO('RoleDAO');
2267  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2268 
2269  if ($userId && $articleId && $roleDao->userHasRole($journal->getId(), $userId, ROLE_ID_PROOFREADER)) {
2270  import('classes.submission.proofreader.ProofreaderAction');
2272  $request->redirect(null, null, 'submissionEditing', $articleId);
2273  } else {
2274  $this->setupTemplate(true, $articleId, 'editing');
2275 
2276  $searchType = null;
2277  $searchMatch = null;
2278  $search = $searchQuery = $request->getUserVar('search');
2279  $searchInitial = $request->getUserVar('searchInitial');
2280  if (!empty($search)) {
2281  $searchType = $request->getUserVar('searchField');
2282  $searchMatch = $request->getUserVar('searchMatch');
2283 
2284  } elseif (!empty($searchInitial)) {
2285  $searchInitial = String::strtoupper($searchInitial);
2286  $searchType = USER_FIELD_INITIAL;
2287  $search = $searchInitial;
2288  }
2289 
2290  $proofreaders = $roleDao->getUsersByRoleId(ROLE_ID_PROOFREADER, $journal->getId(), $searchType, $search, $searchMatch);
2291 
2292  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
2293  $proofreaderStatistics = $sectionEditorSubmissionDao->getProofreaderStatistics($journal->getId());
2294 
2295  $templateMgr =& TemplateManager::getManager();
2296 
2297  $templateMgr->assign('searchField', $searchType);
2298  $templateMgr->assign('searchMatch', $searchMatch);
2299  $templateMgr->assign('search', $searchQuery);
2300  $templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
2301 
2302  $templateMgr->assign_by_ref('users', $proofreaders);
2303 
2304  $proofSignoff = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2305  if ($proofSignoff) {
2306  $templateMgr->assign('currentUser', $proofSignoff->getUserId());
2307  }
2308  $templateMgr->assign('statistics', $proofreaderStatistics);
2309  $templateMgr->assign('fieldOptions', Array(
2310  USER_FIELD_FIRSTNAME => 'user.firstName',
2311  USER_FIELD_LASTNAME => 'user.lastName',
2312  USER_FIELD_USERNAME => 'user.username',
2313  USER_FIELD_EMAIL => 'user.email'
2314  ));
2315  $templateMgr->assign('articleId', $articleId);
2316  $templateMgr->assign('pageSubTitle', 'editor.article.selectProofreader');
2317  $templateMgr->assign('pageTitle', 'user.role.proofreaders');
2318  $templateMgr->assign('actionHandler', 'selectProofreader');
2319 
2320  $templateMgr->assign('helpTopicId', 'journal.roles.proofreader');
2321  $templateMgr->display('sectionEditor/selectUser.tpl');
2322  }
2323  }
2324 
2330  function notifyAuthorProofreader($args, $request) {
2331  $articleId = (int) $request->getUserVar('articleId');
2332  $send = $request->getUserVar('send');
2333  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2334  $this->setupTemplate(true, $articleId, 'editing');
2335 
2336  import('classes.submission.proofreader.ProofreaderAction');
2337  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_AUTHOR_REQUEST', $request, $send?'':$request->url(null, null, 'notifyAuthorProofreader'))) {
2338  $request->redirect(null, null, 'submissionEditing', $articleId);
2339  }
2340  }
2341 
2347  function thankAuthorProofreader($args, $request) {
2348  $articleId = (int) $request->getUserVar('articleId');
2349  $send = $request->getUserVar('send');
2350  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2351  $this->setupTemplate(true, $articleId, 'editing');
2352 
2353  import('classes.submission.proofreader.ProofreaderAction');
2354  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_AUTHOR_ACK', $request, $send?'':$request->url(null, null, 'thankAuthorProofreader'))) {
2355  $request->redirect(null, null, 'submissionEditing', $articleId);
2356  }
2357  }
2358 
2364  function editorInitiateProofreader($args, &$request) {
2365  $articleId = $request->getUserVar('articleId');
2366  $user =& $request->getUser();
2367  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2368 
2369  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2370  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2371  if (!$signoff->getUserId()) {
2372  $signoff->setUserId($user->getId());
2373  }
2374  $signoff->setDateNotified(Core::getCurrentDate());
2375  $signoffDao->updateObject($signoff);
2376 
2377  $request->redirect(null, null, 'submissionEditing', $articleId);
2378  }
2379 
2385  function editorCompleteProofreader($args, &$request) {
2386  $articleId = $request->getUserVar('articleId');
2387  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2388  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2389  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2390  $signoff->setDateCompleted(Core::getCurrentDate());
2391  $signoffDao->updateObject($signoff);
2392  $request->redirect(null, null, 'submissionEditing', $articleId);
2393  }
2394 
2400  function notifyProofreader($args, $request) {
2401  $articleId = (int) $request->getUserVar('articleId');
2402  $send = $request->getUserVar('send');
2403  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2404  $this->setupTemplate(true, $articleId, 'editing');
2405 
2406  import('classes.submission.proofreader.ProofreaderAction');
2407  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_REQUEST', $request, $send?'':$request->url(null, null, 'notifyProofreader'))) {
2408  $request->redirect(null, null, 'submissionEditing', $articleId);
2409  }
2410  }
2411 
2417  function thankProofreader($args, $request) {
2418  $articleId = (int) $request->getUserVar('articleId');
2419  $send = $request->getUserVar('send');
2420  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2421  $this->setupTemplate(true, $articleId, 'editing');
2422 
2423  import('classes.submission.proofreader.ProofreaderAction');
2424  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_ACK', $request, $send?'':$request->url(null, null, 'thankProofreader'))) {
2425  $request->redirect(null, null, 'submissionEditing', $articleId);
2426  }
2427  }
2428 
2434  function editorInitiateLayoutEditor($args, &$request) {
2435  $articleId = (int) $request->getUserVar('articleId');
2436  $user =& $request->getUser();
2437  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2438 
2439  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2440  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2441  if (!$signoff->getUserId()) {
2442  $signoff->setUserId($user->getId());
2443  }
2444  $signoff->setDateNotified(Core::getCurrentDate());
2445  $signoff->setDateUnderway(null);
2446  $signoff->setDateCompleted(null);
2447  $signoff->setDateAcknowledged(null);
2448  $signoffDao->updateObject($signoff);
2449 
2450  $request->redirect(null, null, 'submissionEditing', $articleId);
2451  }
2452 
2458  function editorCompleteLayoutEditor($args, &$request) {
2459  $articleId = $request->getUserVar('articleId');
2460  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2461 
2462  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2463  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2464  $signoff->setDateCompleted(Core::getCurrentDate());
2465  $signoffDao->updateObject($signoff);
2466 
2467  $request->redirect(null, null, 'submissionEditing', $articleId);
2468  }
2469 
2475  function notifyLayoutEditorProofreader($args, $request) {
2476  $articleId = (int) $request->getUserVar('articleId');
2477  $send = $request->getUserVar('send');
2478  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2479  $this->setupTemplate(true, $articleId, 'editing');
2480 
2481  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2482  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2483  $signoff->setDateNotified(Core::getCurrentDate());
2484  $signoff->setDateUnderway(null);
2485  $signoff->setDateCompleted(null);
2486  $signoff->setDateAcknowledged(null);
2487  $signoffDao->updateObject($signoff);
2488 
2489  import('classes.submission.proofreader.ProofreaderAction');
2490  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_LAYOUT_REQUEST', $request, $send?'':$request->url(null, null, 'notifyLayoutEditorProofreader'))) {
2491  $request->redirect(null, null, 'submissionEditing', $articleId);
2492  }
2493  }
2494 
2500  function thankLayoutEditorProofreader($args, $request) {
2501  $articleId = (int) $request->getUserVar('articleId');
2502  $send = $request->getUserVar('send');
2503  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2504  $this->setupTemplate(true, $articleId, 'editing');
2505 
2506  import('classes.submission.proofreader.ProofreaderAction');
2507  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_LAYOUT_ACK', $request, $send?'':$request->url(null, null, 'thankLayoutEditorProofreader'))) {
2508  $request->redirect(null, null, 'submissionEditing', $articleId);
2509  }
2510  }
2511 
2517  function scheduleForPublication($args, $request) {
2518  $articleId = (int) array_shift($args);
2519  $issueId = (int) $request->getUserVar('issueId');
2520  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2521 
2522  $journal =& $request->getJournal();
2524 
2525  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
2526  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
2527  $sectionDao =& DAORegistry::getDAO('SectionDAO');
2528  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
2529 
2530  $issueDao =& DAORegistry::getDAO('IssueDAO');
2531  $issue =& $issueDao->getIssueById($issueId, $journal->getId());
2532 
2533  if ($publishedArticle) {
2534  if (!$issue || !$issue->getPublished()) {
2535  $fromIssue =& $issueDao->getIssueById($publishedArticle->getIssueId(), $journal->getId());
2536  if ($fromIssue->getPublished()) {
2537  // Insert article tombstone
2538  import('classes.article.ArticleTombstoneManager');
2539  $articleTombstoneManager = new ArticleTombstoneManager();
2540  $articleTombstoneManager->insertArticleTombstone($submission, $journal);
2541  }
2542  }
2543  }
2544 
2545  import('classes.search.ArticleSearchIndex');
2546  $articleSearchIndex = new ArticleSearchIndex();
2547 
2548  if ($issue) {
2549 
2550  // Schedule against an issue.
2551  if ($publishedArticle) {
2552  $publishedArticle->setIssueId($issueId);
2553  $publishedArticle->setSeq(REALLY_BIG_NUMBER);
2554  $publishedArticleDao->updatePublishedArticle($publishedArticle);
2555 
2556  // Re-index the published article metadata.
2557  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2558  } else {
2559  $publishedArticle = new PublishedArticle();
2560  $publishedArticle->setId($submission->getId());
2561  $publishedArticle->setIssueId($issueId);
2562  $publishedArticle->setDatePublished(Core::getCurrentDate());
2563  $publishedArticle->setSeq(REALLY_BIG_NUMBER);
2564  $publishedArticle->setAccessStatus(ARTICLE_ACCESS_ISSUE_DEFAULT);
2565 
2566  $publishedArticleDao->insertPublishedArticle($publishedArticle);
2567 
2568  // If we're using custom section ordering, and if this is the first
2569  // article published in a section, make sure we enter a custom ordering
2570  // for it. (Default at the end of the list.)
2571  if ($sectionDao->customSectionOrderingExists($issueId)) {
2572  if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) {
2573  $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER);
2574  $sectionDao->resequenceCustomSectionOrders($issueId);
2575  }
2576  }
2577 
2578  // Index the published article metadata and files for the first time.
2579  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2580  $articleSearchIndex->articleFilesChanged($publishedArticle);
2581  }
2582 
2583  } else {
2584  if ($publishedArticle) {
2585  // This was published elsewhere; make sure we don't
2586  // mess up sequencing information.
2587  $issueId = $publishedArticle->getIssueId();
2588  $publishedArticleDao->deletePublishedArticleByArticleId($articleId);
2589 
2590  // Delete the article from the search index.
2591  $articleSearchIndex->articleFileDeleted($articleId);
2592  }
2593  }
2594 
2595  // Resequence the articles.
2596  $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId);
2597 
2598  $submission->stampStatusModified();
2599 
2600  if ($issue && $issue->getPublished()) {
2601  $submission->setStatus(STATUS_PUBLISHED);
2602  // delete article tombstone
2603  $tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO');
2604  $tombstoneDao->deleteByDataObjectId($submission->getId());
2605  } else {
2606  $submission->setStatus(STATUS_QUEUED);
2607  }
2608 
2609  $sectionEditorSubmissionDao->updateSectionEditorSubmission($submission);
2610  $articleSearchIndex->articleChangesFinished();
2611 
2612  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2613  }
2614 
2620  function setDatePublished($args, $request) {
2621  $articleId = (int) array_shift($args);
2622  $issueId = (int) $request->getUserVar('issueId');
2623  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2624 
2625  $journal =& $request->getJournal();
2627 
2628  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
2629  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
2630  if ($publishedArticle) {
2631  $datePublished = $request->getUserDateVar('datePublished');
2632  $publishedArticle->setDatePublished($datePublished);
2633  $publishedArticleDao->updatePublishedArticle($publishedArticle);
2634 
2635  // Re-index the published article metadata.
2636  import('classes.search.ArticleSearchIndex');
2637  $articleSearchIndex = new ArticleSearchIndex();
2638  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2639  $articleSearchIndex->articleChangesFinished();
2640  }
2641  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2642  }
2643 
2644  //
2645  // Payments
2646  //
2647 
2653  function waiveSubmissionFee($args, $request) {
2654  $articleId = (int) array_shift($args);
2655  $markAsPaid = $request->getUserVar('markAsPaid');
2656 
2657  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2659  import('classes.payment.ojs.OJSPaymentManager');
2660  $paymentManager = new OJSPaymentManager($request);
2661  $user =& $request->getUser();
2662  $journal =& $request->getJournal();
2663 
2664  $queuedPayment =& $paymentManager->createQueuedPayment(
2665  $journal->getId(),
2666  PAYMENT_TYPE_SUBMISSION,
2667  $markAsPaid ? $submission->getUserId() : $user->getId(),
2668  $articleId,
2669  $markAsPaid ? $journal->getSetting('submissionFee') : 0,
2670  $markAsPaid ? $journal->getSetting('currency') : ''
2671  );
2672 
2673  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2674 
2675  // Since this is a waiver, fulfill the payment immediately
2676  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2677  $request->redirect(null, null, 'submission', array($articleId));
2678  }
2679 
2685  function waiveFastTrackFee($args, &$request) {
2686  $articleId = (int) array_shift($args);
2687  $markAsPaid = $request->getUserVar('markAsPaid');
2688  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2689  $journal =& $request->getJournal();
2691 
2692  import('classes.payment.ojs.OJSPaymentManager');
2693  $paymentManager = new OJSPaymentManager($request);
2694  $user =& $request->getUser();
2695 
2696  $queuedPayment =& $paymentManager->createQueuedPayment(
2697  $journal->getId(),
2698  PAYMENT_TYPE_FASTTRACK,
2699  $markAsPaid ? $submission->getUserId() : $user->getId(),
2700  $articleId,
2701  $markAsPaid ? $journal->getSetting('fastTrackFee') : 0,
2702  $markAsPaid ? $journal->getSetting('currency') : ''
2703  );
2704 
2705  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2706 
2707  // Since this is a waiver, fulfill the payment immediately
2708  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2709  $request->redirect(null, null, 'submission', array($articleId));
2710  }
2711 
2717  function waivePublicationFee($args, $request) {
2718  $articleId = (int) array_shift($args);
2719  $markAsPaid = $request->getUserVar('markAsPaid');
2720  $sendToScheduling = $request->getUserVar('sendToScheduling')?true:false;
2721 
2722  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2723  $journal =& Request::getJournal();
2725 
2726  import('classes.payment.ojs.OJSPaymentManager');
2727  $paymentManager = new OJSPaymentManager($request);
2728  $user =& $request->getUser();
2729 
2730  $queuedPayment =& $paymentManager->createQueuedPayment(
2731  $journal->getId(),
2732  PAYMENT_TYPE_PUBLICATION,
2733  $markAsPaid ? $submission->getUserId() : $user->getId(),
2734  $articleId,
2735  $markAsPaid ? $journal->getSetting('publicationFee') : 0,
2736  $markAsPaid ? $journal->getSetting('currency') : ''
2737  );
2738 
2739  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2740 
2741  // Since this is a waiver, fulfill the payment immediately
2742  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2743 
2744  if ($sendToScheduling) {
2745  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2746  } else {
2747  $request->redirect(null, null, 'submission', array($articleId));
2748  }
2749  }
2750 
2756  function downloadLayoutTemplate($args, &$request) {
2757  $articleId = (int) array_shift($args);
2758  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2759 
2760  $journal =& $request->getJournal();
2761  $templates = $journal->getSetting('templates');
2762  import('classes.file.JournalFileManager');
2763  $journalFileManager = new JournalFileManager($journal);
2764  $templateId = (int) array_shift($args);
2765  if ($templateId >= count($templates) || $templateId < 0) $request->redirect(null, 'index');
2766  $template =& $templates[$templateId];
2767 
2768  $filename = "template-$templateId." . $journalFileManager->parseFileExtension($template['originalFilename']);
2769  $journalFileManager->downloadFile($filename, $template['fileType']);
2770  }
2771 }
2772 
2773 ?>
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)
Class defining operations for private journal file management.
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)
downloadLayoutTemplate($args, &$request)
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)