pages/author/TrackSubmissionHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import('pages.author.AuthorHandler');
00018 
00019 class TrackSubmissionHandler extends AuthorHandler {
00021    var $submission;
00022       
00026    function TrackSubmissionHandler() {
00027       parent::AuthorHandler();
00028    }
00029 
00033    function deleteSubmission($args) {
00034       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00035       $this->validate($paperId, null, true);
00036       $authorSubmission =& $this->submission;
00037 
00038       $this->setupTemplate(true);
00039 
00040       // If the submission is incomplete, allow the author to delete it.
00041       if ($authorSubmission->getSubmissionProgress()!=0) {
00042          import('file.PaperFileManager');
00043          $paperFileManager = new PaperFileManager($paperId);
00044          $paperFileManager->deletePaperTree();
00045 
00046          $paperDao =& DAORegistry::getDAO('PaperDAO');
00047          $paperDao->deletePaperById($args[0]);
00048       }
00049 
00050       Request::redirect(null, null, null, 'index');
00051    }
00052 
00057    function deletePaperFile($args) {
00058       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00059       $fileId = isset($args[1]) ? (int) $args[1] : 0;
00060       $revisionId = isset($args[2]) ? (int) $args[2] : 0;
00061 
00062       $this->validate($paperId, true);
00063       $authorSubmission =& $this->submission;
00064             
00065       AuthorAction::deletePaperFile($authorSubmission, $fileId, $revisionId);
00066 
00067       Request::redirect(null, null, null, 'submissionReview', $paperId);
00068    }
00069 
00073    function submission($args) {
00074       $user =& Request::getUser();
00075       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00076       $schedConf =& Request::getSchedConf();
00077 
00078       $this->validate($paperId);
00079       $submission =& $this->submission;
00080 
00081       // The user may be coming in on an old URL e.g. from the submission
00082       // ack email. If OCS is awaiting the completion of the submission,
00083       // send them to the submit page.
00084       if ($submission->getSubmissionProgress() != 0) {
00085          Request::redirect(
00086             null, null, null, 'submit',
00087             array($submission->getSubmissionProgress()),
00088             array('paperId' => $paperId)
00089          );
00090       }
00091 
00092       $this->setupTemplate(true, $paperId);
00093 
00094       $stage = (isset($args[1]) ? (int) $args[1] : 1);
00095       $reviewMode = $submission->getReviewMode();
00096       switch ($reviewMode) {
00097          case REVIEW_MODE_ABSTRACTS_ALONE:
00098             $stage = REVIEW_STAGE_ABSTRACT;
00099             break;
00100          case REVIEW_MODE_BOTH_SIMULTANEOUS:
00101          case REVIEW_MODE_PRESENTATIONS_ALONE:
00102             $stage = REVIEW_STAGE_PRESENTATION;
00103             break;
00104          case REVIEW_MODE_BOTH_SEQUENTIAL:
00105             if ($stage != REVIEW_STAGE_ABSTRACT && $stage != REVIEW_STAGE_PRESENTATION) $stage = $submission->getCurrentStage();
00106             break;
00107       }
00108 
00109       $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
00110       $publishedPaper =& $publishedPaperDao->getPublishedPaperByPaperId($submission->getPaperId());
00111 
00112       $templateMgr =& TemplateManager::getManager();
00113       $templateMgr->assign('mayEditPaper', AuthorAction::mayEditPaper($submission));
00114 
00115       $trackDao =& DAORegistry::getDAO('TrackDAO');
00116       $track =& $trackDao->getTrack($submission->getTrackId());
00117       $templateMgr->assign_by_ref('track', $track);
00118 
00119       $templateMgr->assign_by_ref('submission', $submission);
00120       $templateMgr->assign_by_ref('publishedPaper', $publishedPaper);
00121       $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($stage));
00122       $templateMgr->assign('stage', $stage);
00123       $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
00124       $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
00125       $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
00126 
00127       $controlledVocabDao =& DAORegistry::getDAO('ControlledVocabDAO');
00128       $templateMgr->assign('sessionTypes', $controlledVocabDao->enumerateBySymbolic('sessionTypes', ASSOC_TYPE_SCHED_CONF, $schedConf->getId()));
00129 
00130       // FIXME: Author code should not use track director object
00131       $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
00132       $trackDirectorSubmission =& $trackDirectorSubmissionDao->getTrackDirectorSubmission($submission->getPaperId());
00133       $templateMgr->assign_by_ref('directorDecisionOptions', $trackDirectorSubmission->getDirectorDecisionOptions());
00134 
00135       $templateMgr->assign('helpTopicId','editorial.authorsRole');
00136       $templateMgr->display('author/submission.tpl');
00137    }
00138 
00142    function submissionReview($args) {
00143       import('paper.Paper'); // for REVIEW_PROGRESS constants
00144       $user =& Request::getUser();
00145       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00146 
00147       $this->validate($paperId);
00148       $authorSubmission =& $this->submission;
00149       $this->setupTemplate(true, $paperId);
00150       AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_DIRECTOR)); // FIXME?
00151 
00152       $stage = (isset($args[1]) ? (int) $args[1] : 1);
00153       $reviewMode = $authorSubmission->getReviewMode();
00154       switch ($reviewMode) {
00155          case REVIEW_MODE_ABSTRACTS_ALONE:
00156             $stage = REVIEW_STAGE_ABSTRACT;
00157             break;
00158          case REVIEW_MODE_BOTH_SIMULTANEOUS:
00159          case REVIEW_MODE_PRESENTATIONS_ALONE:
00160             $stage = REVIEW_STAGE_PRESENTATION;
00161             break;
00162          case REVIEW_MODE_BOTH_SEQUENTIAL:
00163             if ($stage != REVIEW_STAGE_ABSTRACT && $stage != REVIEW_STAGE_PRESENTATION) $stage = $submission->getCurrentStage();
00164             break;
00165       }
00166 
00167       $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
00168       $reviewModifiedByStage = $reviewAssignmentDao->getLastModifiedByStage($paperId);
00169       $reviewEarliestNotificationByStage = $reviewAssignmentDao->getEarliestNotificationByStage($paperId);
00170       $reviewFilesByStage =& $reviewAssignmentDao->getReviewFilesByStage($paperId);
00171       $authorViewableFilesByStage =& $reviewAssignmentDao->getAuthorViewableFilesByStage($paperId);
00172 
00173       $directorDecisions = $authorSubmission->getDecisions($authorSubmission->getCurrentStage());
00174       $lastDecision = count($directorDecisions) >= 1 ? $directorDecisions[count($directorDecisions) - 1] : null;
00175 
00176       $templateMgr =& TemplateManager::getManager();
00177       $templateMgr->assign_by_ref('submission', $authorSubmission);
00178       $templateMgr->assign_by_ref('reviewAssignments', $authorSubmission->getReviewAssignments($stage));
00179       $templateMgr->assign('stage', $stage);
00180       $templateMgr->assign_by_ref('reviewFilesByStage', $reviewFilesByStage);
00181       $templateMgr->assign_by_ref('authorViewableFilesByStage', $authorViewableFilesByStage);
00182       $templateMgr->assign_by_ref('reviewModifiedByStage', $reviewModifiedByStage);
00183       $templateMgr->assign('reviewEarliestNotificationByStage', $reviewEarliestNotificationByStage);
00184       $templateMgr->assign_by_ref('submissionFile', $authorSubmission->getSubmissionFile());
00185       $templateMgr->assign_by_ref('revisedFile', $authorSubmission->getRevisedFile());
00186       $templateMgr->assign_by_ref('suppFiles', $authorSubmission->getSuppFiles());
00187       $templateMgr->assign('lastDirectorDecision', $lastDecision);
00188 
00189       // FIXME: Author code should not use track director object
00190       $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
00191       $trackDirectorSubmission =& $trackDirectorSubmissionDao->getTrackDirectorSubmission($authorSubmission->getPaperId());
00192       $templateMgr->assign_by_ref('directorDecisionOptions', $trackDirectorSubmission->getDirectorDecisionOptions());
00193 
00194       // Determine whether or not certain features should be disabled (i.e. past deadline)
00195       $templateMgr->assign('mayEditPaper', AuthorAction::mayEditPaper($authorSubmission));
00196 
00197       $templateMgr->assign('helpTopicId', 'editorial.authorsRole.review');
00198       $templateMgr->display('author/submissionReview.tpl');
00199    }
00200 
00205    function addSuppFile($args) {
00206       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00207       $this->validate($paperId, true);
00208       $authorSubmission =& $this->submission;
00209       $this->setupTemplate(true, $paperId, 'summary');
00210       
00211       import('submission.form.SuppFileForm');
00212 
00213       $submitForm = new SuppFileForm($authorSubmission);
00214 
00215       if ($submitForm->isLocaleResubmit()) {
00216          $submitForm->readInputData();
00217       } else {
00218          $submitForm->initData();
00219       }
00220       $submitForm->display();
00221    }
00222 
00227    function viewSuppFile($args) {
00228       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00229       $suppFileId = isset($args[1]) ? (int) $args[1] : 0;
00230       $this->validate($paperId);
00231 
00232       $this->setupTemplate(true, $paperId, 'summary');
00233 
00234       // View supplementary file only
00235       $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
00236       $suppFile =& $suppFileDao->getSuppFile($suppFileId, $paperId);
00237 
00238       if (!isset($suppFile)) {
00239          Request::redirect(null, null, null, 'submission', $paperId);
00240       }
00241 
00242       $templateMgr =& TemplateManager::getManager();
00243       $templateMgr->assign('paperId', $paperId);
00244       $templateMgr->assign_by_ref('suppFile', $suppFile);
00245       $templateMgr->display('submission/suppFile/suppFileView.tpl'); 
00246    }
00247 
00252    function editSuppFile($args) {
00253       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00254       $suppFileId = isset($args[1]) ? (int) $args[1] : 0;
00255       $this->validate($paperId, true);
00256       $authorSubmission =& $this->submission;
00257 
00258       $this->setupTemplate(true, $paperId, 'summary');
00259 
00260       import('submission.form.SuppFileForm');
00261 
00262       $submitForm = new SuppFileForm($authorSubmission, $suppFileId);
00263 
00264       if ($submitForm->isLocaleResubmit()) {
00265          $submitForm->readInputData();
00266       } else {
00267          $submitForm->initData();
00268       }
00269       $submitForm->display();
00270    }
00271 
00276    function setSuppFileVisibility($args) {
00277       $paperId = Request::getUserVar('paperId');
00278       $this->validate($paperId, true);
00279       $authorSubmission =& $this->submission;
00280 
00281       $suppFileId = Request::getUserVar('fileId');
00282       $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
00283       $suppFile = $suppFileDao->getSuppFile($suppFileId, $paperId);
00284 
00285       if (isset($suppFile) && $suppFile != null) {
00286          $suppFile->setShowReviewers(Request::getUserVar('hide')==1?0:1);
00287          $suppFileDao->updateSuppFile($suppFile);
00288       }
00289       Request::redirect(null, null, null, 'submissionReview', $paperId);
00290    }
00291 
00296    function saveSuppFile($args) {
00297       $paperId = Request::getUserVar('paperId');
00298       $this->validate($paperId, true);
00299       $authorSubmission =& $this->submission;
00300       parent::setupTemplate(true, $paperId, 'summary');
00301 
00302       $suppFileId = isset($args[0]) ? (int) $args[0] : 0;
00303 
00304       import('submission.form.SuppFileForm');
00305 
00306       $submitForm = new SuppFileForm($authorSubmission, $suppFileId);
00307       $submitForm->readInputData();
00308 
00309       if ($submitForm->validate()) {
00310          $submitForm->execute();
00311          Request::redirect(null, null, null, 'submission', $paperId);
00312       } else {
00313          $submitForm->display();
00314       }
00315    }
00316 
00320    function uploadRevisedVersion() {
00321       $paperId = Request::getUserVar('paperId');
00322       $this->validate($paperId, true);
00323       $submission =& $this->submission;
00324 
00325       AuthorAction::uploadRevisedVersion($submission);
00326 
00327       Request::redirect(null, null, null, 'submissionReview', $paperId);
00328    }
00329 
00330    function viewMetadata($args) {
00331       $paperId = isset($args[0]) ? (int) $args[0] : 0;
00332       $this->validate($paperId);
00333       $submission =& $this->submission;
00334 
00335       $this->setupTemplate(true, $paperId, 'summary');
00336 
00337       AuthorAction::viewMetadata($submission, ROLE_ID_AUTHOR);
00338    }
00339 
00340    function saveMetadata() {
00341       $paperId = Request::getUserVar('paperId');
00342       $this->validate($paperId, true);
00343       $submission =& $this->submission;
00344       $this->setupTemplate(true, $paperId);
00345 
00346       if(AuthorAction::saveMetadata($submission)) {
00347          Request::redirect(null, null, null, 'submission', $paperId);
00348       }
00349    }
00350 
00351    //
00352    // Misc
00353    //
00354 
00359    function downloadFile($args) {
00360       $paperId = isset($args[0]) ? $args[0] : 0;
00361       $fileId = isset($args[1]) ? $args[1] : 0;
00362       $revision = isset($args[2]) ? $args[2] : null;
00363 
00364       $this->validate($paperId);
00365       $submission =& $this->submission;
00366             
00367       if (!AuthorAction::downloadAuthorFile($submission, $fileId, $revision)) {
00368          Request::redirect(null, null, null, 'submission', $paperId);
00369       }
00370    }
00371 
00376    function download($args) {
00377       $paperId = isset($args[0]) ? $args[0] : 0;
00378       $fileId = isset($args[1]) ? $args[1] : 0;
00379       $revision = isset($args[2]) ? $args[2] : null;
00380 
00381       $this->validate($paperId);
00382       Action::downloadFile($paperId, $fileId, $revision);
00383    }
00384 
00385    //
00386    // Validation
00387    //
00388 
00398    function validate($paperId, $requiresEditAccess = false, $isDeleting = false) {
00399       parent::validate();
00400 
00401       $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
00402       $roleDao =& DAORegistry::getDAO('RoleDAO');
00403       $conference =& Request::getConference();
00404       $schedConf =& Request::getSchedConf();
00405       $user =& Request::getUser();
00406 
00407       $isValid = true;
00408 
00409       $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($paperId);
00410 
00411       if ($authorSubmission == null) {
00412          $isValid = false;
00413       } else if ($authorSubmission->getSchedConfId() != $schedConf->getId()) {
00414          $isValid = false;
00415       } else {
00416          if ($authorSubmission->getUserId() != $user->getId()) {
00417             $isValid = false;
00418          }
00419       }
00420 
00421       if ($isValid && $requiresEditAccess) {
00422          if (!AuthorAction::mayEditPaper($authorSubmission)) $isValid = false;
00423       }
00424 
00425       if (!$isValid) {
00426          Request::redirect(null, null, Request::getRequestedPage());
00427       }
00428 
00429       $this->submission =& $authorSubmission;
00430       return true;
00431    }
00432 
00437    function viewFile($args) {
00438       $paperId = isset($args[0]) ? $args[0] : 0;
00439       $fileId = isset($args[1]) ? $args[1] : 0;
00440       $revision = isset($args[2]) ? $args[2] : null;
00441 
00442       $this->validate($paperId);
00443       if (!AuthorAction::viewFile($paperId, $fileId, $revision)) {
00444          Request::redirect(null, null, null, 'submission', $paperId);
00445       }
00446    }
00447 }
00448 
00449 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7