/** * Upload the copyedit version of an article. * @param $sectionEditorSubmission object * @param $copyeditStage string */ function uploadCopyeditVersion($sectionEditorSubmission, $copyeditStage) { $articleId = $sectionEditorSubmission->getId(); import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($articleId); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); // Perform validity checks. $initialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId); $authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); if ($copyeditStage == 'final' && $authorSignoff->getDateCompleted() == null) { return; } if ($copyeditStage == 'author' && $initialSignoff->getDateCompleted() == null) { return; } $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName) && !HookRegistry::call('SectionEditorAction::uploadCopyeditVersion', array(&$sectionEditorSubmission))) { if ($sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) != null) { $copyeditFileId = $articleFileManager->uploadCopyeditFile($fileName, $sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true)); } else { $copyeditFileId = $articleFileManager->uploadCopyeditFile($fileName); } } if (isset($copyeditFileId) && $copyeditFileId != 0) { if ($copyeditStage == 'initial') { $signoff =& $initialSignoff; $signoff->setFileId($copyeditFileId); $signoff->setFileRevision($articleFileDao->getRevisionNumber($copyeditFileId)); } elseif ($copyeditStage == 'author') { $signoff =& $authorSignoff; $signoff->setFileId($copyeditFileId); $signoff->setFileRevision($articleFileDao->getRevisionNumber($copyeditFileId)); } elseif ($copyeditStage == 'final') { $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId); $signoff->setFileId($copyeditFileId); $signoff->setFileRevision($articleFileDao->getRevisionNumber($copyeditFileId)); } $signoffDao->updateObject($signoff); } }
/** * Upload the revised version of a copyedit file. * @param $authorSubmission object * @param $copyeditStage string */ function uploadCopyeditVersion($authorSubmission, $copyeditStage) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($authorSubmission->getId()); $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); // Authors cannot upload if the assignment is not active, i.e. // they haven't been notified or the assignment is already complete. $authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $authorSubmission->getId()); if (!$authorSignoff->getDateNotified() || $authorSignoff->getDateCompleted()) { return; } $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { HookRegistry::call('AuthorAction::uploadCopyeditVersion', array(&$authorSubmission, &$copyeditStage)); if ($authorSignoff->getFileId() != null) { $fileId = $articleFileManager->uploadCopyeditFile($fileName, $authorSignoff->getFileId()); } else { $fileId = $articleFileManager->uploadCopyeditFile($fileName); } } $authorSignoff->setFileId($fileId); if ($copyeditStage == 'author') { $authorSignoff->setFileRevision($articleFileDao->getRevisionNumber($fileId)); } $signoffDao->updateObject($authorSignoff); }
/** * Upload the copyedited version of an article. * @param $copyeditorSubmission object * @param $copyeditStage string * @param $request object */ function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage, $request) { import('classes.file.ArticleFileManager'); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); if ($copyeditStage == 'initial') { $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId()); } else { if ($copyeditStage == 'final') { $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId()); } } // Only allow an upload if they're in the initial or final copyediting // stages. if ($copyeditStage == 'initial' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) { return; } else { if ($copyeditStage == 'final' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) { return; } else { if ($copyeditStage != 'initial' && $copyeditStage != 'final') { return; } } } $articleFileManager = new ArticleFileManager($copyeditorSubmission->getId()); $user =& $request->getUser(); $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission)); if ($signoff->getFileId() != null) { $fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true)); } else { $fileId = $articleFileManager->uploadCopyeditFile($fileName); } } if (isset($fileId) && $fileId != 0) { $signoff->setFileId($fileId); $signoff->setFileRevision($articleFileDao->getRevisionNumber($fileId)); $signoffDao->updateObject($signoff); // Add log import('classes.article.log.ArticleLog'); ArticleLog::logEvent($request, $copyeditorSubmission, ARTICLE_LOG_COPYEDITOR_FILE, 'log.copyedit.copyeditorFile', array('copyeditorName' => $user->getFullName(), 'fileId' => $fileId)); } }
/** * Upload the copyedited version of an article. * @param $copyeditorSubmission object */ function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage) { import("file.ArticleFileManager"); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); if ($copyeditStage == 'initial') { $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getArticleId()); } else { if ($copyeditStage == 'final') { $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getArticleId()); } } // Only allow an upload if they're in the initial or final copyediting // stages. if ($copyeditStage == 'initial' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) { return; } else { if ($copyeditStage == 'final' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) { return; } else { if ($copyeditStage != 'initial' && $copyeditStage != 'final') { return; } } } $articleFileManager = new ArticleFileManager($copyeditorSubmission->getArticleId()); $user =& Request::getUser(); $fileName = 'upload'; if ($articleFileManager->uploadedFileExists($fileName)) { HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission)); if ($signoff->getFileId() != null) { $fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true)); } else { $fileId = $articleFileManager->uploadCopyeditFile($fileName); } } if (isset($fileId) && $fileId != 0) { $signoff->setFileId($fileId); $signoff->setFileRevision($articleFileDao->getRevisionNumber($fileId)); $signoffDao->updateObject($signoff); // Add log import('article.log.ArticleLog'); import('article.log.ArticleEventLogEntry'); $entry = new ArticleEventLogEntry(); $entry->setArticleId($copyeditorSubmission->getArticleId()); $entry->setUserId($user->getId()); $entry->setDateLogged(Core::getCurrentDate()); $entry->setEventType(ARTICLE_LOG_COPYEDIT_COPYEDITOR_FILE); $entry->setLogMessage('log.copyedit.copyeditorFile'); $entry->setAssocType(ARTICLE_LOG_TYPE_COPYEDIT); $entry->setAssocId($fileId); ArticleLog::logEventEntry($copyeditorSubmission->getArticleId(), $entry); } }