コード例 #1
0
ファイル: ArticleLog.inc.php プロジェクト: yuricampos/ojs
 /**
  * Add a new event log entry with the specified parameters
  * @param $request object
  * @param $article object
  * @param $eventType int
  * @param $messageKey string
  * @param $params array optional
  * @return object ArticleLogEntry iff the event was logged
  */
 function logEvent(&$request, &$article, $eventType, $messageKey, $params = array())
 {
     $journal =& $request->getJournal();
     $user =& $request->getUser();
     $userId = isset($user) ? $user->getId() : 0;
     return ArticleLog::logEventHeadless($journal, $userId, $article, $eventType, $messageKey, $params);
 }
コード例 #2
0
ファイル: ArticleLog.inc.php プロジェクト: Jouper/jouper
 /**
  * Add a new event log entry with the specified parameters, including log level.
  * @param $articleId int
  * @param $logLevel char
  * @param $eventType int
  * @param $assocType int
  * @param $assocId int
  * @param $messageKey string
  * @param $messageParams array
  */
 function logEventLevel($articleId, $logLevel, $eventType, $assocType = 0, $assocId = 0, $messageKey = null, $messageParams = array())
 {
     $entry =& new ArticleEventLogEntry();
     $entry->setLogLevel($logLevel);
     $entry->setEventType($eventType);
     $entry->setAssocType($assocType);
     $entry->setAssocId($assocId);
     if (isset($messageKey)) {
         $entry->setLogMessage($messageKey, $messageParams);
     }
     return ArticleLog::logEventEntry($articleId, $entry);
 }
コード例 #3
0
 /**
  * Select a proofreader for submission
  */
 function selectProofreader($userId, $article, $request)
 {
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $proofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId());
     if (!HookRegistry::call('ProofreaderAction::selectProofreader', array(&$userId, &$article))) {
         $proofSignoff->setUserId($userId);
         $signoffDao->updateObject($proofSignoff);
         // Add log entry
         $user =& Request::getUser();
         $userDao =& DAORegistry::getDAO('UserDAO');
         $proofreader =& $userDao->getUser($userId);
         if (!isset($proofreader)) {
             return;
         }
         import('classes.article.log.ArticleLog');
         import('classes.article.log.ArticleEventLogEntry');
         ArticleLog::logEvent($request, $article, ARTICLE_LOG_PROOFREAD_ASSIGN, 'log.proofread.assign', array('assignerName' => $user->getFullName(), 'proofreaderName' => $proofreader->getFullName()));
     }
 }
コード例 #4
0
 /**
  * Select a proofreader for submission
  */
 function selectProofreader($userId, $article)
 {
     $proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO');
     $proofAssignment =& $proofAssignmentDao->getProofAssignmentByArticleId($article->getArticleId());
     if (!HookRegistry::call('ProofreaderAction::selectProofreader', array(&$userId, &$article, &$proofAssignment))) {
         $proofAssignment->setProofreaderId($userId);
         $proofAssignmentDao->updateProofAssignment($proofAssignment);
         // Add log entry
         $user =& Request::getUser();
         $userDao =& DAORegistry::getDAO('UserDAO');
         $proofreader =& $userDao->getUser($userId);
         if (!isset($proofreader)) {
             return;
         }
         import('article.log.ArticleLog');
         import('article.log.ArticleEventLogEntry');
         ArticleLog::logEvent($article->getArticleId(), ARTICLE_LOG_PROOFREAD_ASSIGN, ARTICLE_LOG_TYPE_PROOFREAD, $user->getUserId(), 'log.proofread.assign', array('assignerName' => $user->getFullName(), 'proofreaderName' => $proofreader->getFullName(), 'articleId' => $article->getArticleId()));
     }
 }
コード例 #5
0
ファイル: Action.inc.php プロジェクト: farhanabbas1983/ojs-1
 /**
  * Save metadata.
  * @param $article object
  * @param $request PKPRequest
  */
 function saveMetadata($article, &$request)
 {
     $router =& $request->getRouter();
     if (!HookRegistry::call('Action::saveMetadata', array(&$article))) {
         import('classes.submission.form.MetadataForm');
         $journal =& $request->getJournal();
         $metadataForm = new MetadataForm($article, $journal);
         $metadataForm->readInputData();
         // Check for any special cases before trying to save
         if ($request->getUserVar('addAuthor')) {
             // Add an author
             $editData = true;
             $authors = $metadataForm->getData('authors');
             array_push($authors, array());
             $metadataForm->setData('authors', $authors);
         } else {
             if (($delAuthor = $request->getUserVar('delAuthor')) && count($delAuthor) == 1) {
                 // Delete an author
                 $editData = true;
                 list($delAuthor) = array_keys($delAuthor);
                 $delAuthor = (int) $delAuthor;
                 $authors = $metadataForm->getData('authors');
                 if (isset($authors[$delAuthor]['authorId']) && !empty($authors[$delAuthor]['authorId'])) {
                     $deletedAuthors = explode(':', $metadataForm->getData('deletedAuthors'));
                     array_push($deletedAuthors, $authors[$delAuthor]['authorId']);
                     $metadataForm->setData('deletedAuthors', join(':', $deletedAuthors));
                 }
                 array_splice($authors, $delAuthor, 1);
                 $metadataForm->setData('authors', $authors);
                 if ($metadataForm->getData('primaryContact') == $delAuthor) {
                     $metadataForm->setData('primaryContact', 0);
                 }
             } else {
                 if ($request->getUserVar('moveAuthor')) {
                     // Move an author up/down
                     $editData = true;
                     $moveAuthorDir = $request->getUserVar('moveAuthorDir');
                     $moveAuthorDir = $moveAuthorDir == 'u' ? 'u' : 'd';
                     $moveAuthorIndex = (int) $request->getUserVar('moveAuthorIndex');
                     $authors = $metadataForm->getData('authors');
                     if (!($moveAuthorDir == 'u' && $moveAuthorIndex <= 0 || $moveAuthorDir == 'd' && $moveAuthorIndex >= count($authors) - 1)) {
                         $tmpAuthor = $authors[$moveAuthorIndex];
                         $primaryContact = $metadataForm->getData('primaryContact');
                         if ($moveAuthorDir == 'u') {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex - 1];
                             $authors[$moveAuthorIndex - 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex - 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex - 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         } else {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex + 1];
                             $authors[$moveAuthorIndex + 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex + 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex + 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         }
                     }
                     $metadataForm->setData('authors', $authors);
                 }
             }
         }
         if (isset($editData)) {
             $metadataForm->display();
             return false;
         } else {
             if (!$metadataForm->validate()) {
                 return $metadataForm->display();
             }
             $metadataForm->execute($request);
             // Send a notification to associated users
             import('classes.notification.NotificationManager');
             $notificationManager = new NotificationManager();
             $notificationUsers = $article->getAssociatedUserIds();
             foreach ($notificationUsers as $userRole) {
                 $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_METADATA_MODIFIED, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId());
             }
             // Add log entry
             $user =& $request->getUser();
             import('classes.article.log.ArticleLog');
             ArticleLog::logEvent($request, $article, ARTICLE_LOG_METADATA_UPDATE, 'log.editor.metadataModified', array('editorName' => $user->getFullName()));
             return true;
         }
     }
 }
コード例 #6
0
 /**
  * Author completes editor / author review.
  * @param $authorSubmission object
  * @param $send boolean
  * @param $request object
  */
 function completeAuthorCopyedit($authorSubmission, $send, $request)
 {
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $journal =& $request->getJournal();
     $authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
     if ($authorSignoff->getDateCompleted() != null) {
         return true;
     }
     $user =& $request->getUser();
     import('classes.mail.ArticleMailTemplate');
     $email = new ArticleMailTemplate($authorSubmission, 'COPYEDIT_AUTHOR_COMPLETE');
     $editAssignments = $authorSubmission->getEditAssignments();
     $copyeditor = $authorSubmission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL');
     if (!$email->isEnabled() || $send && !$email->hasErrors()) {
         HookRegistry::call('AuthorAction::completeAuthorCopyedit', array(&$authorSubmission, &$email));
         if ($email->isEnabled()) {
             $email->send($request);
         }
         $authorSignoff->setDateCompleted(Core::getCurrentDate());
         $finalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
         if ($copyeditor) {
             $finalSignoff->setUserId($copyeditor->getId());
         }
         $finalSignoff->setDateNotified(Core::getCurrentDate());
         $signoffDao->updateObject($authorSignoff);
         $signoffDao->updateObject($finalSignoff);
         // Add log entry
         import('classes.article.log.ArticleLog');
         ArticleLog::logEvent($request, $authorSubmission, ARTICLE_LOG_COPYEDIT_REVISION, 'log.copyedit.authorFile');
         return true;
     } else {
         if (!$request->getUserVar('continued')) {
             if (isset($copyeditor)) {
                 $email->addRecipient($copyeditor->getEmail(), $copyeditor->getFullName());
                 $assignedSectionEditors = $email->ccAssignedEditingSectionEditors($authorSubmission->getId());
                 $assignedEditors = $email->ccAssignedEditors($authorSubmission->getId());
                 if (empty($assignedSectionEditors) && empty($assignedEditors)) {
                     $email->addCc($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
                     $editorName = $journal->getSetting('contactName');
                 } else {
                     $editor = array_shift($assignedSectionEditors);
                     if (!$editor) {
                         $editor = array_shift($assignedEditors);
                     }
                     $editorName = $editor->getEditorFullName();
                 }
             } else {
                 $assignedSectionEditors = $email->toAssignedEditingSectionEditors($authorSubmission->getId());
                 $assignedEditors = $email->ccAssignedEditors($authorSubmission->getId());
                 if (empty($assignedSectionEditors) && empty($assignedEditors)) {
                     $email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
                     $editorName = $journal->getSetting('contactName');
                 } else {
                     $editor = array_shift($assignedSectionEditors);
                     if (!$editor) {
                         $editor = array_shift($assignedEditors);
                     }
                     $editorName = $editor->getEditorFullName();
                 }
             }
             $paramArray = array('editorialContactName' => isset($copyeditor) ? $copyeditor->getFullName() : $editorName, 'authorName' => $user->getFullName());
             $email->assignParams($paramArray);
         }
         $email->displayEditForm($request->url(null, 'author', 'completeAuthorCopyedit', 'send'), array('articleId' => $authorSubmission->getId()));
         return false;
     }
 }
コード例 #7
0
ファイル: ReviewerAction.inc.php プロジェクト: Jouper/jouper
 /**
  * Upload the annotated version of an article.
  * @param $reviewId int
  */
 function uploadReviewerVersion($reviewId)
 {
     import("file.ArticleFileManager");
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentById($reviewId);
     $articleFileManager =& new ArticleFileManager($reviewAssignment->getArticleId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     // and if review forms are not used
     if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
         $fileName = 'upload';
         if ($articleFileManager->uploadedFileExists($fileName)) {
             HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment));
             if ($reviewAssignment->getReviewerFileId() != null) {
                 $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
             } else {
                 $fileId = $articleFileManager->uploadReviewFile($fileName);
             }
         }
     }
     if (isset($fileId) && $fileId != 0) {
         $reviewAssignment->setReviewerFileId($fileId);
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
         // Add log
         import('article.log.ArticleLog');
         import('article.log.ArticleEventLogEntry');
         $userDao =& DAORegistry::getDAO('UserDAO');
         $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
         $entry =& new ArticleEventLogEntry();
         $entry->setArticleId($reviewAssignment->getArticleId());
         $entry->setUserId($reviewer->getUserId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType(ARTICLE_LOG_REVIEW_FILE);
         $entry->setLogMessage('log.review.reviewerFile');
         $entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW);
         $entry->setAssocId($reviewAssignment->getReviewId());
         ArticleLog::logEventEntry($reviewAssignment->getArticleId(), $entry);
     }
 }
コード例 #8
0
 /**
  * View submission email log.
  */
 function submissionEmailLog($args)
 {
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $logId = isset($args[1]) ? (int) $args[1] : 0;
     list($journal, $submission) = SubmissionEditHandler::validate($articleId);
     parent::setupTemplate(true, $articleId, 'history');
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('isEditor', Validation::isEditor());
     $templateMgr->assign_by_ref('submission', $submission);
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     import('file.ArticleFileManager');
     $templateMgr->assign('attachments', $articleFileDao->getArticleFilesByAssocId($logId, ARTICLE_FILE_ATTACHMENT));
     if ($logId) {
         $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
         $logEntry =& $logDao->getLogEntry($logId, $articleId);
     }
     if (isset($logEntry)) {
         $templateMgr->assign_by_ref('logEntry', $logEntry);
         $templateMgr->display('sectionEditor/submissionEmailLogEntry.tpl');
     } else {
         $rangeInfo =& Handler::getRangeInfo('emailLogEntries');
         import('article.log.ArticleLog');
         $emailLogEntries =& ArticleLog::getEmailLogEntries($articleId, $rangeInfo);
         $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
         $templateMgr->display('sectionEditor/submissionEmailLog.tpl');
     }
 }
コード例 #9
0
 /**
  * Save changes to article.
  */
 function execute()
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $ercReviewersDao =& DAORegistry::getDAO('ErcReviewersDAO');
     $institutionDao =& DAORegistry::getDAO('InstitutionDAO');
     $journal = Request::getJournal();
     $user = Request::getUser();
     // Update article
     $article =& $this->article;
     if ($article->getDateSubmitted() == null) {
         $year = substr(Core::getCurrentDate(), 0, 4);
         $countyear = $articleDao->getSubmissionsForYearCount($year) + 1;
         $pSponsor = $article->getArticlePrimarySponsor();
         $institution = $institutionDao->getInstitutionById($pSponsor->getInstitutionId());
         $article->setProposalId($year . '-' . $countyear . '-' . $institution->getInstitutionAcronym());
     }
     if ($this->getData('commentsToEditor') != '') {
         $article->setCommentsToEditor($this->getData('commentsToEditor'));
     }
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->setSubmissionProgress(0);
     $article->stampStatusModified();
     $articleDao->updateArticle($article);
     // Designate this as the review version by default.
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId());
     AuthorAction::designateReviewVersion($authorSubmission, true);
     unset($authorSubmission);
     $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId());
     $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
     $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId());
     $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, $article->getId());
     $layoutSignoff->setUserId(0);
     $signoffDao->updateObject($layoutSignoff);
     $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
     $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId());
     $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
     $proofAuthorSignoff->setUserId($user->getId());
     $proofProofreaderSignoff->setUserId(0);
     $proofLayoutEditorSignoff->setUserId(0);
     $signoffDao->updateObject($proofAuthorSignoff);
     $signoffDao->updateObject($proofProofreaderSignoff);
     $signoffDao->updateObject($proofLayoutEditorSignoff);
     $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
     $sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $article->getSectionId());
     $user =& Request::getUser();
     // Update search index
     import('classes.search.ArticleSearchIndex');
     ArticleSearchIndex::indexArticleMetadata($article);
     ArticleSearchIndex::indexArticleFiles($article);
     // Send author notification email
     import('classes.mail.ArticleMailTemplate');
     $mail = new ArticleMailTemplate($article, null, 'SUBMISSION_ACK', null, null, null, false);
     foreach ($sectionEditors as $sectionEditor) {
         // If one of the secretary is the chair of the committee, send from the chair, if not, take the last secretary in the array
         $from = $mail->getFrom();
         if ($ercReviewersDao->isErcReviewer($journal->getId(), $sectionEditor->getId(), REVIEWER_CHAIR)) {
             $mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName());
         } elseif ($from['email'] == $user->getEmail()) {
             $mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName());
         }
         $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName());
         unset($sectionEditor);
     }
     if ($mail->isEnabled()) {
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         if ($journal->getSetting('copySubmissionAckSpecified')) {
             $copyAddress = $journal->getSetting('copySubmissionAckAddress');
             if (!empty($copyAddress)) {
                 $mail->addBcc($copyAddress);
             }
         }
         $section = $sectionDao->getSection($article->getSectionId());
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'address' => $sectionDao->getSettingValue($article->getSectionId(), 'address'), 'bankAccount' => $sectionDao->getSettingValue($article->getSectionId(), 'bankAccount'), 'proposalId' => $article->getProposalId(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getId())));
         $mail->send();
     }
     // Send a regular notification to section editors
     $lastDecision = $article->getLastSectionDecision();
     switch ($lastDecision->getReviewType()) {
         case REVIEW_TYPE_INITIAL:
             if ($lastDecision->getRound() == 1) {
                 $message = 'notification.type.articleSubmitted.initialReview';
             } else {
                 $message = 'notification.type.articleReSubmitted.initialReview';
             }
             break;
         case REVIEW_TYPE_PR:
             if ($lastDecision->getRound() == 1) {
                 $message = 'notification.type.articleSubmitted.continuingReview';
             } else {
                 $message = 'notification.type.articleReSubmitted.continuingReview';
             }
             break;
         case REVIEW_TYPE_AMENDMENT:
             if ($lastDecision->getRound() == 1) {
                 $message = 'notification.type.articleSubmitted.PAAmendmentReview';
             } else {
                 $message = 'notification.type.articleReSubmitted.PAAmendmentReview';
             }
             break;
         case REVIEW_TYPE_SAE:
             if ($lastDecision->getRound() == 1) {
                 $message = 'notification.type.articleSubmitted.SAE';
             } else {
                 $message = 'notification.type.articleReSubmitted.SAE';
             }
             break;
         case REVIEW_TYPE_FR:
             if ($lastDecision->getRound() == 1) {
                 $message = 'notification.type.articleSubmitted.EOS';
             } else {
                 $message = 'notification.type.articleReSubmitted.EOS';
             }
             break;
     }
     import('lib.pkp.classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $url = Request::url($journal->getPath(), 'sectionEditor', 'submission', array($article->getId(), 'submissionReview'));
     foreach ($sectionEditors as $sectionEditor) {
         $notificationManager->createNotification($sectionEditor->getId(), $message, $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_ARTICLE_SUBMITTED);
     }
     import('classes.article.log.ArticleLog');
     import('classes.article.log.ArticleEventLogEntry');
     if ($lastDecision->getRound() == 1) {
         $message = 'log.author.submitted';
     } else {
         $message = 'log.author.resubmitted';
     }
     ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), $message, array('submissionId' => $article->getProposalId(), 'authorName' => $user->getFullName(), 'reviewType' => Locale::translate($lastDecision->getReviewTypeKey())));
     return $this->articleId;
 }
コード例 #10
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);
 }
コード例 #11
0
 /**
  * Author completes editor / author review.
  * @param $authorSubmission object
  */
 function completeAuthorCopyedit($authorSubmission, $send = false)
 {
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $journal =& Request::getJournal();
     if ($authorSubmission->getCopyeditorDateAuthorCompleted() != null) {
         return true;
     }
     $user =& Request::getUser();
     import('mail.ArticleMailTemplate');
     $email =& new ArticleMailTemplate($authorSubmission, 'COPYEDIT_AUTHOR_COMPLETE');
     $editAssignments = $authorSubmission->getEditAssignments();
     $copyeditor =& $authorSubmission->getCopyeditor();
     if (!$email->isEnabled() || $send && !$email->hasErrors()) {
         HookRegistry::call('AuthorAction::completeAuthorCopyedit', array(&$authorSubmission, &$email));
         if ($email->isEnabled()) {
             $email->setAssoc(ARTICLE_EMAIL_COPYEDIT_NOTIFY_AUTHOR_COMPLETE, ARTICLE_EMAIL_TYPE_COPYEDIT, $authorSubmission->getArticleId());
             $email->send();
         }
         $authorSubmission->setCopyeditorDateAuthorCompleted(Core::getCurrentDate());
         $authorSubmission->setCopyeditorDateFinalNotified(Core::getCurrentDate());
         $authorSubmissionDao->updateAuthorSubmission($authorSubmission);
         // Add log entry
         import('article.log.ArticleLog');
         import('article.log.ArticleEventLogEntry');
         ArticleLog::logEvent($authorSubmission->getArticleId(), ARTICLE_LOG_COPYEDIT_REVISION, ARTICLE_LOG_TYPE_AUTHOR, $user->getUserId(), 'log.copyedit.authorFile');
         return true;
     } else {
         if (!Request::getUserVar('continued')) {
             if (isset($copyeditor)) {
                 $email->addRecipient($copyeditor->getEmail(), $copyeditor->getFullName());
                 $assignedSectionEditors = $email->ccAssignedEditingSectionEditors($authorSubmission->getArticleId());
                 $assignedEditors = $email->ccAssignedEditors($authorSubmission->getArticleId());
                 if (empty($assignedSectionEditors) && empty($assignedEditors)) {
                     $email->addCc($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
                     $editorName = $journal->getSetting('contactName');
                 } else {
                     $editor = array_shift($assignedSectionEditors);
                     if (!$editor) {
                         $editor = array_shift($assignedEditors);
                     }
                     $editorName = $editor->getEditorFullName();
                 }
             } else {
                 $assignedSectionEditors = $email->toAssignedEditingSectionEditors($authorSubmission->getArticleId());
                 $assignedEditors = $email->ccAssignedEditors($authorSubmission->getArticleId());
                 if (empty($assignedSectionEditors) && empty($assignedEditors)) {
                     $email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
                     $editorName = $journal->getSetting('contactName');
                 } else {
                     $editor = array_shift($assignedSectionEditors);
                     if (!$editor) {
                         $editor = array_shift($assignedEditors);
                     }
                     $editorName = $editor->getEditorFullName();
                 }
             }
             $paramArray = array('editorialContactName' => isset($copyeditor) ? $copyeditor->getFullName() : $editorName, 'authorName' => $user->getFullName());
             $email->assignParams($paramArray);
         }
         $email->displayEditForm(Request::url(null, 'author', 'completeAuthorCopyedit', 'send'), array('articleId' => $authorSubmission->getArticleId()));
         return false;
     }
 }
コード例 #12
0
 /**
  * Marks layout assignment as completed.
  * @param $submission object
  * @param $send boolean
  */
 function completeLayoutEditing($submission, $send = false)
 {
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $journal =& Request::getJournal();
     $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $submission->getArticleId());
     if ($layoutSignoff->getDateCompleted() != null) {
         return true;
     }
     import('classes.mail.ArticleMailTemplate');
     $email = new ArticleMailTemplate($submission, 'LAYOUT_COMPLETE');
     $editAssignments =& $submission->getEditAssignments();
     if (empty($editAssignments)) {
         return;
     }
     if (!$email->isEnabled() || $send && !$email->hasErrors()) {
         HookRegistry::call('LayoutEditorAction::completeLayoutEditing', array(&$submission, &$editAssignments, &$email));
         if ($email->isEnabled()) {
             $email->setAssoc(ARTICLE_EMAIL_LAYOUT_NOTIFY_COMPLETE, ARTICLE_EMAIL_TYPE_LAYOUT, $layoutSignoff->getId());
             $email->send();
         }
         $layoutSignoff->setDateCompleted(Core::getCurrentDate());
         $signoffDao->updateObject($layoutSignoff);
         // Add log entry
         $user =& Request::getUser();
         import('classes.article.log.ArticleLog');
         import('classes.article.log.ArticleEventLogEntry');
         ArticleLog::logEvent($submission->getArticleId(), ARTICLE_LOG_LAYOUT_COMPLETE, ARTICLE_LOG_TYPE_LAYOUT, $user->getId(), 'log.layout.layoutEditComplete', array('editorName' => $user->getFullName(), 'articleId' => $submission->getArticleId()));
         return true;
     } else {
         $user =& Request::getUser();
         if (!Request::getUserVar('continued')) {
             $assignedSectionEditors = $email->toAssignedEditingSectionEditors($submission->getArticleId());
             $assignedEditors = $email->ccAssignedEditors($submission->getArticleId());
             if (empty($assignedSectionEditors) && empty($assignedEditors)) {
                 $email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
                 $editorialContactName = $journal->getSetting('contactName');
             } else {
                 $editorialContact = array_shift($assignedSectionEditors);
                 if (!$editorialContact) {
                     $editorialContact = array_shift($assignedEditors);
                 }
                 $editorialContactName = $editorialContact->getEditorFullName();
             }
             $paramArray = array('editorialContactName' => $editorialContactName, 'layoutEditorName' => $user->getFullName());
             $email->assignParams($paramArray);
         }
         $email->displayEditForm(Request::url(null, 'layoutEditor', 'completeAssignment', 'send'), array('articleId' => $submission->getArticleId()));
         return false;
     }
 }
コード例 #13
0
ファイル: Action.inc.php プロジェクト: elavaud/hrp_ct
 /**
  * Save metadata.
  * @param $article object
  * @param $request PKPRequest
  */
 function saveMetadata($article, &$request)
 {
     $router =& $request->getRouter();
     if (!HookRegistry::call('Action::saveMetadata', array(&$article))) {
         import('classes.submission.form.MetadataForm');
         $journal =& $request->getJournal();
         $metadataForm = new MetadataForm($article, $journal);
         $metadataForm->readInputData();
         // Check for any special cases before trying to save
         if ($request->getUserVar('addAuthor')) {
             // Add an author
             $editData = true;
             $authors = $metadataForm->getData('authors');
             array_push($authors, array());
             $metadataForm->setData('authors', $authors);
         } else {
             if (($delAuthor = $request->getUserVar('delAuthor')) && count($delAuthor) == 1) {
                 // Delete an author
                 $editData = true;
                 list($delAuthor) = array_keys($delAuthor);
                 $delAuthor = (int) $delAuthor;
                 $authors = $metadataForm->getData('authors');
                 if (isset($authors[$delAuthor]['authorId']) && !empty($authors[$delAuthor]['authorId'])) {
                     $deletedAuthors = explode(':', $metadataForm->getData('deletedAuthors'));
                     array_push($deletedAuthors, $authors[$delAuthor]['authorId']);
                     $metadataForm->setData('deletedAuthors', join(':', $deletedAuthors));
                 }
                 array_splice($authors, $delAuthor, 1);
                 $metadataForm->setData('authors', $authors);
                 if ($metadataForm->getData('primaryContact') == $delAuthor) {
                     $metadataForm->setData('primaryContact', 0);
                 }
             } else {
                 if ($request->getUserVar('moveAuthor')) {
                     // Move an author up/down
                     $editData = true;
                     $moveAuthorDir = $request->getUserVar('moveAuthorDir');
                     $moveAuthorDir = $moveAuthorDir == 'u' ? 'u' : 'd';
                     $moveAuthorIndex = (int) $request->getUserVar('moveAuthorIndex');
                     $authors = $metadataForm->getData('authors');
                     if (!($moveAuthorDir == 'u' && $moveAuthorIndex <= 0 || $moveAuthorDir == 'd' && $moveAuthorIndex >= count($authors) - 1)) {
                         $tmpAuthor = $authors[$moveAuthorIndex];
                         $primaryContact = $metadataForm->getData('primaryContact');
                         if ($moveAuthorDir == 'u') {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex - 1];
                             $authors[$moveAuthorIndex - 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex - 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex - 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         } else {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex + 1];
                             $authors[$moveAuthorIndex + 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex + 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex + 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         }
                     }
                     $metadataForm->setData('authors', $authors);
                 }
             }
         }
         if (isset($editData)) {
             $metadataForm->display();
             return false;
         } else {
             if (!$metadataForm->validate()) {
                 return $metadataForm->display();
             }
             $metadataForm->execute($request);
             // Send a notification to associated users
             import('lib.pkp.classes.notification.NotificationManager');
             $notificationManager = new NotificationManager();
             $notificationUsers = $article->getAssociatedUserIds();
             foreach ($notificationUsers as $userRole) {
                 $url = $router->url($request, null, $userRole['role'], 'submission', $article->getId(), null, 'metadata');
                 $notificationManager->createNotification($userRole['id'], 'notification.type.metadataModified', $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_METADATA_MODIFIED);
             }
             //Added by AIM, Jan 20, 2012
             $notificationUsers = array();
             $roleDao =& DAORegistry::getDAO('RoleDAO');
             $editors = $roleDao->getUsersByRoleId(ROLE_ID_EDITOR);
             while (!$editors->eof()) {
                 $editor =& $editors->next();
                 $notificationUsers[] = array('id' => $editor->getId(), 'role' => $roleDao->getRolePath(ROLE_ID_EDITOR));
                 unset($editor);
             }
             //print_r($notificationUsers); die();
             foreach ($notificationUsers as $userRole) {
                 $url = $router->url($request, null, $userRole['role'], 'submission', $article->getId(), null, 'metadata');
                 $notificationManager->createNotification($userRole['id'], 'notification.type.metadataModified', $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_METADATA_MODIFIED);
             }
             // Add log entry
             $user =& $request->getUser();
             import('classes.article.log.ArticleLog');
             import('classes.article.log.ArticleEventLogEntry');
             ArticleLog::logEvent($article->getId(), ARTICLE_LOG_METADATA_UPDATE, ARTICLE_LOG_TYPE_DEFAULT, 0, 'log.editor.metadataModified', array('editorName' => $user->getFullName()));
             return true;
         }
     }
 }
コード例 #14
0
ファイル: ReviewerAction.inc.php プロジェクト: reconciler/ojs
 /**
  * Upload the annotated version of an article.
  * @param $reviewId int
  * @param $reviewerSubmission object
  * @param $request object
  */
 function uploadReviewerVersion($reviewId, $reviewerSubmission, $request)
 {
     import('classes.file.ArticleFileManager');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $articleFileManager = new ArticleFileManager($reviewAssignment->getSubmissionId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     // and if review forms are not used
     if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
         $fileName = 'upload';
         if ($articleFileManager->uploadedFileExists($fileName)) {
             HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment));
             if ($reviewAssignment->getReviewerFileId() != null) {
                 $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
             } else {
                 $fileId = $articleFileManager->uploadReviewFile($fileName);
             }
         }
     }
     if (isset($fileId) && $fileId != 0) {
         $reviewAssignment->setReviewerFileId($fileId);
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
         $userDao =& DAORegistry::getDAO('UserDAO');
         $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
         // Add log
         import('classes.article.log.ArticleLog');
         ArticleLog::logEvent($request, $reviewerSubmission, ARTICLE_LOG_REVIEW_FILE, 'log.review.reviewerFile', array('reviewId' => $reviewAssignment->getId()));
     }
 }
コード例 #15
0
 /**
  * Upload a review on behalf of its reviewer.
  * @param $reviewId int
  */
 function uploadReviewForReviewer($reviewId)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $user =& Request::getUser();
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $sectionDecision =& $sectionDecisionDao->getSectionDecision($reviewAssignment->getDecisionId());
     $article =& $articleDao->getArticle($sectionDecision->getArticleId());
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId(), true);
     if (HookRegistry::call('SectionEditorAction::uploadReviewForReviewer', array(&$reviewAssignment, &$reviewer))) {
         return;
     }
     // Upload the review file.
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($sectionDecision->getArticleId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
         $fileName = 'upload';
         if ($articleFileManager->uploadedFileExists($fileName)) {
             // Check if file already uploaded
             $reviewFile =& $reviewAssignment->getReviewerFile();
             if ($reviewFile != null) {
                 $articleFileManager->deleteFile($reviewFile->getFileId());
             }
             if ($reviewAssignment->getReviewerFileId() != null) {
                 $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId(), $reviewAssignment->getReviewerFileId());
             } else {
                 $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId());
             }
         }
     }
     if (isset($fileId) && $fileId != 0) {
         // Only confirm the review for the reviewer if
         // he has not previously done so.
         if ($reviewAssignment->getDateConfirmed() == null) {
             $reviewAssignment->setDeclined(0);
             $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
         }
         $reviewAssignment->setReviewerFileId($fileId);
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
         // Add log
         import('classes.article.log.ArticleLog');
         import('classes.article.log.ArticleEventLogEntry');
         Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
         $entry = new ArticleEventLogEntry();
         $entry->setArticleId($sectionDecision->getArticleId());
         $entry->setUserId($user->getId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType(ARTICLE_LOG_REVIEW_FILE_BY_PROXY);
         $entry->setLogMessage('log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'articleId' => $article->getProposalId(), 'userName' => $user->getFullName()));
         $entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW);
         $entry->setAssocId($reviewAssignment->getId());
         ArticleLog::logEventEntry($sectionDecision->getArticleId(), $entry);
     }
 }
コード例 #16
0
 /**
  * Save the email in the article email log.
  * @param $request object
  */
 function log($request = null)
 {
     $articleEmailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
     $entry = $articleEmailLogDao->newDataObject();
     $article =& $this->article;
     // Log data
     $entry->setEventType($this->eventType);
     $entry->setSubject($this->getSubject());
     $entry->setBody($this->getBody());
     $entry->setFrom($this->getFromString(false));
     $entry->setRecipients($this->getRecipientString());
     $entry->setCcs($this->getCcString());
     $entry->setBccs($this->getBccString());
     // Add log entry
     import('classes.article.log.ArticleLog');
     $logEntryId = ArticleLog::logEmail($article->getId(), $entry, $request);
     // Add attachments
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($article->getId());
     foreach ($this->getAttachmentFiles() as $attachment) {
         $articleFileManager->temporaryFileToArticleFile($attachment, ARTICLE_FILE_ATTACHMENT, $logEntryId);
     }
 }
コード例 #17
0
ファイル: ReviewerAction.inc.php プロジェクト: elavaud/hrp_ct
 /**
  * Upload the annotated version of an article.
  * @param $reviewId int
  */
 function uploadReviewerVersion($reviewId)
 {
     import('classes.file.ArticleFileManager');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $sectionDecision =& $sectionDecisionDao->getSectionDecision($reviewAssignment->getDecisionId());
     $articleFileManager = new ArticleFileManager($sectionDecision->getArticleId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     // and if review forms are not used
     if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
         $fileName = 'upload';
         if ($articleFileManager->uploadedFileExists($fileName)) {
             // Check if file already uploaded
             $reviewFile =& $reviewAssignment->getReviewerFile();
             if ($reviewFile != null) {
                 $articleFileManager->deleteFile($reviewFile->getFileId());
             }
             HookRegistry::call('ReviewerAction::uploadReviewFile', array(&$reviewAssignment));
             if ($reviewAssignment->getReviewerFileId() != null) {
                 $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId(), $reviewAssignment->getReviewerFileId());
             } else {
                 $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId());
             }
         }
     }
     if (isset($fileId) && $fileId != 0) {
         $reviewAssignment->setReviewerFileId($fileId);
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
         // Add log
         import('classes.article.log.ArticleLog');
         import('classes.article.log.ArticleEventLogEntry');
         $userDao =& DAORegistry::getDAO('UserDAO');
         $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
         $entry = new ArticleEventLogEntry();
         $entry->setArticleId($sectionDecision->getArticleId());
         $entry->setUserId($reviewer->getId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType(ARTICLE_LOG_REVIEW_FILE);
         $entry->setLogLevel('N');
         $entry->setLogMessage('log.review.reviewerFile');
         $entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW);
         $entry->setAssocId($reviewAssignment->getId());
         ArticleLog::logEventEntry($sectionDecision->getArticleId(), $entry);
         //Send a notification to section editors
         import('lib.pkp.classes.notification.NotificationManager');
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         $article =& $articleDao->getArticle($sectionDecision->getArticleId());
         $notificationManager = new NotificationManager();
         $notificationUsers = $article->getAssociatedUserIds(false, false);
         $user =& Request::getUser();
         $message = $article->getProposalId() . ':<br/>' . $user->getUsername();
         foreach ($notificationUsers as $userRole) {
             $url = Request::url(null, $userRole['role'], 'submission', array($article->getId(), 'submissionReview'), null, 'peerReview');
             $notificationManager->createNotification($userRole['id'], 'notification.type.reviewerFile', $message, $url, 1, NOTIFICATION_TYPE_REVIEWER_COMMENT);
         }
     }
 }
コード例 #18
0
 /**
  * Save the email in the article email log.
  */
 function log()
 {
     import('classes.article.log.ArticleEmailLogEntry');
     import('classes.article.log.ArticleLog');
     $entry = new ArticleEmailLogEntry();
     $article =& $this->article;
     // Log data
     $entry->setEventType($this->eventType);
     $entry->setAssocType($this->assocType);
     $entry->setAssocId($this->assocId);
     // Email data
     $entry->setSubject($this->getSubject());
     $entry->setBody($this->getBody());
     $entry->setFrom($this->getFromString(false));
     $entry->setRecipients($this->getRecipientString());
     $entry->setCcs($this->getCcString());
     $entry->setBccs($this->getBccString());
     // Add log entry
     $logEntryId = ArticleLog::logEmailEntry($article->getId(), $entry);
     // Add attachments
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($article->getId());
     foreach ($this->getAttachmentFiles() as $attachment) {
         $articleFileManager->temporaryFileToArticleFile($attachment, ARTICLE_FILE_ATTACHMENT, $logEntryId);
     }
 }
コード例 #19
0
 function handleArticleNode(&$journal, &$articleNode, &$issue, &$section, &$article, &$publishedArticle, &$errors, &$user, $isCommandLine, &$dependentItems)
 {
     $errors = array();
     $journalSupportedLocales = array_keys($journal->getSupportedLocaleNames());
     // => journal locales must be set up before
     $journalPrimaryLocale = $journal->getPrimaryLocale();
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $article = new Article();
     $article->setLocale($journalPrimaryLocale);
     // FIXME in bug #5543
     $article->setJournalId($journal->getId());
     $article->setUserId($user->getId());
     $article->setSectionId($section->getId());
     $article->setStatus(STATUS_PUBLISHED);
     $article->setSubmissionProgress(0);
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->stampStatusModified();
     $titleExists = false;
     for ($index = 0; $node = $articleNode->getChildByName('title', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $journalPrimaryLocale;
         } elseif (!in_array($locale, $journalSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.articleTitleLocaleUnsupported', array('articleTitle' => $node->getValue(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
             return false;
         }
         $article->setTitle($node->getValue(), $locale);
         $titleExists = true;
     }
     if (!$titleExists || $article->getTitle($journalPrimaryLocale) == "") {
         $errors[] = array('plugins.importexport.native.import.error.articleTitleMissing', array('issueTitle' => $issue->getIssueIdentification(), 'sectionTitle' => $section->getLocalizedTitle()));
         return false;
     }
     for ($index = 0; $node = $articleNode->getChildByName('abstract', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $journalPrimaryLocale;
         } elseif (!in_array($locale, $journalSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.articleAbstractLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
             return false;
         }
         $article->setAbstract($node->getValue(), $locale);
     }
     if ($indexingNode = $articleNode->getChildByName('indexing')) {
         for ($index = 0; $node = $indexingNode->getChildByName('discipline', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleDisciplineLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setDiscipline($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('type', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleTypeLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setType($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('subject', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleSubjectLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setSubject($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('subject_class', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleSubjectClassLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setSubjectClass($node->getValue(), $locale);
         }
         if ($coverageNode = $indexingNode->getChildByName('coverage')) {
             for ($index = 0; $node = $coverageNode->getChildByName('geographical', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $journalPrimaryLocale;
                 } elseif (!in_array($locale, $journalSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.articleCoverageGeoLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                     return false;
                 }
                 $article->setCoverageGeo($node->getValue(), $locale);
             }
             for ($index = 0; $node = $coverageNode->getChildByName('chronological', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $journalPrimaryLocale;
                 } elseif (!in_array($locale, $journalSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.articleCoverageChronLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                     return false;
                 }
                 $article->setCoverageChron($node->getValue(), $locale);
             }
             for ($index = 0; $node = $coverageNode->getChildByName('sample', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $journalPrimaryLocale;
                 } elseif (!in_array($locale, $journalSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.articleCoverageSampleLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                     return false;
                 }
                 $article->setCoverageSample($node->getValue(), $locale);
             }
         }
     }
     for ($index = 0; $node = $articleNode->getChildByName('sponsor', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $journalPrimaryLocale;
         } elseif (!in_array($locale, $journalSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.articleSponsorLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
             return false;
         }
         $article->setSponsor($node->getValue(), $locale);
     }
     if ($node = $articleNode->getChildByName('pages')) {
         $article->setPages($node->getValue());
     }
     if ($language = $articleNode->getAttribute('language')) {
         $article->setLanguage($language);
     }
     /* --- Handle authors --- */
     $hasErrors = false;
     for ($index = 0; $node = $articleNode->getChildByName('author', $index); $index++) {
         if (!NativeImportDom::handleAuthorNode($journal, $node, $issue, $section, $article, $authorErrors)) {
             $errors = array_merge($errors, $authorErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     /* --- Handle covers --- */
     for ($index = 0; $node = $articleNode->getChildByName('cover', $index); $index++) {
         if (!NativeImportDom::handleArticleCoverNode($journal, $node, $article, $coverErrors, $isCommandLine)) {
             $errors = array_merge($errors, $coverErrors);
             $hasErrors = true;
         }
     }
     for ($index = 0; $node = $articleNode->getChildByName('id', $index); $index++) {
         switch ($node->getAttribute('type')) {
             case 'doi':
                 $article->setStoredDOI($node->getValue());
                 break;
         }
     }
     $articleDao->insertArticle($article);
     $dependentItems[] = array('article', $article);
     // Create submission mangement records
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $initialCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId());
     $initialCopyeditSignoff->setUserId(0);
     $signoffDao->updateObject($initialCopyeditSignoff);
     $authorCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
     $authorCopyeditSignoff->setUserId(0);
     $signoffDao->updateObject($authorCopyeditSignoff);
     $finalCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId());
     $finalCopyeditSignoff->setUserId(0);
     $signoffDao->updateObject($finalCopyeditSignoff);
     $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
     $layoutSignoff->setUserId(0);
     $signoffDao->updateObject($layoutSignoff);
     $authorProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
     $authorProofSignoff->setUserId(0);
     $signoffDao->updateObject($authorProofSignoff);
     $proofreaderProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId());
     $proofreaderProofSignoff->setUserId(0);
     $signoffDao->updateObject($proofreaderProofSignoff);
     $layoutProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
     $layoutProofSignoff->setUserId(0);
     $signoffDao->updateObject($layoutProofSignoff);
     // Log the import in the article event log.
     import('classes.article.log.ArticleLog');
     import('classes.article.log.ArticleEventLogEntry');
     ArticleLog::logEvent($article->getId(), ARTICLE_LOG_ARTICLE_IMPORT, ARTICLE_LOG_TYPE_DEFAULT, 0, 'log.imported', array('userName' => $user->getFullName(), 'articleId' => $article->getId()));
     // Insert published article entry.
     $publishedArticle = new PublishedArticle();
     $publishedArticle->setArticleId($article->getId());
     $publishedArticle->setIssueId($issue->getId());
     if ($node = $articleNode->getChildByName('date_published')) {
         $publishedDate = strtotime($node->getValue());
         if ($publishedDate === -1) {
             $errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue()));
             return false;
         } else {
             $publishedArticle->setDatePublished($publishedDate);
         }
     }
     $node = $articleNode->getChildByName('open_access');
     $publishedArticle->setAccessStatus($node ? ARTICLE_ACCESS_OPEN : ARTICLE_ACCESS_ISSUE_DEFAULT);
     $publishedArticle->setSeq(REALLY_BIG_NUMBER);
     $publishedArticle->setViews(0);
     $publishedArticle->setPublicArticleId($articleNode->getAttribute('public_id'));
     $publishedArticle->setPubId($publishedArticleDao->insertPublishedArticle($publishedArticle));
     $publishedArticleDao->resequencePublishedArticles($section->getId(), $issue->getId());
     /* --- Galleys (html or otherwise handled simultaneously) --- */
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($article->getId());
     /* --- Handle galleys --- */
     $hasErrors = false;
     $galleyCount = 0;
     for ($index = 0; $index < count($articleNode->children); $index++) {
         $node = $articleNode->children[$index];
         if ($node->getName() == 'htmlgalley') {
             $isHtml = true;
         } elseif ($node->getName() == 'galley') {
             $isHtml = false;
         } else {
             continue;
         }
         if (!NativeImportDom::handleGalleyNode($journal, $node, $issue, $section, $article, $galleyErrors, $isCommandLine, $isHtml, $galleyCount, $articleFileManager)) {
             $errors = array_merge($errors, $galleyErrors);
             $hasErrors = true;
         }
         $galleyCount++;
         unset($node);
     }
     if ($hasErrors) {
         return false;
     }
     /* --- Handle supplemental files --- */
     $hasErrors = false;
     for ($index = 0; $node = $articleNode->getChildByName('supplemental_file', $index); $index++) {
         if (!NativeImportDom::handleSuppFileNode($journal, $node, $issue, $section, $article, $suppFileErrors, $isCommandLine, $articleFileManager)) {
             $errors = array_merge($errors, $suppFileErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     // Index the inserted article.
     import('classes.search.ArticleSearchIndex');
     ArticleSearchIndex::indexArticleMetadata($article);
     ArticleSearchIndex::indexArticleFiles($article);
     return true;
 }
コード例 #20
0
 /**
  * Upload the copyedited version of an article.
  * @param $copyeditorSubmission object
  * @param $copyeditStage string
  * @param $request object
  */
 function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage, $request)
 {
     import('classes.file.ArticleFileManager');
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     if ($copyeditStage == 'initial') {
         $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId());
     } else {
         if ($copyeditStage == 'final') {
             $signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId());
         }
     }
     // Only allow an upload if they're in the initial or final copyediting
     // stages.
     if ($copyeditStage == 'initial' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
         return;
     } else {
         if ($copyeditStage == 'final' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
             return;
         } else {
             if ($copyeditStage != 'initial' && $copyeditStage != 'final') {
                 return;
             }
         }
     }
     $articleFileManager = new ArticleFileManager($copyeditorSubmission->getId());
     $user =& $request->getUser();
     $fileName = 'upload';
     if ($articleFileManager->uploadedFileExists($fileName)) {
         HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission));
         if ($signoff->getFileId() != null) {
             $fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true));
         } else {
             $fileId = $articleFileManager->uploadCopyeditFile($fileName);
         }
     }
     if (isset($fileId) && $fileId != 0) {
         $signoff->setFileId($fileId);
         $signoff->setFileRevision($articleFileDao->getRevisionNumber($fileId));
         $signoffDao->updateObject($signoff);
         // Add log
         import('classes.article.log.ArticleLog');
         ArticleLog::logEvent($request, $copyeditorSubmission, ARTICLE_LOG_COPYEDITOR_FILE, 'log.copyedit.copyeditorFile', array('copyeditorName' => $user->getFullName(), 'fileId' => $fileId));
     }
 }
コード例 #21
0
 /**
  * Upload a review on behalf of its reviewer.
  * @param $reviewId int
  */
 function uploadReviewForReviewer($reviewId, $article, $request)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& $request->getUser();
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId(), true);
     if (HookRegistry::call('SectionEditorAction::uploadReviewForReviewer', array(&$reviewAssignment, &$reviewer))) {
         return;
     }
     // Upload the review file.
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($reviewAssignment->getSubmissionId());
     // Only upload the file if the reviewer has yet to submit a recommendation
     if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
         $fileName = 'upload';
         if ($articleFileManager->uploadedFileExists($fileName)) {
             if ($reviewAssignment->getReviewerFileId() != null) {
                 $fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
             } else {
                 $fileId = $articleFileManager->uploadReviewFile($fileName);
             }
         }
     }
     if (isset($fileId) && $fileId != 0) {
         // Only confirm the review for the reviewer if
         // he has not previously done so.
         if ($reviewAssignment->getDateConfirmed() == null) {
             $reviewAssignment->setDeclined(0);
             $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
         }
         $reviewAssignment->setReviewerFileId($fileId);
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
         // Add log
         import('classes.article.log.ArticleLog');
         ArticleLog::logEvent($request, $article, ARTICLE_LOG_REVIEW_FILE_BY_PROXY, 'log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'round' => $reviewAssignment->getRound(), 'userName' => $user->getFullName(), 'reviewId' => $reviewAssignment->getId()));
     }
 }
コード例 #22
0
 /**
  * Save changes to article.
  */
 function execute()
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $journal = Request::getJournal();
     // Update article
     $article =& $this->article;
     if ($this->getData('commentsToEditor') != '') {
         $article->setCommentsToEditor($this->getData('commentsToEditor'));
     }
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->setSubmissionProgress(0);
     $article->stampStatusModified();
     $articleDao->updateArticle($article);
     // Designate this as the review version by default.
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getArticleId());
     AuthorAction::designateReviewVersion($authorSubmission, true);
     unset($authorSubmission);
     // Create additional submission mangement records
     $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
     $copyeditorSubmission =& new CopyeditorSubmission();
     $copyeditorSubmission->setArticleId($article->getArticleId());
     $copyeditorSubmission->setCopyeditorId(0);
     $copyeditorSubmissionDao->insertCopyeditorSubmission($copyeditorSubmission);
     $layoutDao =& DAORegistry::getDAO('LayoutAssignmentDAO');
     $layoutAssignment =& new LayoutAssignment();
     $layoutAssignment->setArticleId($article->getArticleId());
     $layoutAssignment->setEditorId(0);
     $layoutDao->insertLayoutAssignment($layoutAssignment);
     $proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO');
     $proofAssignment =& new ProofAssignment();
     $proofAssignment->setArticleId($article->getArticleId());
     $proofAssignment->setProofreaderId(0);
     $proofAssignmentDao->insertProofAssignment($proofAssignment);
     $sectionEditors = $this->assignEditors($article);
     $user =& Request::getUser();
     // Update search index
     import('search.ArticleSearchIndex');
     ArticleSearchIndex::indexArticleMetadata($article);
     ArticleSearchIndex::indexArticleFiles($article);
     // Send author notification email
     import('mail.ArticleMailTemplate');
     $mail =& new ArticleMailTemplate($article, 'SUBMISSION_ACK');
     $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
     if ($mail->isEnabled()) {
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         // If necessary, BCC the acknowledgement to someone.
         if ($journal->getSetting('copySubmissionAckPrimaryContact')) {
             $mail->addBcc($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
         }
         if ($journal->getSetting('copySubmissionAckSpecified')) {
             $copyAddress = $journal->getSetting('copySubmissionAckAddress');
             if (!empty($copyAddress)) {
                 $mail->addBcc($copyAddress);
             }
         }
         // Also BCC automatically assigned section editors
         foreach ($sectionEditors as $sectionEditorEntry) {
             $sectionEditor =& $sectionEditorEntry['user'];
             $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName());
             unset($sectionEditor);
         }
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getJournalTitle(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getArticleId())));
         $mail->send();
     }
     import('article.log.ArticleLog');
     import('article.log.ArticleEventLogEntry');
     ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getUserId(), 'log.author.submitted', array('submissionId' => $article->getArticleId(), 'authorName' => $user->getFullName()));
     return $this->articleId;
 }
コード例 #23
0
 /**
  * Payments
  */
 function waiveSubmissionFee($args, $request)
 {
     $articleId = (int) array_shift($args);
     $markAsPaid = $request->getUserVar('markAsPaid');
     $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
     $submission =& $this->submission;
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     $user =& $request->getUser();
     $journal =& $request->getJournal();
     $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_SUBMISSION, $markAsPaid ? $submission->getUserId() : $user->getId(), $articleId, $markAsPaid ? $journal->getSetting('submissionFee') : 0, $markAsPaid ? $journal->getSetting('currency') : '');
     // Since this is a waiver, fulfill the payment immediately
     $paymentManager->fulfillQueuedPayment($queuedPayment, $markAsPaid ? 'ManualPayment' : 'Waiver');
     import('classes.article.log.ArticleLog');
     import('classes.article.log.ArticleEventLogEntry');
     Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
     if ($markAsPaid) {
         $message = 'log.editor.fee.paid';
     } else {
         $message = 'log.editor.fee.waived';
     }
     ArticleLog::logEvent($submission->getArticleId(), ARTICLE_LOG_SECTION_DECISION, ARTICLE_LOG_TYPE_EDITOR, $user->getId(), $message, array('editorName' => $user->getFullName(), 'proposalId' => $submission->getProposalId()));
     $request->redirect(null, null, 'submissionReview', $articleId);
 }
コード例 #24
0
 /**
  * Display a summary of the status of an author's submission.
  */
 function submission($args)
 {
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId);
     $submission =& $this->submission;
     $this->setupTemplate(true, $articleId);
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     if (Request::getUserVar("archive")) {
         $article = $articleDao->getArticle($articleId);
         $article->setStatus(STATUS_ARCHIVED);
         $article->stampStatusModified();
         $articleDao->updateArticle($article);
         // Add log
         import('classes.article.log.ArticleLog');
         import('classes.article.log.ArticleEventLogEntry');
         ArticleLog::logEvent($articleId, ARTICLE_LOG_EDITOR_ARCHIVE, ARTICLE_LOG_TYPE_EDITOR, $articleId, 'log.editor.archived', array('articleId' => $articleId));
     }
     $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
     $journalSettings = $journalSettingsDao->getJournalSettings($journal->getId());
     // Setting the round.
     $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
     $templateMgr =& TemplateManager::getManager();
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId());
     if ($publishedArticle) {
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         $issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
         $templateMgr->assign_by_ref('issue', $issue);
     }
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $section =& $sectionDao->getSection($submission->getSectionId());
     $templateMgr->assign_by_ref('section', $section);
     $templateMgr->assign_by_ref('journalSettings', $journalSettings);
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
     $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
     $templateMgr->assign('round', $round);
     $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
     $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
     $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
     $authorSubmisionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $authorSubmission = $authorSubmisionDao->getAuthorSubmission($articleId);
     if ($authorSubmission->getSubmissionStatus() == STATUS_QUEUED_EDITING) {
         $templateMgr->assign_by_ref('proofView', $proofView = 1);
     }
     //%CBP% Pass repository URL also
     //TODO: Update to get different file versions also (include ED)
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
     $submission->getAuthorFileRevisions($submission->getCurrentRound());
     if ($submission->getRevisedFile()) {
         $submissionFile = $submission->getRevisedFile();
     } else {
         $submissionFile = $submission->getSubmissionFile();
     }
     $editorDecisions = $submission->getDecisions($submission->getCurrentRound());
     $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1] : null;
     if ($submissionFile) {
         $fileId = $submissionFile->getFileId();
         $object = $CBPPlatformDao->getFedoraObjectInformation($fileId);
         $objectPid = $object['fedora_namespace'] . ":" . $object['fedora_pid'];
         $templateMgr->assign_by_ref('repositoryObjectPid', $objectPid);
         $objectDsid = $object['fedora_dsid'];
         $templateMgr->assign_by_ref('repositoryObjectDsid', $objectDsid);
     }
     $templateMgr->assign('lastEditorDecision', $lastDecision['decision']);
     import('classes.submission.sectionEditor.SectionEditorSubmission');
     $templateMgr->assign_by_ref('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     // Set up required Payment Related Information
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     if ($paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
         $templateMgr->assign('authorFees', true);
         $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
         if ($paymentManager->submissionEnabled()) {
             $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment($journal->getId(), $articleId));
         }
         if ($paymentManager->fastTrackEnabled()) {
             $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment($journal->getId(), $articleId));
         }
         if ($paymentManager->publicationEnabled()) {
             $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDAO->getPublicationCompletedPayment($journal->getId(), $articleId));
         }
     }
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole');
     $initialCopyeditSignoff = $submission->getSignoff('SIGNOFF_COPYEDITING_INITIAL');
     $templateMgr->assign('canEditMetadata', !$initialCopyeditSignoff->getDateCompleted() && $submission->getStatus() != STATUS_PUBLISHED);
     $templateMgr->display('author/submission.tpl');
 }
コード例 #25
0
ファイル: Action.inc.php プロジェクト: LiteratimBi/jupitertfn
 /**
  * Save metadata.
  * @param $article object
  */
 function saveMetadata($article)
 {
     if (!HookRegistry::call('Action::saveMetadata', array(&$article))) {
         import("submission.form.MetadataForm");
         $metadataForm =& new MetadataForm($article);
         $metadataForm->readInputData();
         if (!$metadataForm->validate()) {
             return $metadataForm->display();
         }
         // Check for any special cases before trying to save
         if (Request::getUserVar('addAuthor')) {
             // Add an author
             $editData = true;
             $authors = $metadataForm->getData('authors');
             array_push($authors, array());
             $metadataForm->setData('authors', $authors);
         } else {
             if (($delAuthor = Request::getUserVar('delAuthor')) && count($delAuthor) == 1) {
                 // Delete an author
                 $editData = true;
                 list($delAuthor) = array_keys($delAuthor);
                 $delAuthor = (int) $delAuthor;
                 $authors = $metadataForm->getData('authors');
                 if (isset($authors[$delAuthor]['authorId']) && !empty($authors[$delAuthor]['authorId'])) {
                     $deletedAuthors = explode(':', $metadataForm->getData('deletedAuthors'));
                     array_push($deletedAuthors, $authors[$delAuthor]['authorId']);
                     $metadataForm->setData('deletedAuthors', join(':', $deletedAuthors));
                 }
                 array_splice($authors, $delAuthor, 1);
                 $metadataForm->setData('authors', $authors);
                 if ($metadataForm->getData('primaryContact') == $delAuthor) {
                     $metadataForm->setData('primaryContact', 0);
                 }
             } else {
                 if (Request::getUserVar('moveAuthor')) {
                     // Move an author up/down
                     $editData = true;
                     $moveAuthorDir = Request::getUserVar('moveAuthorDir');
                     $moveAuthorDir = $moveAuthorDir == 'u' ? 'u' : 'd';
                     $moveAuthorIndex = (int) Request::getUserVar('moveAuthorIndex');
                     $authors = $metadataForm->getData('authors');
                     if (!($moveAuthorDir == 'u' && $moveAuthorIndex <= 0 || $moveAuthorDir == 'd' && $moveAuthorIndex >= count($authors) - 1)) {
                         $tmpAuthor = $authors[$moveAuthorIndex];
                         $primaryContact = $metadataForm->getData('primaryContact');
                         if ($moveAuthorDir == 'u') {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex - 1];
                             $authors[$moveAuthorIndex - 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex - 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex - 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         } else {
                             $authors[$moveAuthorIndex] = $authors[$moveAuthorIndex + 1];
                             $authors[$moveAuthorIndex + 1] = $tmpAuthor;
                             if ($primaryContact == $moveAuthorIndex) {
                                 $metadataForm->setData('primaryContact', $moveAuthorIndex + 1);
                             } else {
                                 if ($primaryContact == $moveAuthorIndex + 1) {
                                     $metadataForm->setData('primaryContact', $moveAuthorIndex);
                                 }
                             }
                         }
                     }
                     $metadataForm->setData('authors', $authors);
                 }
             }
         }
         if (isset($editData)) {
             $metadataForm->display();
             return false;
         } else {
             $metadataForm->execute();
             // Add log entry
             $user =& Request::getUser();
             import('article.log.ArticleLog');
             import('article.log.ArticleEventLogEntry');
             ArticleLog::logEvent($article->getArticleId(), ARTICLE_LOG_METADATA_UPDATE, ARTICLE_LOG_TYPE_DEFAULT, 0, 'log.editor.metadataModified', array('editorName' => $user->getFullName()));
             return true;
         }
     }
 }
コード例 #26
0
ファイル: CopyeditorAction.inc.php プロジェクト: alenoosh/ojs
 /**
  * Upload the copyedited version of an article.
  * @param $copyeditorSubmission object
  */
 function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage)
 {
     import("file.ArticleFileManager");
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
     // Only allow an upload if they're in the initial or final copyediting
     // stages.
     if ($copyeditStage == 'initial' && ($copyeditorSubmission->getDateNotified() == null || $copyeditorSubmission->getDateCompleted() != null)) {
         return;
     } else {
         if ($copyeditStage == 'final' && ($copyeditorSubmission->getDateFinalNotified() == null || $copyeditorSubmission->getDateFinalCompleted() != null)) {
             return;
         } else {
             if ($copyeditStage != 'initial' && $copyeditStage != 'final') {
                 return;
             }
         }
     }
     $articleFileManager =& new ArticleFileManager($copyeditorSubmission->getArticleId());
     $user =& Request::getUser();
     $fileName = 'upload';
     if ($articleFileManager->uploadedFileExists($fileName)) {
         HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission));
         if ($copyeditorSubmission->getCopyeditFileId() != null) {
             $fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getCopyeditFileId());
         } else {
             $fileId = $articleFileManager->uploadCopyeditFile($fileName);
         }
     }
     if (isset($fileId) && $fileId != 0) {
         $copyeditorSubmission->setCopyeditFileId($fileId);
         if ($copyeditStage == 'initial') {
             $copyeditorSubmission->setInitialRevision($articleFileDao->getRevisionNumber($fileId));
         } elseif ($copyeditStage == 'final') {
             $copyeditorSubmission->setFinalRevision($articleFileDao->getRevisionNumber($fileId));
         }
         $copyeditorSubmissionDao->updateCopyeditorSubmission($copyeditorSubmission);
         // Add log
         import('article.log.ArticleLog');
         import('article.log.ArticleEventLogEntry');
         $entry =& new ArticleEventLogEntry();
         $entry->setArticleId($copyeditorSubmission->getArticleId());
         $entry->setUserId($user->getUserId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType(ARTICLE_LOG_COPYEDIT_COPYEDITOR_FILE);
         $entry->setLogMessage('log.copyedit.copyeditorFile');
         $entry->setAssocType(ARTICLE_LOG_TYPE_COPYEDIT);
         $entry->setAssocId($fileId);
         ArticleLog::logEventEntry($copyeditorSubmission->getArticleId(), $entry);
     }
 }
コード例 #27
0
ファイル: EditorAction.inc.php プロジェクト: reconciler/ojs
 /**
  * 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);
 }
コード例 #28
0
 /**
  * Save changes to article.
  */
 function execute()
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $journal = Request::getJournal();
     $user = Request::getUser();
     // Update article
     $article =& $this->article;
     if ($this->getData('commentsToEditor') != '') {
         $article->setCommentsToEditor($this->getData('commentsToEditor'));
     }
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->setSubmissionProgress(0);
     $article->stampStatusModified();
     $articleDao->updateArticle($article);
     // Designate this as the review version by default.
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId());
     AuthorAction::designateReviewVersion($authorSubmission, true);
     unset($authorSubmission);
     $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId());
     $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
     $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId());
     $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, $article->getId());
     $layoutSignoff->setUserId(0);
     $signoffDao->updateObject($layoutSignoff);
     $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId());
     $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId());
     $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
     $proofAuthorSignoff->setUserId($user->getId());
     $proofProofreaderSignoff->setUserId(0);
     $proofLayoutEditorSignoff->setUserId(0);
     $signoffDao->updateObject($proofAuthorSignoff);
     $signoffDao->updateObject($proofProofreaderSignoff);
     $signoffDao->updateObject($proofLayoutEditorSignoff);
     $sectionEditors = $this->assignEditors($article);
     $user =& Request::getUser();
     // Update search index
     import('classes.search.ArticleSearchIndex');
     ArticleSearchIndex::indexArticleMetadata($article);
     ArticleSearchIndex::indexArticleFiles($article);
     // Send author notification email
     import('classes.mail.ArticleMailTemplate');
     $mail = new ArticleMailTemplate($article, 'SUBMISSION_ACK', null, null, null, false);
     $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
     if ($mail->isEnabled()) {
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         // If necessary, BCC the acknowledgement to someone.
         if ($journal->getSetting('copySubmissionAckPrimaryContact')) {
             $mail->addBcc($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
         }
         if ($journal->getSetting('copySubmissionAckSpecified')) {
             $copyAddress = $journal->getSetting('copySubmissionAckAddress');
             if (!empty($copyAddress)) {
                 $mail->addBcc($copyAddress);
             }
         }
         // Also BCC automatically assigned section editors
         foreach ($sectionEditors as $sectionEditorEntry) {
             $sectionEditor =& $sectionEditorEntry['user'];
             $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName());
             unset($sectionEditor);
         }
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedTitle(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getId())));
         $mail->send();
     }
     import('classes.article.log.ArticleLog');
     import('classes.article.log.ArticleEventLogEntry');
     ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), 'log.author.submitted', array('submissionId' => $article->getId(), 'authorName' => $user->getFullName()));
     return $this->articleId;
 }
コード例 #29
0
ファイル: NativeImportDom.inc.php プロジェクト: Jouper/jouper
 function handleArticleNode(&$journal, &$articleNode, &$issue, &$section, &$article, &$publishedArticle, &$errors, &$user, $isCommandLine, &$dependentItems)
 {
     $errors = array();
     $journalSupportedLocales = array_keys($journal->getSupportedLocaleNames());
     // => journal locales must be set up before
     $journalPrimaryLocale = $journal->getPrimaryLocale();
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $article = new Article();
     $article->setJournalId($journal->getJournalId());
     $article->setUserId($user->getUserId());
     $article->setSectionId($section->getSectionId());
     $article->setStatus(STATUS_PUBLISHED);
     $article->setSubmissionProgress(0);
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->stampStatusModified();
     $titleExists = false;
     for ($index = 0; $node = $articleNode->getChildByName('title', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $journalPrimaryLocale;
         } elseif (!in_array($locale, $journalSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.articleTitleLocaleUnsupported', array('articleTitle' => $node->getValue(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
             return false;
         }
         $article->setTitle($node->getValue(), $locale);
         $titleExists = true;
     }
     if (!$titleExists || $article->getTitle($journalPrimaryLocale) == "") {
         $errors[] = array('plugins.importexport.native.import.error.articleTitleMissing', array('issueTitle' => $issue->getIssueIdentification(), 'sectionTitle' => $section->getSectionTitle()));
         return false;
     }
     for ($index = 0; $node = $articleNode->getChildByName('abstract', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $journalPrimaryLocale;
         } elseif (!in_array($locale, $journalSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.articleAbstractLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
             return false;
         }
         $article->setAbstract($node->getValue(), $locale);
     }
     if ($indexingNode = $articleNode->getChildByName('indexing')) {
         for ($index = 0; $node = $indexingNode->getChildByName('discipline', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleDisciplineLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setDiscipline($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('type', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleTypeLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setType($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('subject', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleSubjectLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setSubject($node->getValue(), $locale);
         }
         for ($index = 0; $node = $indexingNode->getChildByName('subject_class', $index); $index++) {
             $locale = $node->getAttribute('locale');
             if ($locale == '') {
                 $locale = $journalPrimaryLocale;
             } elseif (!in_array($locale, $journalSupportedLocales)) {
                 $errors[] = array('plugins.importexport.native.import.error.articleSubjectClassLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                 return false;
             }
             $article->setSubjectClass($node->getValue(), $locale);
         }
         if ($coverageNode = $indexingNode->getChildByName('coverage')) {
             for ($index = 0; $node = $coverageNode->getChildByName('geographical', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $journalPrimaryLocale;
                 } elseif (!in_array($locale, $journalSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.articleCoverageGeoLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                     return false;
                 }
                 $article->setCoverageGeo($node->getValue(), $locale);
             }
             for ($index = 0; $node = $coverageNode->getChildByName('chronological', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $journalPrimaryLocale;
                 } elseif (!in_array($locale, $journalSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.articleCoverageChronLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                     return false;
                 }
                 $article->setCoverageChron($node->getValue(), $locale);
             }
             for ($index = 0; $node = $coverageNode->getChildByName('sample', $index); $index++) {
                 $locale = $node->getAttribute('locale');
                 if ($locale == '') {
                     $locale = $journalPrimaryLocale;
                 } elseif (!in_array($locale, $journalSupportedLocales)) {
                     $errors[] = array('plugins.importexport.native.import.error.articleCoverageSampleLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
                     return false;
                 }
                 $article->setCoverageSample($node->getValue(), $locale);
             }
         }
     }
     for ($index = 0; $node = $articleNode->getChildByName('sponsor', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $journalPrimaryLocale;
         } elseif (!in_array($locale, $journalSupportedLocales)) {
             $errors[] = array('plugins.importexport.native.import.error.articleSponsorLocaleUnsupported', array('articleTitle' => $article->getArticleTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale));
             return false;
         }
         $article->setSponsor($node->getValue(), $locale);
     }
     if ($node = $articleNode->getChildByName('pages')) {
         $article->setPages($node->getValue());
     }
     if ($language = $articleNode->getAttribute('language')) {
         $article->setLanguage($language);
     }
     /* --- Handle authors --- */
     $hasErrors = false;
     for ($index = 0; $node = $articleNode->getChildByName('author', $index); $index++) {
         if (!NativeImportDom::handleAuthorNode($journal, $node, $issue, $section, $article, $authorErrors)) {
             $errors = array_merge($errors, $authorErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     $articleDao->insertArticle($article);
     $dependentItems[] = array('article', $article);
     // Create submission mangement records
     $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
     $copyeditorSubmission =& new CopyeditorSubmission();
     $copyeditorSubmission->setArticleId($article->getArticleId());
     $copyeditorSubmission->setCopyeditorId(0);
     $copyeditorSubmissionDao->insertCopyeditorSubmission($copyeditorSubmission);
     $layoutDao =& DAORegistry::getDAO('LayoutAssignmentDAO');
     $layoutAssignment =& new LayoutAssignment();
     $layoutAssignment->setArticleId($article->getArticleId());
     $layoutAssignment->setEditorId(0);
     $layoutAssignment->setDateAcknowledged(Core::getCurrentDate());
     // Make sure that imported articles go directly into the Archive. FIXME?
     $layoutDao->insertLayoutAssignment($layoutAssignment);
     $proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO');
     $proofAssignment =& new ProofAssignment();
     $proofAssignment->setArticleId($article->getArticleId());
     $proofAssignment->setProofreaderId(0);
     $proofAssignmentDao->insertProofAssignment($proofAssignment);
     // Log the import in the article event log.
     import('article.log.ArticleLog');
     import('article.log.ArticleEventLogEntry');
     ArticleLog::logEvent($article->getArticleId(), ARTICLE_LOG_ARTICLE_IMPORT, ARTICLE_LOG_TYPE_DEFAULT, 0, 'log.imported', array('userName' => $user->getFullName(), 'articleId' => $article->getArticleId()));
     // Insert published article entry.
     $publishedArticle =& new PublishedArticle();
     $publishedArticle->setArticleId($article->getArticleId());
     $publishedArticle->setIssueId($issue->getIssueId());
     if ($node = $articleNode->getChildByName('date_published')) {
         $publishedDate = strtotime($node->getValue());
         if ($publishedDate === -1) {
             $errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue()));
             return false;
         } else {
             $publishedArticle->setDatePublished($publishedDate);
         }
     }
     $node = $articleNode->getChildByName('open_access');
     $publishedArticle->setAccessStatus($node ? 1 : 0);
     $publishedArticle->setSeq(REALLY_BIG_NUMBER);
     $publishedArticle->setViews(0);
     $publishedArticle->setPublicArticleId($articleNode->getAttribute('public_id'));
     $publishedArticle->setPubId($publishedArticleDao->insertPublishedArticle($publishedArticle));
     $publishedArticleDao->resequencePublishedArticles($section->getSectionId(), $issue->getIssueId());
     /* --- Galleys (html or otherwise handled simultaneously) --- */
     import('file.ArticleFileManager');
     $articleFileManager =& new ArticleFileManager($article->getArticleId());
     /* --- Handle galleys --- */
     $hasErrors = false;
     $galleyCount = 0;
     for ($index = 0; $index < count($articleNode->children); $index++) {
         $node =& $articleNode->children[$index];
         if ($node->getName() == 'htmlgalley') {
             $isHtml = true;
         } elseif ($node->getName() == 'galley') {
             $isHtml = false;
         } else {
             continue;
         }
         if (!NativeImportDom::handleGalleyNode($journal, $node, $issue, $section, $article, $galleyErrors, $isCommandLine, $isHtml, $galleyCount, $articleFileManager)) {
             $errors = array_merge($errors, $galleyErrors);
             $hasErrors = true;
         }
         $galleyCount++;
     }
     if ($hasErrors) {
         return false;
     }
     /* --- Handle supplemental files --- */
     $hasErrors = false;
     for ($index = 0; $node = $articleNode->getChildByName('supplemental_file', $index); $index++) {
         if (!NativeImportDom::handleSuppFileNode($journal, $node, $issue, $section, $article, $suppFileErrors, $isCommandLine, $articleFileManager)) {
             $errors = array_merge($errors, $suppFileErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     // Index the inserted article.
     import('search.ArticleSearchIndex');
     ArticleSearchIndex::indexArticleMetadata($article);
     ArticleSearchIndex::indexArticleFiles($article);
     return true;
 }