/**
  * Upload the submission file.
  * @param $fileName string
  * @return boolean
  */
 function uploadSubmissionFile($fileName)
 {
     import("file.PaperFileManager");
     $paperFileManager = new PaperFileManager($this->paperId);
     $paperDao =& DAORegistry::getDAO('PaperDAO');
     if ($paperFileManager->uploadError($fileName)) {
         return false;
     }
     if ($paperFileManager->uploadedFileExists($fileName)) {
         // upload new submission file, overwriting previous if necessary
         $submissionFileId = $paperFileManager->uploadSubmissionFile($fileName, $this->paper->getSubmissionFileId(), true);
     }
     if (isset($submissionFileId)) {
         $this->paper->setSubmissionFileId($submissionFileId);
         $paperDao->updatePaper($this->paper);
         return true;
     } else {
         return false;
     }
 }
Exemple #2
0
 /**
  * Save changes to the supplementary file.
  * @return int the supplementary file ID
  */
 function execute($fileName = null)
 {
     import("file.PaperFileManager");
     $paperFileManager = new PaperFileManager($this->paper->getPaperId());
     $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
     $fileName = isset($fileName) ? $fileName : 'uploadSuppFile';
     if (isset($this->suppFile)) {
         $suppFile =& $this->suppFile;
         // Upload file, if file selected.
         if ($paperFileManager->uploadedFileExists($fileName)) {
             $paperFileManager->uploadSuppFile($fileName, $suppFile->getFileId());
             import('search.PaperSearchIndex');
             PaperSearchIndex::updateFileIndex($this->paper->getPaperId(), PAPER_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId());
         }
         // Index metadata
         PaperSearchIndex::indexSuppFileMetadata($suppFile);
         // Update existing supplementary file
         $this->setSuppFileData($suppFile);
         $suppFileDao->updateSuppFile($suppFile);
     } else {
         // Upload file, if file selected.
         if ($paperFileManager->uploadedFileExists($fileName)) {
             $fileId = $paperFileManager->uploadSuppFile($fileName);
             import('search.PaperSearchIndex');
             PaperSearchIndex::updateFileIndex($this->paper->getPaperId(), PAPER_SEARCH_SUPPLEMENTARY_FILE, $fileId);
         } else {
             $fileId = 0;
         }
         // Insert new supplementary file
         $suppFile = new SuppFile();
         $suppFile->setPaperId($this->paper->getPaperId());
         $suppFile->setFileId($fileId);
         $this->setSuppFileData($suppFile);
         $suppFileDao->insertSuppFile($suppFile);
         $this->suppFileId = $suppFile->getId();
     }
     return $this->suppFileId;
 }
Exemple #3
0
 /**
  * Upload the annotated version of a paper.
  * @param $reviewId int
  */
 function uploadReviewerVersion($reviewId)
 {
     import('file.PaperFileManager');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId);
     $paperFileManager = new PaperFileManager($reviewAssignment->getPaperId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     if (!(($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled())) {
         return false;
     }
     $fileName = 'upload';
     if ($paperFileManager->uploadError($fileName)) {
         return false;
     }
     if (!$paperFileManager->uploadedFileExists($fileName)) {
         return false;
     }
     HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment));
     if ($reviewAssignment->getReviewerFileId() != null) {
         $fileId = $paperFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
     } else {
         $fileId = $paperFileManager->uploadReviewFile($fileName);
     }
     if ($fileId == 0) {
         return false;
     }
     $reviewAssignment->setReviewerFileId($fileId);
     $reviewAssignment->stampModified();
     $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
     // Add log
     import('paper.log.PaperLog');
     import('paper.log.PaperEventLogEntry');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     $entry = new PaperEventLogEntry();
     $entry->setPaperId($reviewAssignment->getPaperId());
     $entry->setUserId($reviewer->getId());
     $entry->setDateLogged(Core::getCurrentDate());
     $entry->setEventType(PAPER_LOG_REVIEW_FILE);
     $entry->setLogMessage('log.review.reviewerFile');
     $entry->setAssocType(LOG_TYPE_REVIEW);
     $entry->setAssocId($reviewAssignment->getId());
     PaperLog::logEventEntry($reviewAssignment->getPaperId(), $entry);
     return true;
 }
Exemple #4
0
 /**
  * Upload the revised version of a paper.
  * @param $authorSubmission object
  */
 function uploadRevisedVersion($authorSubmission)
 {
     import('file.PaperFileManager');
     $paperFileManager = new PaperFileManager($authorSubmission->getPaperId());
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $fileName = 'upload';
     if ($paperFileManager->uploadError($fileName)) {
         return false;
     }
     if (!$paperFileManager->uploadedFileExists($fileName)) {
         return false;
     }
     HookRegistry::call('AuthorAction::uploadRevisedVersion', array(&$authorSubmission));
     if ($authorSubmission->getRevisedFileId() != null) {
         $fileId = $paperFileManager->uploadDirectorDecisionFile($fileName, $authorSubmission->getRevisedFileId());
     } else {
         $fileId = $paperFileManager->uploadDirectorDecisionFile($fileName);
     }
     if (!$fileId) {
         return false;
     }
     $authorSubmission->setRevisedFileId($fileId);
     $authorSubmissionDao->updateAuthorSubmission($authorSubmission);
     // Add log entry
     $user =& Request::getUser();
     import('paper.log.PaperLog');
     import('paper.log.PaperEventLogEntry');
     PaperLog::logEvent($authorSubmission->getPaperId(), PAPER_LOG_AUTHOR_REVISION, LOG_TYPE_AUTHOR, $user->getId(), 'log.author.documentRevised', array('authorName' => $user->getFullName(), 'fileId' => $fileId, 'paperId' => $authorSubmission->getPaperId()));
 }
 /**
  * Upload a review on behalf of its reviewer.
  * @param $reviewId int
  */
 function uploadReviewForReviewer($reviewId)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId);
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId(), true);
     if (HookRegistry::call('TrackDirectorAction::uploadReviewForReviewer', array(&$reviewAssignment, &$reviewer))) {
         return;
     }
     // Upload the review file.
     import('file.PaperFileManager');
     $paperFileManager = new PaperFileManager($reviewAssignment->getPaperId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
         $fileName = 'upload';
         if ($paperFileManager->uploadError($fileName)) {
             return false;
         }
         if ($paperFileManager->uploadedFileExists($fileName)) {
             if ($reviewAssignment->getReviewerFileId() != null) {
                 $fileId = $paperFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
             } else {
                 $fileId = $paperFileManager->uploadReviewFile($fileName);
             }
         }
     }
     if (isset($fileId) && $fileId != 0) {
         // Only confirm the review for the reviewer if
         // he has not previously done so.
         if ($reviewAssignment->getDateConfirmed() == null) {
             $reviewAssignment->setDeclined(0);
             $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
         }
         $reviewAssignment->setReviewerFileId($fileId);
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
         // Add log
         import('paper.log.PaperLog');
         import('paper.log.PaperEventLogEntry');
         $entry = new PaperEventLogEntry();
         $entry->setPaperId($reviewAssignment->getPaperId());
         $entry->setUserId($user->getId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType(PAPER_LOG_REVIEW_FILE_BY_PROXY);
         $entry->setLogMessage('log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'paperId' => $reviewAssignment->getPaperId(), 'stage' => $reviewAssignment->getStage(), 'userName' => $user->getFullName()));
         $entry->setAssocType(LOG_TYPE_REVIEW);
         $entry->setAssocId($reviewAssignment->getId());
         PaperLog::logEventEntry($reviewAssignment->getPaperId(), $entry);
     }
 }
 /**
  * Save changes to the supplementary file.
  * @return int the supplementary file ID
  */
 function execute()
 {
     import("file.PaperFileManager");
     $paperFileManager = new PaperFileManager($this->paperId);
     $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
     $fileName = 'uploadSuppFile';
     // edit an existing supp file, otherwise create new supp file entry
     if (isset($this->suppFile)) {
         $suppFile =& $this->suppFile;
         // Remove old file and upload new, if file is selected.
         if ($paperFileManager->uploadedFileExists($fileName)) {
             $paperFileDao =& DAORegistry::getDAO('PaperFileDAO');
             $suppFileId = $paperFileManager->uploadSuppFile($fileName, $suppFile->getFileId(), true);
             $suppFile->setFileId($suppFileId);
         }
         // Update existing supplementary file
         $this->setSuppFileData($suppFile);
         $suppFileDao->updateSuppFile($suppFile);
     } else {
         // Upload file, if file selected.
         if ($paperFileManager->uploadedFileExists($fileName)) {
             $fileId = $paperFileManager->uploadSuppFile($fileName);
         } else {
             $fileId = 0;
         }
         // Insert new supplementary file
         $suppFile = new SuppFile();
         $suppFile->setPaperId($this->paperId);
         $suppFile->setFileId($fileId);
         $this->setSuppFileData($suppFile);
         $suppFileDao->insertSuppFile($suppFile);
         $this->suppFileId = $suppFile->getId();
     }
     return $this->suppFileId;
 }
 /**
  * Upload an image to an HTML galley.
  * @param $imageName string file input key
  */
 function uploadImage()
 {
     import('classes.file.PaperFileManager');
     $fileManager = new PaperFileManager($this->paperId);
     $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
     $fileName = 'imageFile';
     if (isset($this->galley) && $fileManager->uploadedFileExists($fileName)) {
         $type = $fileManager->getUploadedFileType($fileName);
         $extension = $fileManager->getImageExtension($type);
         if (!$extension) {
             $this->addError('imageFile', Locale::translate('submission.layout.imageInvalid'));
             return false;
         }
         if ($fileId = $fileManager->uploadPublicFile($fileName)) {
             $galleyDao->insertGalleyImage($this->galleyId, $fileId);
             // Update galley image files
             $this->galley->setImageFiles($galleyDao->getGalleyImages($this->galleyId));
         }
     }
 }