Beispiel #1
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');
             SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
             $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.savedIssueMetadata')));
             // Now, create a galley for this submission.  Assume PDF, and set to 'available'.
             $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
             $articleGalley = $articleGalleyDao->newDataObject();
             $articleGalley->setGalleyType('pdfarticlegalleyplugin');
             $articleGalley->setIsAvailable(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');
             $submissionFiles = $submissionFileDao->getLatestRevisions($submission->getId(), SUBMISSION_FILE_SUBMISSION);
             // Assume a single file was uploaded, but check for something that's PDF anyway.
             foreach ($submissionFiles as $submissionFile) {
                 // test both mime type and file extension in case the mime type isn't correct after uploading.
                 if ($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);
                     break;
                 }
             }
             // 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));
 }
 /**
  * Show the publication metadata form.
  * @param $request Request
  * @param $args array
  * @return JSONMessage JSON object
  */
 function publicationMetadata($args, $request)
 {
     import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
     $submission = $this->getSubmission();
     $stageId = $this->getStageId();
     $user = $request->getUser();
     $issueEntryPublicationMetadataForm = new IssueEntryPublicationMetadataForm($submission->getId(), $user->getId(), $stageId, array('displayedInContainer' => true));
     $issueEntryPublicationMetadataForm->initData();
     return new JSONMessage(true, $issueEntryPublicationMetadataForm->fetch($request));
 }
Beispiel #3
0
 /**
  * Save publication metadata form when scheduling for publication.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function savePublicationMetadataForm($args, $request)
 {
     $submission = $this->getSubmission();
     $stageId = $this->getStageId();
     $user = $request->getUser();
     import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
     $form = new IssueEntryPublicationMetadataForm($submission->getId(), $user->getId(), $stageId);
     $form->readInputData();
     if ($form->validate($request)) {
         $form->execute($request);
         // Log the event
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         // Log consts
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
         // Create trivial notification in place on the form
         $notificationManager = new NotificationManager();
         $notificationKey = 'notification.savedIssueMetadata';
         $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __($notificationKey)));
         // Display assign public identifiers form
         $assignPubIds = false;
         $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
         foreach ($pubIdPlugins as $pubIdPlugin) {
             if ($pubIdPlugin->isObjectTypeEnabled('Submission', $submission->getContextId())) {
                 $assignPubIds = true;
                 break;
             }
         }
         if ($assignPubIds) {
             import('controllers.grid.pubIds.form.AssignPublicIdentifiersForm');
             $formTemplate = $this->getAssignPublicIdentifiersFormTemplate();
             $formParams = array('stageId' => $stageId);
             $assignPublicIdentifiersForm = new AssignPublicIdentifiersForm($formTemplate, $submission, true, '', $formParams);
             $assignPublicIdentifiersForm->initData($args, $request);
             return new JSONMessage(true, $assignPublicIdentifiersForm->fetch($request));
         } else {
             return new JSONMessage();
         }
     } else {
         return new JSONMessage(true, $form->fetch($request));
     }
 }