Open Journal Systems  2.4.8
 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  if (!$section) {
70  import('classes.notification.NotificationManager');
71  $notificationManager = new NotificationManager();
72  $notificationManager->createTrivialNotification(
73  $user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => __('author.submit.form.sectionRequired'))
74  );
75  }
76 
77  $enableComments = $journal->getSetting('enableComments');
78 
79  $templateMgr =& TemplateManager::getManager();
80 
81  $templateMgr->assign_by_ref('submission', $submission);
82  $templateMgr->assign_by_ref('section', $section);
83  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
84  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
85  $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
86  $templateMgr->assign_by_ref('journalSettings', $journalSettings);
87  $templateMgr->assign('userId', $user->getId());
88  $templateMgr->assign('isEditor', $isEditor);
89  $templateMgr->assign('enableComments', $enableComments);
90 
91  $sectionDao =& DAORegistry::getDAO('SectionDAO');
92  $templateMgr->assign_by_ref('sections', $sectionDao->getSectionTitles($journal->getId()));
93  if ($enableComments) {
94  import('classes.article.Article');
95  $templateMgr->assign('commentsStatus', $submission->getCommentsStatus());
96  $templateMgr->assign_by_ref('commentsStatusOptions', Article::getCommentsStatusOptions());
97  }
98 
99  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
100  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getId());
101  if ($publishedArticle) {
102  $issueDao =& DAORegistry::getDAO('IssueDAO');
103  $issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
104  $templateMgr->assign_by_ref('issue', $issue);
105  $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
106  }
107 
108  if ($isEditor) {
109  $templateMgr->assign('helpTopicId', 'editorial.editorsRole.submissionSummary');
110  }
111 
112  // Set up required Payment Related Information
113  import('classes.payment.ojs.OJSPaymentManager');
114  $paymentManager = new OJSPaymentManager($request);
115  if ( $paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
116  $templateMgr->assign('authorFees', true);
117  $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
118 
119  if ( $paymentManager->submissionEnabled() ) {
120  $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDao->getSubmissionCompletedPayment ( $journal->getId(), $articleId ));
121  }
122 
123  if ( $paymentManager->fastTrackEnabled() ) {
124  $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDao->getFastTrackCompletedPayment ( $journal->getId(), $articleId ));
125  }
126 
127  if ( $paymentManager->publicationEnabled() ) {
128  $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment ( $journal->getId(), $articleId ));
129  }
130  }
131 
132  $templateMgr->assign('canEditMetadata', true);
133 
134  $templateMgr->display('sectionEditor/submission.tpl');
135  }
136 
142  function submissionRegrets($args, &$request) {
143  $articleId = (int) array_shift($args);
144  $this->validate($articleId);
145  $journal =& $request->getJournal();
147  $this->setupTemplate(true, $articleId, 'review');
148 
149  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
150  $cancelsAndRegrets = $reviewAssignmentDao->getCancelsAndRegrets($articleId);
151  $reviewFilesByRound = $reviewAssignmentDao->getReviewFilesByRound($articleId);
152 
153  $reviewAssignments =& $submission->getReviewAssignments();
154  $editorDecisions = $submission->getDecisions();
155  $numRounds = $submission->getCurrentRound();
156 
157  $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
158  $reviewFormResponses = array();
159  if (isset($reviewAssignments[$numRounds-1])) {
160  foreach ($reviewAssignments[$numRounds-1] as $reviewAssignment) {
161  $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
162  }
163  }
164 
165  $templateMgr =& TemplateManager::getManager();
166 
167  $templateMgr->assign_by_ref('submission', $submission);
168  $templateMgr->assign_by_ref('reviewAssignments', $reviewAssignments);
169  $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
170  $templateMgr->assign_by_ref('cancelsAndRegrets', $cancelsAndRegrets);
171  $templateMgr->assign_by_ref('reviewFilesByRound', $reviewFilesByRound);
172  $templateMgr->assign_by_ref('editorDecisions', $editorDecisions);
173  $templateMgr->assign('numRounds', $numRounds);
174  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
175 
176  $templateMgr->assign_by_ref('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
177 
178  import('classes.submission.reviewAssignment.ReviewAssignment');
179  $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
180  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
181 
182  $templateMgr->display('sectionEditor/submissionRegrets.tpl');
183  }
184 
190  function submissionReview($args, &$request) {
191  $articleId = isset($args[0]) ? (int) $args[0] : 0;
192  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
193  $journal =& Request::getJournal();
195  $this->setupTemplate(true, $articleId);
196 
197  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_MANAGER);
198 
199  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
200  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
201 
202  // Setting the round.
203  $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
204 
205  $sectionDao =& DAORegistry::getDAO('SectionDAO');
206  $sections =& $sectionDao->getJournalSections($journal->getId());
207 
208  $showPeerReviewOptions = $round == $submission->getCurrentRound() && $submission->getReviewFile() != null ? true : false;
209 
210  $editorDecisions = $submission->getDecisions($round);
211  $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
212 
213  $editAssignments =& $submission->getEditAssignments();
214  $allowRecommendation = $submission->getCurrentRound() == $round && $submission->getReviewFileId() != null && !empty($editAssignments);
215  $allowResubmit = $lastDecision == SUBMISSION_EDITOR_DECISION_RESUBMIT && $sectionEditorSubmissionDao->getMaxReviewRound($articleId) == $round ? true : false;
216  $allowCopyedit = $lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT && $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) == null ? true : false;
217 
218  // Prepare an array to store the 'Notify Reviewer' email logs
219  $notifyReviewerLogs = array();
220  foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
221  $notifyReviewerLogs[$reviewAssignment->getId()] = array();
222  }
223 
224  // Parse the list of email logs and populate the array.
225  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
226  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
227  foreach ($emailLogEntries->toArray() as $emailLog) {
228  if ($emailLog->getEventType() == ARTICLE_EMAIL_REVIEW_NOTIFY_REVIEWER) {
229  if (isset($notifyReviewerLogs[$emailLog->getAssocId()]) && is_array($notifyReviewerLogs[$emailLog->getAssocId()])) {
230  array_push($notifyReviewerLogs[$emailLog->getAssocId()], $emailLog);
231  }
232  }
233  }
234 
235  $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
236  $reviewFormResponses = array();
237 
238  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
239  $reviewFormTitles = array();
240 
241  foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
242  $reviewForm =& $reviewFormDao->getReviewForm($reviewAssignment->getReviewFormId());
243  if ($reviewForm) {
244  $reviewFormTitles[$reviewForm->getId()] = $reviewForm->getLocalizedTitle();
245  }
246  unset($reviewForm);
247  $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
248  }
249 
250  $templateMgr =& TemplateManager::getManager();
251 
252  $templateMgr->assign_by_ref('submission', $submission);
253  $templateMgr->assign_by_ref('reviewIndexes', $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round));
254  $templateMgr->assign('round', $round);
255  $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
256  $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
257  $templateMgr->assign('reviewFormTitles', $reviewFormTitles);
258  $templateMgr->assign_by_ref('notifyReviewerLogs', $notifyReviewerLogs);
259  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
260  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
261  $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
262  $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
263  $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
264  $templateMgr->assign_by_ref('editorFile', $submission->getEditorFile());
265  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
266  $templateMgr->assign('showPeerReviewOptions', $showPeerReviewOptions);
267  $templateMgr->assign_by_ref('sections', $sections->toArray());
268  $templateMgr->assign('editorDecisionOptions',SectionEditorSubmission::getEditorDecisionOptions());
269  $templateMgr->assign_by_ref('lastDecision', $lastDecision);
270 
271  import('classes.submission.reviewAssignment.ReviewAssignment');
272  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
273  $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
274 
275  $templateMgr->assign('allowRecommendation', $allowRecommendation);
276  $templateMgr->assign('allowResubmit', $allowResubmit);
277  $templateMgr->assign('allowCopyedit', $allowCopyedit);
278 
279  $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.review');
280  $templateMgr->display('sectionEditor/submissionReview.tpl');
281  }
282 
288  function submissionEditing($args, $request) {
289  $articleId = isset($args[0]) ? (int) $args[0] : 0;
290  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
291  $journal =& $request->getJournal();
293  $this->setupTemplate(true, $articleId);
294 
295  $useCopyeditors = $journal->getSetting('useCopyeditors');
296  $useLayoutEditors = $journal->getSetting('useLayoutEditors');
297  $useProofreaders = $journal->getSetting('useProofreaders');
298 
299  // check if submission is accepted
300  $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
301  $editorDecisions = $submission->getDecisions($round);
302  $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
303  $submissionAccepted = ($lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT) ? true : false;
304 
305  $templateMgr =& TemplateManager::getManager();
306 
307  $templateMgr->assign_by_ref('submission', $submission);
308  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
309  $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
310  $templateMgr->assign_by_ref('initialCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
311  $templateMgr->assign_by_ref('editorAuthorCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_AUTHOR'));
312  $templateMgr->assign_by_ref('finalCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_FINAL'));
313  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
314  $templateMgr->assign_by_ref('copyeditor', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
315 
316  $roleDao =& DAORegistry::getDAO('RoleDAO');
317  $user =& Request::getUser();
318  $templateMgr->assign('isEditor', $roleDao->userHasRole($journal->getId(), $user->getId(), ROLE_ID_EDITOR));
319 
320  import('classes.issue.IssueAction');
321  $templateMgr->assign('issueOptions', IssueAction::getIssueOptions());
322  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
323  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getId());
324  $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
325 
326  $templateMgr->assign('useCopyeditors', $useCopyeditors);
327  $templateMgr->assign('useLayoutEditors', $useLayoutEditors);
328  $templateMgr->assign('useProofreaders', $useProofreaders);
329  $templateMgr->assign('submissionAccepted', $submissionAccepted);
330  $templateMgr->assign('templates', $journal->getSetting('templates'));
331 
332  // Set up required Payment Related Information
333  import('classes.payment.ojs.OJSPaymentManager');
334  $paymentManager = new OJSPaymentManager($request);
335  $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
336 
337  $publicationFeeEnabled = $paymentManager->publicationEnabled();
338  $templateMgr->assign('publicationFeeEnabled', $publicationFeeEnabled);
339  if ( $publicationFeeEnabled ) {
340  $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment ( $journal->getId(), $articleId ));
341  }
342 
343  $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.editing');
344  $templateMgr->display('sectionEditor/submissionEditing.tpl');
345  }
346 
352  function submissionHistory($args, &$request) {
353  $articleId = (int) array_shift($args);
354  $this->validate($articleId);
355  $this->setupTemplate(true, $articleId);
356 
357  $templateMgr =& TemplateManager::getManager();
359  $templateMgr->assign_by_ref('submission', $submission);
360 
361  // Notes
362  $noteDao =& DAORegistry::getDAO('NoteDAO');
363  $submissionNotes =& $noteDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
364  $templateMgr->assign_by_ref('submissionNotes', $submissionNotes);
365 
366  // Event log
367  $eventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
368  $rangeInfo =& $this->getRangeInfo('eventLogEntries');
369  $eventLogEntries =& $eventLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
370  $templateMgr->assign_by_ref('eventLogEntries', $eventLogEntries);
371  unset($rangeInfo);
372 
373  // Email log
374  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
375  $rangeInfo =& $this->getRangeInfo('emailLogEntries');
376  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
377  $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
378  unset($rangeInfo);
379 
380  $templateMgr->assign('isEditor', Validation::isEditor());
381  $templateMgr->display('sectionEditor/submissionHistory.tpl');
382  }
383 
389  function submissionCitations($args, $request) {
390  // Authorize the request.
391  $articleId = isset($args[0]) ? (int) $args[0] : 0;
392  $this->validate($articleId);
393 
394  // Prepare the view.
395  $this->setupTemplate(true, $articleId);
396 
397  // Insert the citation editing assistant into the view.
399 
400  // Render the view.
401  $templateMgr =& TemplateManager::getManager();
402  $templateMgr->display('sectionEditor/submissionCitations.tpl');
403  }
404 
410  function changeSection($args, &$request) {
411  $articleId = (int) $request->getUserVar('articleId');
412  $this->validate($articleId);
414 
415  $sectionId = $request->getUserVar('sectionId');
416 
418 
419  $request->redirect(null, null, 'submission', $articleId);
420  }
421 
427  function recordDecision($args, $request) {
428  $articleId = $request->getUserVar('articleId');
429  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
431 
432  $decision = $request->getUserVar('decision');
433 
434  switch ($decision) {
435  case SUBMISSION_EDITOR_DECISION_ACCEPT:
436  case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
437  case SUBMISSION_EDITOR_DECISION_RESUBMIT:
438  case SUBMISSION_EDITOR_DECISION_DECLINE:
439  SectionEditorAction::recordDecision($submission, $decision, $request);
440  break;
441  }
442 
443  $request->redirect(null, null, 'submissionReview', $articleId);
444  }
445 
446  //
447  // Peer Review
448  //
449 
455  function selectReviewer($args, &$request) {
456  $articleId = (int) array_shift($args);
457  $reviewerId = (int) array_shift($args);
458 
459  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
460  $journal =& $request->getJournal();
462 
463  $sort = $request->getUserVar('sort');
464  $sort = isset($sort) ? $sort : 'reviewerName';
465  $sortDirection = $request->getUserVar('sortDirection');
466  $sortDirection = (isset($sortDirection) && ($sortDirection == SORT_DIRECTION_ASC || $sortDirection == SORT_DIRECTION_DESC)) ? $sortDirection : SORT_DIRECTION_ASC;
467 
468  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
469 
470  if ($reviewerId) {
471  // Assign reviewer to article
472  SectionEditorAction::addReviewer($submission, $reviewerId, null, $request);
473  $request->redirect(null, null, 'submissionReview', $articleId);
474 
475  // FIXME: Prompt for due date.
476  } else {
477  $this->setupTemplate(true, $articleId, 'review');
478 
479  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
480 
481  $searchType = null;
482  $searchMatch = null;
483  $search = $searchQuery = $request->getUserVar('search');
484  $searchInitial = $request->getUserVar('searchInitial');
485  if (!empty($search)) {
486  $searchType = $request->getUserVar('searchField');
487  $searchMatch = $request->getUserVar('searchMatch');
488 
489  } elseif (!empty($searchInitial)) {
490  $searchInitial = String::strtoupper($searchInitial);
491  $searchType = USER_FIELD_INITIAL;
492  $search = $searchInitial;
493  }
494 
495  $rangeInfo =& $this->getRangeInfo('reviewers');
496  $reviewers = $sectionEditorSubmissionDao->getReviewersForArticle($journal->getId(), $articleId, $submission->getCurrentRound(), $searchType, $search, $searchMatch, $rangeInfo, $sort, $sortDirection); /* @var $reviewers DAOResultFactory */
497 
498  $journal = $request->getJournal();
499  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
500 
501  $templateMgr =& TemplateManager::getManager();
502 
503  $templateMgr->assign('searchField', $searchType);
504  $templateMgr->assign('searchMatch', $searchMatch);
505  $templateMgr->assign('search', $searchQuery);
506  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
507 
508  $templateMgr->assign_by_ref('reviewers', $reviewers);
509  $templateMgr->assign('articleId', $articleId);
510  $templateMgr->assign('reviewerStatistics', $sectionEditorSubmissionDao->getReviewerStatistics($journal->getId()));
511  $templateMgr->assign('fieldOptions', array(
512  USER_FIELD_INTERESTS => 'user.interests',
513  USER_FIELD_FIRSTNAME => 'user.firstName',
514  USER_FIELD_LASTNAME => 'user.lastName',
515  USER_FIELD_USERNAME => 'user.username',
516  USER_FIELD_EMAIL => 'user.email'
517  ));
518  $templateMgr->assign('completedReviewCounts', $reviewAssignmentDao->getCompletedReviewCounts($journal->getId()));
519  $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
520  $templateMgr->assign('averageQualityRatings', $reviewAssignmentDao->getAverageQualityRatings($journal->getId()));
521 
522  $templateMgr->assign('helpTopicId', 'journal.roles.reviewer');
523  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
524  $templateMgr->assign('reviewerDatabaseLinks', $journal->getSetting('reviewerDatabaseLinks'));
525  $templateMgr->assign('sort', $sort);
526  $templateMgr->assign('sortDirection', $sortDirection);
527  $templateMgr->display('sectionEditor/selectReviewer.tpl');
528  }
529  }
530 
536  function createReviewer($args, &$request) {
537  $articleId = isset($args[0]) ? (int) $args[0] : 0;
538  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
540 
541  import('classes.sectionEditor.form.CreateReviewerForm');
542  $createReviewerForm = new CreateReviewerForm($articleId);
543  $this->setupTemplate(true, $articleId);
544 
545  if (isset($args[1]) && $args[1] === 'create') {
546  $createReviewerForm->readInputData();
547  if ($createReviewerForm->validate()) {
548  // Create a user and enroll them as a reviewer.
549  $newUserId = $createReviewerForm->execute();
550  $request->redirect(null, null, 'selectReviewer', array($articleId, $newUserId));
551  } else {
552  $createReviewerForm->display($args, $request);
553  }
554  } else {
555  // Display the "create user" form.
556  if ($createReviewerForm->isLocaleResubmit()) {
557  $createReviewerForm->readInputData();
558  } else {
559  $createReviewerForm->initData();
560  }
561  $createReviewerForm->display($args, $request);
562  }
563  }
564 
571  function suggestUsername($args, &$request) {
572  parent::validate();
573  $suggestion = Validation::suggestUsername(
574  $request->getUserVar('firstName'),
575  $request->getUserVar('lastName')
576  );
577  echo $suggestion;
578  }
579 
585  function enrollSearch($args, $request) {
586  $articleId = isset($args[0]) ? (int) $args[0] : 0;
587  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
588  AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER); // manager.people.enrollment, manager.people.enroll
590 
591  $roleDao =& DAORegistry::getDAO('RoleDAO');
592  $roleId = $roleDao->getRoleIdFromPath('reviewer');
593 
594  $user =& $request->getUser();
595 
596  $rangeInfo = $this->getRangeInfo('users');
597  $templateMgr =& TemplateManager::getManager();
598  $this->setupTemplate(true);
599 
600  $searchType = null;
601  $searchMatch = null;
602  $search = $searchQuery = $request->getUserVar('search');
603  $searchInitial = $request->getUserVar('searchInitial');
604  if (!empty($search)) {
605  $searchType = $request->getUserVar('searchField');
606  $searchMatch = $request->getUserVar('searchMatch');
607 
608  } elseif (!empty($searchInitial)) {
609  $searchInitial = String::strtoupper($searchInitial);
610  $searchType = USER_FIELD_INITIAL;
611  $search = $searchInitial;
612  }
613 
614  $userDao =& DAORegistry::getDAO('UserDAO');
615  $users =& $userDao->getUsersByField($searchType, $searchMatch, $search, false, $rangeInfo);
616 
617  $templateMgr->assign('searchField', $searchType);
618  $templateMgr->assign('searchMatch', $searchMatch);
619  $templateMgr->assign('search', $searchQuery);
620  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
621 
622  $templateMgr->assign('articleId', $articleId);
623  $templateMgr->assign('fieldOptions', Array(
624  USER_FIELD_INTERESTS => 'user.interests',
625  USER_FIELD_FIRSTNAME => 'user.firstName',
626  USER_FIELD_LASTNAME => 'user.lastName',
627  USER_FIELD_USERNAME => 'user.username',
628  USER_FIELD_EMAIL => 'user.email'
629  ));
630  $templateMgr->assign('roleId', $roleId);
631  $templateMgr->assign_by_ref('users', $users);
632  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
633 
634  $templateMgr->assign('helpTopicId', 'journal.roles.index');
635  $templateMgr->display('sectionEditor/searchUsers.tpl');
636  }
637 
643  function enroll($args, &$request) {
644  $articleId = isset($args[0]) ? (int) $args[0] : 0;
645  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
646  $journal =& $request->getJournal();
648 
649  $roleDao =& DAORegistry::getDAO('RoleDAO');
650  $roleId = $roleDao->getRoleIdFromPath('reviewer');
651 
652  $users = $request->getUserVar('users');
653  if (!is_array($users) && $request->getUserVar('userId') != null) $users = array($request->getUserVar('userId'));
654 
655  // Enroll reviewer
656  for ($i=0; $i<count($users); $i++) {
657  if (!$roleDao->userHasRole($journal->getId(), $users[$i], $roleId)) {
658  $role = new Role();
659  $role->setJournalId($journal->getId());
660  $role->setUserId($users[$i]);
661  $role->setRoleId($roleId);
662 
663  $roleDao->insertRole($role);
664  }
665  }
666  $request->redirect(null, null, 'selectReviewer', $articleId);
667  }
668 
674  function notifyReviewer($args, $request) {
675  $articleId = (int) $request->getUserVar('articleId');
676  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
678 
679  $reviewId = (int) $request->getUserVar('reviewId');
680 
681  $send = $request->getUserVar('send')?true:false;
682  $this->setupTemplate(true, $articleId, 'review');
683 
684  if (SectionEditorAction::notifyReviewer($submission, $reviewId, $send, $request)) {
685  $request->redirect(null, null, 'submissionReview', $articleId);
686  }
687  }
688 
694  function clearReview($args, $request) {
695  $articleId = (int) array_shift($args);
696  $reviewId = (int) array_shift($args);
697  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
699 
700  SectionEditorAction::clearReview($submission, $reviewId, $request);
701 
702  $request->redirect(null, null, 'submissionReview', $articleId);
703  }
704 
710  function cancelReview($args, $request) {
711  $articleId = (int) $request->getUserVar('articleId');
712  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
714 
715  $reviewId = (int) $request->getUserVar('reviewId');
716 
717  $send = $request->getUserVar('send')?true:false;
718  $this->setupTemplate(true, $articleId, 'review');
719 
720  if (SectionEditorAction::cancelReview($submission, $reviewId, $send, $request)) {
721  $request->redirect(null, null, 'submissionReview', $articleId);
722  }
723  }
724 
730  function remindReviewer($args, $request) {
731  $articleId = (int) $request->getUserVar('articleId');
732  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
734 
735  $reviewId = (int) $request->getUserVar('reviewId');
736  $this->setupTemplate(true, $articleId, 'review');
737 
738  if (SectionEditorAction::remindReviewer($submission, $reviewId, $request->getUserVar('send'), $request)) {
739  $request->redirect(null, null, 'submissionReview', $articleId);
740  }
741  }
742 
743  /*
744  * Reassign a reviewer to the current round of review
745  * @param $args array
746  * @param $request object
747  */
748  function reassignReviewer($args, $request) {
749  $articleId = isset($args[0]) ? (int) $args[0] : 0;
750  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
751  $userId = isset($args[1]) ? (int) $args[1] : 0;
752 
753  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
754  $submission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
755  $round = $submission->getCurrentRound();
756 
757  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
758  $reviewAssignment =& $reviewAssignmentDao->getReviewAssignment($articleId, $userId, $submission->getCurrentRound()); /* @var $reviewAssignment ReviewAssignment */
759  if($reviewAssignment && !$reviewAssignment->getDateCompleted() && $reviewAssignment->getDeclined()) {
760  $reviewAssignment->setDeclined(false);
761  $reviewAssignment->setDateAssigned(Core::getCurrentDate());
762  $reviewAssignment->setDateNotified(null);
763  $reviewAssignment->setDateConfirmed(null);
764  $reviewAssignment->setRound($submission->getCurrentRound());
765 
766  $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
767  }
768  $request->redirect(null, null, 'submissionReview', $articleId);
769  }
770 
776  function thankReviewer($args, &$request) {
777  $articleId = (int) $request->getUserVar('articleId');
778  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
780 
781  $reviewId = (int) $request->getUserVar('reviewId');
782 
783  $send = $request->getUserVar('send')?true:false;
784  $this->setupTemplate(true, $articleId, 'review');
785 
786  if (SectionEditorAction::thankReviewer($submission, $reviewId, $send, $request)) {
787  $request->redirect(null, null, 'submissionReview', $articleId);
788  }
789  }
790 
796  function rateReviewer($args, &$request) {
797  $articleId = (int) $request->getUserVar('articleId');
798  $reviewId = (int) $request->getUserVar('reviewId');
799  $quality = (int) $request->getUserVar('quality');
800 
801  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
802  $this->setupTemplate(true, $articleId, 'review');
803 
804  SectionEditorAction::rateReviewer($articleId, $reviewId, $quality, $request);
805 
806  $request->redirect(null, null, 'submissionReview', $articleId);
807  }
808 
814  function confirmReviewForReviewer($args, &$request) {
815  $articleId = (int) array_shift($args);
816  $reviewId = (int) array_shift($args);
817 
818  $accept = $request->getUserVar('accept')?true:false;
819  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
821 
822  SectionEditorAction::confirmReviewForReviewer($reviewId, $accept, $request);
823  $request->redirect(null, null, 'submissionReview', $articleId);
824  }
825 
831  function uploadReviewForReviewer($args, &$request) {
832  $articleId = (int) $request->getUserVar('articleId');
833  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
835 
836  $reviewId = (int) $request->getUserVar('reviewId');
837 
839  $request->redirect(null, null, 'submissionReview', $articleId);
840  }
841 
847  function makeReviewerFileViewable($args, &$request) {
848  $articleId = $request->getUserVar('articleId');
849  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
851 
852  $reviewId = $request->getUserVar('reviewId');
853  $fileId = $request->getUserVar('fileId');
854  $revision = $request->getUserVar('revision');
855  $viewable = $request->getUserVar('viewable');
856 
857  SectionEditorAction::makeReviewerFileViewable($articleId, $reviewId, $fileId, $revision, $viewable);
858 
859  $request->redirect(null, null, 'submissionReview', $articleId);
860  }
861 
867  function setDueDate($args, &$request) {
868  $articleId = (int) array_shift($args);
869  $reviewId = (int) array_shift($args);
870 
871  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
873 
874  $dueDate = $request->getUserVar('dueDate');
875  $numWeeks = $request->getUserVar('numWeeks');
876 
877  if ($dueDate != null || $numWeeks != null) {
878  SectionEditorAction::setDueDate($articleId, $reviewId, $dueDate, $numWeeks, false, $request);
879  $request->redirect(null, null, 'submissionReview', $articleId);
880  } else {
881  $this->setupTemplate(true, $articleId, 'review');
882  $journal =& $request->getJournal();
883 
884  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
885  $reviewAssignment = $reviewAssignmentDao->getById($reviewId);
886 
887  $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
888  $settings =& $settingsDao->getJournalSettings($journal->getId());
889 
890  $templateMgr =& TemplateManager::getManager();
891 
892  if ($reviewAssignment->getDateDue() != null) {
893  $templateMgr->assign('dueDate', $reviewAssignment->getDateDue());
894  }
895 
896  $numWeeksPerReview = $settings['numWeeksPerReview'] == null ? 0 : $settings['numWeeksPerReview'];
897 
898  $templateMgr->assign('articleId', $articleId);
899  $templateMgr->assign('reviewId', $reviewId);
900  $templateMgr->assign('todaysDate', date('Y-m-d'));
901  $templateMgr->assign('numWeeksPerReview', $numWeeksPerReview);
902  $templateMgr->assign('actionHandler', 'setDueDate');
903 
904  $templateMgr->display('sectionEditor/setDueDate.tpl');
905  }
906  }
907 
913  function enterReviewerRecommendation($args, &$request) {
914  $articleId = $request->getUserVar('articleId');
915  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
917 
918  $reviewId = $request->getUserVar('reviewId');
919 
920  $recommendation = $request->getUserVar('recommendation');
921 
922  if ($recommendation != null) {
923  SectionEditorAction::setReviewerRecommendation($this->submission, $reviewId, $recommendation, SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT, $request);
924  $request->redirect(null, null, 'submissionReview', $articleId);
925  } else {
926  $this->setupTemplate(true, $articleId, 'review');
927 
928  $templateMgr =& TemplateManager::getManager();
929 
930  $templateMgr->assign('articleId', $articleId);
931  $templateMgr->assign('reviewId', $reviewId);
932 
933  import('classes.submission.reviewAssignment.ReviewAssignment');
934  $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
935 
936  $templateMgr->display('sectionEditor/reviewerRecommendation.tpl');
937  }
938  }
939 
945  function userProfile($args, &$request) {
946  parent::validate();
947  $this->setupTemplate(true);
948 
949  $templateMgr =& TemplateManager::getManager();
950  $templateMgr->assign('currentUrl', $request->url(null, $request->getRequestedPage()));
951 
952  $userDao =& DAORegistry::getDAO('UserDAO');
953  $userId = isset($args[0]) ? $args[0] : 0;
954  if (is_numeric($userId)) {
955  $userId = (int) $userId;
956  $user = $userDao->getById($userId);
957  } else {
958  $user = $userDao->getByUsername($userId);
959  }
960 
961 
962  if ($user == null) {
963  // Non-existent user requested
964  $templateMgr->assign('pageTitle', 'manager.people');
965  $templateMgr->assign('errorMsg', 'manager.people.invalidUser');
966  $templateMgr->display('common/error.tpl');
967 
968  } else {
969  $site =& $request->getSite();
970  $journal =& $request->getJournal();
971 
972  $countryDao =& DAORegistry::getDAO('CountryDAO');
973  $country = null;
974  if ($user->getCountry() != '') {
975  $country = $countryDao->getCountry($user->getCountry());
976  }
977  $templateMgr->assign('country', $country);
978 
979  $templateMgr->assign('userInterests', $user->getInterestString());
980 
981  $templateMgr->assign_by_ref('user', $user);
982  $templateMgr->assign('localeNames', AppLocale::getAllLocales());
983  $templateMgr->assign('helpTopicId', 'journal.roles.index');
984  $templateMgr->display('sectionEditor/userProfile.tpl');
985  }
986  }
987 
993  function viewMetadata($args, &$request) {
994  $articleId = (int) array_shift($args);
995  $journal =& $request->getJournal();
996 
997  $this->validate($articleId);
998  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_AUTHOR);
1000  $this->setupTemplate(true, $articleId, 'summary');
1001 
1003  }
1004 
1010  function saveMetadata($args, &$request) {
1011  $articleId = $request->getUserVar('articleId');
1012  $this->validate($articleId);
1013  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_AUTHOR);
1015  $this->setupTemplate(true, $articleId, 'summary');
1016 
1018  $request->redirect(null, null, 'submission', $articleId);
1019  }
1020  }
1021 
1027  function removeArticleCoverPage($args, &$request) {
1028  $articleId = isset($args[0]) ? (int)$args[0] : 0;
1029  $this->validate($articleId);
1030 
1031  $formLocale = $args[1];
1032  if (!AppLocale::isLocaleValid($formLocale)) {
1033  $request->redirect(null, null, 'viewMetadata', $articleId);
1034  }
1035 
1038  $request->redirect(null, null, 'viewMetadata', $articleId);
1039  }
1040  }
1041 
1042  //
1043  // Review Form
1044  //
1045 
1051  function previewReviewForm($args, &$request) {
1052  parent::validate();
1053  $this->setupTemplate(true);
1054 
1055  $reviewId = (int) array_shift($args);
1056  $reviewFormId = (int) array_shift($args);
1057 
1058  $journal =& $request->getJournal();
1059  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
1060  $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_JOURNAL, $journal->getId());
1061  $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
1062  $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
1063  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
1064  $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
1065 
1066  $templateMgr =& TemplateManager::getManager();
1067  $templateMgr->assign('pageTitle', 'manager.reviewForms.preview');
1068  $templateMgr->assign_by_ref('reviewForm', $reviewForm);
1069  $templateMgr->assign('reviewFormElements', $reviewFormElements);
1070  $templateMgr->assign('reviewId', $reviewId);
1071  $templateMgr->assign('articleId', $reviewAssignment->getSubmissionId());
1072  //$templateMgr->assign('helpTopicId','journal.managementPages.reviewForms');
1073  $templateMgr->display('sectionEditor/previewReviewForm.tpl');
1074  }
1075 
1081  function clearReviewForm($args, &$request) {
1082  $articleId = isset($args[0]) ? (int) $args[0] : 0;
1083  $reviewId = isset($args[1]) ? (int) $args[1] : null;
1084  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1086 
1088 
1089  $request->redirect(null, null, 'submissionReview', $articleId);
1090  }
1091 
1097  function selectReviewForm($args, &$request) {
1098  $articleId = isset($args[0]) ? (int) $args[0] : 0;
1099  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1101 
1102  $reviewId = isset($args[1]) ? (int) $args[1] : null;
1103  $reviewFormId = isset($args[2]) ? (int) $args[2] : null;
1104 
1105  if ($reviewFormId != null) {
1106  SectionEditorAction::addReviewForm($submission, $reviewId, $reviewFormId);
1107  $request->redirect(null, null, 'submissionReview', $articleId);
1108  } else {
1109  $journal =& $request->getJournal();
1110  $rangeInfo =& $this->getRangeInfo('reviewForms');
1111  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
1112  $reviewForms =& $reviewFormDao->getActiveByAssocId(ASSOC_TYPE_JOURNAL, $journal->getId(), $rangeInfo);
1113  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
1114  $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
1115 
1116  $this->setupTemplate(true, $articleId, 'review');
1117  $templateMgr =& TemplateManager::getManager();
1118 
1119  $templateMgr->assign('articleId', $articleId);
1120  $templateMgr->assign('reviewId', $reviewId);
1121  $templateMgr->assign('assignedReviewFormId', $reviewAssignment->getReviewFormId());
1122  $templateMgr->assign_by_ref('reviewForms', $reviewForms);
1123  //$templateMgr->assign('helpTopicId','journal.managementPages.reviewForms');
1124  $templateMgr->display('sectionEditor/selectReviewForm.tpl');
1125  }
1126  }
1127 
1133  function viewReviewFormResponse($args, &$request) {
1134  $articleId = (int) array_shift($args);
1135  $reviewId = (int) array_shift($args);
1136 
1137  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1138  $this->setupTemplate(true, $articleId, 'editing');
1139 
1141  }
1142 
1143  //
1144  // Editor Review
1145  //
1146 
1152  function editorReview($args, $request) {
1153  $articleId = $request->getUserVar('articleId');
1154  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1156 
1157  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
1158 
1159  $redirectTarget = 'submissionReview';
1160 
1161  // If the Upload button was pressed.
1162  $submit = $request->getUserVar('submit');
1163  if ($submit != null) {
1165  }
1166 
1167  if ($request->getUserVar('setCopyeditFile')) {
1168  // If the Send To Copyedit button was pressed
1169  $file = explode(',', $request->getUserVar('editorDecisionFile'));
1170  if (isset($file[0]) && isset($file[1])) {
1171  $round = $submission->getCurrentRound();
1172  if ($submission->getMostRecentEditorDecisionComment()) {
1173  // The conditions are met for being able
1174  // to send a file to copyediting.
1175  SectionEditorAction::setCopyeditFile($submission, $file[0], $file[1], $request);
1176  }
1177  $redirectTarget = 'submissionEditing';
1178  }
1179 
1180  } else if ($request->getUserVar('resubmit')) {
1181  // If the Resubmit button was pressed
1182  $file = explode(',', $request->getUserVar('editorDecisionFile'));
1183  if (isset($file[0]) && isset($file[1])) {
1184  SectionEditorAction::resubmitFile($submission, $file[0], $file[1], $request);
1185  }
1186  }
1187 
1188  $request->redirect(null, null, $redirectTarget, $articleId);
1189  }
1190 
1191  //
1192  // Copyedit
1193  //
1194 
1200  function selectCopyeditor($args, $request) {
1201  $articleId = (int) array_shift($args);
1202  $userId = (int) array_shift($args);
1203 
1204  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1205  $journal =& $request->getJournal();
1207 
1208  $roleDao =& DAORegistry::getDAO('RoleDAO');
1209 
1210  if ($roleDao->userHasRole($journal->getId(), $userId, ROLE_ID_COPYEDITOR)) {
1212  $request->redirect(null, null, 'submissionEditing', $articleId);
1213  } else {
1214  $this->setupTemplate(true, $articleId, 'editing');
1215 
1216  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
1217 
1218  $searchType = null;
1219  $searchMatch = null;
1220  $search = $searchQuery = $request->getUserVar('search');
1221  $searchInitial = $request->getUserVar('searchInitial');
1222  if (!empty($search)) {
1223  $searchType = $request->getUserVar('searchField');
1224  $searchMatch = $request->getUserVar('searchMatch');
1225 
1226  } elseif (!empty($searchInitial)) {
1227  $searchInitial = String::strtoupper($searchInitial);
1228  $searchType = USER_FIELD_INITIAL;
1229  $search = $searchInitial;
1230  }
1231 
1232  $copyeditors = $roleDao->getUsersByRoleId(ROLE_ID_COPYEDITOR, $journal->getId(), $searchType, $search, $searchMatch);
1233  $copyeditorStatistics = $sectionEditorSubmissionDao->getCopyeditorStatistics($journal->getId());
1234 
1235  $templateMgr =& TemplateManager::getManager();
1236 
1237  $templateMgr->assign('searchField', $searchType);
1238  $templateMgr->assign('searchMatch', $searchMatch);
1239  $templateMgr->assign('search', $searchQuery);
1240  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
1241 
1242  $templateMgr->assign_by_ref('users', $copyeditors);
1243  $templateMgr->assign('currentUser', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
1244  $templateMgr->assign_by_ref('statistics', $copyeditorStatistics);
1245  $templateMgr->assign('pageSubTitle', 'editor.article.selectCopyeditor');
1246  $templateMgr->assign('pageTitle', 'user.role.copyeditors');
1247  $templateMgr->assign('actionHandler', 'selectCopyeditor');
1248  $templateMgr->assign('fieldOptions', array(
1249  USER_FIELD_FIRSTNAME => 'user.firstName',
1250  USER_FIELD_LASTNAME => 'user.lastName',
1251  USER_FIELD_USERNAME => 'user.username',
1252  USER_FIELD_EMAIL => 'user.email'
1253  ));
1254  $templateMgr->assign('articleId', $articleId);
1255 
1256  $templateMgr->assign('helpTopicId', 'journal.roles.copyeditor');
1257  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
1258  $templateMgr->display('sectionEditor/selectUser.tpl');
1259  }
1260  }
1261 
1267  function notifyCopyeditor($args, $request) {
1268  $articleId = (int) $request->getUserVar('articleId');
1269  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1271 
1272  $send = $request->getUserVar('send')?true:false;
1273  $this->setupTemplate(true, $articleId, 'editing');
1274 
1275  if (SectionEditorAction::notifyCopyeditor($submission, $send, $request)) {
1276  $request->redirect(null, null, 'submissionEditing', $articleId);
1277  }
1278  }
1279 
1285  function initiateCopyedit($args, $request) {
1286  $articleId = (int) $request->getUserVar('articleId');
1287  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1288 
1290  $request->redirect(null, null, 'submissionEditing', $articleId);
1291  }
1292 
1298  function thankCopyeditor($args, $request) {
1299  $articleId = (int) $request->getUserVar('articleId');
1300  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1301  $send = $request->getUserVar('send')?true:false;
1302  $this->setupTemplate(true, $articleId, 'editing');
1303 
1304  if (SectionEditorAction::thankCopyeditor($this->submission, $send, $request)) {
1305  $request->redirect(null, null, 'submissionEditing', $articleId);
1306  }
1307  }
1308 
1314  function notifyAuthorCopyedit($args, $request) {
1315  $articleId = (int) $request->getUserVar('articleId');
1316  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1317  $send = $request->getUserVar('send')?true:false;
1318  $this->setupTemplate(true, $articleId, 'editing');
1319 
1320  if (SectionEditorAction::notifyAuthorCopyedit($this->submission, $send, $request)) {
1321  $request->redirect(null, null, 'submissionEditing', $articleId);
1322  }
1323  }
1324 
1330  function thankAuthorCopyedit($args, $request) {
1331  $articleId = (int) $request->getUserVar('articleId');
1332  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1333  $send = $request->getUserVar('send')?true:false;
1334  $this->setupTemplate(true, $articleId, 'editing');
1335 
1336  if (SectionEditorAction::thankAuthorCopyedit($this->submission, $send, $request)) {
1337  $request->redirect(null, null, 'submissionEditing', $articleId);
1338  }
1339  }
1340 
1346  function notifyFinalCopyedit($args, $request) {
1347  $articleId = (int) $request->getUserVar('articleId');
1348  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1349  $send = $request->getUserVar('send')?true:false;
1350  $this->setupTemplate(true, $articleId, 'editing');
1351 
1352  if (SectionEditorAction::notifyFinalCopyedit($this->submission, $send, $request)) {
1353  $request->redirect(null, null, 'submissionEditing', $articleId);
1354  }
1355  }
1356 
1362  function completeCopyedit($args, $request) {
1363  $articleId = (int) $request->getUserVar('articleId');
1364  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1366  $request->redirect(null, null, 'submissionEditing', $articleId);
1367  }
1368 
1374  function completeFinalCopyedit($args, $request) {
1375  $articleId = (int) $request->getUserVar('articleId');
1376  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1378  $request->redirect(null, null, 'submissionEditing', $articleId);
1379  }
1380 
1386  function thankFinalCopyedit($args, $request) {
1387  $articleId = $request->getUserVar('articleId');
1388  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1389  $send = $request->getUserVar('send')?true:false;
1390  $this->setupTemplate(true, $articleId, 'editing');
1391 
1392  if (SectionEditorAction::thankFinalCopyedit($this->submission, $send, $request)) {
1393  $request->redirect(null, null, 'submissionEditing', $articleId);
1394  }
1395  }
1396 
1402  function uploadReviewVersion($args, $request) {
1403  $articleId = $request->getUserVar('articleId');
1404  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1406  $request->redirect(null, null, 'submissionReview', $articleId);
1407  }
1408 
1414  function uploadCopyeditVersion($args, $request) {
1415  $articleId = $request->getUserVar('articleId');
1416  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1417  $copyeditStage = $request->getUserVar('copyeditStage');
1419 
1420  $request->redirect(null, null, 'submissionEditing', $articleId);
1421  }
1422 
1428  function addSuppFile($args, $request) {
1429  $articleId = (int) array_shift($args);
1430  $journal =& $request->getJournal();
1431 
1432  $this->validate($articleId);
1434  $this->setupTemplate(true, $articleId, 'summary');
1435 
1436  import('classes.submission.form.SuppFileForm');
1437 
1438  $submitForm = new SuppFileForm($submission, $journal);
1439 
1440  if ($submitForm->isLocaleResubmit()) {
1441  $submitForm->readInputData();
1442  } else {
1443  $submitForm->initData();
1444  }
1445  $submitForm->display();
1446  }
1447 
1453  function editSuppFile($args, $request) {
1454  $articleId = (int) array_shift($args);
1455  $suppFileId = (int) array_shift($args);
1456  $journal =& $request->getJournal();
1457 
1458  $this->validate($articleId);
1460 
1461  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
1462  $suppFile =& $suppFileDao->getSuppFile($suppFileId, $articleId);
1463  if (!$suppFile) {
1464  $request->redirect(null, null, 'submissionEditing', $articleId);
1465  }
1466 
1467  $this->setupTemplate(true, $articleId, 'summary');
1468 
1469  import('classes.submission.form.SuppFileForm');
1470  $submitForm = new SuppFileForm($submission, $journal, $suppFileId);
1471  if ($submitForm->isLocaleResubmit()) {
1472  $submitForm->readInputData();
1473  } else {
1474  $submitForm->initData();
1475  }
1476  $submitForm->display();
1477  }
1478 
1484  function setSuppFileVisibility($args, $request) {
1485  $articleId = (int) $request->getUserVar('articleId');
1486  $this->validate($articleId);
1488 
1489  $suppFileId = (int) $request->getUserVar('fileId');
1490  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
1491  $suppFile = $suppFileDao->getSuppFile($suppFileId, $articleId);
1492 
1493  if (isset($suppFile) && $suppFile != null) {
1494  $suppFile->setShowReviewers($request->getUserVar('show')==1?1:0);
1495  $suppFileDao->updateSuppFile($suppFile);
1496  }
1497  $request->redirect(null, null, 'submissionReview', $articleId);
1498  }
1499 
1505  function saveSuppFile($args, $request) {
1506  $articleId = $request->getUserVar('articleId');
1507  $this->validate($articleId);
1508  $this->setupTemplate(true, $articleId, 'summary');
1510 
1511  $suppFileId = (int) array_shift($args);
1512  $journal =& $request->getJournal();
1513 
1514  import('classes.submission.form.SuppFileForm');
1515 
1516  $submitForm = new SuppFileForm($submission, $journal, $suppFileId);
1517  $submitForm->readInputData();
1518 
1519  if ($submitForm->validate()) {
1520  $submitForm->execute();
1521 
1522  // Send a notification to associated users
1523  import('classes.notification.NotificationManager');
1524  $notificationManager = new NotificationManager();
1525  $articleDao =& DAORegistry::getDAO('ArticleDAO');
1526  $article =& $articleDao->getArticle($articleId);
1527  $notificationUsers = $article->getAssociatedUserIds(true, false);
1528  foreach ($notificationUsers as $userRole) {
1529  $notificationManager->createNotification(
1530  $request, $userRole['id'], NOTIFICATION_TYPE_SUPP_FILE_MODIFIED,
1531  $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()
1532  );
1533  }
1534 
1535  $request->redirect(null, null, $this->_getFrom(), $articleId);
1536  } else {
1537  $submitForm->display();
1538  }
1539  }
1540 
1546  function deleteArticleFile($args, &$request) {
1547  $articleId = (int) array_shift($args);
1548  $fileId = (int) array_shift($args);
1549  $revisionId = (int) array_shift($args);
1550 
1551  $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
1552  SectionEditorAction::deleteArticleFile($this->submission, $fileId, $revisionId);
1553 
1554  $request->redirect(null, null, 'submissionReview', $articleId);
1555  }
1556 
1562  function deleteSuppFile($args, $request) {
1563  $articleId = (int) array_shift($args);
1564  $suppFileId = (int) array_shift($args);
1565  $this->validate($articleId);
1566  SectionEditorAction::deleteSuppFile($this->submission, $suppFileId);
1567  $request->redirect(null, null, $this->_getFrom(), $articleId);
1568  }
1569 
1575  function archiveSubmission($args, $request) {
1576  $articleId = (int) array_shift($args);
1577  $this->validate($articleId);
1579  $request->redirect(null, null, 'submission', $articleId);
1580  }
1581 
1587  function restoreToQueue($args, $request) {
1588  $articleId = (int) array_shift($args);
1589  $this->validate($articleId);
1591  $request->redirect(null, null, 'submissionEditing', $articleId);
1592  }
1593 
1599  function unsuitableSubmission($args, $request) {
1600  $articleId = $request->getUserVar('articleId');
1601  $this->validate($articleId);
1602  $send = $request->getUserVar('send')?true:false;
1603  $this->setupTemplate(true, $articleId, 'summary');
1604 
1605  if (SectionEditorAction::unsuitableSubmission($this->submission, $send, $request)) {
1606  $request->redirect(null, null, 'submission', $articleId);
1607  }
1608  }
1609 
1614  function updateSection($args, &$request) {
1615  $articleId = (int) array_shift($args);
1616  $this->validate($articleId);
1617  SectionEditorAction::updateSection($this->submission, $request->getUserVar('section'));
1618  $request->redirect(null, null, 'submission', $articleId);
1619  }
1620 
1626  function updateCommentsStatus($args, &$request) {
1627  $articleId = (int) array_shift($args);
1628  $this->validate($articleId);
1629  SectionEditorAction::updateCommentsStatus($this->submission, $request->getUserVar('commentsStatus'));
1630  $request->redirect(null, null, 'submission', $articleId);
1631  }
1632 
1633  //
1634  // Layout Editing
1635  //
1636 
1642  function uploadLayoutFile($args, &$request) {
1643  $layoutFileType = $request->getUserVar('layoutFileType');
1644  if ($layoutFileType == 'submission') {
1645  $this->_uploadLayoutVersion($request);
1646 
1647  } else if ($layoutFileType == 'galley') {
1648  $this->_uploadGalley('layoutFile', $request);
1649 
1650  } else if ($layoutFileType == 'supp') {
1651  $this->_uploadSuppFile('layoutFile', $request);
1652 
1653  } else {
1654  $request->redirect(null, null, $this->_getFrom(), $request->getUserVar('articleId'));
1655  }
1656  }
1657 
1662  function _uploadLayoutVersion(&$request) {
1663  $articleId = (int) $request->getUserVar('articleId');
1664  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1666  $request->redirect(null, null, 'submissionEditing', $articleId);
1667  }
1668 
1674  function deleteArticleImage($args, &$request) {
1675  $articleId = (int) array_shift($args);
1676  $galleyId = (int) array_shift($args);
1677  $fileId = (int) array_shift($args);
1678  $revision = (int) array_shift($args);
1679  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1680  SectionEditorAction::deleteArticleImage($this->submission, $fileId, $revision);
1681  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1682  }
1683 
1689  function assignLayoutEditor($args, $request) {
1690  $articleId = (int) array_shift($args);
1691  $editorId = (int) array_shift($args);
1692  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1693  $journal =& $request->getJournal();
1695 
1696  $roleDao =& DAORegistry::getDAO('RoleDAO');
1697  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
1698 
1699  if ($editorId && $roleDao->userHasRole($journal->getId(), $editorId, ROLE_ID_LAYOUT_EDITOR)) {
1701  $request->redirect(null, null, 'submissionEditing', $articleId);
1702  } else {
1703  $searchType = null;
1704  $searchMatch = null;
1705  $search = $searchQuery = $request->getUserVar('search');
1706  $searchInitial = $request->getUserVar('searchInitial');
1707  if (!empty($search)) {
1708  $searchType = $request->getUserVar('searchField');
1709  $searchMatch = $request->getUserVar('searchMatch');
1710 
1711  } elseif (!empty($searchInitial)) {
1712  $searchInitial = String::strtoupper($searchInitial);
1713  $searchType = USER_FIELD_INITIAL;
1714  $search = $searchInitial;
1715  }
1716 
1717  $layoutEditors = $roleDao->getUsersByRoleId(ROLE_ID_LAYOUT_EDITOR, $journal->getId(), $searchType, $search, $searchMatch);
1718 
1719  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
1720  $layoutEditorStatistics = $sectionEditorSubmissionDao->getLayoutEditorStatistics($journal->getId());
1721 
1722  $this->setupTemplate(true, $articleId, 'editing');
1723 
1724  $templateMgr =& TemplateManager::getManager();
1725 
1726  $templateMgr->assign('searchField', $searchType);
1727  $templateMgr->assign('searchMatch', $searchMatch);
1728  $templateMgr->assign('search', $searchQuery);
1729  $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial'));
1730  $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
1731 
1732  $templateMgr->assign('pageTitle', 'user.role.layoutEditors');
1733  $templateMgr->assign('pageSubTitle', 'editor.article.selectLayoutEditor');
1734  $templateMgr->assign('actionHandler', 'assignLayoutEditor');
1735  $templateMgr->assign('articleId', $articleId);
1736  $templateMgr->assign_by_ref('users', $layoutEditors);
1737 
1738  $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
1739  if ($layoutSignoff) {
1740  $templateMgr->assign('currentUser', $layoutSignoff->getUserId());
1741  }
1742 
1743  $templateMgr->assign('fieldOptions', Array(
1744  USER_FIELD_FIRSTNAME => 'user.firstName',
1745  USER_FIELD_LASTNAME => 'user.lastName',
1746  USER_FIELD_USERNAME => 'user.username',
1747  USER_FIELD_EMAIL => 'user.email'
1748  ));
1749  $templateMgr->assign('statistics', $layoutEditorStatistics);
1750  $templateMgr->assign('helpTopicId', 'journal.roles.layoutEditor');
1751  $templateMgr->display('sectionEditor/selectUser.tpl');
1752  }
1753  }
1754 
1760  function notifyLayoutEditor($args, $request) {
1761  $articleId = (int) $request->getUserVar('articleId');
1762  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1763  $send = $request->getUserVar('send')?true:false;
1764  $this->setupTemplate(true, $articleId, 'editing');
1765  if (SectionEditorAction::notifyLayoutEditor($this->submission, $send, $request)) {
1766  $request->redirect(null, null, 'submissionEditing', $articleId);
1767  }
1768  }
1769 
1775  function thankLayoutEditor($args, $request) {
1776  $articleId = $request->getUserVar('articleId');
1777  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1779 
1780  $send = $request->getUserVar('send')?true:false;
1781  $this->setupTemplate(true, $articleId, 'editing');
1782 
1783  if (SectionEditorAction::thankLayoutEditor($submission, $send, $request)) {
1784  $request->redirect(null, null, 'submissionEditing', $articleId);
1785  }
1786  }
1787 
1793  function _uploadGalley($fileName = null, $request) {
1794  $articleId = $request->getUserVar('articleId');
1795  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1796 
1797  import('classes.submission.form.ArticleGalleyForm');
1798  $galleyForm = new ArticleGalleyForm($articleId);
1799  $galleyId = $galleyForm->execute($fileName, $request->getUserVar('createRemote'));
1800 
1801  Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
1802  }
1803 
1809  function editGalley($args, $request) {
1810  $articleId = (int) array_shift($args);
1811  $galleyId = (int) array_shift($args);
1812  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1813 
1814  $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
1815  $galley =& $galleyDao->getGalley($galleyId, $articleId);
1816  if (!$galley) {
1817  $request->redirect(null, null, 'submissionEditing', $articleId);
1818  }
1819 
1820  $this->setupTemplate(true, $articleId, 'editing');
1821 
1822  import('classes.submission.form.ArticleGalleyForm');
1823  $submitForm = new ArticleGalleyForm($articleId, $galleyId);
1824  if ($submitForm->isLocaleResubmit()) {
1825  $submitForm->readInputData();
1826  } else {
1827  $submitForm->initData();
1828  }
1829  $submitForm->display();
1830  }
1831 
1837  function saveGalley($args, $request) {
1838  $articleId = (int) array_shift($args);
1839  $galleyId = (int) array_shift($args);
1840  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1841  $this->setupTemplate(true, $articleId, 'editing');
1843 
1844  import('classes.submission.form.ArticleGalleyForm');
1845 
1846  $submitForm = new ArticleGalleyForm($articleId, $galleyId);
1847 
1848  $submitForm->readInputData();
1849  if ($submitForm->validate()) {
1850  $submitForm->execute();
1851 
1852  // Send a notification to associated users
1853  import('classes.notification.NotificationManager');
1854  $notificationManager = new NotificationManager();
1855  $articleDao =& DAORegistry::getDAO('ArticleDAO');
1856  $article =& $articleDao->getArticle($articleId);
1857  $notificationUsers = $article->getAssociatedUserIds(true, false);
1858  foreach ($notificationUsers as $userRole) {
1859  $notificationManager->createNotification(
1860  $request, $userRole['id'], NOTIFICATION_TYPE_GALLEY_MODIFIED,
1861  $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()
1862  );
1863  }
1864 
1865  if ($request->getUserVar('uploadImage')) {
1866  $submitForm->uploadImage();
1867  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1868  } else if(($deleteImage = $request->getUserVar('deleteImage')) && count($deleteImage) == 1) {
1869  list($imageId) = array_keys($deleteImage);
1870  $submitForm->deleteImage($imageId);
1871  $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
1872  }
1873  $request->redirect(null, null, 'submissionEditing', $articleId);
1874  } else {
1875  $submitForm->display();
1876  }
1877  }
1878 
1884  function orderGalley($args, &$request) {
1885  $articleId = (int) $request->getUserVar('articleId');
1886  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1887  SectionEditorAction::orderGalley($this->submission, $request->getUserVar('galleyId'), $request->getUserVar('d'));
1888  $request->redirect(null, null, 'submissionEditing', $articleId);
1889  }
1890 
1896  function deleteGalley($args, &$request) {
1897  $articleId = (int) array_shift($args);
1898  $galleyId = (int) array_shift($args);
1899  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1900  SectionEditorAction::deleteGalley($this->submission, $galleyId);
1901  $request->redirect(null, null, 'submissionEditing', $articleId);
1902  }
1903 
1909  function proofGalley($args, &$request) {
1910  $articleId = (int) array_shift($args);
1911  $galleyId = (int) array_shift($args);
1912  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1913  $this->setupTemplate();
1914 
1915  $templateMgr =& TemplateManager::getManager();
1916  $templateMgr->assign('articleId', $articleId);
1917  $templateMgr->assign('galleyId', $galleyId);
1918  $templateMgr->display('submission/layout/proofGalley.tpl');
1919  }
1920 
1926  function proofGalleyTop($args, &$request) {
1927  $articleId = (int) array_shift($args);
1928  $galleyId = (int) array_shift($args);
1929  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1930  $this->setupTemplate();
1931 
1932  $templateMgr =& TemplateManager::getManager();
1933  $templateMgr->assign('articleId', $articleId);
1934  $templateMgr->assign('galleyId', $galleyId);
1935  $templateMgr->assign('backHandler', 'submissionEditing');
1936  $templateMgr->display('submission/layout/proofGalleyTop.tpl');
1937  }
1938 
1944  function proofGalleyFile($args, &$request) {
1945  $articleId = (int) array_shift($args);
1946  $galleyId = (int) array_shift($args);
1947  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
1948 
1949  $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
1950  $galley =& $galleyDao->getGalley($galleyId, $articleId);
1951 
1952  import('classes.file.ArticleFileManager'); // FIXME
1953 
1954  if (isset($galley)) {
1955  if ($galley->isHTMLGalley()) {
1956  $templateMgr =& TemplateManager::getManager();
1957  $templateMgr->assign_by_ref('galley', $galley);
1958  if ($galley->isHTMLGalley() && $styleFile =& $galley->getStyleFile()) {
1959  $templateMgr->addStyleSheet(Request::url(null, 'article', 'viewFile', array(
1960  $articleId, $galleyId, $styleFile->getFileId()
1961  )));
1962  }
1963  $templateMgr->display('submission/layout/proofGalleyHTML.tpl');
1964 
1965  } else {
1966  // View non-HTML file inline
1967  $this->viewFile(array($articleId, $galley->getFileId()), $request);
1968  }
1969  }
1970  }
1971 
1977  function _uploadSuppFile($fileName = null, $request) {
1978  $articleId = $request->getUserVar('articleId');
1979  $this->validate($articleId);
1981  $journal =& $request->getJournal();
1982 
1983  import('classes.submission.form.SuppFileForm');
1984 
1985  $suppFileForm = new SuppFileForm($submission, $journal);
1986  $suppFileForm->setData('title', array($submission->getLocale() => __('common.untitled')));
1987  $suppFileId = $suppFileForm->execute($fileName, $request->getUserVar('createRemote'));
1988 
1989  $request->redirect(null, null, 'editSuppFile', array($articleId, $suppFileId));
1990  }
1991 
1997  function orderSuppFile($args, &$request) {
1998  $articleId = $request->getUserVar('articleId');
1999  $this->validate($articleId);
2000  SectionEditorAction::orderSuppFile($this->submission, $request->getUserVar('suppFileId'), $request->getUserVar('d'));
2001  $request->redirect(null, null, 'submissionEditing', $articleId);
2002  }
2003 
2004 
2005  //
2006  // Submission History (FIXME Move to separate file?)
2007  //
2008 
2014  function submissionEventLog($args, &$request) {
2015  $articleId = (int) array_shift($args);
2016  $logId = (int) array_shift($args);
2017  $this->validate($articleId);
2019  $this->setupTemplate(true, $articleId, 'history');
2020 
2021  $templateMgr =& TemplateManager::getManager();
2022 
2023  $templateMgr->assign('isEditor', Validation::isEditor());
2024  $templateMgr->assign_by_ref('submission', $submission);
2025 
2026  if ($logId) {
2027  $logDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2028  $logEntry =& $logDao->getById($logId, ASSOC_TYPE_ARTICLE, $articleId);
2029  }
2030 
2031  if (isset($logEntry)) {
2032  $templateMgr->assign('logEntry', $logEntry);
2033  $templateMgr->display('sectionEditor/submissionEventLogEntry.tpl');
2034 
2035  } else {
2036  $rangeInfo =& $this->getRangeInfo('eventLogEntries');
2037  $eventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2038  $eventLogEntries =& $eventLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
2039  $templateMgr->assign('eventLogEntries', $eventLogEntries);
2040  $templateMgr->display('sectionEditor/submissionEventLog.tpl');
2041  }
2042  }
2043 
2049  function clearSubmissionEventLog($args, &$request) {
2050  $articleId = (int) array_shift($args);
2051  $logId = (int) array_shift($args);
2052  $this->validate($articleId);
2053  $logDao =& DAORegistry::getDAO('ArticleEventLogDAO');
2054  if ($logId) {
2055  $logDao->deleteObject($logId, ASSOC_TYPE_ARTICLE, $articleId);
2056  } else {
2057  $logDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2058  }
2059  $request->redirect(null, null, 'submissionEventLog', $articleId);
2060  }
2061 
2067  function submissionEmailLog($args, $request) {
2068  $articleId = (int) array_shift($args);
2069  $logId = (int) array_shift($args);
2070 
2071  $this->validate($articleId);
2073  $this->setupTemplate(true, $articleId, 'history');
2074 
2075  $templateMgr =& TemplateManager::getManager();
2076 
2077  $templateMgr->assign('isEditor', Validation::isEditor());
2078  $templateMgr->assign_by_ref('submission', $submission);
2079 
2080  $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
2081  import('classes.file.ArticleFileManager');
2082  $templateMgr->assign('attachments', $articleFileDao->getArticleFilesByAssocId($logId, ARTICLE_FILE_ATTACHMENT));
2083 
2084  if ($logId) {
2085  $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2086  $logEntry =& $logDao->getById($logId, ASSOC_TYPE_ARTICLE, $articleId);
2087  }
2088 
2089  if (isset($logEntry)) {
2090  $templateMgr->assign_by_ref('logEntry', $logEntry);
2091  $templateMgr->display('sectionEditor/submissionEmailLogEntry.tpl');
2092  } else {
2093  $rangeInfo =& $this->getRangeInfo('emailLogEntries');
2094 
2095  $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2096  $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
2097  $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
2098  $templateMgr->display('sectionEditor/submissionEmailLog.tpl');
2099  }
2100  }
2101 
2107  function clearSubmissionEmailLog($args, &$request) {
2108  $articleId = (int) array_shift($args);
2109  $logId = (int) array_shift($args);
2110  $this->validate($articleId);
2111 
2112  $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
2113  if ($logId) {
2114  $logDao->deleteObject($logId, ASSOC_TYPE_ARTICLE, $articleId);
2115  } else {
2116  $logDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2117  }
2118  $request->redirect(null, null, 'submissionEmailLog', $articleId);
2119  }
2120 
2121  //
2122  // Submission Notes Functions
2123  //
2124 
2130  function addSubmissionNote($args, $request) {
2131  $articleId = (int) $request->getUserVar('articleId');
2132  $this->validate($articleId);
2133  SectionEditorAction::addSubmissionNote($articleId, $request);
2134  $request->redirect(null, null, 'submissionNotes', $articleId);
2135  }
2136 
2143  function removeSubmissionNote($args, $request) {
2144  $articleId = (int) $request->getUserVar('articleId');
2145  $noteId = (int) $request->getUserVar('noteId');
2146  $fileId = (int) $request->getUserVar('fileId');
2147  $this->validate($articleId);
2148  SectionEditorAction::removeSubmissionNote($articleId, $noteId, $fileId);
2149  $request->redirect(null, null, 'submissionNotes', $articleId);
2150  }
2151 
2158  function updateSubmissionNote($args, $request) {
2159  $articleId = (int) $request->getUserVar('articleId');
2160  $this->validate($articleId);
2161  SectionEditorAction::updateSubmissionNote($articleId, $request);
2162  $request->redirect(null, null, 'submissionNotes', $articleId);
2163  }
2164 
2170  function clearAllSubmissionNotes($args, &$request) {
2171  $articleId = (int) $request->getUserVar('articleId');
2172  $this->validate($articleId);
2174  $request->redirect(null, null, 'submissionNotes', $articleId);
2175  }
2176 
2182  function submissionNotes($args, &$request) {
2183  $articleId = (int) array_shift($args);
2184  $noteViewType = array_shift($args); // May be null/empty
2185  $noteId = (int) array_shift($args);
2186 
2187  $this->validate($articleId);
2188  $this->setupTemplate(true, $articleId, 'history');
2190 
2191  $rangeInfo =& $this->getRangeInfo('submissionNotes');
2192  $noteDao =& DAORegistry::getDAO('NoteDAO');
2193 
2194  // submission note edit
2195  if ($noteViewType == 'edit') {
2196  $note = $noteDao->getById($noteId);
2197  }
2198 
2199  $templateMgr =& TemplateManager::getManager();
2200 
2201  $templateMgr->assign('articleId', $articleId);
2202  $templateMgr->assign_by_ref('submission', $submission);
2203  $templateMgr->assign('noteViewType', $noteViewType);
2204  if (isset($note)) {
2205  $templateMgr->assign_by_ref('articleNote', $note);
2206  }
2207 
2208  if ($noteViewType == 'edit' || $noteViewType == 'add') {
2209  $templateMgr->assign('showBackLink', true);
2210  } else {
2211  $submissionNotes =& $noteDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
2212  $templateMgr->assign_by_ref('submissionNotes', $submissionNotes);
2213  }
2214 
2215  $templateMgr->display('sectionEditor/submissionNotes.tpl');
2216  }
2217 
2218 
2219  //
2220  // Misc
2221  //
2222 
2228  function downloadFile($args, &$request) {
2229  $articleId = (int) array_shift($args);
2230  $fileId = (int) array_shift($args);
2231  $revision = array_shift($args); // May be null
2232 
2233  $this->validate($articleId);
2234  if (!SectionEditorAction::downloadFile($articleId, $fileId, $revision)) {
2235  $request->redirect(null, null, 'submission', $articleId);
2236  }
2237  }
2238 
2244  function viewFile($args, &$request) {
2245  $articleId = (int) array_shift($args);
2246  $fileId = (int) array_shift($args);
2247  $revision = array_shift($args); // May be null
2248 
2249  $this->validate($articleId);
2250  if (!SectionEditorAction::viewFile($articleId, $fileId, $revision)) {
2251  $request->redirect(null, null, 'submission', $articleId);
2252  }
2253  }
2254 
2255 
2256  //
2257  // Proofreading
2258  //
2259 
2265  function selectProofreader($args, $request) {
2266  $articleId = (int) array_shift($args);
2267  $userId = (int) array_shift($args);
2268 
2269  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2270  $journal =& $request->getJournal();
2272 
2273  $roleDao =& DAORegistry::getDAO('RoleDAO');
2274  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2275 
2276  if ($userId && $articleId && $roleDao->userHasRole($journal->getId(), $userId, ROLE_ID_PROOFREADER)) {
2277  import('classes.submission.proofreader.ProofreaderAction');
2279  $request->redirect(null, null, 'submissionEditing', $articleId);
2280  } else {
2281  $this->setupTemplate(true, $articleId, 'editing');
2282 
2283  $searchType = null;
2284  $searchMatch = null;
2285  $search = $searchQuery = $request->getUserVar('search');
2286  $searchInitial = $request->getUserVar('searchInitial');
2287  if (!empty($search)) {
2288  $searchType = $request->getUserVar('searchField');
2289  $searchMatch = $request->getUserVar('searchMatch');
2290 
2291  } elseif (!empty($searchInitial)) {
2292  $searchInitial = String::strtoupper($searchInitial);
2293  $searchType = USER_FIELD_INITIAL;
2294  $search = $searchInitial;
2295  }
2296 
2297  $proofreaders = $roleDao->getUsersByRoleId(ROLE_ID_PROOFREADER, $journal->getId(), $searchType, $search, $searchMatch);
2298 
2299  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
2300  $proofreaderStatistics = $sectionEditorSubmissionDao->getProofreaderStatistics($journal->getId());
2301 
2302  $templateMgr =& TemplateManager::getManager();
2303 
2304  $templateMgr->assign('searchField', $searchType);
2305  $templateMgr->assign('searchMatch', $searchMatch);
2306  $templateMgr->assign('search', $searchQuery);
2307  $templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
2308 
2309  $templateMgr->assign_by_ref('users', $proofreaders);
2310 
2311  $proofSignoff = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2312  if ($proofSignoff) {
2313  $templateMgr->assign('currentUser', $proofSignoff->getUserId());
2314  }
2315  $templateMgr->assign('statistics', $proofreaderStatistics);
2316  $templateMgr->assign('fieldOptions', Array(
2317  USER_FIELD_FIRSTNAME => 'user.firstName',
2318  USER_FIELD_LASTNAME => 'user.lastName',
2319  USER_FIELD_USERNAME => 'user.username',
2320  USER_FIELD_EMAIL => 'user.email'
2321  ));
2322  $templateMgr->assign('articleId', $articleId);
2323  $templateMgr->assign('pageSubTitle', 'editor.article.selectProofreader');
2324  $templateMgr->assign('pageTitle', 'user.role.proofreaders');
2325  $templateMgr->assign('actionHandler', 'selectProofreader');
2326 
2327  $templateMgr->assign('helpTopicId', 'journal.roles.proofreader');
2328  $templateMgr->display('sectionEditor/selectUser.tpl');
2329  }
2330  }
2331 
2337  function notifyAuthorProofreader($args, $request) {
2338  $articleId = (int) $request->getUserVar('articleId');
2339  $send = $request->getUserVar('send');
2340  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2341  $this->setupTemplate(true, $articleId, 'editing');
2342 
2343  import('classes.submission.proofreader.ProofreaderAction');
2344  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_AUTHOR_REQUEST', $request, $send?'':$request->url(null, null, 'notifyAuthorProofreader'))) {
2345  $request->redirect(null, null, 'submissionEditing', $articleId);
2346  }
2347  }
2348 
2354  function thankAuthorProofreader($args, $request) {
2355  $articleId = (int) $request->getUserVar('articleId');
2356  $send = $request->getUserVar('send');
2357  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2358  $this->setupTemplate(true, $articleId, 'editing');
2359 
2360  import('classes.submission.proofreader.ProofreaderAction');
2361  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_AUTHOR_ACK', $request, $send?'':$request->url(null, null, 'thankAuthorProofreader'))) {
2362  $request->redirect(null, null, 'submissionEditing', $articleId);
2363  }
2364  }
2365 
2371  function editorInitiateProofreader($args, &$request) {
2372  $articleId = $request->getUserVar('articleId');
2373  $user =& $request->getUser();
2374  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2375 
2376  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2377  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2378  if (!$signoff->getUserId()) {
2379  $signoff->setUserId($user->getId());
2380  }
2381  $signoff->setDateNotified(Core::getCurrentDate());
2382  $signoffDao->updateObject($signoff);
2383 
2384  $request->redirect(null, null, 'submissionEditing', $articleId);
2385  }
2386 
2392  function editorCompleteProofreader($args, &$request) {
2393  $articleId = $request->getUserVar('articleId');
2394  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2395  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2396  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
2397  $signoff->setDateCompleted(Core::getCurrentDate());
2398  $signoffDao->updateObject($signoff);
2399  $request->redirect(null, null, 'submissionEditing', $articleId);
2400  }
2401 
2407  function notifyProofreader($args, $request) {
2408  $articleId = (int) $request->getUserVar('articleId');
2409  $send = $request->getUserVar('send');
2410  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2411  $this->setupTemplate(true, $articleId, 'editing');
2412 
2413  import('classes.submission.proofreader.ProofreaderAction');
2414  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_REQUEST', $request, $send?'':$request->url(null, null, 'notifyProofreader'))) {
2415  $request->redirect(null, null, 'submissionEditing', $articleId);
2416  }
2417  }
2418 
2424  function thankProofreader($args, $request) {
2425  $articleId = (int) $request->getUserVar('articleId');
2426  $send = $request->getUserVar('send');
2427  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2428  $this->setupTemplate(true, $articleId, 'editing');
2429 
2430  import('classes.submission.proofreader.ProofreaderAction');
2431  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_ACK', $request, $send?'':$request->url(null, null, 'thankProofreader'))) {
2432  $request->redirect(null, null, 'submissionEditing', $articleId);
2433  }
2434  }
2435 
2441  function editorInitiateLayoutEditor($args, &$request) {
2442  $articleId = (int) $request->getUserVar('articleId');
2443  $user =& $request->getUser();
2444  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2445 
2446  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2447  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2448  if (!$signoff->getUserId()) {
2449  $signoff->setUserId($user->getId());
2450  }
2451  $signoff->setDateNotified(Core::getCurrentDate());
2452  $signoff->setDateUnderway(null);
2453  $signoff->setDateCompleted(null);
2454  $signoff->setDateAcknowledged(null);
2455  $signoffDao->updateObject($signoff);
2456 
2457  $request->redirect(null, null, 'submissionEditing', $articleId);
2458  }
2459 
2465  function editorCompleteLayoutEditor($args, &$request) {
2466  $articleId = $request->getUserVar('articleId');
2467  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2468 
2469  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2470  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2471  $signoff->setDateCompleted(Core::getCurrentDate());
2472  $signoffDao->updateObject($signoff);
2473 
2474  $request->redirect(null, null, 'submissionEditing', $articleId);
2475  }
2476 
2482  function notifyLayoutEditorProofreader($args, $request) {
2483  $articleId = (int) $request->getUserVar('articleId');
2484  $send = $request->getUserVar('send');
2485  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2486  $this->setupTemplate(true, $articleId, 'editing');
2487 
2488  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
2489  $signoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
2490  $signoff->setDateNotified(Core::getCurrentDate());
2491  $signoff->setDateUnderway(null);
2492  $signoff->setDateCompleted(null);
2493  $signoff->setDateAcknowledged(null);
2494  $signoffDao->updateObject($signoff);
2495 
2496  import('classes.submission.proofreader.ProofreaderAction');
2497  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_LAYOUT_REQUEST', $request, $send?'':$request->url(null, null, 'notifyLayoutEditorProofreader'))) {
2498  $request->redirect(null, null, 'submissionEditing', $articleId);
2499  }
2500  }
2501 
2507  function thankLayoutEditorProofreader($args, $request) {
2508  $articleId = (int) $request->getUserVar('articleId');
2509  $send = $request->getUserVar('send');
2510  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2511  $this->setupTemplate(true, $articleId, 'editing');
2512 
2513  import('classes.submission.proofreader.ProofreaderAction');
2514  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_LAYOUT_ACK', $request, $send?'':$request->url(null, null, 'thankLayoutEditorProofreader'))) {
2515  $request->redirect(null, null, 'submissionEditing', $articleId);
2516  }
2517  }
2518 
2524  function scheduleForPublication($args, $request) {
2525  $articleId = (int) array_shift($args);
2526  $issueId = (int) $request->getUserVar('issueId');
2527  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2528 
2529  $journal =& $request->getJournal();
2531 
2532  $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
2533  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
2534  $sectionDao =& DAORegistry::getDAO('SectionDAO');
2535  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
2536 
2537  $issueDao =& DAORegistry::getDAO('IssueDAO');
2538  $issue =& $issueDao->getIssueById($issueId, $journal->getId());
2539 
2540  if ($publishedArticle) {
2541  if (!$issue || !$issue->getPublished()) {
2542  $fromIssue =& $issueDao->getIssueById($publishedArticle->getIssueId(), $journal->getId());
2543  if ($fromIssue->getPublished()) {
2544  // Insert article tombstone
2545  import('classes.article.ArticleTombstoneManager');
2546  $articleTombstoneManager = new ArticleTombstoneManager();
2547  $articleTombstoneManager->insertArticleTombstone($submission, $journal);
2548  }
2549  }
2550  }
2551 
2552  import('classes.search.ArticleSearchIndex');
2553  $articleSearchIndex = new ArticleSearchIndex();
2554 
2555  if ($issue) {
2556 
2557  // Schedule against an issue.
2558  if ($publishedArticle) {
2559  $publishedArticle->setIssueId($issueId);
2560  $publishedArticle->setSeq(REALLY_BIG_NUMBER);
2561  $publishedArticleDao->updatePublishedArticle($publishedArticle);
2562 
2563  // Re-index the published article metadata.
2564  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2565  } else {
2566  $publishedArticle = new PublishedArticle();
2567  $publishedArticle->setId($submission->getId());
2568  $publishedArticle->setIssueId($issueId);
2569  $publishedArticle->setDatePublished(Core::getCurrentDate());
2570  $publishedArticle->setSeq(REALLY_BIG_NUMBER);
2571  $publishedArticle->setAccessStatus(ARTICLE_ACCESS_ISSUE_DEFAULT);
2572 
2573  $publishedArticleDao->insertPublishedArticle($publishedArticle);
2574 
2575  // If we're using custom section ordering, and if this is the first
2576  // article published in a section, make sure we enter a custom ordering
2577  // for it. (Default at the end of the list.)
2578  if ($sectionDao->customSectionOrderingExists($issueId)) {
2579  if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) {
2580  $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER);
2581  $sectionDao->resequenceCustomSectionOrders($issueId);
2582  }
2583  }
2584 
2585  // Index the published article metadata and files for the first time.
2586  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2587  $articleSearchIndex->articleFilesChanged($publishedArticle);
2588  }
2589 
2590  } else {
2591  if ($publishedArticle) {
2592  // This was published elsewhere; make sure we don't
2593  // mess up sequencing information.
2594  $issueId = $publishedArticle->getIssueId();
2595  $publishedArticleDao->deletePublishedArticleByArticleId($articleId);
2596 
2597  // Delete the article from the search index.
2598  $articleSearchIndex->articleFileDeleted($articleId);
2599  }
2600  }
2601 
2602  // Resequence the articles.
2603  $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId);
2604 
2605  $submission->stampStatusModified();
2606 
2607  if ($issue && $issue->getPublished()) {
2608  $submission->setStatus(STATUS_PUBLISHED);
2609  // delete article tombstone
2610  $tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO');
2611  $tombstoneDao->deleteByDataObjectId($submission->getId());
2612  } else {
2613  $submission->setStatus(STATUS_QUEUED);
2614  }
2615 
2616  $sectionEditorSubmissionDao->updateSectionEditorSubmission($submission);
2617 
2618  // Call initialize permissions again to check if copyright year needs to be initialized.
2619  $articleDao =& DAORegistry::getDAO('ArticleDAO');
2620  $article = $articleDao->getArticle($articleId);
2621  $article->initializePermissions();
2622  $articleDao->updateLocaleFields($article);
2623 
2624  $articleSearchIndex->articleChangesFinished();
2625 
2626  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2627  }
2628 
2634  function setDatePublished($args, $request) {
2635  $articleId = (int) array_shift($args);
2636  $issueId = (int) $request->getUserVar('issueId');
2637  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2638 
2639  $journal =& $request->getJournal();
2641 
2642  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
2643  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
2644  if ($publishedArticle) {
2645  $datePublished = $request->getUserDateVar('datePublished');
2646  $publishedArticle->setDatePublished($datePublished);
2647  $publishedArticleDao->updatePublishedArticle($publishedArticle);
2648 
2649  // Re-index the published article metadata.
2650  import('classes.search.ArticleSearchIndex');
2651  $articleSearchIndex = new ArticleSearchIndex();
2652  $articleSearchIndex->articleMetadataChanged($publishedArticle);
2653  $articleSearchIndex->articleChangesFinished();
2654  }
2655  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2656  }
2657 
2658  //
2659  // Payments
2660  //
2661 
2667  function waiveSubmissionFee($args, $request) {
2668  $articleId = (int) array_shift($args);
2669  $markAsPaid = $request->getUserVar('markAsPaid');
2670 
2671  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2673  import('classes.payment.ojs.OJSPaymentManager');
2674  $paymentManager = new OJSPaymentManager($request);
2675  $user =& $request->getUser();
2676  $journal =& $request->getJournal();
2677 
2678  $queuedPayment =& $paymentManager->createQueuedPayment(
2679  $journal->getId(),
2680  PAYMENT_TYPE_SUBMISSION,
2681  $markAsPaid ? $submission->getUserId() : $user->getId(),
2682  $articleId,
2683  $markAsPaid ? $journal->getSetting('submissionFee') : 0,
2684  $markAsPaid ? $journal->getSetting('currency') : ''
2685  );
2686 
2687  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2688 
2689  // Since this is a waiver, fulfill the payment immediately
2690  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2691  $request->redirect(null, null, 'submission', array($articleId));
2692  }
2693 
2699  function waiveFastTrackFee($args, &$request) {
2700  $articleId = (int) array_shift($args);
2701  $markAsPaid = $request->getUserVar('markAsPaid');
2702  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2703  $journal =& $request->getJournal();
2705 
2706  import('classes.payment.ojs.OJSPaymentManager');
2707  $paymentManager = new OJSPaymentManager($request);
2708  $user =& $request->getUser();
2709 
2710  $queuedPayment =& $paymentManager->createQueuedPayment(
2711  $journal->getId(),
2712  PAYMENT_TYPE_FASTTRACK,
2713  $markAsPaid ? $submission->getUserId() : $user->getId(),
2714  $articleId,
2715  $markAsPaid ? $journal->getSetting('fastTrackFee') : 0,
2716  $markAsPaid ? $journal->getSetting('currency') : ''
2717  );
2718 
2719  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2720 
2721  // Since this is a waiver, fulfill the payment immediately
2722  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2723  $request->redirect(null, null, 'submission', array($articleId));
2724  }
2725 
2731  function waivePublicationFee($args, $request) {
2732  $articleId = (int) array_shift($args);
2733  $markAsPaid = $request->getUserVar('markAsPaid');
2734  $sendToScheduling = $request->getUserVar('sendToScheduling')?true:false;
2735 
2736  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2737  $journal =& Request::getJournal();
2739 
2740  import('classes.payment.ojs.OJSPaymentManager');
2741  $paymentManager = new OJSPaymentManager($request);
2742  $user =& $request->getUser();
2743 
2744  $queuedPayment =& $paymentManager->createQueuedPayment(
2745  $journal->getId(),
2746  PAYMENT_TYPE_PUBLICATION,
2747  $markAsPaid ? $submission->getUserId() : $user->getId(),
2748  $articleId,
2749  $markAsPaid ? $journal->getSetting('publicationFee') : 0,
2750  $markAsPaid ? $journal->getSetting('currency') : ''
2751  );
2752 
2753  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
2754 
2755  // Since this is a waiver, fulfill the payment immediately
2756  $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid?'ManualPayment':'Waiver');
2757 
2758  if ($sendToScheduling) {
2759  $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
2760  } else {
2761  $request->redirect(null, null, 'submission', array($articleId));
2762  }
2763  }
2764 
2770  function downloadLayoutTemplate($args, &$request) {
2771  $articleId = (int) array_shift($args);
2772  $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
2773 
2774  $journal =& $request->getJournal();
2775  $templates = $journal->getSetting('templates');
2776  import('classes.file.JournalFileManager');
2777  $journalFileManager = new JournalFileManager($journal);
2778  $templateId = (int) array_shift($args);
2779  if ($templateId >= count($templates) || $templateId < 0) $request->redirect(null, 'index');
2780  $template =& $templates[$templateId];
2781 
2782  $filename = "template-$templateId." . $journalFileManager->parseFileExtension($template['originalFilename']);
2783  $journalFileManager->downloadFile($filename, $template['fileType']);
2784  }
2785 }
2786 
2787 ?>
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)