Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
TrackSubmissionHandler.inc.php
1 <?php
2 
16 import('pages.author.AuthorHandler');
17 
21 
26  parent::AuthorHandler();
27  }
28 
34  function deleteSubmission($args, $request) {
35  $articleId = (int) array_shift($args);
36  $this->validate($request, $articleId);
37  $authorSubmission =& $this->submission;
38  $this->setupTemplate($request, true);
39 
40  // If the submission is incomplete, allow the author to delete it.
41  if ($authorSubmission->getSubmissionProgress()!=0) {
42  import('classes.file.ArticleFileManager');
43  $articleFileManager = new ArticleFileManager($articleId);
44  $articleFileManager->deleteArticleTree();
45 
46  $articleDao =& DAORegistry::getDAO('ArticleDAO');
47  $articleDao->deleteArticleById($articleId);
48 
49  import('classes.search.ArticleSearchIndex');
50  $articleSearchIndex = new ArticleSearchIndex();
51  $articleSearchIndex->articleDeleted($articleId);
52  $articleSearchIndex->articleChangesFinished();
53  }
54 
55  $request->redirect(null, null, 'index');
56  }
57 
63  function deleteArticleFile($args, $request) {
64  $articleId = (int) array_shift($args);
65  $fileId = (int) array_shift($args);
66  $revisionId = (int) array_shift($args);
67 
68  $this->validate($request, $articleId);
69  $authorSubmission =& $this->submission;
70 
71  if ($authorSubmission->getStatus() != STATUS_PUBLISHED && $authorSubmission->getStatus() != STATUS_ARCHIVED) {
72  AuthorAction::deleteArticleFile($authorSubmission, $fileId, $revisionId);
73  }
74 
75  $request->redirect(null, null, 'submissionReview', $articleId);
76  }
77 
83  function submission($args, $request) {
84  $journal =& $request->getJournal();
85  $user =& $request->getUser();
86  $articleId = (int) array_shift($args);
87 
88  $this->validate($request, $articleId);
90  $this->setupTemplate($request, true, $articleId);
91 
92  $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
93  $journalSettings = $journalSettingsDao->getJournalSettings($journal->getId());
94 
95  // Setting the round.
96  $round = (int) array_shift($args);
97  if (!$round) $round = $submission->getCurrentRound();
98 
99  $templateMgr =& TemplateManager::getManager();
100 
101  $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
102  $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getId());
103  if ($publishedArticle) {
104  $issueDao =& DAORegistry::getDAO('IssueDAO');
105  $issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
106  $templateMgr->assign_by_ref('issue', $issue);
107  }
108 
109  $sectionDao =& DAORegistry::getDAO('SectionDAO');
110  $section =& $sectionDao->getSection($submission->getSectionId());
111  $templateMgr->assign_by_ref('section', $section);
112 
113  $templateMgr->assign_by_ref('journalSettings', $journalSettings);
114  $templateMgr->assign_by_ref('submission', $submission);
115  $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
116  $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
117  $templateMgr->assign('round', $round);
118  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
119  $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
120  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
121 
122  import('classes.submission.sectionEditor.SectionEditorSubmission');
123  $templateMgr->assign_by_ref('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
124 
125  // Set up required Payment Related Information
126  import('classes.payment.ojs.OJSPaymentManager');
127  $paymentManager = new OJSPaymentManager($request);
128  if ( $paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
129  $templateMgr->assign('authorFees', true);
130  $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
131 
132  if ($paymentManager->submissionEnabled()) {
133  $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDao->getSubmissionCompletedPayment ($journal->getId(), $articleId));
134  }
135 
136  if ($paymentManager->fastTrackEnabled()) {
137  $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDao->getFastTrackCompletedPayment ($journal->getId(), $articleId));
138  }
139 
140  if ($paymentManager->publicationEnabled()) {
141  $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment ($journal->getId(), $articleId));
142  }
143  }
144 
145  $templateMgr->assign('helpTopicId','editorial.authorsRole');
146 
147  $initialCopyeditSignoff = $submission->getSignoff('SIGNOFF_COPYEDITING_INITIAL');
148  $templateMgr->assign('canEditMetadata', !$initialCopyeditSignoff->getDateCompleted() && $submission->getStatus() != STATUS_PUBLISHED);
149 
150  $templateMgr->display('author/submission.tpl');
151  }
152 
158  function submissionReview($args, $request) {
159  $user =& $request->getUser();
160  $articleId = (int) array_shift($args);
161 
162  $this->validate($request, $articleId);
163  $authorSubmission =& $this->submission;
164  $this->setupTemplate($request, true, $articleId);
165  AppLocale::requireComponents(LOCALE_COMPONENT_OJS_EDITOR); // editor.article.decision etc. FIXME?
166 
167  $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
168  $reviewModifiedByRound = $reviewAssignmentDao->getLastModifiedByRound($articleId);
169  $reviewEarliestNotificationByRound = $reviewAssignmentDao->getEarliestNotificationByRound($articleId);
170  $reviewFilesByRound =& $reviewAssignmentDao->getReviewFilesByRound($articleId);
171  $authorViewableFilesByRound =& $reviewAssignmentDao->getAuthorViewableFilesByRound($articleId);
172 
173  $editorDecisions = $authorSubmission->getDecisions($authorSubmission->getCurrentRound());
174  $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1] : null;
175 
176  $templateMgr =& TemplateManager::getManager();
177 
178  $reviewAssignments =& $authorSubmission->getReviewAssignments();
179  $templateMgr->assign_by_ref('reviewAssignments', $reviewAssignments);
180  $templateMgr->assign_by_ref('submission', $authorSubmission);
181  $templateMgr->assign_by_ref('reviewFilesByRound', $reviewFilesByRound);
182  $templateMgr->assign_by_ref('authorViewableFilesByRound', $authorViewableFilesByRound);
183  $templateMgr->assign_by_ref('reviewModifiedByRound', $reviewModifiedByRound);
184 
185  $reviewIndexesByRound = array();
186  for ($round = 1; $round <= $authorSubmission->getCurrentRound(); $round++) {
187  $reviewIndexesByRound[$round] = $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round);
188  }
189  $templateMgr->assign_by_ref('reviewIndexesByRound', $reviewIndexesByRound);
190 
191  $templateMgr->assign('reviewEarliestNotificationByRound', $reviewEarliestNotificationByRound);
192  $templateMgr->assign_by_ref('submissionFile', $authorSubmission->getSubmissionFile());
193  $templateMgr->assign_by_ref('revisedFile', $authorSubmission->getRevisedFile());
194  $templateMgr->assign_by_ref('suppFiles', $authorSubmission->getSuppFiles());
195  $templateMgr->assign('lastEditorDecision', $lastDecision);
196  import('classes.submission.sectionEditor.SectionEditorSubmission');
197  $templateMgr->assign('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
198  $templateMgr->assign('helpTopicId', 'editorial.authorsRole.review');
199  $templateMgr->display('author/submissionReview.tpl');
200  }
201 
207  function addSuppFile($args, $request) {
208  $articleId = (int) array_shift($args);
209  $journal =& $request->getJournal();
210 
211  $this->validate($request, $articleId);
212  $authorSubmission =& $this->submission;
213 
214  if ($authorSubmission->getStatus() != STATUS_PUBLISHED && $authorSubmission->getStatus() != STATUS_ARCHIVED) {
215  $this->setupTemplate($request, true, $articleId, 'summary');
216 
217  import('classes.submission.form.SuppFileForm');
218 
219  $submitForm = new SuppFileForm($authorSubmission, $journal);
220 
221  if ($submitForm->isLocaleResubmit()) {
222  $submitForm->readInputData();
223  } else {
224  $submitForm->initData();
225  }
226  $submitForm->display();
227  } else {
228  $request->redirect(null, null, 'submission', $articleId);
229  }
230  }
231 
237  function editSuppFile($args, &$request) {
238  $articleId = (int) array_shift($args);
239  $suppFileId = (int) array_shift($args);
240  $this->validate($request, $articleId);
241  $authorSubmission =& $this->submission;
242 
243  if ($authorSubmission->getStatus() != STATUS_PUBLISHED && $authorSubmission->getStatus() != STATUS_ARCHIVED) {
244  $this->setupTemplate($request, true, $articleId, 'summary');
245 
246  import('classes.submission.form.SuppFileForm');
247 
248  $journal =& $request->getJournal();
249  $submitForm = new SuppFileForm($authorSubmission, $journal, $suppFileId);
250 
251  if ($submitForm->isLocaleResubmit()) {
252  $submitForm->readInputData();
253  } else {
254  $submitForm->initData();
255  }
256  $submitForm->display();
257  } else {
258  $request->redirect(null, null, 'submission', $articleId);
259  }
260  }
261 
267  function setSuppFileVisibility($args, $request) {
268  $articleId = (int) $request->getUserVar('articleId');
269  $this->validate($request, $articleId);
270  $authorSubmission =& $this->submission;
271 
272  if ($authorSubmission->getStatus() != STATUS_PUBLISHED && $authorSubmission->getStatus() != STATUS_ARCHIVED) {
273  $suppFileId = $request->getUserVar('fileId');
274  $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
275  $suppFile = $suppFileDao->getSuppFile($suppFileId, $articleId);
276 
277  if (isset($suppFile) && $suppFile != null) {
278  $suppFile->setShowReviewers($request->getUserVar('hide')==1?0:1);
279  $suppFileDao->updateSuppFile($suppFile);
280  }
281  }
282  $request->redirect(null, null, 'submissionReview', $articleId);
283  }
284 
290  function saveSuppFile($args, $request) {
291  $articleId = (int) $request->getUserVar('articleId');
292  $suppFileId = (int) array_shift($args);
293  $this->validate($request, $articleId);
294 
295  $authorSubmission =& $this->submission;
296  $this->setupTemplate($request, true, $articleId, 'summary');
297 
298  if ($authorSubmission->getStatus() != STATUS_PUBLISHED && $authorSubmission->getStatus() != STATUS_ARCHIVED) {
299  import('classes.submission.form.SuppFileForm');
300 
301  $journal =& $request->getJournal();
302  $submitForm = new SuppFileForm($authorSubmission, $journal, $suppFileId);
303  $submitForm->readInputData();
304 
305  if ($submitForm->validate()) {
306  $submitForm->execute();
307  $request->redirect(null, null, 'submission', $articleId);
308  } else {
309  $submitForm->display();
310  }
311  } else {
312  $request->redirect(null, null, 'submission', $articleId);
313  }
314  }
315 
321  function submissionEditing($args, $request) {
322  $journal =& $request->getJournal();
323  $user =& $request->getUser();
324  $articleId = (int) array_shift($args);
325 
326  $this->validate($request, $articleId);
328  $this->setupTemplate($request, true, $articleId);
329 
331  import('classes.submission.proofreader.ProofreaderAction');
332  ProofreaderAction::proofreadingUnderway($submission, 'SIGNOFF_PROOFREADING_AUTHOR');
333 
334  $templateMgr =& TemplateManager::getManager();
335  $templateMgr->assign_by_ref('submission', $submission);
336  $templateMgr->assign_by_ref('copyeditor', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
337  $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
338  $templateMgr->assign_by_ref('initialCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
339  $templateMgr->assign_by_ref('editorAuthorCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_AUTHOR'));
340  $templateMgr->assign_by_ref('finalCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_FINAL'));
341  $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
342  $templateMgr->assign('useCopyeditors', $journal->getSetting('useCopyeditors'));
343  $templateMgr->assign('useLayoutEditors', $journal->getSetting('useLayoutEditors'));
344  $templateMgr->assign('useProofreaders', $journal->getSetting('useProofreaders'));
345  $templateMgr->assign('helpTopicId', 'editorial.authorsRole.editing');
346  $templateMgr->display('author/submissionEditing.tpl');
347  }
348 
354  function uploadRevisedVersion($args, $request) {
355  $articleId = (int) $request->getUserVar('articleId');
356  $this->validate($request, $articleId);
358  $this->setupTemplate($request, true);
359 
361 
362  $request->redirect(null, null, 'submissionReview', $articleId);
363  }
364 
370  function viewMetadata($args, $request) {
371  $articleId = (int) array_shift($args);
372  $journal =& $request->getJournal();
373  $this->validate($request, $articleId);
375  $this->setupTemplate($request, true, $articleId, 'summary');
376 
378  }
379 
385  function saveMetadata($args, $request) {
386  $articleId = (int) $request->getUserVar('articleId');
387  $this->validate($request, $articleId);
389  $this->setupTemplate($request, true, $articleId);
390 
391  // If the copy editor has completed copyediting, disallow
392  // the author from changing the metadata.
393  $signoffDao =& DAORegistry::getDAO('SignoffDAO');
394  $initialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $submission->getId());
395  if ($initialSignoff->getDateCompleted() != null || AuthorAction::saveMetadata($submission, $request)) {
396  $request->redirect(null, null, 'submission', $articleId);
397  }
398  }
399 
405  function removeArticleCoverPage($args, $request) {
406  $articleId = (int) array_shift($args);
407  $this->validate($request, $articleId);
408 
409  $formLocale = array_shift($args);
410  if (!AppLocale::isLocaleValid($formLocale)) {
411  $request->redirect(null, null, 'viewMetadata', $articleId);
412  }
413 
415  $journal =& $request->getJournal();
416 
417  import('classes.file.PublicFileManager');
418  $publicFileManager = new PublicFileManager();
419  $publicFileManager->removeJournalFile($journal->getId(),$submission->getFileName($formLocale));
420  $submission->setFileName('', $formLocale);
421  $submission->setOriginalFileName('', $formLocale);
422  $submission->setWidth('', $formLocale);
423  $submission->setHeight('', $formLocale);
424 
425  $articleDao =& DAORegistry::getDAO('ArticleDAO');
426  $articleDao->updateArticle($submission);
427 
428  $request->redirect(null, null, 'viewMetadata', $articleId);
429  }
430 
436  function uploadCopyeditVersion($args, $request) {
437  $copyeditStage = $request->getUserVar('copyeditStage');
438  $articleId = (int) $request->getUserVar('articleId');
439 
440  $this->validate($request, $articleId);
442  $this->setupTemplate($request, true, $articleId);
443 
445 
446  $request->redirect(null, null, 'submissionEditing', $articleId);
447  }
448 
454  function completeAuthorCopyedit($args, $request) {
455  $articleId = (int) $request->getUserVar('articleId');
456  $this->validate($request, $articleId);
458  $this->setupTemplate($request, true);
459 
460  if (AuthorAction::completeAuthorCopyedit($submission, $request->getUserVar('send'), $request)) {
461  $request->redirect(null, null, 'submissionEditing', $articleId);
462  }
463  }
464 
465  //
466  // Misc
467  //
468 
474  function downloadFile($args, $request) {
475  $articleId = (int) array_shift($args);
476  $fileId = (int) array_shift($args);
477  $revision = (int) array_shift($args);
478  if (!$revision) $revision = null;
479 
480  $this->validate($request, $articleId);
482  if (!AuthorAction::downloadAuthorFile($submission, $fileId, $revision)) {
483  $request->redirect(null, null, 'submission', $articleId);
484  }
485  }
486 
492  function download($args, $request) {
493  $articleId = (int) array_shift($args);
494  $fileId = (int) array_shift($args);
495  $revision = (int) array_shift($args);
496  if (!$revision) $revision = null;
497 
498  $this->validate($request, $articleId);
499  Action::downloadFile($articleId, $fileId, $revision);
500  }
501 
502  //
503  // Proofreading
504  //
505 
511  function authorProofreadingComplete($args, $request) {
512  $articleId = (int) $request->getUserVar('articleId');
513  $this->validate($request, $articleId);
514  $this->setupTemplate($request, true);
515 
516  $send = $request->getUserVar('send');
517 
518  import('classes.submission.proofreader.ProofreaderAction');
519 
520  if (ProofreaderAction::proofreadEmail($articleId, 'PROOFREAD_AUTHOR_COMPLETE', $request, $send?'':$request->url(null, 'author', 'authorProofreadingComplete'))) {
521  $request->redirect(null, null, 'submissionEditing', $articleId);
522  }
523  }
524 
530  function proofGalley($args, $request) {
531  $articleId = (int) array_shift($args);
532  $galleyId = (int) array_shift($args);
533  $this->validate($request, $articleId);
534  $this->setupTemplate($request);
535 
536  $templateMgr =& TemplateManager::getManager();
537  $templateMgr->assign('articleId', $articleId);
538  $templateMgr->assign('galleyId', $galleyId);
539  $templateMgr->display('submission/layout/proofGalley.tpl');
540  }
541 
547  function proofGalleyTop($args, $request) {
548  $articleId = (int) array_shift($args);
549  $galleyId = (int) array_shift($args);
550  $this->validate($request, $articleId);
551  $this->setupTemplate($request);
552 
553  $templateMgr =& TemplateManager::getManager();
554  $templateMgr->assign('articleId', $articleId);
555  $templateMgr->assign('galleyId', $galleyId);
556  $templateMgr->assign('backHandler', 'submissionEditing');
557  $templateMgr->display('submission/layout/proofGalleyTop.tpl');
558  }
559 
565  function proofGalleyFile($args, $request) {
566  $articleId = (int) array_shift($args);
567  $galleyId = (int) array_shift($args);
568  $this->validate($request, $articleId);
569 
570  $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
571  $galley =& $galleyDao->getGalley($galleyId, $articleId);
572 
573  import('classes.file.ArticleFileManager'); // FIXME
574 
575  if (isset($galley)) {
576  if ($galley->isHTMLGalley()) {
577  $templateMgr =& TemplateManager::getManager();
578  $templateMgr->assign_by_ref('galley', $galley);
579  if ($galley->isHTMLGalley() && $styleFile =& $galley->getStyleFile()) {
580  $templateMgr->addStyleSheet($request->url(null, 'article', 'viewFile', array(
581  $articleId, $galleyId, $styleFile->getFileId()
582  )));
583  }
584  $templateMgr->display('submission/layout/proofGalleyHTML.tpl');
585 
586  } else {
587  // View non-HTML file inline
588  $this->viewFile(array($articleId, $galley->getFileId()), $request);
589  }
590  }
591  }
592 
598  function viewFile($args, $request) {
599  $articleId = (int) array_shift($args);
600  $fileId = (int) array_shift($args);
601  $revision = (int) array_shift($args);
602  if (!$revision) $revision = null;
603 
604  $this->validate($request, $articleId);
605  if (!AuthorAction::viewFile($articleId, $fileId, $revision)) {
606  $request->redirect(null, null, 'submission', $articleId);
607  }
608  }
609 
610  //
611  // Payment Actions
612  //
613 
619  function paySubmissionFee($args, $request) {
620  $articleId = (int) array_shift($args);
621 
622  $this->validate($request, $articleId);
623  $this->setupTemplate($request, true, $articleId);
624 
625  $journal =& $request->getJournal();
626 
627  import('classes.payment.ojs.OJSPaymentManager');
628  $paymentManager = new OJSPaymentManager($request);
629  $user =& $request->getUser();
630 
631  $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_SUBMISSION, $user->getId(), $articleId, $journal->getSetting('submissionFee'));
632  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
633 
634  $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
635  }
636 
642  function payFastTrackFee($args, $request) {
643  $articleId = (int) array_shift($args);
644 
645  $this->validate($request, $articleId);
646  $this->setupTemplate($request, true, $articleId);
647 
648  $journal =& $request->getJournal();
649 
650  import('classes.payment.ojs.OJSPaymentManager');
651  $paymentManager = new OJSPaymentManager($request);
652  $user =& $request->getUser();
653 
654  $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_FASTTRACK, $user->getId(), $articleId, $journal->getSetting('fastTrackFee'));
655  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
656 
657  $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
658  }
659 
665  function payPublicationFee($args, $request) {
666  $articleId = (int) array_shift($args);
667 
668  $this->validate($request, $articleId);
669  $this->setupTemplate($request, true, $articleId);
670 
671  $journal =& $request->getJournal();
672 
673  import('classes.payment.ojs.OJSPaymentManager');
674  $paymentManager = new OJSPaymentManager($request);
675  $user =& $request->getUser();
676 
677  $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_PUBLICATION, $user->getId(), $articleId, $journal->getSetting('publicationFee'));
678  $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
679 
680  $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
681  }
682 }
683 
684 ?>
isLocaleValid($locale)
Wrapper class for uploading files to a site/journal&#39;s public directory.
downloadFile($articleId, $fileId, $revision=null)
Definition: Action.inc.php:180
uploadRevisedVersion($authorSubmission, $request)
deleteArticleFile($article, $fileId, $revisionId)
viewMetadata($article, $journal)
Definition: Action.inc.php:59
setupTemplate($request, $subclass=false, $articleId=0, $parentPage=null)
downloadAuthorFile($article, $fileId, $revision=null)
proofreadEmail($articleId, $mailType, $request, $actionPath= '')
viewFile($articleId, $fileId, $revision=null)
Definition: Action.inc.php:192
proofreadingUnderway(&$submission, $signoffType)
validate(&$request, $articleId=null, $reason=null)
Handle requests for journal author functions.
& getDAO($name, $dbconn=null)
Class defining operations for article file management.
Class to maintain the article search index.
uploadCopyeditVersion($authorSubmission, $copyeditStage)
Handle requests for submission tracking.
copyeditUnderway($authorSubmission)
Provides payment management functions.
Supplementary file form.
saveMetadata($article, &$request)
Definition: Action.inc.php:77
completeAuthorCopyedit($authorSubmission, $send, $request)