Ejemplo n.º 1
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.º 2
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.º 3
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);
 }