Inheritance: extends Action
Ejemplo n.º 1
0
 /**
  * @copydoc Form::execute()
  */
 function execute($args, $request)
 {
     // Retrieve the submission.
     $submission = $this->getSubmission();
     // Get this form decision actions labels.
     $actionLabels = EditorDecisionActionsManager::getActionLabels($this->_getDecisions());
     // Record the decision.
     $reviewRound = $this->getReviewRound();
     $decision = $this->getDecision();
     $stageId = $this->getStageId();
     import('lib.pkp.classes.submission.action.EditorAction');
     $editorAction = new EditorAction();
     $editorAction->recordDecision($request, $submission, $decision, $actionLabels, $reviewRound, $stageId);
     // Identify email key and status of round.
     switch ($decision) {
         case SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS:
             $emailKey = 'EDITOR_DECISION_REVISIONS';
             $status = REVIEW_ROUND_STATUS_REVISIONS_REQUESTED;
             break;
         case SUBMISSION_EDITOR_DECISION_RESUBMIT:
             $emailKey = 'EDITOR_DECISION_RESUBMIT';
             $status = REVIEW_ROUND_STATUS_RESUBMITTED;
             break;
         case SUBMISSION_EDITOR_DECISION_DECLINE:
             $emailKey = 'SUBMISSION_UNSUITABLE';
             $status = REVIEW_ROUND_STATUS_DECLINED;
             break;
         default:
             fatalError('Unsupported decision!');
     }
     $this->_updateReviewRoundStatus($submission, $status, $reviewRound);
     // Send email to the author.
     $this->_sendReviewMailToAuthor($submission, $emailKey, $request);
 }
 /**
  * @copydoc Form::execute()
  */
 function execute($args, $request)
 {
     // Retrieve the submission.
     $submission = $this->getSubmission();
     // Record the decision.
     import('classes.workflow.EditorDecisionActionsManager');
     $actionLabels = EditorDecisionActionsManager::getActionLabels(array($this->_decision));
     import('lib.pkp.classes.submission.action.EditorAction');
     $editorAction = new EditorAction();
     $editorAction->recordDecision($request, $submission, $this->_decision, $actionLabels);
     // Move to the internal review stage.
     $editorAction->incrementWorkflowStage($submission, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, $request);
     // Create an initial internal review round.
     $this->_initiateReviewRound($submission, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, $request, REVIEW_ROUND_STATUS_PENDING_REVIEWERS);
 }
Ejemplo n.º 3
0
 /**
  * @copydoc Form::execute()
  * @return integer The new review round number
  */
 function execute($args, $request)
 {
     // Retrieve the submission.
     $submission = $this->getSubmission();
     // Get this form decision actions labels.
     $actionLabels = EditorDecisionActionsManager::getActionLabels($this->_getDecisions());
     // Record the decision.
     $reviewRound = $this->getReviewRound();
     import('lib.pkp.classes.submission.action.EditorAction');
     $editorAction = new EditorAction();
     $editorAction->recordDecision($request, $submission, SUBMISSION_EDITOR_DECISION_RESUBMIT, $actionLabels, $reviewRound);
     // Update the review round status.
     $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
     $reviewRoundDao->updateStatus($reviewRound, null, REVIEW_ROUND_STATUS_RESUBMITTED);
     // Create a new review round.
     $newRound = $this->_initiateReviewRound($submission, $submission->getStageId(), $request, REVIEW_ROUND_STATUS_PENDING_REVIEWERS);
     return $newRound;
 }
Ejemplo n.º 4
0
 /**
  * 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();
 }
Ejemplo n.º 5
0
 /**
  * Deletes the review assignment and notifies the reviewer via email
  *
  * @param mixed $args
  * @param $request PKPRequest
  * @return bool whether or not the review assignment was deleted successfully
  */
 function execute($args, $request)
 {
     $submission = $this->getSubmission();
     $reviewAssignment = $this->getReviewAssignment();
     // Notify the reviewer via email.
     import('lib.pkp.classes.mail.SubmissionMailTemplate');
     $mail = new SubmissionMailTemplate($submission, 'REVIEW_CANCEL', null, null, false);
     if ($mail->isEnabled() && !$this->getData('skipEmail')) {
         $userDao = DAORegistry::getDAO('UserDAO');
         $reviewerId = (int) $this->getData('reviewerId');
         $reviewer = $userDao->getById($reviewerId);
         $mail->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
         $mail->setBody($this->getData('personalMessage'));
         $mail->assignParams();
         $mail->send($request);
     }
     // Delete the review assignment.
     // NB: EditorAction::clearReview() will check that this review
     // id is actually attached to the submission so no need for further
     // validation here.
     import('lib.pkp.classes.submission.action.EditorAction');
     $editorAction = new EditorAction();
     return $editorAction->clearReview($request, $submission->getId(), $reviewAssignment->getId());
 }
Ejemplo n.º 6
0
 /**
  * Expedite a submission -- rush it through the editorial process, for
  * users who are both authors and editors.
  * @param $args array
  * @param $request PKPRequest
  */
 function expediteSubmission($args, $request)
 {
     $articleId = (int) $request->getUserVar('articleId');
     $this->validate($request, $articleId);
     $journal =& $request->getJournal();
     $article =& $this->article;
     // The author must also be an editor to perform this task.
     if (Validation::isEditor($journal->getId()) && $article->getSubmissionFileId()) {
         import('classes.submission.editor.EditorAction');
         EditorAction::expediteSubmission($article, $request);
         $request->redirect(null, 'editor', 'submissionEditing', array($article->getId()));
     }
     $request->redirect(null, null, 'track');
 }
Ejemplo n.º 7
0
 /**
  * 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);
 }
Ejemplo n.º 8
0
 /**
  * Assigns the selected editor to the submission.
  */
 function assignEditor($args, $request)
 {
     $this->validate();
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
     // manager.people.noneEnrolled
     $journal =& $request->getJournal();
     $articleId = $request->getUserVar('articleId');
     $editorId = $request->getUserVar('editorId');
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $isSectionEditor = $roleDao->userHasRole($journal->getId(), $editorId, ROLE_ID_SECTION_EDITOR);
     $isEditor = $roleDao->userHasRole($journal->getId(), $editorId, ROLE_ID_EDITOR);
     if (isset($editorId) && $editorId != null && ($isEditor || $isSectionEditor)) {
         // A valid section editor has already been chosen;
         // either prompt with a modifiable email or, if this
         // has been done, send the email and store the editor
         // selection.
         $this->setupTemplate(EDITOR_SECTION_SUBMISSIONS, $articleId, 'summary');
         // FIXME: Prompt for due date.
         if (EditorAction::assignEditor($articleId, $editorId, $isEditor, $request->getUserVar('send'), $request)) {
             Request::redirect(null, null, 'submission', $articleId);
         }
     } else {
         // Allow the user to choose a section editor or editor.
         $this->setupTemplate(EDITOR_SECTION_SUBMISSIONS, $articleId, 'summary');
         $searchType = null;
         $searchMatch = null;
         $search = $request->getUserVar('search');
         $searchInitial = $request->getUserVar('searchInitial');
         if (!empty($search)) {
             $searchType = $request->getUserVar('searchField');
             $searchMatch = $request->getUserVar('searchMatch');
         } elseif (!empty($searchInitial)) {
             $searchInitial = String::strtoupper($searchInitial);
             $searchType = USER_FIELD_INITIAL;
             $search = $searchInitial;
         }
         $rangeInfo =& $this->getRangeInfo('editors');
         $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
         if (isset($args[0]) && $args[0] === 'editor') {
             $roleName = 'user.role.editor';
             $rolePath = 'editor';
             $editors =& $editorSubmissionDao->getUsersNotAssignedToArticle($journal->getId(), $articleId, RoleDAO::getRoleIdFromPath('editor'), $searchType, $search, $searchMatch, $rangeInfo);
         } else {
             $roleName = 'user.role.sectionEditor';
             $rolePath = 'sectionEditor';
             $editors =& $editorSubmissionDao->getUsersNotAssignedToArticle($journal->getId(), $articleId, RoleDAO::getRoleIdFromPath('sectionEditor'), $searchType, $search, $searchMatch, $rangeInfo);
         }
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign_by_ref('editors', $editors);
         $templateMgr->assign('roleName', $roleName);
         $templateMgr->assign('rolePath', $rolePath);
         $templateMgr->assign('articleId', $articleId);
         $sectionDao =& DAORegistry::getDAO('SectionDAO');
         $sectionEditorSections =& $sectionDao->getEditorSections($journal->getId());
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editorStatistics = $editAssignmentDao->getEditorStatistics($journal->getId());
         $templateMgr->assign_by_ref('editorSections', $sectionEditorSections);
         $templateMgr->assign('editorStatistics', $editorStatistics);
         $templateMgr->assign('searchField', $searchType);
         $templateMgr->assign('searchMatch', $searchMatch);
         $templateMgr->assign('search', $search);
         $templateMgr->assign('searchInitial', Request::getUserVar('searchInitial'));
         $templateMgr->assign('fieldOptions', array(USER_FIELD_FIRSTNAME => 'user.firstName', USER_FIELD_LASTNAME => 'user.lastName', USER_FIELD_USERNAME => 'user.username', USER_FIELD_EMAIL => 'user.email'));
         $templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
         $templateMgr->assign('helpTopicId', 'editorial.editorsRole.submissionSummary.submissionManagement');
         $templateMgr->display('editor/selectSectionEditor.tpl');
     }
 }
Ejemplo n.º 9
0
 /**
  * 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 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);
 }
 /**
  * Save review assignment
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, $request)
 {
     $submission = $this->getSubmission();
     $context = $request->getContext();
     $currentReviewRound = $this->getReviewRound();
     $stageId = $currentReviewRound->getStageId();
     $reviewDueDate = $this->getData('reviewDueDate');
     $responseDueDate = $this->getData('responseDueDate');
     // Get reviewer id and validate it.
     $reviewerId = (int) $this->getData('reviewerId');
     if (!$this->_isValidReviewer($context, $submission, $currentReviewRound, $reviewerId)) {
         fatalError('Invalid reviewer id.');
     }
     $reviewMethod = (int) $this->getData('reviewMethod');
     import('lib.pkp.classes.submission.action.EditorAction');
     $editorAction = new EditorAction();
     $editorAction->addReviewer($request, $submission, $reviewerId, $currentReviewRound, $reviewDueDate, $responseDueDate, $reviewMethod);
     // Get the reviewAssignment object now that it has been added.
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     /* @var $reviewAssignmentDao ReviewAssignmentDAO */
     $reviewAssignment = $reviewAssignmentDao->getReviewAssignment($currentReviewRound->getId(), $reviewerId, $currentReviewRound->getRound(), $stageId);
     $reviewAssignment->setDateNotified(Core::getCurrentDate());
     $reviewAssignment->setCancelled(0);
     $reviewAssignment->stampModified();
     // Ensure that the review form ID is valid, if specified
     $reviewFormId = (int) $this->getData('reviewFormId');
     $reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm = $reviewFormDao->getById($reviewFormId, Application::getContextAssocType(), $context->getId());
     $reviewAssignment->setReviewFormId($reviewForm ? $reviewFormId : null);
     $reviewAssignmentDao->updateObject($reviewAssignment);
     // Grant access for this review to all selected files.
     $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
     import('lib.pkp.classes.submission.SubmissionFile');
     // File constants
     $submissionFiles = $submissionFileDao->getLatestRevisionsByReviewRound($currentReviewRound, SUBMISSION_FILE_REVIEW_FILE);
     $selectedFiles = (array) $this->getData('selectedFiles');
     $reviewFilesDao = DAORegistry::getDAO('ReviewFilesDAO');
     foreach ($submissionFiles as $submissionFile) {
         if (in_array($submissionFile->getFileId(), $selectedFiles)) {
             $reviewFilesDao->grant($reviewAssignment->getId(), $submissionFile->getFileId());
         }
     }
     // Notify the reviewer via email.
     import('lib.pkp.classes.mail.SubmissionMailTemplate');
     $templateKey = $this->getData('template');
     $mail = new SubmissionMailTemplate($submission, $templateKey, null, null, null, false);
     if ($mail->isEnabled() && !$this->getData('skipEmail')) {
         $userDao = DAORegistry::getDAO('UserDAO');
         /* @var $userDao UserDAO */
         $reviewer = $userDao->getById($reviewerId);
         $user = $request->getUser();
         $mail->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
         $mail->setBody($this->getData('personalMessage'));
         $dispatcher = $request->getDispatcher();
         // Set the additional arguments for the one click url
         $reviewUrlArgs = array('submissionId' => $this->getSubmissionId());
         if ($context->getSetting('reviewerAccessKeysEnabled')) {
             import('lib.pkp.classes.security.AccessKeyManager');
             $accessKeyManager = new AccessKeyManager();
             $expiryDays = $context->getSetting('numWeeksPerReview') + 4 * 7;
             $accessKey = $accessKeyManager->createKey($context->getId(), $reviewerId, $reviewAssignment->getId(), $expiryDays);
             $reviewUrlArgs = array_merge($reviewUrlArgs, array('reviewId' => $reviewAssignment->getId(), 'key' => $accessKey));
         }
         // Assign the remaining parameters
         $mail->assignParams(array('reviewerName' => $reviewer->getFullName(), 'responseDueDate' => $responseDueDate, 'reviewDueDate' => $reviewDueDate, 'reviewerUserName' => $reviewer->getUsername(), 'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, $reviewUrlArgs)));
         $mail->send($request);
     }
     return $reviewAssignment;
 }
 /**
  * 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);
 }
Ejemplo n.º 13
0
 /**
  * @copydoc Form::execute()
  */
 function execute($args, $request)
 {
     // Retrieve the submission.
     $submission = $this->getSubmission();
     // Get this form decision actions labels.
     $actionLabels = EditorDecisionActionsManager::getActionLabels($this->_getDecisions());
     // Record the decision.
     $reviewRound = $this->getReviewRound();
     $decision = $this->getDecision();
     import('lib.pkp.classes.submission.action.EditorAction');
     $editorAction = new EditorAction();
     $editorAction->recordDecision($request, $submission, $decision, $actionLabels, $reviewRound);
     // Identify email key and status of round.
     import('lib.pkp.classes.file.SubmissionFileManager');
     $submissionFileManager = new SubmissionFileManager($submission->getContextId(), $submission->getId());
     switch ($decision) {
         case SUBMISSION_EDITOR_DECISION_ACCEPT:
             $emailKey = 'EDITOR_DECISION_ACCEPT';
             $status = REVIEW_ROUND_STATUS_ACCEPTED;
             $this->_updateReviewRoundStatus($submission, $status, $reviewRound);
             // Move to the editing stage.
             $editorAction->incrementWorkflowStage($submission, WORKFLOW_STAGE_ID_EDITING, $request);
             // Bring in the SUBMISSION_FILE_* constants.
             import('lib.pkp.classes.submission.SubmissionFile');
             // Bring in the Manager (we need it).
             import('lib.pkp.classes.file.SubmissionFileManager');
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             /* @var $submissionFileDao SubmissionFileDAO */
             $selectedFiles = $this->getData('selectedFiles');
             if (is_array($selectedFiles)) {
                 foreach ($selectedFiles as $fileId) {
                     $revisionNumber = $submissionFileDao->getLatestRevisionNumber($fileId);
                     $submissionFileManager->copyFileToFileStage($fileId, $revisionNumber, SUBMISSION_FILE_FINAL, null, true);
                 }
             }
             // Send email to the author.
             $this->_sendReviewMailToAuthor($submission, $emailKey, $request);
             break;
         case SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW:
             $emailKey = 'EDITOR_DECISION_SEND_TO_EXTERNAL';
             $status = REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL;
             $this->_updateReviewRoundStatus($submission, $status, $reviewRound);
             // Move to the external review stage.
             $editorAction->incrementWorkflowStage($submission, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, $request);
             // Create an initial external review round.
             $this->_initiateReviewRound($submission, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, $request, REVIEW_ROUND_STATUS_PENDING_REVIEWERS);
             // Send email to the author.
             $this->_sendReviewMailToAuthor($submission, $emailKey, $request);
             break;
         case SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION:
             $emailKey = 'EDITOR_DECISION_SEND_TO_PRODUCTION';
             // FIXME: this is copy-pasted from above, save the FILE_GALLEY.
             // Move to the editing stage.
             $editorAction->incrementWorkflowStage($submission, WORKFLOW_STAGE_ID_PRODUCTION, $request);
             // Bring in the SUBMISSION_FILE_* constants.
             import('lib.pkp.classes.submission.SubmissionFile');
             // Bring in the Manager (we need it).
             import('lib.pkp.classes.file.SubmissionFileManager');
             // Move the revisions to the next stage
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             /* @var $submissionFileDao SubmissionFileDAO */
             $selectedFiles = $this->getData('selectedFiles');
             if (is_array($selectedFiles)) {
                 foreach ($selectedFiles as $fileId) {
                     $revisionNumber = $submissionFileDao->getLatestRevisionNumber($fileId);
                     $submissionFileManager->copyFileToFileStage($fileId, $revisionNumber, SUBMISSION_FILE_PRODUCTION_READY);
                 }
             }
             // Send email to the author.
             $this->_sendReviewMailToAuthor($submission, $emailKey, $request);
             break;
         default:
             fatalError('Unsupported decision!');
     }
 }
Ejemplo n.º 14
0
 function expediteSubmission()
 {
     $articleId = (int) Request::getUserVar('articleId');
     list($journal, $article) = SubmitHandler::validate($articleId);
     // The author must also be an editor to perform this task.
     if (Validation::isEditor($journal->getJournalId()) && $article->getSubmissionFileId()) {
         import('submission.editor.EditorAction');
         EditorAction::expediteSubmission($article);
         Request::redirect(null, 'editor', 'submissionEditing', array($article->getArticleId()));
     }
     Request::redirect(null, null, 'track');
 }