/** * Save changes to the supplementary file. * @return int the supplementary file ID */ function execute($fileName = null) { import("file.ArticleFileManager"); $articleFileManager =& new ArticleFileManager($this->article->getArticleId()); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $fileName = isset($fileName) ? $fileName : 'uploadSuppFile'; if (isset($this->suppFile)) { $suppFile =& $this->suppFile; // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $articleFileManager->uploadSuppFile($fileName, $suppFile->getFileId()); import('search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId()); } // Index metadata ArticleSearchIndex::indexSuppFileMetadata($suppFile); // Update existing supplementary file $this->setSuppFileData($suppFile); $suppFileDao->updateSuppFile($suppFile); } else { // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $fileId = $articleFileManager->uploadSuppFile($fileName); import('search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId); } else { $fileId = 0; } // Insert new supplementary file $suppFile =& new SuppFile(); $suppFile->setArticleId($this->article->getArticleId()); $suppFile->setFileId($fileId); $this->setSuppFileData($suppFile); $suppFileDao->insertSuppFile($suppFile); $this->suppFileId = $suppFile->getSuppFileId(); } return $this->suppFileId; }
/** * 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); }
/** * 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); }
/** * Save changes to the galley. * @return int the galley ID */ function execute($fileName = null) { import('file.ArticleFileManager'); $articleFileManager =& new ArticleFileManager($this->articleId); $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $fileName = isset($fileName) ? $fileName : 'galleyFile'; $journal =& Request::getJournal(); if (isset($this->galley)) { $galley =& $this->galley; // Upload galley file if ($articleFileManager->uploadedFileExists($fileName)) { if ($galley->getFileId()) { $articleFileManager->uploadPublicFile($fileName, $galley->getFileId()); } else { $fileId = $articleFileManager->uploadPublicFile($fileName); $galley->setFileId($fileId); } // Update file search index import('search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } if ($articleFileManager->uploadedFileExists('styleFile')) { // Upload stylesheet file $styleFileId = $articleFileManager->uploadPublicFile('styleFile', $galley->getStyleFileId()); $galley->setStyleFileId($styleFileId); } else { if ($this->getData('deleteStyleFile')) { // Delete stylesheet file $styleFile =& $galley->getStyleFile(); if (isset($styleFile)) { $articleFileManager->deleteFile($styleFile->getFileId()); } } } // Update existing galley $galley->setLabel($this->getData('label')); if ($journal->getSetting('enablePublicGalleyId')) { $galley->setPublicGalleyId($this->getData('publicGalleyId')); } $galley->setLocale($this->getData('galleyLocale')); $galleyDao->updateGalley($galley); } else { // Upload galley file if ($articleFileManager->uploadedFileExists($fileName)) { $fileType = $articleFileManager->getUploadedFileType($fileName); $fileId = $articleFileManager->uploadPublicFile($fileName); // Update file search index import('search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $fileId); } else { $fileId = 0; } if (isset($fileType) && strstr($fileType, 'html')) { // Assume HTML galley $galley =& new ArticleHTMLGalley(); } else { $galley =& new ArticleGalley(); } $galley->setArticleId($this->articleId); $galley->setFileId($fileId); if ($this->getData('label') == null) { // Generate initial label based on file type $enablePublicGalleyId = $journal->getSetting('enablePublicGalleyId'); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); if ($enablePublicGalleyId) { $galley->setPublicGalleyId('html'); } } else { if (isset($fileType)) { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); if ($enablePublicGalleyId) { $galley->setPublicgalleyId('pdf'); } } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('PostScript'); if ($enablePublicGalleyId) { $galley->setPublicgalleyId('ps'); } } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); if ($enablePublicGalleyId) { $galley->setPublicgalleyId('xml'); } } } } } } if ($galley->getLabel() == null) { $galley->setLabel(Locale::translate('common.untitled')); } } else { $galley->setLabel($this->getData('label')); } $galley->setLocale($this->getData('galleyLocale')); // Insert new galley $galleyDao->insertGalley($galley); $this->galleyId = $galley->getGalleyId(); } return $this->galleyId; }
/** * Index all article files (supplementary and galley). * @param $article Article */ function indexArticleFiles(&$article) { // Index supplementary files $fileDao =& DAORegistry::getDAO('SuppFileDAO'); $files =& $fileDao->getSuppFilesByArticle($article->getId()); foreach ($files as $file) { if ($file->getFileId()) { ArticleSearchIndex::updateFileIndex($article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $file->getFileId()); } ArticleSearchIndex::indexSuppFileMetadata($file); } unset($files); // Index galley files $fileDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $files =& $fileDao->getGalleysByArticle($article->getId()); foreach ($files as $file) { if ($file->getFileId()) { ArticleSearchIndex::updateFileIndex($article->getId(), ARTICLE_SEARCH_GALLEY_FILE, $file->getFileId()); } } }
/** * Save settings. */ function execute($editArticleId) { $this->editArticleID = $editArticleId; $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 //add Original Journal to Abstract $orig_journal = $this->getData('originalJournal'); $abstr = $this->getData('abstract'); foreach (array_keys($abstr) as $abs_key) { $abstr[$abs_key] .= ' <p id="originalPub"> ' . $orig_journal . ' </p> '; // $abstr[$abs_key] .= ' <p id="originalPub"> ' . $orig_journal[$abs_key]. ' </p> '; //OriginalJournal in EditPlugin only a string and not an array... $this->setData('abstract', $abstr); } $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); // As article has an ID already set it $article->setId($this->editArticleID); $articleId = $this->editArticleID; //delete prior Authors to prevent from double saving the same authors $authorDao =& DAORegistry::getDAO('AuthorDAO'); $authorDao->deleteAuthorsByArticle($articleId); // 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); } } } // Check whether the user gave a handle and create a handleSubmissionFile in case $submissionHandle = $this->getData('submissionHandle'); $handleSubmissionFileId; $handleCheck = FALSE; //import FileManager before creating files because otherwise naming of the copied files failes import('classes.file.ArticleFileManager'); foreach (array_keys($submissionHandle) as $locale) { if (!empty($submissionHandle[$locale])) { $this->deleteOldFile("submission/original", $articleId); // $this->deleteOldFile("submission/copyedit", $articleId); $handleCheck = TRUE; $handleSubmissionId = $this->createHandleTXTFile($submissionHandle[$locale], $articleId, 'submission'); $handleSubmissionPDFId = $this->createHandlePDF($submissionHandle[$locale], $articleId, 'submission'); //Add the handle submission files as galley $this->setGalley($articleId, $handleSubmissionPDFId, $locale, 'application/pdf'); } if ($handleCheck == TRUE) { if ($locale == $journal->getPrimaryLocale()) { $article->setSubmissionFileId($handleSubmissionPDFId); $article->SetReviewFileId($handleSubmissionPDFId); } // Update file search index import('classes.search.ArticleSearchIndex'); if (isset($galley)) { ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } } } // 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); $tempFileCheck = FALSE; foreach (array_keys($tempFileIds) as $locale) { $temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId()); $fileId = null; if ($temporaryFile) { $this->deleteOldFile("submission/original", $articleId); $this->deleteOldFile("submission/copyedit", $articleId); $tempFileCheck = TRUE; $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUBMISSION); $fileType = $temporaryFile->getFileType(); $this->setGalley($articleId, $fileId, $locale, $fileType); // $galley =& $this->setGalley($articleId, $fileId, $locale, $fileType); } if ($tempFileCheck == TRUE) { 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()); } } } //Check whether the user gave a handle and create handleSupplFile in case $supplHandle = $this->getData('supplHandle'); $handleSuppFileId = null; foreach (array_keys($supplHandle) as $locale) { if (!empty($supplHandle[$locale])) { $this->deleteOldFile("supp", $articleId); $handleSuppFileId = $this->createHandleTXTFile($supplHandle[$locale], $articleId, 'supplementary'); $handleSupplPDFFileID = $this->createHandlePDF($submissionHandle[$locale], $articleId, 'supplementary'); } } //Add uploaded Supplementary file $tempSupplFileIds = $this->getData('tempSupplFileId'); foreach (array_keys($tempSupplFileIds) as $locale) { $temporaryFile = $temporaryFileManager->getFile($tempSupplFileIds[$locale], $user->getId()); $fileId = null; if ($temporaryFile) { $this->deleteOldFile("supp", $articleId); $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUPP); $fileType = $temporaryFile->getFileType(); } } // 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); } // As the article already has an issue, just get it from database $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueByArticleId($this->editArticleID); $issueId = $issue->getIssueId(); //$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); }
/** * Save changes to the galley. * @return int the galley ID */ function execute($fileName = null, $createRemote = false) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($this->articleId); $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $fileName = isset($fileName) ? $fileName : 'galleyFile'; $journal =& Request::getJournal(); $fileId = null; if (isset($this->galley)) { $galley =& $this->galley; // Upload galley file if ($articleFileManager->uploadedFileExists($fileName)) { if ($galley->getFileId()) { $articleFileManager->uploadPublicFile($fileName, $galley->getFileId()); $fileId = $galley->getFileId(); } else { $fileId = $articleFileManager->uploadPublicFile($fileName); $galley->setFileId($fileId); } // Update file search index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } if ($articleFileManager->uploadedFileExists('styleFile')) { // Upload stylesheet file $styleFileId = $articleFileManager->uploadPublicFile('styleFile', $galley->getStyleFileId()); $galley->setStyleFileId($styleFileId); } else { if ($this->getData('deleteStyleFile')) { // Delete stylesheet file $styleFile =& $galley->getStyleFile(); if (isset($styleFile)) { $articleFileManager->deleteFile($styleFile->getFileId()); } } } // Update existing galley $galley->setLabel($this->getData('label')); if ($journal->getSetting('enablePublicGalleyId')) { $galley->setStoredPubId('publisher-id', $this->getData('publicGalleyId')); } $galley->setLocale($this->getData('galleyLocale')); if ($this->getData('remoteURL')) { $galley->setRemoteURL($this->getData('remoteURL')); } // consider the additional field names from the public identifer plugins import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->execute($this, $galley); parent::execute(); $galleyDao->updateGalley($galley); } else { // Upload galley file if ($articleFileManager->uploadedFileExists($fileName)) { $fileType = $articleFileManager->getUploadedFileType($fileName); $fileId = $articleFileManager->uploadPublicFile($fileName); } if (isset($fileType) && strstr($fileType, 'html')) { // Assume HTML galley $galley = new ArticleHTMLGalley(); } else { $galley = new ArticleGalley(); } $galley->setArticleId($this->articleId); $galley->setFileId($fileId); if ($this->getData('label') == null) { // Generate initial label based on file type $enablePublicGalleyId = $journal->getSetting('enablePublicGalleyId'); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'html'); } } else { if ($createRemote) { $galley->setLabel(__('common.remote')); $galley->setRemoteURL(__('common.remoteURL')); if ($enablePublicGalleyId) { $galley->setPublicGalleyId(strtolower(__('common.remote'))); } } else { if (isset($fileType)) { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'pdf'); } } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('PostScript'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'ps'); } } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); if ($enablePublicGalleyId) { $galley->setStoredPubId('publisher-id', 'xml'); } } } } } } } if ($galley->getLabel() == null) { $galley->setLabel(__('common.untitled')); } } else { $galley->setLabel($this->getData('label')); } $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $articleDao->getArticle($this->articleId, $journal->getId()); $galley->setLocale($article->getLocale()); if ($enablePublicGalleyId) { // check to make sure the assigned public id doesn't already exist $journalDao =& DAORegistry::getDAO('JournalDAO'); /* @var $journalDao JournalDAO */ $publicGalleyId = $galley->getPubId('publisher-id'); $suffix = ''; $i = 1; while ($journalDao->anyPubIdExists($journal->getId(), 'publisher-id', $publicGalleyId . $suffix)) { $suffix = '_' . $i++; } $galley->setStoredPubId('publisher-id', $publicGalleyId . $suffix); } parent::execute(); // Insert new galley $galleyDao->insertGalley($galley); $this->galleyId = $galley->getId(); } if ($fileId) { // Update file search index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $fileId); } return $this->galleyId; }
/** * Save changes to the supplementary file. * @return int the supplementary file ID */ function execute($fileName = null, $createRemote = false) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($this->article->getId()); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $fileName = isset($fileName) ? $fileName : 'uploadSuppFile'; if (isset($this->suppFile)) { parent::execute(); // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $fileId = $this->suppFile->getFileId(); if ($fileId != 0) { $articleFileManager->uploadSuppFile($fileName, $fileId); } else { $fileId = $articleFileManager->uploadSuppFile($fileName); $this->suppFile->setFileId($fileId); } import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId); } // Index metadata ArticleSearchIndex::indexSuppFileMetadata($this->suppFile); // Update existing supplementary file $this->setSuppFileData($this->suppFile); if ($this->getData('remoteURL')) { $this->suppFile->setRemoteURL($this->getData('remoteURL')); } $suppFileDao->updateSuppFile($this->suppFile); } else { // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $fileId = $articleFileManager->uploadSuppFile($fileName); import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId); } else { $fileId = 0; } // Insert new supplementary file $this->suppFile = new SuppFile(); $this->suppFile->setArticleId($this->article->getId()); $this->suppFile->setFileId($fileId); if ($createRemote) { $this->suppFile->setRemoteURL(__('common.remoteURL')); } parent::execute(); $this->setSuppFileData($this->suppFile); $suppFileDao->insertSuppFile($this->suppFile); $this->suppFileId = $this->suppFile->getId(); } return $this->suppFileId; }
/** * Save changes to the supplementary file. * @return int the supplementary file ID */ function execute($fileName = null) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($this->article->getArticleId()); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $fileName = isset($fileName) ? $fileName : 'uploadSuppFile'; if (isset($this->suppFile)) { $suppFile =& $this->suppFile; // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $articleFileManager->uploadSuppFile($fileName, $suppFile->getFileId()); import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId()); } // Index metadata ArticleSearchIndex::indexSuppFileMetadata($suppFile); // Update existing supplementary file $this->setSuppFileData($suppFile); $suppFileDao->updateSuppFile($suppFile); } else { // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $fileId = $articleFileManager->uploadSuppFile($fileName); import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId); // Insert new supplementary file $suppFile = new SuppFile(); $suppFile->setArticleId($this->article->getArticleId()); $suppFile->setFileId($fileId); $this->setSuppFileData($suppFile); $suppFileDao->insertSuppFile($suppFile); $this->suppFileId = $suppFile->getId(); } else { $fileId = 0; } } // Notifications import('lib.pkp.classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $journal =& Request::getJournal(); $url = Request::url($journal->getPath(), 'sectionEditor', 'submission', array($this->article->getArticleId(), 'submissionReview')); $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO'); $sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $this->article->getSectionId()); foreach ($sectionEditors as $sectionEditor) { $notificationSectionEditors[] = array('id' => $sectionEditor->getId()); } if ($suppFile->getData('type') == 'Raw Data File') { $message = 'notification.type.rawDataSubmitted'; } if ($suppFile->getData('type') == 'Other Supplementary Research Output') { $message = 'notification.type.otherSuppResearchOutput'; } if ($suppFile->getData('type') == 'Progress Report') { $message = 'notification.type.progressReport'; } if ($suppFile->getData('type') == 'Completion Report') { $message = 'notification.type.completionReport'; } if ($suppFile->getData('type') == 'Extension Request') { $message = 'notification.type.extensionRequest'; } if ($this->getData('type') == "Supp File") { $message = 'notification.type.suppFile'; } if (isset($message)) { foreach ($notificationSectionEditors as $userRole) { $notificationManager->createNotification($userRole['id'], $message, $this->article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_SUPP_FILE_MODIFIED); } } return $this->suppFileId; }
/** * Save changes to the supplementary file. * @return int the supplementary file ID */ function execute($fileName = null) { import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($this->article->getArticleId()); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $fileName = 'uploadSuppFile'; // Upload file, if file selected. if ($articleFileManager->uploadedFileExists($fileName)) { $fileId = $articleFileManager->uploadSuppFile($fileName); import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId); // Insert new supplementary file $suppFile = new SuppFile(); $suppFile->setArticleId($this->article->getArticleId()); $suppFile->setFileId($fileId); $this->setSuppFileData($suppFile); $suppFileDao->insertSuppFile($suppFile); $this->suppFileId = $suppFile->getId(); } else { $fileId = 0; } // Save article settings (withdrawReason and withdrawComments) $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $this->article; $article->setWithdrawReason($this->getData('withdrawReason'), null); if ($article->getWithdrawReason('en_US') == "2") { $article->setWithdrawReason($this->getData('otherReason'), null); } $article->setWithdrawComments($this->getData('withdrawComments'), null); // Save the article $articleDao->updateArticle($article); return $this->suppFileId; }