/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($subclass = false, $articleId = 0, $parentPage = null) { $templateMgr =& TemplateManager::getManager(); $pageHierarchy = $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'author'), 'user.role.author'), array(Request::url(null, 'author'), 'article.submissions')) : array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'author'), 'user.role.author')); import('submission.sectionEditor.SectionEditorAction'); $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'author'); if (isset($submissionCrumb)) { $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb); } $templateMgr->assign('pageHierarchy', $pageHierarchy); }
function execute() { $meeting =& $this->meeting; $submission =& $this->submission; $decision = $this->getData('decision'); $sectionDecisionDao =& DAORegistry::getDAO("SectionDecisionDAO"); $previousDecision =& $sectionDecisionDao->getLastSectionDecision($submission->getId()); $dateDecided = $meeting->getDate(); switch ($decision) { case SUBMISSION_SECTION_DECISION_APPROVED: case SUBMISSION_SECTION_DECISION_RESUBMIT: case SUBMISSION_SECTION_DECISION_DECLINED: SectionEditorAction::recordDecision($submission, $decision, REVIEW_TYPE_PR, $previousDecision->getRound(), null, $dateDecided, $previousDecision->getId()); break; } }
/** * Remove cover page from article * @param $args array * @param $request PKPRequest */ function removeArticleCoverPage($args, &$request) { $articleId = (int) array_shift($args); $this->validate($request, $articleId); $formLocale = array_shift($args); if (!AppLocale::isLocaleValid($formLocale)) { $request->redirect(null, null, 'viewMetadata', $articleId); } import('classes.submission.sectionEditor.SectionEditorAction'); if (SectionEditorAction::removeArticleCoverPage($this->submission, $formLocale)) { $request->redirect(null, null, 'viewMetadata', $articleId); } }
/** * Rush a new submission into the end of the editing queue. * @param $article object */ function expediteSubmission($article) { $user =& Request::getUser(); import('submission.editor.EditorAction'); import('submission.sectionEditor.SectionEditorAction'); import('submission.proofreader.ProofreaderAction'); $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getArticleId()); $submissionFile = $sectionEditorSubmission->getSubmissionFile(); // Add a long entry before doing anything. import('article.log.ArticleLog'); import('article.log.ArticleEventLogEntry'); ArticleLog::logEvent($article->getArticleId(), ARTICLE_LOG_EDITOR_EXPEDITE, ARTICLE_LOG_TYPE_EDITOR, $user->getUserId(), 'log.editor.submissionExpedited', array('editorName' => $user->getFullName(), 'articleId' => $article->getArticleId())); // 1. Ensure that an editor is assigned. $editAssignments =& $sectionEditorSubmission->getEditAssignments(); if (empty($editAssignments)) { // No editors are currently assigned; assign self. EditorAction::assignEditor($article->getArticleId(), $user->getUserId(), true); } // 2. Accept the submission and send to copyediting. $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getArticleId()); if (!$sectionEditorSubmission->getCopyeditFile()) { SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT); $reviewFile = $sectionEditorSubmission->getReviewFile(); SectionEditorAction::setCopyeditFile($sectionEditorSubmission, $reviewFile->getFileId(), $reviewFile->getRevision()); } // 3. Add a galley. $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getArticleId()); $galleys =& $sectionEditorSubmission->getGalleys(); if (empty($galleys)) { // No galley present -- use copyediting file. import('file.ArticleFileManager'); $copyeditFile =& $sectionEditorSubmission->getCopyeditFile(); $fileType = $copyeditFile->getFileType(); $articleFileManager =& new ArticleFileManager($article->getArticleId()); $fileId = $articleFileManager->copyPublicFile($copyeditFile->getFilePath(), $fileType); if (strstr($fileType, 'html')) { $galley =& new ArticleHTMLGalley(); } else { $galley =& new ArticleGalley(); } $galley->setArticleId($article->getArticleId()); $galley->setFileId($fileId); $galley->setLocale(Locale::getLocale()); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); } else { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('Postscript'); } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); } else { $galley->setLabel(Locale::translate('common.untitled')); } } } } $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $galleyDao->insertGalley($galley); } $sectionEditorSubmission->setStatus(STATUS_QUEUED); $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission); }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy */ function setupTemplate($subclass = false, $articleId = 0, $parentPage = null) { parent::setupTemplate(); AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION)); $templateMgr =& TemplateManager::getManager(); $pageHierarchy = $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'copyeditor'), 'user.role.copyeditor')) : array(array('user', 'navigation.user'), array('copyeditor', 'user.role.copyeditor')); import('classes.submission.sectionEditor.SectionEditorAction'); $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'copyeditor'); if (isset($submissionCrumb)) { $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb); } $templateMgr->assign('pageHierarchy', $pageHierarchy); }
/** * Delete comment. */ function deleteComment($args) { $articleId = $args[0]; $commentId = $args[1]; $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId)); $this->validate(); $comment =& $this->comment; $this->setupTemplate(true); $submissionEditHandler = new SubmissionEditHandler(); $submissionEditHandler->validate($articleId); $submission =& $submissionEditHandler->submission; SectionEditorAction::deleteComment($commentId); // Redirect back to initial comments page if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) { Request::redirect(null, null, 'viewPeerReviewComments', array($articleId, $comment->getAssocId())); } else { if ($comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) { Request::redirect(null, null, 'viewEditorDecisionComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_COPYEDIT) { Request::redirect(null, null, 'viewCopyeditComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) { Request::redirect(null, null, 'viewLayoutComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) { Request::redirect(null, null, 'viewProofreadComments', $articleId); } } } } } }
/** * Internal function to write the pdf of a published researt. * @param $sectionEditorSubmission SectionEditorSubmission * @return bool */ function _publishResearch($sectionEditorSubmission) { $completionReport = $sectionEditorSubmission->getLastReportFile(); if ($completionReport->getFileType() == "application/pdf") { $coverPath = SectionEditorAction::_generateCover($sectionEditorSubmission); if ($coverPath && $coverPath != '') { import('classes.lib.TCPDFMerger'); $file2merge = array($coverPath . 'tempCover.pdf', $completionReport->getFilePath()); $pdf = new TCPDFMerger(); $pdf->setFiles($file2merge); $pdf->concat(); $fileName = $sectionEditorSubmission->getProposalId() . '-Final_Technical_Report.pdf'; $pdf->Output($coverPath . $fileName, "F"); FileManager::deleteFile($coverPath . 'tempCover.pdf'); if (file_exists($coverPath . $fileName)) { //import('classes.article.ArticleFile'); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $technicalReport = new ArticleFile(); $technicalReport->setArticleId($sectionEditorSubmission->getArticleId()); $technicalReport->setFileName($fileName); $technicalReport->setFileType('application/pdf'); $technicalReport->setFileSize(filesize($coverPath . $fileName)); $technicalReport->setOriginalFileName($fileName); $technicalReport->setType('public'); $technicalReport->setDateUploaded(Core::getCurrentDate()); $technicalReport->setDateModified(Core::getCurrentDate()); $fileId = $articleFileDao->insertArticleFile($technicalReport); return $fileId; } } } return false; }
/** * Resubmit the file for review. * @param $sectionEditorSubmission object * @param $fileId int * @param $revision int * TODO: SECURITY! */ function resubmitFile($sectionEditorSubmission, $fileId, $revision, $request) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($sectionEditorSubmission->getId()); $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $user =& $request->getUser(); if (!HookRegistry::call('SectionEditorAction::resubmitFile', array(&$sectionEditorSubmission, &$fileId, &$revision))) { // Increment the round $currentRound = $sectionEditorSubmission->getCurrentRound(); $sectionEditorSubmission->setCurrentRound($currentRound + 1); $sectionEditorSubmission->stampStatusModified(); // Copy the file from the editor decision file folder to the review file folder $newFileId = $articleFileManager->copyToReviewFile($fileId, $revision, $sectionEditorSubmission->getReviewFileId()); $newReviewFile = $articleFileDao->getArticleFile($newFileId); $newReviewFile->setRound($sectionEditorSubmission->getCurrentRound()); $articleFileDao->updateArticleFile($newReviewFile); // Copy the file from the editor decision file folder to the next-round editor file // $editorFileId may or may not be null after assignment $editorFileId = $sectionEditorSubmission->getEditorFileId() != null ? $sectionEditorSubmission->getEditorFileId() : null; // $editorFileId definitely will not be null after assignment $editorFileId = $articleFileManager->copyToEditorFile($newFileId, null, $editorFileId); $newEditorFile = $articleFileDao->getArticleFile($editorFileId); $newEditorFile->setRound($sectionEditorSubmission->getCurrentRound()); $articleFileDao->updateArticleFile($newEditorFile); // The review revision is the highest revision for the review file. $reviewRevision = $articleFileDao->getRevisionNumber($newFileId); $sectionEditorSubmission->setReviewRevision($reviewRevision); $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission); // Now, reassign all reviewers that submitted a review for this new round of reviews. $previousRound = $sectionEditorSubmission->getCurrentRound() - 1; foreach ($sectionEditorSubmission->getReviewAssignments($previousRound) as $reviewAssignment) { if ($reviewAssignment->getRecommendation() !== null && $reviewAssignment->getRecommendation() !== '') { // Then this reviewer submitted a review. SectionEditorAction::addReviewer($sectionEditorSubmission, $reviewAssignment->getReviewerId(), $sectionEditorSubmission->getCurrentRound(), $request); } } // Add log import('classes.article.log.ArticleLog'); ArticleLog::logEvent($request, $sectionEditorSubmission, ARTICLE_LOG_REVIEW_RESUBMIT, 'log.review.resubmit'); } }
/** * Rush a new submission into the end of the editing queue. * @param $article object */ function expediteSubmission($article, $request) { $user =& $request->getUser(); import('classes.submission.editor.EditorAction'); import('classes.submission.sectionEditor.SectionEditorAction'); import('classes.submission.proofreader.ProofreaderAction'); $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId()); $submissionFile = $sectionEditorSubmission->getSubmissionFile(); // Add a log entry before doing anything. import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); ArticleLog::logEvent($request, $article, ARTICLE_LOG_EDITOR_EXPEDITE, 'log.editor.submissionExpedited', array('editorName' => $user->getFullName())); // 1. Ensure that an editor is assigned. $editAssignments =& $sectionEditorSubmission->getEditAssignments(); if (empty($editAssignments)) { // No editors are currently assigned; assign self. EditorAction::assignEditor($article->getId(), $user->getId(), true, false, $request); } // 2. Accept the submission and send to copyediting. $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId()); if (!$sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true)) { SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT, $request); $reviewFile = $sectionEditorSubmission->getReviewFile(); SectionEditorAction::setCopyeditFile($sectionEditorSubmission, $reviewFile->getFileId(), $reviewFile->getRevision(), $request); } // 3. Add a galley. $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId()); $galleys =& $sectionEditorSubmission->getGalleys(); if (empty($galleys)) { // No galley present -- use copyediting file. import('classes.file.ArticleFileManager'); $copyeditFile =& $sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'); $fileType = $copyeditFile->getFileType(); $articleFileManager = new ArticleFileManager($article->getId()); $fileId = $articleFileManager->copyPublicFile($copyeditFile->getFilePath(), $fileType); if (strstr($fileType, 'html')) { $galley = new ArticleHTMLGalley(); } else { $galley = new ArticleGalley(); } $galley->setArticleId($article->getId()); $galley->setFileId($fileId); $galley->setLocale(AppLocale::getLocale()); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); } else { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('Postscript'); } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); } else { $galley->setLabel(__('common.untitled')); } } } } $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $galleyDao->insertGalley($galley); // Update file search index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($article->getId(), ARTICLE_SEARCH_GALLEY_FILE, $fileId); } $sectionEditorSubmission->setStatus(STATUS_QUEUED); $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission); }
/** * View a file (inlines file). * @param $args array ($articleId, $galleyId, $fileId [optional]) */ function viewFile($args) { $articleId = isset($args[0]) ? $args[0] : 0; $galleyId = isset($args[1]) ? $args[1] : 0; $fileId = isset($args[2]) ? (int) $args[2] : 0; list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId); $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $galley =& $galleyDao->getGalley($galleyId, $article->getArticleId()); if (!$galley) { Request::redirect(null, null, 'view', $articleId); } if (!$fileId) { $galleyDao->incrementViews($galleyId); $fileId = $galley->getFileId(); } else { if (!$galley->isDependentFile($fileId)) { Request::redirect(null, null, 'view', $articleId); } } if (!HookRegistry::call('ArticleHandler::viewFile', array(&$article, &$galley, &$fileId))) { // reuse section editor's view file function import('submission.sectionEditor.SectionEditorAction'); SectionEditorAction::viewFile($article->getArticleId(), $fileId); } }
/** * Save settings. */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $application =& PKPApplication::getApplication(); $request =& $application->getRequest(); $user =& $request->getUser(); $router =& $request->getRouter(); $journal =& $router->getContext($request); $article = new Article(); $article->setLocale($journal->getPrimaryLocale()); // FIXME in bug #5543 $article->setUserId($user->getId()); $article->setJournalId($journal->getId()); $article->setSectionId($this->getData('sectionId')); $article->setLanguage(String::substr($journal->getPrimaryLocale(), 0, 2)); $article->setTitle($this->getData('title'), null); // Localized $article->setAbstract($this->getData('abstract'), null); // Localized $article->setDiscipline($this->getData('discipline'), null); // Localized $article->setSubjectClass($this->getData('subjectClass'), null); // Localized $article->setSubject($this->getData('subject'), null); // Localized $article->setCoverageGeo($this->getData('coverageGeo'), null); // Localized $article->setCoverageChron($this->getData('coverageChron'), null); // Localized $article->setCoverageSample($this->getData('coverageSample'), null); // Localized $article->setType($this->getData('type'), null); // Localized $article->setSponsor($this->getData('sponsor'), null); // Localized $article->setCitations($this->getData('citations')); $article->setPages($this->getData('pages')); // Set some default values so the ArticleDAO doesn't complain when adding this article $article->setDateSubmitted(Core::getCurrentDate()); $article->setStatus(STATUS_PUBLISHED); $article->setSubmissionProgress(0); $article->stampStatusModified(); $article->setCurrentRound(1); $article->setFastTracked(1); $article->setHideAuthor(0); $article->setCommentsStatus(0); // Insert the article to get it's ID $articleDao->insertArticle($article); $articleId = $article->getId(); // Add authors $authors = $this->getData('authors'); for ($i = 0, $count = count($authors); $i < $count; $i++) { if ($authors[$i]['authorId'] > 0) { // Update an existing author $author =& $article->getAuthor($authors[$i]['authorId']); $isExistingAuthor = true; } else { // Create a new author $author = new Author(); $isExistingAuthor = false; } if ($author != null) { $author->setSubmissionId($articleId); $author->setFirstName($authors[$i]['firstName']); $author->setMiddleName($authors[$i]['middleName']); $author->setLastName($authors[$i]['lastName']); if (array_key_exists('affiliation', $authors[$i])) { $author->setAffiliation($authors[$i]['affiliation'], null); } $author->setCountry($authors[$i]['country']); $author->setEmail($authors[$i]['email']); $author->setUrl($authors[$i]['url']); if (array_key_exists('competingInterests', $authors[$i])) { $author->setCompetingInterests($authors[$i]['competingInterests'], null); } $author->setBiography($authors[$i]['biography'], null); $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $article->addAuthor($author); } } } // Add the submission files as galleys import('classes.file.TemporaryFileManager'); import('classes.file.ArticleFileManager'); $tempFileIds = $this->getData('tempFileId'); $temporaryFileManager = new TemporaryFileManager(); $articleFileManager = new ArticleFileManager($articleId); foreach (array_keys($tempFileIds) as $locale) { $temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId()); $fileId = null; if ($temporaryFile) { $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUBMISSION); $fileType = $temporaryFile->getFileType(); if (strstr($fileType, 'html')) { import('classes.article.ArticleHTMLGalley'); $galley = new ArticleHTMLGalley(); } else { import('classes.article.ArticleGalley'); $galley = new ArticleGalley(); } $galley->setArticleId($articleId); $galley->setFileId($fileId); $galley->setLocale($locale); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); } else { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('Postscript'); } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); } else { $galley->setLabel(__('common.untitled')); } } } } $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $galleyDao->insertGalley($galley); } if ($locale == $journal->getPrimaryLocale()) { $article->setSubmissionFileId($fileId); $article->SetReviewFileId($fileId); } // Update file search index import('classes.search.ArticleSearchIndex'); if (isset($galley)) { ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } } // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($articleId); import('classes.submission.author.AuthorAction'); AuthorAction::designateReviewVersion($authorSubmission, true); // Accept the submission $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId); $articleFileManager = new ArticleFileManager($articleId); $sectionEditorSubmission->setReviewFile($articleFileManager->getFile($article->getSubmissionFileId())); import('classes.submission.sectionEditor.SectionEditorAction'); SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT); // Create signoff infrastructure $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); import('classes.author.form.submit.AuthorSubmitForm'); AuthorSubmitForm::assignEditors($article); $articleDao->updateArticle($article); // Add to end of editing queue import('classes.submission.editor.EditorAction'); if (isset($galley)) { EditorAction::expediteSubmission($article); } if ($this->getData('destination') == "issue") { // Add to an existing issue $issueId = $this->getData('issueId'); $this->scheduleForPublication($articleId, $issueId); } // Index article. import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); // Import the references list. $citationDao =& DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList); }
/** * Delete comment. */ function deleteComment($args) { SectionEditorHandler::validate(); SectionEditorHandler::setupTemplate(true); $articleId = $args[0]; $commentId = $args[1]; list($journal, $submission) = SubmissionEditHandler::validate($articleId); list($comment) = SubmissionCommentsHandler::validate($commentId); SectionEditorAction::deleteComment($commentId); // Redirect back to initial comments page if ($comment->getCommentType() == COMMENT_TYPE_PEER_REVIEW) { Request::redirect(null, null, 'viewPeerReviewComments', array($articleId, $comment->getAssocId())); } else { if ($comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) { Request::redirect(null, null, 'viewEditorDecisionComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_COPYEDIT) { Request::redirect(null, null, 'viewCopyeditComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) { Request::redirect(null, null, 'viewLayoutComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) { Request::redirect(null, null, 'viewProofreadComments', $articleId); } } } } } }
/** * View a file (inlines file). * @param $args array ($articleId, $fileId, [$revision]) * @param $request PKPRequest */ function viewFile($args, &$request) { $articleId = (int) array_shift($args); $fileId = (int) array_shift($args); $revision = array_shift($args); // May be null $this->validate($articleId); if (!SectionEditorAction::viewFile($articleId, $fileId, $revision)) { $request->redirect(null, null, 'submission', $articleId); } }
/** * Remove cover page from article */ function removeArticleCoverPage($args, &$request) { $articleId = isset($args[0]) ? (int) $args[0] : 0; $this->validate($articleId); $formLocale = $args[1]; if (!Locale::isLocaleValid($formLocale)) { $request->redirect(null, null, 'viewMetadata', $articleId); } $submission =& $this->submission; import('classes.submission.sectionEditor.SectionEditorAction'); if (SectionEditorAction::removeArticleCoverPage($submission, $formLocale)) { $request->redirect(null, null, 'viewMetadata', $articleId); } }
/** * View a file (inlines file). * @param $args array ($articleId, $fileId, [$revision]) */ function viewFile($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); if (!SectionEditorAction::viewFile($articleId, $fileId, $revision)) { Request::redirect(null, null, 'submission', $articleId); } }
/** * Display submission management instructions. * @param $args (type) */ function instructions($args) { import('submission.sectionEditor.SectionEditorAction'); if (!isset($args[0]) || !SectionEditorAction::instructions($args[0])) { Request::redirect(null, Request::getRequestedPage()); } }
/** * Setup common template variables. * @param $level int set to 0 if caller is at the same level as this handler in the hierarchy; otherwise the number of levels below this handler */ function setupTemplate($level = EDITOR_SECTION_HOME, $articleId = 0, $parentPage = null) { parent::setupTemplate(); // Layout Editors have access to some Issue Mgmt functions. Make sure we give them // the appropriate breadcrumbs and sidebar. $isLayoutEditor = Request::getRequestedPage() == 'layoutEditor'; $journal =& Request::getJournal(); $templateMgr =& TemplateManager::getManager(); if ($level == EDITOR_SECTION_HOME) { $pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user')); } else { if ($level == EDITOR_SECTION_SUBMISSIONS) { $pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'editor'), 'user.role.editor'), array(Request::url(null, 'editor', 'submissions'), 'article.submissions')); } else { if ($level == EDITOR_SECTION_ISSUES) { $pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $isLayoutEditor ? 'layoutEditor' : 'editor'), $isLayoutEditor ? 'user.role.layoutEditor' : 'user.role.editor'), array(Request::url(null, $isLayoutEditor ? 'layoutEditor' : 'editor', 'futureIssues'), 'issue.issues')); } } } import('classes.submission.sectionEditor.SectionEditorAction'); $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'editor'); if (isset($submissionCrumb)) { $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb); } $templateMgr->assign('pageHierarchy', $pageHierarchy); }
/** * View a file (inlines file). * @param $args array ($articleId, $fileId, [$revision]) */ function viewFile($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) = SubmissionEditHandler::validate($articleId); if (!SectionEditorAction::viewFile($articleId, $fileId, $revision)) { Request::redirect(null, null, 'submission', $articleId); } }
/** * Setup common template variables. * @param $subclass boolean set to true if caller is below this handler in the hierarchy * @param $articleId int optional * @param $parentPage string optional * @param $showSidebar boolean optional */ function setupTemplate($subclass = false, $articleId = 0, $parentPage = null, $showSidebar = true) { parent::setupTemplate(); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OJS_AUTHOR, LOCALE_COMPONENT_OJS_MANAGER); $templateMgr =& TemplateManager::getManager(); $isEditor = Validation::isEditor(); if (Request::getRequestedPage() == 'editor') { $templateMgr->assign('helpTopicId', 'editorial.editorsRole'); } else { $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole'); } $roleSymbolic = $isEditor ? 'editor' : 'sectionEditor'; $roleKey = $isEditor ? 'user.role.editor' : 'user.role.sectionEditor'; $pageHierarchy = $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $roleSymbolic), $roleKey), array(Request::url(null, $roleSymbolic), 'article.submissions')) : array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $roleSymbolic), $roleKey)); import('classes.submission.sectionEditor.SectionEditorAction'); $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, $roleSymbolic); if (isset($submissionCrumb)) { $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb); } $templateMgr->assign('pageHierarchy', $pageHierarchy); }
/** * Save settings. */ function execute() { $articleDao = DAORegistry::getDAO('ArticleDAO'); $signoffDao = DAORegistry::getDAO('SignoffDAO'); $sectionEditorSubmissionDao = DAORegistry::getDAO('SectionEditorSubmissionDAO'); $application = PKPApplication::getApplication(); $request = $this->request; $user = $request->getUser(); $router = $request->getRouter(); $journal = $router->getContext($request); $article = $articleDao->newDataObject(); $article->setLocale($journal->getPrimaryLocale()); // FIXME in bug #5543 $article->setUserId($user->getId()); $article->setJournalId($journal->getId()); $article->setSectionId($this->getData('sectionId')); $article->setLanguage($this->getData('language')); $article->setTitle($this->getData('title'), null); // Localized $article->setAbstract($this->getData('abstract'), null); // Localized $article->setDiscipline($this->getData('discipline'), null); // Localized $article->setSubjectClass($this->getData('subjectClass'), null); // Localized $article->setSubject($this->getData('subject'), null); // Localized $article->setCoverageGeo($this->getData('coverageGeo'), null); // Localized $article->setCoverageChron($this->getData('coverageChron'), null); // Localized $article->setCoverageSample($this->getData('coverageSample'), null); // Localized $article->setType($this->getData('type'), null); // Localized $article->setSponsor($this->getData('sponsor'), null); // Localized $article->setCitations($this->getData('citations')); $article->setPages($this->getData('pages')); // Set some default values so the ArticleDAO doesn't complain when adding this article $article->setDateSubmitted(Core::getCurrentDate()); $article->setStatus(STATUS_PUBLISHED); $article->setSubmissionProgress(0); $article->stampStatusModified(); $article->setCurrentRound(1); $article->setFastTracked(1); $article->setHideAuthor(0); $article->setCommentsStatus(0); // Insert the article to get it's ID $articleDao->insertObject($article); $articleId = $article->getId(); // Add authors $authors = $this->getData('authors'); for ($i = 0, $count = count($authors); $i < $count; $i++) { if ($authors[$i]['authorId'] > 0) { // Update an existing author $author =& $authorDao->getAuthor($authors[$i]['authorId'], $articleId); $isExistingAuthor = true; } else { // Create a new author $author = new Author(); $isExistingAuthor = false; } if ($author != null) { $author->setSubmissionId($articleId); $author->setFirstName($authors[$i]['firstName']); $author->setMiddleName($authors[$i]['middleName']); $author->setLastName($authors[$i]['lastName']); if (array_key_exists('affiliation', $authors[$i])) { $author->setAffiliation($authors[$i]['affiliation'], null); } $author->setCountry($authors[$i]['country']); $author->setEmail($authors[$i]['email']); $author->setUrl($authors[$i]['url']); if (array_key_exists('competingInterests', $authors[$i])) { $author->setCompetingInterests($authors[$i]['competingInterests'], null); } $author->setBiography($authors[$i]['biography'], null); $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $authorDao = DAORegistry::getDAO('AuthorDAO'); /* @var $authorDao AuthorDAO */ $authorDao->insertObject($author); } } } // Add the submission files as galleys import('lib.pkp.classes.file.TemporaryFileManager'); import('classes.file.ArticleFileManager'); $tempFileIds = $this->getData('tempFileId'); $temporaryFileManager = new TemporaryFileManager(); $articleFileManager = new ArticleFileManager($articleId); $designatedPrimary = false; foreach (array_keys($tempFileIds) as $locale) { $temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId()); $fileId = null; if ($temporaryFile) { $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, SUBMISSION_FILE_SUBMISSION); $fileType = $temporaryFile->getFileType(); if (strstr($fileType, 'html')) { import('classes.article.ArticleHTMLGalley'); $galley = new ArticleHTMLGalley(); } else { import('classes.article.ArticleGalley'); $galley = new ArticleGalley(); } $galley->setArticleId($articleId); $galley->setFileId($fileId); $galley->setLocale($locale); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); } else { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('Postscript'); } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); } else { $galley->setLabel(__('common.untitled')); } } } } $galleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); $galleyDao->insertGalley($galley); if (!$designatedPrimary) { $article->setSubmissionFileId($fileId); if ($locale == $journal->getPrimaryLocale()) { // Used to make sure that *some* file // is designated Review Version, but // preferrably the primary locale. $designatedPrimary = true; } } } // Update file search index import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); if (isset($galley)) { $articleSearchIndex->articleFileChanged($galley->getArticleId(), SUBMISSION_SEARCH_GALLEY_FILE, $galley->getFileId()); } $articleSearchIndex->articleChangesFinished(); } // Designate this as the review version by default. $authorSubmissionDao = DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($articleId); import('classes.submission.author.AuthorAction'); AuthorAction::designateReviewVersion($authorSubmission, true); // Accept the submission $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId); $articleFileManager = new ArticleFileManager($articleId); import('classes.submission.sectionEditor.SectionEditorAction'); assert(false); // FIXME: $decisionLabels missing from call below. SectionEditorAction::recordDecision($this->request, $sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT); import('classes.author.form.submit.AuthorSubmitForm'); AuthorSubmitForm::assignEditors($article); $articleDao->updateObject($article); // Add to end of editing queue import('classes.submission.editor.EditorAction'); if (isset($galley)) { EditorAction::expediteSubmission($article, $this->request); } if ($this->getData('destination') == "issue") { // Add to an existing issue $issueId = $this->getData('issueId'); $this->scheduleForPublication($articleId, $issueId); } // Import the references list. $citationDao = DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList); // Index article. import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); $articleSearchIndex->articleMetadataChanged($article); $articleSearchIndex->articleChangesFinished(); }
function downloadSummary($args) { $articleId = isset($args[0]) ? (int) $args[0] : 0; $this->validate($articleId); $submission =& $this->submission; SectionEditorAction::automaticSummaryInPDF($submission); }