/** * Download a file. * @param $args array ($articleId, $fileId) */ function downloadProposalFromMeetingFile($args) { $proposalId = isset($args[0]) ? $args[0] : 0; $fileId = isset($args[1]) ? $args[1] : 0; $this->validate($proposalId); if (!Action::downloadFile($proposalId, $fileId)) { Request::redirect(null, 'user'); } }
/** * Download a file a copyeditor has access to. * @param $submission object * @param $fileId int * @param $revision int */ function downloadCopyeditorFile($submission, $fileId, $revision = null) { $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $canDownload = false; // Copyeditors have access to: // 1) The first revision of the copyedit file // 2) The initial copyedit revision // 3) The author copyedit revision, after the author copyedit has been completed // 4) The final copyedit revision // 5) Layout galleys if ($submission->getCopyeditFileId() == $fileId) { $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $currentRevision =& $articleFileDao->getRevisionNumber($fileId); if ($revision == null) { $revision = $currentRevision; } if ($revision == 1) { $canDownload = true; } else { if ($submission->getInitialRevision() == $revision) { $canDownload = true; } else { if ($submission->getEditorAuthorRevision() == $revision && $submission->getDateAuthorCompleted() != null) { $canDownload = true; } else { if ($submission->getFinalRevision() == $revision) { $canDownload = true; } } } } } else { // Check galley files foreach ($submission->getGalleys() as $galleyFile) { if ($galleyFile->getFileId() == $fileId) { $canDownload = true; } } // Check supp files foreach ($submission->getSuppFiles() as $suppFile) { if ($suppFile->getFileId() == $fileId) { $canDownload = true; } } } $result = false; if (!HookRegistry::call('CopyeditorAction::downloadCopyeditorFile', array(&$submission, &$fileId, &$revision, &$result))) { if ($canDownload) { return Action::downloadFile($submission->getArticleId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file. * @param $args array ($articleId, $fileId, [$revision]) */ function download($args) { $articleId = isset($args[0]) ? $args[0] : 0; $fileId = isset($args[1]) ? $args[1] : 0; $revision = isset($args[2]) ? $args[2] : null; $this->validate($articleId); Action::downloadFile($articleId, $fileId, $revision); }
/** * Download a file a reviewer has access to. * @param $reviewId int * @param $paper object * @param $fileId int * @param $revision int */ function downloadReviewerFile($reviewId, &$paper, $fileId, $revision = null) { $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId); $conference =& Request::getConference(); $canDownload = false; // Reviewers have access to: // 1) The current revision of the file to be reviewed. // 2) Any file that he uploads. // 3) Any supplementary file that is visible to reviewers. if ((!$reviewAssignment->getDateConfirmed() || $reviewAssignment->getDeclined()) && $conference->getSetting('restrictReviewerFileAccess')) { // Restrict files until review is accepted } else { if ($reviewAssignment->getReviewFileId() == $fileId) { if ($revision != null) { if ($reviewAssignment->getReviewRevision() == null) { $canDownload = true; } else { $canDownload = $reviewAssignment->getReviewRevision() == $revision; } } } else { if ($reviewAssignment->getReviewerFileId() == $fileId) { $canDownload = true; } else { foreach ($reviewAssignment->getSuppFiles() as $suppFile) { if ($suppFile->getFileId() == $fileId && $suppFile->getShowReviewers()) { $canDownload = true; } } } } } $result = false; if (!HookRegistry::call('ReviewerAction::downloadReviewerFile', array(&$paper, &$fileId, &$revision, &$canDownload, &$result))) { if ($canDownload) { return Action::downloadFile($paper->getId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file a copyeditor has access to. * @param $submission object * @param $fileId int * @param $revision int */ function downloadCopyeditorFile($copyeditorSubmission, $fileId, $revision = null) { $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $canDownload = false; // Copyeditors have access to: // 1) The first revision of the copyedit file // 2) The initial copyedit revision // 3) The author copyedit revision, after the author copyedit has been completed // 4) The final copyedit revision // 5) Layout galleys if ($copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) == $fileId) { $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $currentRevision =& $articleFileDao->getRevisionNumber($fileId); if ($revision == null) { $revision = $currentRevision; } $initialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId()); $authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId()); $finalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId()); if ($revision == 1) { $canDownload = true; } else { if ($initialSignoff->getFileRevision() == $revision) { $canDownload = true; } else { if ($finalSignoff->getFileRevision() == $revision) { $canDownload = true; } } } } else { if ($copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_AUTHOR', true) == $fileId) { $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId()); if ($authorSignoff->getDateCompleted() != null) { $canDownload = true; } } else { if ($copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_FINAL', true) == $fileId) { $canDownload = true; } else { // Check galley files foreach ($copyeditorSubmission->getGalleys() as $galleyFile) { if ($galleyFile->getFileId() == $fileId) { $canDownload = true; } } // Check supp files foreach ($copyeditorSubmission->getSuppFiles() as $suppFile) { if ($suppFile->getFileId() == $fileId) { $canDownload = true; } } } } } $result = false; if (!HookRegistry::call('CopyeditorAction::downloadCopyeditorFile', array(&$copyeditorSubmission, &$fileId, &$revision, &$result))) { if ($canDownload) { return Action::downloadFile($copyeditorSubmission->getId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file an author has access to. * @param $article object * @param $fileId int * @param $revision int * @return boolean * TODO: Complete list of files author has access to */ function downloadAuthorFile($article, $fileId, $revision = null) { $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $submission =& $authorSubmissionDao->getAuthorSubmission($article->getArticleId()); $layoutAssignment =& $submission->getLayoutAssignment(); $canDownload = false; // Authors have access to: // 1) The original submission file. // 2) Any files uploaded by the reviewers that are "viewable", // although only after a decision has been made by the editor. // 3) The initial and final copyedit files, after initial copyedit is complete. // 4) Any of the author-revised files. // 5) The layout version of the file. // 6) Any supplementary file // 7) Any galley file // 8) All review versions of the file // 9) Current editor versions of the file // THIS LIST SHOULD NOW BE COMPLETE. if ($submission->getSubmissionFileId() == $fileId) { $canDownload = true; } else { if ($submission->getCopyeditFileId() == $fileId) { if ($revision != null) { $copyAssignmentDao =& DAORegistry::getDAO('CopyAssignmentDAO'); $copyAssignment =& $copyAssignmentDao->getCopyAssignmentByArticleId($article->getArticleId()); if ($copyAssignment && $copyAssignment->getInitialRevision() == $revision && $copyAssignment->getDateCompleted() != null) { $canDownload = true; } else { if ($copyAssignment && $copyAssignment->getFinalRevision() == $revision && $copyAssignment->getDateFinalCompleted() != null) { $canDownload = true; } else { if ($copyAssignment && $copyAssignment->getEditorAuthorRevision() == $revision) { $canDownload = true; } } } } else { $canDownload = false; } } else { if ($submission->getRevisedFileId() == $fileId) { $canDownload = true; } else { if ($layoutAssignment->getLayoutFileId() == $fileId) { $canDownload = true; } else { // Check reviewer files foreach ($submission->getReviewAssignments() as $roundReviewAssignments) { foreach ($roundReviewAssignments as $reviewAssignment) { if ($reviewAssignment->getReviewerFileId() == $fileId) { $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $articleFile =& $articleFileDao->getArticleFile($fileId, $revision); if ($articleFile != null && $articleFile->getViewable()) { $canDownload = true; } } } } // Check supplementary files foreach ($submission->getSuppFiles() as $suppFile) { if ($suppFile->getFileId() == $fileId) { $canDownload = true; } } // Check galley files foreach ($submission->getGalleys() as $galleyFile) { if ($galleyFile->getFileId() == $fileId) { $canDownload = true; } } // Check current review version $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewFilesByRound =& $reviewAssignmentDao->getReviewFilesByRound($article->getArticleId()); $reviewFile = @$reviewFilesByRound[$article->getCurrentRound()]; if ($reviewFile && $fileId == $reviewFile->getFileId()) { $canDownload = true; } // Check editor version $editorFiles = $submission->getEditorFileRevisions($article->getCurrentRound()); if (is_array($editorFiles)) { foreach ($editorFiles as $editorFile) { if ($editorFile->getFileId() == $fileId) { $canDownload = true; } } } } } } } $result = false; if (!HookRegistry::call('AuthorAction::downloadAuthorFile', array(&$article, &$fileId, &$revision, &$canDownload, &$result))) { if ($canDownload) { return Action::downloadFile($article->getArticleId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file a reviewer has access to. * @param $reviewId int * @param $article object * @param $fileId int */ function downloadReviewerFile($article, $fileId, $reviewId = null) { $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); if ($reviewId) { $reviewAssignment =& $reviewAssignmentDao->getById($reviewId); } $canDownload = false; $submissionFile = $article->getSubmissionFile(); $reviewFile = $article->getReviewFile(); $suppFiles = $article->getSuppFiles(); // Reviewers have access to: // 1) The current revision of the file to be reviewed. // 2) Any file that (s)he uploads. // 3) Any supplementary file that is visible to reviewers. // 4) Any of the previous main proposal files // 5) Any of the report files // 6) Any of the sae files if ($reviewFile->getId() == $fileId) { $canDownload = true; } else { if ($reviewId) { if ($reviewAssignment->getReviewerFileId() == $fileId) { $canDownload = true; } } else { if ($submissionFile->getFileId() == $fileId) { $canDownload = true; } else { foreach ($suppFiles as $suppFile) { if ($suppFile->getFileId() == $fileId && $suppFile->getShowReviewers()) { $canDownload = true; } } if (!$canDownload) { foreach ($article->getReportFiles() as $reportFile) { if ($reportFile->getFileId() == $fileId) { $canDownload = true; } } } if (!$canDownload) { foreach ($article->getSAEFiles() as $reportFile) { if ($reportFile->getFileId() == $fileId) { $canDownload = true; } } } if (!$canDownload) { $previousFiles =& $articleFileDao->getPreviousFilesByArticleId($article->getId()); foreach ($previousFiles as $previousFile) { if ($previousFile->getFileId() == $fileId) { $canDownload = true; } } } } } } $result = false; if (!HookRegistry::call('ReviewerAction::downloadReviewerFile', array(&$article, &$fileId, &$canDownload, &$result))) { if ($canDownload) { return Action::downloadFile($article->getId(), $fileId); } else { return false; } } return $result; }
/** * Download a file an author has access to. * @param $paper object * @param $fileId int * @param $revision int * @return boolean * TODO: Complete list of files author has access to */ function downloadAuthorFile($paper, $fileId, $revision = null) { $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $submission =& $authorSubmissionDao->getAuthorSubmission($paper->getId()); $canDownload = false; // Authors have access to: // 1) The original submission file. // 2) Any files uploaded by the reviewers that are "viewable", // although only after a decision has been made by the director. // 4) Any of the author-revised files. // 5) The layout version of the file. // 6) Any supplementary file // 7) Any galley file // 8) All review versions of the file // 9) Current director versions of the file // THIS LIST SHOULD NOW BE COMPLETE. if ($submission->getSubmissionFileId() == $fileId) { $canDownload = true; } else { if ($submission->getRevisedFileId() == $fileId) { $canDownload = true; } else { if ($submission->getLayoutFileId() == $fileId) { $canDownload = true; } else { // Check reviewer files foreach ($submission->getReviewAssignments(null) as $stageReviewAssignments) { foreach ($stageReviewAssignments as $reviewAssignment) { if ($reviewAssignment->getReviewerFileId() == $fileId) { $paperFileDao =& DAORegistry::getDAO('PaperFileDAO'); $paperFile =& $paperFileDao->getPaperFile($fileId, $revision); if ($paperFile != null && $paperFile->getViewable()) { $canDownload = true; } } } } // Check supplementary files foreach ($submission->getSuppFiles() as $suppFile) { if ($suppFile->getFileId() == $fileId) { $canDownload = true; } } // Check galley files foreach ($submission->getGalleys() as $galleyFile) { if ($galleyFile->getFileId() == $fileId) { $canDownload = true; } } // Check current review version $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewFilesByStage =& $reviewAssignmentDao->getReviewFilesByStage($paper->getId()); $reviewFile = @$reviewFilesByStage[$paper->getCurrentStage()]; if ($reviewFile && $fileId == $reviewFile->getFileId()) { $canDownload = true; } // Check director version $directorFiles = $submission->getDirectorFileRevisions($paper->getCurrentStage()); if (is_array($directorFiles)) { foreach ($directorFiles as $directorFile) { if ($directorFile->getFileId() == $fileId) { $canDownload = true; } } } } } } $result = false; if (!HookRegistry::call('AuthorAction::downloadAuthorFile', array(&$paper, &$fileId, &$revision, &$canDownload, &$result))) { if ($canDownload) { return Action::downloadFile($paper->getId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file. * @param $args array ($paperId, $fileId, [$revision]) */ function download($args, $request) { $paperId = (int) array_shift($args); $fileId = (int) array_shift($args); $revision = (int) array_shift($args); if (!$revision) { $revision = null; } $this->validate($request, $paperId); Action::downloadFile($paperId, $fileId, $revision); }
/** * Download a file a proofreader has access to. * @param $submission object * @param $fileId int * @param $revision int */ function downloadProofreaderFile($submission, $fileId, $revision = null) { $canDownload = false; // Proofreaders have access to: // 1) All supplementary files. // 2) All galley files. // Check supplementary files foreach ($submission->getSuppFiles() as $suppFile) { if ($suppFile->getFileId() == $fileId) { $canDownload = true; } } // Check galley files foreach ($submission->getGalleys() as $galleyFile) { if ($galleyFile->getFileId() == $fileId) { $canDownload = true; } } $result = false; if (!HookRegistry::call('ProofreaderAction::downloadProofreaderFile', array(&$submission, &$fileId, &$revision, &$canDownload, &$result))) { if ($canDownload) { return Action::downloadFile($submission->getArticleId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file a layout editor has access to. * This includes: The layout editor submission file, supplementary files, and galley files. * @param $article object * @parma $fileId int * @param $revision int optional * @return boolean */ function downloadFile($article, $fileId, $revision = null) { $canDownload = false; $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $suppDao =& DAORegistry::getDAO('SuppFileDAO'); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); if ($layoutSignoff->getFileId() == $fileId) { $canDownload = true; } else { if ($galleyDao->galleyExistsByFileId($article->getId(), $fileId)) { $canDownload = true; } else { if ($suppDao->suppFileExistsByFileId($article->getId(), $fileId)) { $canDownload = true; } } } $result = false; if (!HookRegistry::call('LayoutEditorAction::downloadFile', array(&$article, &$fileId, &$revision, &$canDownload, &$result))) { if ($canDownload) { return parent::downloadFile($article->getId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file an author has access to. * @param $article object * @param $fileId int * @return boolean * TODO: Complete list of files author has access to */ function downloadAuthorFile($article, $fileId) { $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId()); $layoutSignoff = $signoffDao->getBySymbolic('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $authorSubmission->getId()); $canDownload = false; // Authors have access to: // 1) The original submission file. // 2) Any files uploaded by the reviewers that are "viewable", // although only after a decision has been made by the editor. // 3) The initial and final copyedit files, after initial copyedit is complete. // 4) Any of the author-revised files. // 5) The layout version of the file. // 6) Any supplementary file // 7) Any galley file // 8) All review versions of the file // 9) Current editor versions of the file // THIS LIST SHOULD NOW BE COMPLETE. if ($authorSubmission->getSubmissionFileId() == $fileId) { $canDownload = true; } else { if ($authorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) == $fileId) { $initialSignoff = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $authorSubmission->getId()); $authorSignoff = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $authorSubmission->getId()); $finalSignoff = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $authorSubmission->getId()); if ($initialSignoff && $initialSignoff->getDateCompleted() != null) { $canDownload = true; } else { if ($finalSignoff && $finalSignoff->getDateCompleted() != null) { $canDownload = true; } else { if ($authorSignoff) { $canDownload = true; } } } } else { if ($authorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_AUTHOR', true) == $fileId) { $canDownload = true; } else { if ($authorSubmission->getRevisedFileId() == $fileId) { $canDownload = true; } else { if ($layoutSignoff->getFileId() == $fileId) { $canDownload = true; } else { // Check reviewer files $articleFileDao = DAORegistry::getDAO('ArticleFileDAO'); $files =& $articleFileDao->getArticleFilesByArticle($authorSubmission->getArticleId()); foreach ($files as $articleFile) { if ($articleFile->getFileId() == $fileId) { if ($articleFile != null && $articleFile->getViewable()) { $canDownload = true; } } } // Check supplementary files foreach ($authorSubmission->getSuppFiles() as $suppFile) { if ($suppFile->getFileId() == $fileId) { $canDownload = true; } } // Check report files foreach ($authorSubmission->getReportFiles() as $reportFile) { if ($reportFile->getFileId() == $fileId) { $canDownload = true; } } // Check SAE files foreach ($authorSubmission->getSAEFiles() as $reportFile) { if ($reportFile->getFileId() == $fileId) { $canDownload = true; } } // Check galley files foreach ($authorSubmission->getGalleys() as $galleyFile) { if ($galleyFile->getFileId() == $fileId) { $canDownload = true; } } // Check current review version $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewFilesByDecision =& $reviewAssignmentDao->getReviewFilesByDecision($article->getId()); $reviewFile = @$reviewFilesByDecision[$article->getLastSectionDecisionId()]; if ($reviewFile && $fileId == $reviewFile->getFileId()) { $canDownload = true; } // Check editor version /* $editorFiles = $authorSubmission->getEditorFileRevisions(); if (is_array($editorFiles)) foreach ($editorFiles as $editorFile) { if ($editorFile->getFileId() == $fileId) { $canDownload = true; } } */ } } } } } $result = false; if (!HookRegistry::call('AuthorAction::downloadAuthorFile', array(&$article, &$fileId, &$canDownload, &$result))) { if ($canDownload) { return Action::downloadFile($article->getId(), $fileId); } else { return false; } } return $result; }
/** * Download a file. * @param $args array ($paperId, $fileId, [$revision]) */ function download($args) { $paperId = (int) array_shift($args); $fileId = (int) array_shift($args); $revision = (int) array_shift($args); $this->validate($paperId); Action::downloadFile($paperId, $fileId, $revision); }
/** * Download a file a layout editor has access to. * This includes: The layout editor submission file, supplementary files, and galley files. * @param $article object * @parma $fileId int * @param $revision int optional * @return boolean */ function downloadFile($article, $fileId, $revision = null) { $canDownload = false; $layoutDao =& DAORegistry::getDAO('LayoutAssignmentDAO'); $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $suppDao =& DAORegistry::getDAO('SuppFileDAO'); $layoutAssignment =& $layoutDao->getLayoutAssignmentByArticleId($article->getArticleId()); if ($layoutAssignment->getLayoutFileId() == $fileId) { $canDownload = true; } else { if ($galleyDao->galleyExistsByFileId($article->getArticleId(), $fileId)) { $canDownload = true; } else { if ($suppDao->suppFileExistsByFileId($article->getArticleId(), $fileId)) { $canDownload = true; } } } $result = false; if (!HookRegistry::call('LayoutEditorAction::downloadFile', array(&$article, &$fileId, &$revision, &$canDownload, &$result))) { if ($canDownload) { return parent::downloadFile($article->getArticleId(), $fileId, $revision); } else { return false; } } return $result; }
/** * Download a file. * @param $args array ($articleId, $fileId, [$revision]) */ function download($args) { $articleId = isset($args[0]) ? $args[0] : 0; $fileId = isset($args[1]) ? $args[1] : 0; $revision = isset($args[2]) ? $args[2] : null; list($journal, $submission) = TrackSubmissionHandler::validate($articleId); Action::downloadFile($articleId, $fileId, $revision); }