Esempio n. 1
0
 /**
  * @see Filter::process()
  * @param $document DOMDocument|string
  * @return array Array of imported documents
  */
 function &process(&$document)
 {
     $importedObjects =& parent::process($document);
     // Index imported content
     import('classes.search.ArticleSearchIndex');
     foreach ($importedObjects as $submission) {
         assert(is_a($submission, 'Submission'));
         ArticleSearchIndex::articleMetadataChanged($submission);
         ArticleSearchIndex::submissionFilesChanged($submission);
     }
     ArticleSearchIndex::articleChangesFinished();
     return $importedObjects;
 }
 /**
  * Delete a submission.
  * @param $args array
  * @param $request PKPRequest
  */
 function deleteSubmission($args, $request)
 {
     $articleId = (int) array_shift($args);
     $this->validate($request, $articleId);
     $authorSubmission =& $this->submission;
     $this->setupTemplate($request, true);
     // If the submission is incomplete, allow the author to delete it.
     if ($authorSubmission->getSubmissionProgress() != 0) {
         import('classes.file.ArticleFileManager');
         $articleFileManager = new ArticleFileManager($articleId);
         $articleFileManager->deleteArticleTree();
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         $articleDao->deleteArticleById($articleId);
         import('classes.search.ArticleSearchIndex');
         $articleSearchIndex = new ArticleSearchIndex();
         $articleSearchIndex->articleDeleted($articleId);
         $articleSearchIndex->articleChangesFinished();
     }
     $request->redirect(null, null, 'index');
 }
Esempio n. 3
0
 /**
  * Publish issue
  * @param $args array
  * @param $request Request
  */
 function publishIssue($args, $request)
 {
     $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     $issueId = $issue->getId();
     $journal = $request->getJournal();
     $journalId = $journal->getId();
     $articleSearchIndex = null;
     if (!$issue->getPublished()) {
         $confirmationText = __('editor.issues.confirmPublish');
         import('controllers.grid.pubIds.form.AssignPublicIdentifiersForm');
         $formTemplate = $this->getAssignPublicIdentifiersFormTemplate();
         $assignPublicIdentifiersForm = new AssignPublicIdentifiersForm($formTemplate, $issue, true, $confirmationText);
         if (!$request->getUserVar('confirmed')) {
             // Display assign pub ids modal
             $assignPublicIdentifiersForm->initData($args, $request);
             return new JSONMessage(true, $assignPublicIdentifiersForm->fetch($request));
         }
         // Asign pub ids
         $assignPublicIdentifiersForm->readInputData();
         $assignPublicIdentifiersForm->execute($request);
         // Set the status of any attendant queued articles to STATUS_PUBLISHED.
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         $articleDao = DAORegistry::getDAO('ArticleDAO');
         $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId);
         foreach ($publishedArticles as $publishedArticle) {
             $article = $articleDao->getById($publishedArticle->getId());
             if ($article && $article->getStatus() == STATUS_QUEUED) {
                 $article->setStatus(STATUS_PUBLISHED);
                 $article->stampStatusModified();
                 $articleDao->updateObject($article);
                 if (!$articleSearchIndex) {
                     import('classes.search.ArticleSearchIndex');
                     $articleSearchIndex = new ArticleSearchIndex();
                 }
                 $articleSearchIndex->articleMetadataChanged($publishedArticle);
             }
             // delete article tombstone
             $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO');
             $tombstoneDao->deleteByDataObjectId($article->getId());
         }
     }
     $issue->setCurrent(1);
     $issue->setPublished(1);
     $issue->setDatePublished(Core::getCurrentDate());
     // If subscriptions with delayed open access are enabled then
     // update open access date according to open access delay policy
     if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
         $delayDuration = $journal->getSetting('delayedOpenAccessDuration');
         $delayYears = (int) floor($delayDuration / 12);
         $delayMonths = (int) fmod($delayDuration, 12);
         $curYear = date('Y');
         $curMonth = date('n');
         $curDay = date('j');
         $delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
         $delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
         $issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
         $issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
     }
     $issueDao = DAORegistry::getDAO('IssueDAO');
     $issueDao->updateCurrent($journalId, $issue);
     if ($articleSearchIndex) {
         $articleSearchIndex->articleChangesFinished();
     }
     // Send a notification to associated users
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $notificationUsers = array();
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $allUsers = $userGroupDao->getUsersByContextId($journalId);
     while ($user = $allUsers->next()) {
         $notificationUsers[] = array('id' => $user->getId());
     }
     foreach ($notificationUsers as $userRole) {
         $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId);
     }
     $notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
     return DAO::getDataChangedEvent();
 }
Esempio n. 4
0
 /**
  * Expedites a submission through the submission process, if the submitter is a manager or editor.
  * @param $args array
  * @param $request PKPRequest
  */
 function expedite($args, $request)
 {
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
     $user = $request->getUser();
     $form = new IssueEntryPublicationMetadataForm($submission->getId(), $user, null, array('expeditedSubmission' => true));
     if ($submission && (int) $request->getUserVar('issueId') > 0) {
         // Process our submitted form in order to create the published article entry.
         $form->readInputData();
         if ($form->validate()) {
             $form->execute($request);
             // Create trivial notification in place on the form, and log the event.
             $notificationManager = new NotificationManager();
             $user = $request->getUser();
             import('lib.pkp.classes.log.SubmissionLog');
             import('classes.log.SubmissionEventLogEntry');
             // Log consts
             SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
             $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.savedIssueMetadata')));
             // For indexing
             import('classes.search.ArticleSearchIndex');
             $articleSearchIndex = new ArticleSearchIndex();
             // Now, create a galley for this submission.  Assume PDF, and set to 'available'.
             $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
             $articleGalley = $articleGalleyDao->newDataObject();
             $articleGalley->setGalleyType('pdfarticlegalleyplugin');
             $articleGalley->setIsApproved(true);
             $articleGalley->setSubmissionId($submission->getId());
             $articleGalley->setLocale($submission->getLocale());
             $articleGalley->setLabel('PDF');
             $articleGalley->setSeq($articleGalleyDao->getNextGalleySequence($submission->getId()));
             $articleGalleyId = $articleGalleyDao->insertObject($articleGalley);
             // Next, create a galley PROOF file out of the submission file uploaded.
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             import('lib.pkp.classes.submission.SubmissionFile');
             // SUBMISSION_FILE_... constants
             $submissionFiles = $submissionFileDao->getLatestRevisions($submission->getId(), SUBMISSION_FILE_SUBMISSION);
             // Watch for a single file, or any PDFs.
             foreach ($submissionFiles as $submissionFile) {
                 // test both mime type and file extension in case the mime type isn't correct after uploading.
                 if (count($submissionFiles) == 1 || $submissionFile->getFileType() == 'application/pdf' || preg_match('/\\.pdf$/', $submissionFile->getOriginalFileName())) {
                     // Get the path of the current file because we change the file stage in a bit.
                     $currentFilePath = $submissionFile->getFilePath();
                     // this will be a new file based on the old one.
                     $submissionFile->setFileId(null);
                     $submissionFile->setRevision(1);
                     $submissionFile->setFileStage(SUBMISSION_FILE_PROOF);
                     $submissionFile->setAssocType(ASSOC_TYPE_GALLEY);
                     $submissionFile->setAssocId($articleGalleyId);
                     $submissionFileDao->insertObject($submissionFile, $currentFilePath);
                     // Update file index
                     $articleSearchIndex->submissionFileChanged($submission->getId(), SUBMISSION_SEARCH_GALLEY_FILE, $submissionFile->getFileId());
                     break;
                 }
             }
             // Update index
             $articleSearchIndex->articleMetadataChanged($submission);
             $articleSearchIndex->articleChangesFinished();
             // no errors, clear all notifications for this submission which may have been created during the submission process and close the modal.
             $context = $request->getContext();
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             $notificationFactory = $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), null, null, $context->getId());
             return new JSONMessage(true);
         } else {
             return new JSONMessage(true, $form->fetch($request));
         }
     }
     return new JSONMessage(true, $form->fetch($request));
 }
 /**
  * Save changes to the galley.
  * @return int the galley ID
  */
 function execute($fileName = null, $createRemote = false)
 {
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($this->articleId);
     $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     $fileName = isset($fileName) ? $fileName : 'galleyFile';
     $journal =& Request::getJournal();
     $fileId = null;
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $article =& $articleDao->getArticle($this->articleId, $journal->getId());
     if (isset($this->galley)) {
         $galley =& $this->galley;
         // Upload galley file
         if ($articleFileManager->uploadedFileExists($fileName)) {
             if ($galley->getFileId()) {
                 $articleFileManager->uploadPublicFile($fileName, $galley->getFileId());
                 $fileId = $galley->getFileId();
             } else {
                 $fileId = $articleFileManager->uploadPublicFile($fileName);
                 $galley->setFileId($fileId);
             }
             // Update file search index
             import('classes.search.ArticleSearchIndex');
             $articleSearchIndex = new ArticleSearchIndex();
             $articleSearchIndex->articleFileChanged($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
             $articleSearchIndex->articleChangesFinished();
         }
         if ($articleFileManager->uploadedFileExists('styleFile')) {
             // Upload stylesheet file
             $styleFileId = $articleFileManager->uploadPublicFile('styleFile', $galley->getStyleFileId());
             $galley->setStyleFileId($styleFileId);
         } else {
             if ($this->getData('deleteStyleFile')) {
                 // Delete stylesheet file
                 $styleFile =& $galley->getStyleFile();
                 if (isset($styleFile)) {
                     $articleFileManager->deleteFile($styleFile->getFileId());
                 }
             }
         }
         // Update existing galley
         $galley->setLabel($this->getData('label'));
         if ($journal->getSetting('enablePublicGalleyId')) {
             $galley->setStoredPubId('publisher-id', $this->getData('publicGalleyId'));
         }
         $galley->setLocale($this->getData('galleyLocale'));
         if ($this->getData('remoteURL')) {
             $galley->setRemoteURL($this->getData('remoteURL'));
         }
         // consider the additional field names from the public identifer plugins
         import('classes.plugins.PubIdPluginHelper');
         $pubIdPluginHelper = new PubIdPluginHelper();
         $pubIdPluginHelper->execute($this, $galley);
         parent::execute();
         $galleyDao->updateGalley($galley);
     } else {
         // Upload galley file
         if ($articleFileManager->uploadedFileExists($fileName)) {
             $fileType = $articleFileManager->getUploadedFileType($fileName);
             $fileId = $articleFileManager->uploadPublicFile($fileName);
         }
         if (isset($fileType) && strstr($fileType, 'html')) {
             // Assume HTML galley
             $galley = new ArticleHTMLGalley();
         } else {
             $galley = new ArticleGalley();
         }
         $galley->setArticleId($this->articleId);
         $galley->setFileId($fileId);
         if ($this->getData('label') == null) {
             // Generate initial label based on file type
             $enablePublicGalleyId = $journal->getSetting('enablePublicGalleyId');
             if ($galley->isHTMLGalley()) {
                 $galley->setLabel('HTML');
                 if ($enablePublicGalleyId) {
                     $galley->setStoredPubId('publisher-id', 'html');
                 }
             } else {
                 if ($createRemote) {
                     $galley->setLabel(__('common.remote'));
                     $galley->setRemoteURL(__('common.remoteURL'));
                     if ($enablePublicGalleyId) {
                         $galley->setStoredPubId('publisher-id', strtolower(__('common.remote')));
                     }
                 } else {
                     if (isset($fileType)) {
                         if (strstr($fileType, 'pdf')) {
                             $galley->setLabel('PDF');
                             if ($enablePublicGalleyId) {
                                 $galley->setStoredPubId('publisher-id', 'pdf');
                             }
                         } else {
                             if (strstr($fileType, 'postscript')) {
                                 $galley->setLabel('PostScript');
                                 if ($enablePublicGalleyId) {
                                     $galley->setStoredPubId('publisher-id', 'ps');
                                 }
                             } else {
                                 if (strstr($fileType, 'xml')) {
                                     $galley->setLabel('XML');
                                     if ($enablePublicGalleyId) {
                                         $galley->setStoredPubId('publisher-id', 'xml');
                                     }
                                 } else {
                                     if (strstr($fileType, 'epub')) {
                                         $galley->setLabel('EPUB');
                                         if ($enablePublicGalleyId) {
                                             $galley->setStoredPubId('publisher-id', 'epub');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             if ($galley->getLabel() == null) {
                 $galley->setLabel(__('common.untitled'));
             }
         } else {
             $galley->setLabel($this->getData('label'));
         }
         $galley->setLocale($article->getLocale());
         if ($enablePublicGalleyId) {
             // check to make sure the assigned public id doesn't already exist for another galley of this article
             $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
             /* @var $galleylDao ArticleGalleyDAO */
             $publicGalleyId = $galley->getPubId('publisher-id');
             $suffix = '';
             $i = 1;
             while ($galleyDao->getGalleyByPubId('publisher-id', $publicGalleyId . $suffix, $this->articleId)) {
                 $suffix = '_' . $i++;
             }
             $galley->setStoredPubId('publisher-id', $publicGalleyId . $suffix);
         }
         parent::execute();
         // Insert new galley
         $galleyDao->insertGalley($galley);
         $this->galleyId = $galley->getId();
     }
     if ($fileId) {
         // Update file search index
         import('classes.search.ArticleSearchIndex');
         $articleSearchIndex = new ArticleSearchIndex();
         $articleSearchIndex->articleFileChanged($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $fileId);
         $articleSearchIndex->articleChangesFinished();
     }
     // Stamp the article modification (for OAI)
     $articleDao->updateArticle($article);
     return $this->galleyId;
 }
 /**
  * Save the metadata and store the catalog data for this published
  * monograph.
  */
 function execute($request)
 {
     parent::execute($request);
     $submission = $this->getSubmission();
     $context = $request->getContext();
     $waivePublicationFee = $request->getUserVar('waivePublicationFee') ? true : false;
     if ($waivePublicationFee) {
         $markAsPaid = $request->getUserVar('markAsPaid');
         import('classes.payment.ojs.OJSPaymentManager');
         $paymentManager = new OJSPaymentManager($request);
         $user = $request->getUser();
         // Get a list of author user IDs
         $authorUserIds = array();
         $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
         $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR);
         $submitterAssignment = $submitterAssignments->next();
         assert($submitterAssignment);
         // At least one author should be assigned
         $queuedPayment =& $paymentManager->createQueuedPayment($context->getId(), PAYMENT_TYPE_PUBLICATION, $markAsPaid ? $submitterAssignment->getUserId() : $user->getId(), $submission->getId(), $markAsPaid ? $context->getSetting('publicationFee') : 0, $markAsPaid ? $context->getSetting('currency') : '');
         $paymentManager->queuePayment($queuedPayment);
         // Since this is a waiver, fulfill the payment immediately
         $paymentManager->fulfillQueuedPayment($request, $queuedPayment, $markAsPaid ? 'ManualPayment' : 'Waiver');
     } else {
         // Get the issue for publication.
         $issueDao = DAORegistry::getDAO('IssueDAO');
         $issueId = $this->getData('issueId');
         $issue = $issueDao->getById($issueId, $context->getId());
         $sectionDao = DAORegistry::getDAO('SectionDAO');
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         $publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submission->getId(), null, false);
         /* @var $publishedArticle PublishedArticle */
         if ($publishedArticle) {
             if (!$issue || !$issue->getPublished()) {
                 $fromIssue = $issueDao->getById($publishedArticle->getIssueId(), $context->getId());
                 if ($fromIssue->getPublished()) {
                     // Insert article tombstone
                     import('classes.article.ArticleTombstoneManager');
                     $articleTombstoneManager = new ArticleTombstoneManager();
                     $articleTombstoneManager->insertArticleTombstone($submission, $context);
                 }
             }
         }
         import('classes.search.ArticleSearchIndex');
         $articleSearchIndex = new ArticleSearchIndex();
         // define the access status for the article if none is set.
         $accessStatus = $this->getData('accessStatus') != '' ? $this->getData('accessStatus') : ARTICLE_ACCESS_ISSUE_DEFAULT;
         $articleDao = DAORegistry::getDAO('ArticleDAO');
         if (!is_null($this->getData('pages'))) {
             $submission->setPages($this->getData('pages'));
         }
         if ($issue) {
             // Schedule against an issue.
             if ($publishedArticle) {
                 $publishedArticle->setIssueId($issueId);
                 $publishedArticle->setSequence(REALLY_BIG_NUMBER);
                 $publishedArticle->setDatePublished($this->getData('datePublished'));
                 $publishedArticle->setAccessStatus($accessStatus);
                 $publishedArticleDao->updatePublishedArticle($publishedArticle);
                 // Re-index the published article metadata.
                 $articleSearchIndex->articleMetadataChanged($publishedArticle);
             } else {
                 $publishedArticle = $publishedArticleDao->newDataObject();
                 $publishedArticle->setId($submission->getId());
                 $publishedArticle->setIssueId($issueId);
                 $publishedArticle->setDatePublished(Core::getCurrentDate());
                 $publishedArticle->setSequence(REALLY_BIG_NUMBER);
                 $publishedArticle->setAccessStatus($accessStatus);
                 $publishedArticleDao->insertObject($publishedArticle);
                 // If we're using custom section ordering, and if this is the first
                 // article published in a section, make sure we enter a custom ordering
                 // for it. (Default at the end of the list.)
                 if ($sectionDao->customSectionOrderingExists($issueId)) {
                     if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) {
                         $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER);
                         $sectionDao->resequenceCustomSectionOrders($issueId);
                     }
                 }
                 // Index the published article metadata and files for the first time.
                 $articleSearchIndex->articleMetadataChanged($publishedArticle);
                 $articleSearchIndex->submissionFilesChanged($publishedArticle);
             }
         } else {
             if ($publishedArticle) {
                 // This was published elsewhere; make sure we don't
                 // mess up sequencing information.
                 $issueId = $publishedArticle->getIssueId();
                 $publishedArticleDao->deletePublishedArticleByArticleId($submission->getId());
                 // Delete the article from the search index.
                 $articleSearchIndex->submissionFileDeleted($submission->getId());
             }
         }
         if ($this->getData('attachPermissions')) {
             $submission->setCopyrightYear($this->getData('copyrightYear'));
             $submission->setCopyrightHolder($this->getData('copyrightHolder'), null);
             // Localized
             $submission->setLicenseURL($this->getData('licenseURL'));
         } else {
             $submission->setCopyrightYear(null);
             $submission->setCopyrightHolder(null, null);
             $submission->setLicenseURL(null);
         }
         // Resequence the articles.
         $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId);
         $submission->stampStatusModified();
         if ($issue && $issue->getPublished()) {
             $submission->setStatus(STATUS_PUBLISHED);
             // delete article tombstone
             $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO');
             $tombstoneDao->deleteByDataObjectId($submission->getId());
         } else {
             $submission->setStatus(STATUS_QUEUED);
         }
         $articleDao->updateObject($submission);
         $articleSearchIndex->articleChangesFinished();
     }
 }
Esempio n. 7
0
 /**
  * Rush a new submission into the end of the editing queue.
  * @param $article object
  */
 function expediteSubmission($article, $request)
 {
     $user =& $request->getUser();
     import('classes.submission.editor.EditorAction');
     import('classes.submission.sectionEditor.SectionEditorAction');
     import('classes.submission.proofreader.ProofreaderAction');
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId());
     $submissionFile = $sectionEditorSubmission->getSubmissionFile();
     // Add a log entry before doing anything.
     import('classes.article.log.ArticleLog');
     import('classes.article.log.ArticleEventLogEntry');
     ArticleLog::logEvent($request, $article, ARTICLE_LOG_EDITOR_EXPEDITE, 'log.editor.submissionExpedited', array('editorName' => $user->getFullName()));
     // 1. Ensure that an editor is assigned.
     $editAssignments =& $sectionEditorSubmission->getEditAssignments();
     if (empty($editAssignments)) {
         // No editors are currently assigned; assign self.
         EditorAction::assignEditor($article->getId(), $user->getId(), true, false, $request);
     }
     // 2. Accept the submission and send to copyediting.
     $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId());
     if (!$sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true)) {
         SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT, $request);
         $reviewFile = $sectionEditorSubmission->getReviewFile();
         SectionEditorAction::setCopyeditFile($sectionEditorSubmission, $reviewFile->getFileId(), $reviewFile->getRevision(), $request);
     }
     // 3. Add a galley.
     $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId());
     $galleys =& $sectionEditorSubmission->getGalleys();
     $articleSearchIndex = null;
     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 = new ArticleSearchIndex();
         $articleSearchIndex->articleFileChanged($article->getId(), ARTICLE_SEARCH_GALLEY_FILE, $fileId);
     }
     $sectionEditorSubmission->setStatus(STATUS_QUEUED);
     $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
     if ($articleSearchIndex) {
         $articleSearchIndex->articleChangesFinished();
     }
 }
Esempio n. 8
0
 /**
  * Changes the section.
  * @param $submission object
  * @param $sectionId int
  */
 function updateSection($submission, $sectionId)
 {
     if (HookRegistry::call('SectionEditorAction::updateSection', array(&$submission, &$sectionId))) {
         return;
     }
     $submissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $submission->setSectionId($sectionId);
     // FIXME validate this ID?
     $submissionDao->updateSectionEditorSubmission($submission);
     // Reindex the submission (may be required to update section-specific ranking).
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->articleMetadataChanged($submission);
     $articleSearchIndex->articleChangesFinished();
 }
Esempio n. 9
0
 /**
  * Delete an article by ID.
  * @param $articleId int
  */
 function deleteArticleById($articleId)
 {
     $this->authorDao->deleteAuthorsByArticle($articleId);
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticleDao->deletePublishedArticleByArticleId($articleId);
     $commentDao =& DAORegistry::getDAO('CommentDAO');
     $commentDao->deleteBySubmissionId($articleId);
     $noteDao =& DAORegistry::getDAO('NoteDAO');
     $noteDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $sectionEditorSubmissionDao->deleteDecisionsByArticle($articleId);
     $sectionEditorSubmissionDao->deleteReviewRoundsByArticle($articleId);
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignmentDao->deleteBySubmissionId($articleId);
     $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
     $editAssignmentDao->deleteEditAssignmentsByArticle($articleId);
     // Delete copyedit, layout, and proofread signoffs
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $copyedInitialSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
     $copyedAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
     $copyedFinalSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId);
     $layoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
     $proofreadAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
     $proofreadProofreaderSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
     $proofreadLayoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
     $signoffs = array($copyedInitialSignoffs, $copyedAuthorSignoffs, $copyedFinalSignoffs, $layoutSignoffs, $proofreadAuthorSignoffs, $proofreadProofreaderSignoffs, $proofreadLayoutSignoffs);
     foreach ($signoffs as $signoff) {
         if ($signoff) {
             $signoffDao->deleteObject($signoff);
         }
     }
     $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
     $articleCommentDao->deleteArticleComments($articleId);
     $articleGalleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     $articleGalleyDao->deleteGalleysByArticle($articleId);
     $articleSearchDao =& DAORegistry::getDAO('ArticleSearchDAO');
     $articleSearchDao->deleteArticleKeywords($articleId);
     $articleEventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
     $articleEventLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
     $articleEmailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
     $articleEmailLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
     $notificationDao =& DAORegistry::getDAO('NotificationDAO');
     $notificationDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
     $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
     $suppFileDao->deleteSuppFilesByArticle($articleId);
     // Delete article files -- first from the filesystem, then from the database
     import('classes.file.ArticleFileManager');
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     $articleFiles =& $articleFileDao->getArticleFilesByArticle($articleId);
     $articleFileManager = new ArticleFileManager($articleId);
     foreach ($articleFiles as $articleFile) {
         $articleFileManager->deleteFile($articleFile->getFileId());
     }
     $articleFileDao->deleteArticleFiles($articleId);
     // Delete article citations.
     $citationDao =& DAORegistry::getDAO('CitationDAO');
     $citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $articleId);
     $this->update('DELETE FROM article_settings WHERE article_id = ?', $articleId);
     $this->update('DELETE FROM articles WHERE article_id = ?', $articleId);
     import('classes.search.ArticleSearchIndex');
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->articleDeleted($articleId);
     $articleSearchIndex->articleChangesFinished();
     $this->flushCache();
 }
Esempio n. 10
0
 /**
  * Delete an article by ID.
  * @param $articleId int
  */
 function deleteById($articleId)
 {
     parent::deleteById($articleId);
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticleDao->deletePublishedArticleByArticleId($articleId);
     $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
     $articleGalleyDao->deleteGalleysByArticle($articleId);
     $articleSearchDao = DAORegistry::getDAO('ArticleSearchDAO');
     $articleSearchDao->deleteSubmissionKeywords($articleId);
     $commentDao = DAORegistry::getDAO('CommentDAO');
     $commentDao->deleteBySubmissionId($submissionId);
     // Delete article files -- first from the filesystem, then from the database
     import('classes.file.ArticleFileManager');
     $articleFileDao = DAORegistry::getDAO('ArticleFileDAO');
     $articleFiles = $articleFileDao->getArticleFilesByArticle($articleId);
     $articleFileManager = new ArticleFileManager($articleId);
     foreach ($articleFiles as $articleFile) {
         $articleFileManager->deleteFile($articleFile->getFileId());
     }
     $articleFileDao->deleteArticleFiles($articleId);
     // Delete article citations.
     $citationDao = DAORegistry::getDAO('CitationDAO');
     $citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $articleId);
     import('classes.search.ArticleSearchIndex');
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->articleDeleted($articleId);
     $articleSearchIndex->articleChangesFinished();
     $this->flushCache();
 }
Esempio n. 11
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
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $article = new Article();
     if ($locale = $articleNode->getAttribute('locale')) {
         $article->setLocale($locale);
     } else {
         $article->setLocale($journal->getPrimaryLocale());
     }
     if (($value = $articleNode->getAttribute('public_id')) != '') {
         $anotherArticle = $publishedArticleDao->getPublishedArticleByPubId('publisher-id', $value, $journal->getId());
         if ($anotherArticle) {
             $errors[] = array('plugins.importexport.native.import.error.duplicatePublicArticleId', array('articleTitle' => $article->getLocalizedTitle(), 'otherArticleTitle' => $anotherArticle->getLocalizedTitle()));
             $hasErrors = true;
         } else {
             $issue->setStoredPubId('publisher-id', $value);
         }
     }
     $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 = $article->getLocale();
         } 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($article->getLocale()) == '') {
         $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 = $article->getLocale();
         } 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 = $article->getLocale();
             } 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 = $article->getLocale();
             } 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 = $article->getLocale();
             } 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 = $article->getLocale();
             } 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 = $article->getLocale();
                 } 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 = $article->getLocale();
                 } 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 = $article->getLocale();
                 } 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 = $article->getLocale();
         } 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 covers --- */
     $hasErrors = false;
     for ($index = 0; $node = $articleNode->getChildByName('cover', $index); $index++) {
         if (!NativeImportDom::handleArticleCoverNode($journal, $node, $article, $coverErrors, $isCommandLine)) {
             $errors = array_merge($errors, $coverErrors);
             $hasErrors = true;
         }
     }
     /* --- Set IDs --- */
     if (!NativeImportDom::handlePubIds($articleNode, $article, $journal, $issue, $article, $errors)) {
         $hasErrors = true;
     }
     $articleDao->insertArticle($article);
     $dependentItems[] = array('article', $article);
     /* --- Handle authors --- */
     for ($index = 0; $node = $articleNode->getChildByName('author', $index); $index++) {
         if (!NativeImportDom::handleAuthorNode($journal, $node, $issue, $section, $article, $authorErrors, $index)) {
             $errors = array_merge($errors, $authorErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     // 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');
     ArticleLog::logEventHeadless($journal, $user->getId(), $article, ARTICLE_LOG_ARTICLE_IMPORT, 'log.imported', array('userName' => $user->getFullName(), 'articleId' => $article->getId()));
     // Insert published article entry.
     $publishedArticle = new PublishedArticle();
     $publishedArticle->setId($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->setPublishedArticleId($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++;
     }
     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 = new ArticleSearchIndex();
     $articleSearchIndex->articleMetadataChanged($article);
     $articleSearchIndex->articleFilesChanged($article);
     $articleSearchIndex->articleChangesFinished();
     return true;
 }
Esempio n. 12
0
 /**
  * Save changes to the supplementary file.
  * @return int the supplementary file ID
  */
 function execute($fileName = null, $createRemote = false)
 {
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($this->article->getId());
     $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
     $fileName = isset($fileName) ? $fileName : 'uploadSuppFile';
     import('classes.search.ArticleSearchIndex');
     $articleSearchIndex = new ArticleSearchIndex();
     if (isset($this->suppFile)) {
         parent::execute();
         // Upload file, if file selected.
         if ($articleFileManager->uploadedFileExists($fileName)) {
             $fileId = $this->suppFile->getFileId();
             if ($fileId != 0) {
                 $articleFileManager->uploadSuppFile($fileName, $fileId);
             } else {
                 $fileId = $articleFileManager->uploadSuppFile($fileName);
                 $this->suppFile->setFileId($fileId);
             }
             $articleSearchIndex->articleFileChanged($this->article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
         }
         // Update existing supplementary file
         $this->setSuppFileData($this->suppFile);
         if ($this->getData('remoteURL')) {
             $this->suppFile->setRemoteURL($this->getData('remoteURL'));
         }
         $suppFileDao->updateSuppFile($this->suppFile);
     } else {
         // Upload file, if file selected.
         if ($articleFileManager->uploadedFileExists($fileName)) {
             $fileId = $articleFileManager->uploadSuppFile($fileName);
             $articleSearchIndex->articleFileChanged($this->article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
         } else {
             $fileId = 0;
         }
         // Insert new supplementary file
         $this->suppFile = new SuppFile();
         $this->suppFile->setArticleId($this->article->getId());
         $this->suppFile->setFileId($fileId);
         if ($createRemote) {
             $this->suppFile->setRemoteURL(__('common.remoteURL'));
         }
         parent::execute();
         $this->setSuppFileData($this->suppFile);
         $suppFileDao->insertSuppFile($this->suppFile);
         $this->suppFileId = $this->suppFile->getId();
     }
     // Index updated metadata.
     $articleSearchIndex->suppFileMetadataChanged($this->suppFile);
     $articleSearchIndex->articleChangesFinished();
     return $this->suppFileId;
 }
 /**
  * Publish issue
  * @param $args array
  * @param $request Request
  */
 function publishIssue($args, $request)
 {
     $issueId = (int) array_shift($args);
     $this->validate($issueId);
     $issue =& $this->issue;
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $articleSearchIndex = null;
     if (!$issue->getPublished()) {
         // Set the status of any attendant queued articles to STATUS_PUBLISHED.
         $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         $publishedArticles =& $publishedArticleDao->getPublishedArticles($issueId);
         foreach ($publishedArticles as $publishedArticle) {
             $article =& $articleDao->getArticle($publishedArticle->getId());
             if ($article && $article->getStatus() == STATUS_QUEUED) {
                 $article->setStatus(STATUS_PUBLISHED);
                 $article->stampStatusModified();
                 $articleDao->updateArticle($article);
                 // Call initialize permissions again to check if copyright year needs to be initialized.
                 $article->initializePermissions();
                 $articleDao->updateLocaleFields($article);
                 if (!$articleSearchIndex) {
                     import('classes.search.ArticleSearchIndex');
                     $articleSearchIndex = new ArticleSearchIndex();
                 }
                 $articleSearchIndex->articleMetadataChanged($publishedArticle);
             }
             // delete article tombstone
             $tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO');
             $tombstoneDao->deleteByDataObjectId($article->getId());
             unset($article);
         }
     }
     $issue->setCurrent(1);
     $issue->setPublished(1);
     $issue->setDatePublished(Core::getCurrentDate());
     // If subscriptions with delayed open access are enabled then
     // update open access date according to open access delay policy
     if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
         $delayDuration = $journal->getSetting('delayedOpenAccessDuration');
         $delayYears = (int) floor($delayDuration / 12);
         $delayMonths = (int) fmod($delayDuration, 12);
         $curYear = date('Y');
         $curMonth = date('n');
         $curDay = date('j');
         $delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
         $delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
         $issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
         $issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
     }
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issueDao->updateCurrentIssue($journalId, $issue);
     if ($articleSearchIndex) {
         $articleSearchIndex->articleChangesFinished();
     }
     // Send a notification to associated users
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $notificationUsers = array();
     $allUsers = $roleDao->getUsersByJournalId($journalId);
     while (!$allUsers->eof()) {
         $user =& $allUsers->next();
         $notificationUsers[] = array('id' => $user->getId());
         unset($user);
     }
     foreach ($notificationUsers as $userRole) {
         $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId);
     }
     $notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
     $request->redirect(null, null, 'issueToc', $issue->getId());
 }
Esempio n. 14
0
 /**
  * Save changes to article.
  * @param $request PKPRequest
  * @return int the article ID
  */
 function execute(&$request)
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $authorDao =& DAORegistry::getDAO('AuthorDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $citationDao =& DAORegistry::getDAO('CitationDAO');
     /* @var $citationDao CitationDAO */
     $article =& $this->article;
     // Retrieve the previous citation list for comparison.
     $previousRawCitationList = $article->getCitations();
     // Update article
     $article->setTitle($this->getData('title'), null);
     // Localized
     $section =& $sectionDao->getSection($article->getSectionId());
     $article->setAbstract($this->getData('abstract'), null);
     // Localized
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     if ($publicFileManager->uploadedFileExists(COVER_PAGE_IMAGE_NAME)) {
         $journal = Request::getJournal();
         $originalFileName = $publicFileManager->getUploadedFileName(COVER_PAGE_IMAGE_NAME);
         $type = $publicFileManager->getUploadedFileType(COVER_PAGE_IMAGE_NAME);
         $newFileName = 'cover_article_' . $this->article->getId() . '_' . $this->getFormLocale() . $publicFileManager->getImageExtension($type);
         $publicFileManager->uploadJournalFile($journal->getId(), COVER_PAGE_IMAGE_NAME, $newFileName);
         $article->setOriginalFileName($publicFileManager->truncateFileName($originalFileName, 127), $this->getFormLocale());
         $article->setFileName($newFileName, $this->getFormLocale());
         // Store the image dimensions.
         list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $newFileName);
         $article->setWidth($width, $this->getFormLocale());
         $article->setHeight($height, $this->getFormLocale());
     }
     $article->setCoverPageAltText($this->getData('coverPageAltText'), null);
     // Localized
     $showCoverPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showCoverPage'));
     foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
         if (!array_key_exists($locale, $showCoverPage)) {
             $showCoverPage[$locale] = 0;
         }
     }
     $article->setShowCoverPage($showCoverPage, null);
     // Localized
     $hideCoverPageToc = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageToc'));
     foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
         if (!array_key_exists($locale, $hideCoverPageToc)) {
             $hideCoverPageToc[$locale] = 0;
         }
     }
     $article->setHideCoverPageToc($hideCoverPageToc, null);
     // Localized
     $hideCoverPageAbstract = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageAbstract'));
     foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
         if (!array_key_exists($locale, $hideCoverPageAbstract)) {
             $hideCoverPageAbstract[$locale] = 0;
         }
     }
     $article->setHideCoverPageAbstract($hideCoverPageAbstract, null);
     // Localized
     $article->setDiscipline($this->getData('discipline'), null);
     // Localized
     $article->setSubjectClass($this->getData('subjectClass'), null);
     // Localized
     $article->setSubject($this->getData('subject'), null);
     // Localized
     $article->setCoverageGeo($this->getData('coverageGeo'), null);
     // Localized
     $article->setCoverageChron($this->getData('coverageChron'), null);
     // Localized
     $article->setCoverageSample($this->getData('coverageSample'), null);
     // Localized
     $article->setType($this->getData('type'), null);
     // Localized
     $article->setLanguage($this->getData('language'));
     // Localized
     $article->setSponsor($this->getData('sponsor'), null);
     // Localized
     $article->setCitations($this->getData('citations'));
     if ($this->isEditor) {
         $article->setHideAuthor($this->getData('hideAuthor') ? $this->getData('hideAuthor') : 0);
     }
     // consider the additional field names from the public identifer plugins
     import('classes.plugins.PubIdPluginHelper');
     $pubIdPluginHelper = new PubIdPluginHelper();
     $pubIdPluginHelper->execute($this, $article);
     // Update authors
     $authors = $this->getData('authors');
     for ($i = 0, $count = count($authors); $i < $count; $i++) {
         if ($authors[$i]['authorId'] > 0) {
             // Update an existing author
             $author =& $authorDao->getAuthor($authors[$i]['authorId'], $article->getId());
             $isExistingAuthor = true;
         } else {
             // Create a new author
             if (checkPhpVersion('5.0.0')) {
                 // *5488* PHP4 Requires explicit instantiation-by-reference
                 $author = new Author();
             } else {
                 $author =& new Author();
             }
             $isExistingAuthor = false;
         }
         if ($author != null) {
             $author->setSubmissionId($article->getId());
             $author->setFirstName($authors[$i]['firstName']);
             $author->setMiddleName($authors[$i]['middleName']);
             $author->setLastName($authors[$i]['lastName']);
             $author->setAffiliation($authors[$i]['affiliation'], null);
             // Localized
             $author->setCountry($authors[$i]['country']);
             $author->setEmail($authors[$i]['email']);
             $author->setData('orcid', $authors[$i]['orcid']);
             $author->setUrl($authors[$i]['url']);
             if (array_key_exists('competingInterests', $authors[$i])) {
                 $author->setCompetingInterests($authors[$i]['competingInterests'], null);
                 // Localized
             }
             $author->setBiography($authors[$i]['biography'], null);
             // Localized
             $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
             $author->setSequence($authors[$i]['seq']);
             HookRegistry::call('Submission::Form::MetadataForm::Execute', array(&$author, &$authors[$i]));
             if ($isExistingAuthor) {
                 $authorDao->updateAuthor($author);
             } else {
                 $authorDao->insertAuthor($author);
             }
             unset($author);
         }
     }
     // Remove deleted authors
     $deletedAuthors = preg_split('/:/', $this->getData('deletedAuthors'), -1, PREG_SPLIT_NO_EMPTY);
     for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) {
         $authorDao->deleteAuthorById($deletedAuthors[$i], $article->getId());
     }
     if ($this->isEditor) {
         $article->setCopyrightHolder($this->getData('copyrightHolder'), null);
         $article->setCopyrightYear($this->getData('copyrightYear'));
         $article->setLicenseURL($this->getData('licenseURL'));
     }
     parent::execute();
     // Save the article
     $articleDao->updateArticle($article);
     // Update search index
     import('classes.search.ArticleSearchIndex');
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->articleMetadataChanged($article);
     $articleSearchIndex->articleChangesFinished();
     // Update references list if it changed.
     $rawCitationList = $article->getCitations();
     if ($previousRawCitationList != $rawCitationList) {
         $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList);
     }
     return $article->getId();
 }
 /**
  * Set the publication date for a published article
  * @param $args array
  * @param $request object
  */
 function setDatePublished($args, $request)
 {
     $articleId = (int) array_shift($args);
     $issueId = (int) $request->getUserVar('issueId');
     $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
     $journal =& $request->getJournal();
     $submission =& $this->submission;
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
     if ($publishedArticle) {
         $datePublished = $request->getUserDateVar('datePublished');
         $publishedArticle->setDatePublished($datePublished);
         $publishedArticleDao->updatePublishedArticle($publishedArticle);
         // Re-index the published article metadata.
         import('classes.search.ArticleSearchIndex');
         $articleSearchIndex = new ArticleSearchIndex();
         $articleSearchIndex->articleMetadataChanged($publishedArticle);
         $articleSearchIndex->articleChangesFinished();
     }
     $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
 }
Esempio n. 16
0
 /**
  * Publish issue
  * @param $args array
  * @param $request Request
  */
 function publishIssue($args, $request)
 {
     $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
     $issueId = $issue->getId();
     $journal = $request->getJournal();
     $journalId = $journal->getId();
     $articleSearchIndex = null;
     if (!$issue->getPublished()) {
         // Set the status of any attendant queued articles to STATUS_PUBLISHED.
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         $articleDao = DAORegistry::getDAO('ArticleDAO');
         $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId);
         foreach ($publishedArticles as $publishedArticle) {
             $article = $articleDao->getById($publishedArticle->getId());
             if ($article && $article->getStatus() == STATUS_QUEUED) {
                 $article->setStatus(STATUS_PUBLISHED);
                 $article->stampStatusModified();
                 $articleDao->updateObject($article);
                 if (!$articleSearchIndex) {
                     import('classes.search.ArticleSearchIndex');
                     $articleSearchIndex = new ArticleSearchIndex();
                 }
                 $articleSearchIndex->articleMetadataChanged($publishedArticle);
             }
             // delete article tombstone
             $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO');
             $tombstoneDao->deleteByDataObjectId($article->getId());
         }
     }
     $issue->setCurrent(1);
     $issue->setPublished(1);
     $issue->setDatePublished(Core::getCurrentDate());
     // If subscriptions with delayed open access are enabled then
     // update open access date according to open access delay policy
     if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
         $delayDuration = $journal->getSetting('delayedOpenAccessDuration');
         $delayYears = (int) floor($delayDuration / 12);
         $delayMonths = (int) fmod($delayDuration, 12);
         $curYear = date('Y');
         $curMonth = date('n');
         $curDay = date('j');
         $delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
         $delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
         $issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
         $issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
     }
     $issueDao = DAORegistry::getDAO('IssueDAO');
     $issueDao->updateCurrent($journalId, $issue);
     if ($articleSearchIndex) {
         $articleSearchIndex->articleChangesFinished();
     }
     // Send a notification to associated users
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $notificationUsers = array();
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $allUsers = $userGroupDao->getUsersByContextId($journalId);
     while ($user = $allUsers->next()) {
         $notificationUsers[] = array('id' => $user->getId());
     }
     foreach ($notificationUsers as $userRole) {
         $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId);
     }
     $notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
     $dispatcher = $request->getDispatcher();
     // FIXME: Find a better way to reload the containing tabs.
     // Without this, issues don't move between tabs properly.
     return $request->redirectUrlJson($dispatcher->url($request, ROUTE_PAGE, null, 'manageIssues'));
 }
Esempio n. 17
0
 /**
  * @copydoc Submission::deleteById
  */
 function deleteById($submissionId)
 {
     parent::deleteById($submissionId);
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticleDao->deletePublishedArticleByArticleId($submissionId);
     $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
     $articleGalleyDao->deleteByArticleId($submissionId);
     $articleSearchDao = DAORegistry::getDAO('ArticleSearchDAO');
     $articleSearchDao->deleteSubmissionKeywords($submissionId);
     // Delete article citations.
     $citationDao = DAORegistry::getDAO('CitationDAO');
     $citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $submissionId);
     import('classes.search.ArticleSearchIndex');
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->articleDeleted($submissionId);
     $articleSearchIndex->articleChangesFinished();
     $this->flushCache();
 }
Esempio n. 18
0
 /**
  * Save settings.
  */
 function execute()
 {
     $articleDao = DAORegistry::getDAO('ArticleDAO');
     $signoffDao = DAORegistry::getDAO('SignoffDAO');
     $sectionEditorSubmissionDao = DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $application = PKPApplication::getApplication();
     $request = $this->request;
     $user = $request->getUser();
     $router = $request->getRouter();
     $journal = $router->getContext($request);
     $article = $articleDao->newDataObject();
     $article->setLocale($journal->getPrimaryLocale());
     // FIXME in bug #5543
     $article->setUserId($user->getId());
     $article->setJournalId($journal->getId());
     $article->setSectionId($this->getData('sectionId'));
     $article->setLanguage($this->getData('language'));
     $article->setTitle($this->getData('title'), null);
     // Localized
     $article->setAbstract($this->getData('abstract'), null);
     // Localized
     $article->setDiscipline($this->getData('discipline'), null);
     // Localized
     $article->setSubjectClass($this->getData('subjectClass'), null);
     // Localized
     $article->setSubject($this->getData('subject'), null);
     // Localized
     $article->setCoverageGeo($this->getData('coverageGeo'), null);
     // Localized
     $article->setCoverageChron($this->getData('coverageChron'), null);
     // Localized
     $article->setCoverageSample($this->getData('coverageSample'), null);
     // Localized
     $article->setType($this->getData('type'), null);
     // Localized
     $article->setSponsor($this->getData('sponsor'), null);
     // Localized
     $article->setCitations($this->getData('citations'));
     $article->setPages($this->getData('pages'));
     // Set some default values so the ArticleDAO doesn't complain when adding this article
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->setStatus(STATUS_PUBLISHED);
     $article->setSubmissionProgress(0);
     $article->stampStatusModified();
     $article->setCurrentRound(1);
     $article->setFastTracked(1);
     $article->setHideAuthor(0);
     $article->setCommentsStatus(0);
     // Insert the article to get it's ID
     $articleDao->insertObject($article);
     $articleId = $article->getId();
     // Add authors
     $authors = $this->getData('authors');
     for ($i = 0, $count = count($authors); $i < $count; $i++) {
         if ($authors[$i]['authorId'] > 0) {
             // Update an existing author
             $author =& $authorDao->getAuthor($authors[$i]['authorId'], $articleId);
             $isExistingAuthor = true;
         } else {
             // Create a new author
             $author = new Author();
             $isExistingAuthor = false;
         }
         if ($author != null) {
             $author->setSubmissionId($articleId);
             $author->setFirstName($authors[$i]['firstName']);
             $author->setMiddleName($authors[$i]['middleName']);
             $author->setLastName($authors[$i]['lastName']);
             if (array_key_exists('affiliation', $authors[$i])) {
                 $author->setAffiliation($authors[$i]['affiliation'], null);
             }
             $author->setCountry($authors[$i]['country']);
             $author->setEmail($authors[$i]['email']);
             $author->setUrl($authors[$i]['url']);
             if (array_key_exists('competingInterests', $authors[$i])) {
                 $author->setCompetingInterests($authors[$i]['competingInterests'], null);
             }
             $author->setBiography($authors[$i]['biography'], null);
             $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
             $author->setSequence($authors[$i]['seq']);
             if ($isExistingAuthor == false) {
                 $authorDao = DAORegistry::getDAO('AuthorDAO');
                 /* @var $authorDao AuthorDAO */
                 $authorDao->insertObject($author);
             }
         }
     }
     // Add the submission files as galleys
     import('lib.pkp.classes.file.TemporaryFileManager');
     import('classes.file.ArticleFileManager');
     $tempFileIds = $this->getData('tempFileId');
     $temporaryFileManager = new TemporaryFileManager();
     $articleFileManager = new ArticleFileManager($articleId);
     $designatedPrimary = false;
     foreach (array_keys($tempFileIds) as $locale) {
         $temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId());
         $fileId = null;
         if ($temporaryFile) {
             $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, SUBMISSION_FILE_SUBMISSION);
             $fileType = $temporaryFile->getFileType();
             if (strstr($fileType, 'html')) {
                 import('classes.article.ArticleHTMLGalley');
                 $galley = new ArticleHTMLGalley();
             } else {
                 import('classes.article.ArticleGalley');
                 $galley = new ArticleGalley();
             }
             $galley->setArticleId($articleId);
             $galley->setFileId($fileId);
             $galley->setLocale($locale);
             if ($galley->isHTMLGalley()) {
                 $galley->setLabel('HTML');
             } else {
                 if (strstr($fileType, 'pdf')) {
                     $galley->setLabel('PDF');
                 } else {
                     if (strstr($fileType, 'postscript')) {
                         $galley->setLabel('Postscript');
                     } else {
                         if (strstr($fileType, 'xml')) {
                             $galley->setLabel('XML');
                         } else {
                             $galley->setLabel(__('common.untitled'));
                         }
                     }
                 }
             }
             $galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
             $galleyDao->insertGalley($galley);
             if (!$designatedPrimary) {
                 $article->setSubmissionFileId($fileId);
                 if ($locale == $journal->getPrimaryLocale()) {
                     // Used to make sure that *some* file
                     // is designated Review Version, but
                     // preferrably the primary locale.
                     $designatedPrimary = true;
                 }
             }
         }
         // Update file search index
         import('classes.search.ArticleSearchIndex');
         $articleSearchIndex = new ArticleSearchIndex();
         if (isset($galley)) {
             $articleSearchIndex->articleFileChanged($galley->getArticleId(), SUBMISSION_SEARCH_GALLEY_FILE, $galley->getFileId());
         }
         $articleSearchIndex->articleChangesFinished();
     }
     // Designate this as the review version by default.
     $authorSubmissionDao = DAORegistry::getDAO('AuthorSubmissionDAO');
     $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($articleId);
     import('classes.submission.author.AuthorAction');
     AuthorAction::designateReviewVersion($authorSubmission, true);
     // Accept the submission
     $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
     $articleFileManager = new ArticleFileManager($articleId);
     import('classes.submission.sectionEditor.SectionEditorAction');
     assert(false);
     // FIXME: $decisionLabels missing from call below.
     SectionEditorAction::recordDecision($this->request, $sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT);
     import('classes.author.form.submit.AuthorSubmitForm');
     AuthorSubmitForm::assignEditors($article);
     $articleDao->updateObject($article);
     // Add to end of editing queue
     import('classes.submission.editor.EditorAction');
     if (isset($galley)) {
         EditorAction::expediteSubmission($article, $this->request);
     }
     if ($this->getData('destination') == "issue") {
         // Add to an existing issue
         $issueId = $this->getData('issueId');
         $this->scheduleForPublication($articleId, $issueId);
     }
     // Import the references list.
     $citationDao = DAORegistry::getDAO('CitationDAO');
     $rawCitationList = $article->getCitations();
     $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList);
     // Index article.
     import('classes.search.ArticleSearchIndex');
     $articleSearchIndex = new ArticleSearchIndex();
     $articleSearchIndex->articleMetadataChanged($article);
     $articleSearchIndex->articleChangesFinished();
 }
 /**
  * Delete a supplementary file.
  * @param $article object
  * @param $suppFileId int
  */
 function deleteSuppFile($article, $suppFileId)
 {
     $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
     $suppFile =& $suppFileDao->getSuppFile($suppFileId, $article->getId());
     if (isset($suppFile) && !HookRegistry::call('LayoutEditorAction::deleteSuppFile', array(&$article, &$suppFile))) {
         if ($suppFile->getFileId()) {
             import('classes.file.ArticleFileManager');
             $articleFileManager = new ArticleFileManager($article->getId());
             $articleFileManager->deleteFile($suppFile->getFileId());
         }
         $suppFileDao->deleteSuppFile($suppFile);
         // Update the search index after deleting the
         // supp file so that idempotent search plug-ins
         // correctly update supp file meta-data.
         if ($suppFile->getFileId()) {
             import('classes.search.ArticleSearchIndex');
             $articleSearchIndex = new ArticleSearchIndex();
             $articleSearchIndex->articleFileDeleted($article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId());
             $articleSearchIndex->articleChangesFinished();
         }
         // Stamp the article modification (for OAI)
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         $articleDao->updateArticle($article);
     }
 }