/**
  * Save changes to submission.
  * @param $submission Submission
  * @param $request PKPRequest
  * @return Submission
  */
 function execute($submission, $request)
 {
     parent::execute($submission, $request);
     // Log the modification event.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_METADATA_UPDATE, 'submission.event.general.metadataUpdated');
 }
Пример #2
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));
 }
Пример #3
0
 /**
  * Save changes to submission.
  * @param $args array
  * @param $request PKPRequest
  * @return int the submission ID
  */
 function execute($args, $request)
 {
     parent::execute($args, $request);
     $submission = $this->submission;
     // Send author notification email
     import('classes.mail.ArticleMailTemplate');
     $mail = new ArticleMailTemplate($submission, 'SUBMISSION_ACK');
     $authorMail = new ArticleMailTemplate($submission, 'SUBMISSION_ACK_NOT_USER');
     $context = $request->getContext();
     $router = $request->getRouter();
     if ($mail->isEnabled()) {
         // submission ack emails should be from the contact.
         $mail->setFrom($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $authorMail->setFrom($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $user = $request->getUser();
         $primaryAuthor = $submission->getPrimaryAuthor();
         if (!isset($primaryAuthor)) {
             $authors = $submission->getAuthors();
             $primaryAuthor = $authors[0];
         }
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         // Add primary contact and e-mail address as specified in the journal submission settings
         if ($context->getSetting('copySubmissionAckPrimaryContact')) {
             $mail->addBcc($context->getSetting('contactEmail'), $context->getSetting('contactName'));
         }
         if ($copyAddress = $context->getSetting('copySubmissionAckAddress')) {
             $mail->addBcc($copyAddress);
         }
         if ($user->getEmail() != $primaryAuthor->getEmail()) {
             $authorMail->addRecipient($primaryAuthor->getEmail(), $primaryAuthor->getFullName());
         }
         $assignedAuthors = $submission->getAuthors();
         foreach ($assignedAuthors as $author) {
             $authorEmail = $author->getEmail();
             // only add the author email if they have not already been added as the primary author
             // or user creating the submission.
             if ($authorEmail != $primaryAuthor->getEmail() && $authorEmail != $user->getEmail()) {
                 $authorMail->addRecipient($author->getEmail(), $author->getFullName());
             }
         }
         $mail->bccAssignedSubEditors($submission->getId(), WORKFLOW_STAGE_ID_SUBMISSION);
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $context->getSetting('contactName'), 'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $submission->getId())));
         $authorMail->assignParams(array('submitterName' => $user->getFullName(), 'editorialContactSignature' => $context->getSetting('contactName')));
         $mail->send($request);
         $recipients = $authorMail->getRecipients();
         if (!empty($recipients)) {
             $authorMail->send($request);
         }
     }
     // Log submission.
     import('classes.log.SubmissionEventLogEntry');
     // Constants
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_SUBMISSION_SUBMIT, 'submission.event.submissionSubmitted');
     return $this->submissionId;
 }
 /**
  * Log an event for this file
  * @param $request PKPRequest
  * @param $eventType SUBMISSION_LOG_...
  */
 function _logEvent($request, $eventType)
 {
     // Get the log event message
     switch ($eventType) {
         case SUBMISSION_LOG_MESSAGE_SENT:
             $logMessage = 'informationCenter.history.messageSent';
             break;
         default:
             assert(false);
     }
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $this->getSubmission(), $eventType, $logMessage);
 }
 /**
  * Log an event for this file
  * @param $request PKPRequest
  * @param $eventType SUBMISSION_LOG_...
  */
 function _logEvent($request, $eventType)
 {
     // Get the log event message
     switch ($eventType) {
         case SUBMISSION_LOG_NOTE_POSTED:
             $logMessage = 'informationCenter.history.notePosted';
             break;
         default:
             assert(false);
     }
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $this->_submission, $eventType, $logMessage);
 }
Пример #6
0
 /**
  * logs the deletion event using app-specific logging classes.
  * @param $request PKPRequest
  * @param $submission Submission
  * @param $submissionFile SubmissionFile
  * @param $user PKPUser
  */
 function logDeletionEvent($request, $submission, $submissionFile, $user)
 {
     // log the deletion event.
     import('lib.pkp.classes.log.SubmissionFileLog');
     import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
     // constants
     if ($submissionFile->getRevision() > 1) {
         SubmissionFileLog::logEvent($request, $submissionFile, SUBMISSION_LOG_FILE_REVISION_DELETE, 'submission.event.revisionDeleted', array('fileStage' => $submissionFile->getFileStage(), 'sourceFileId' => $submissionFile->getSourceFileId(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
     } else {
         SubmissionFileLog::logEvent($request, $submissionFile, SUBMISSION_LOG_FILE_DELETE, 'submission.event.fileDeleted', array('fileStage' => $submissionFile->getFileStage(), 'sourceFileId' => $submissionFile->getSourceFileId(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
     }
     if ($submissionFile->getRevision() == 1 && $submissionFile->getSourceFileId() == null) {
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         // constants
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_LAST_REVISION_DELETED, 'submission.event.lastRevisionDeleted', array('title' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
     }
 }
Пример #7
0
 /**
  * Get the form for a particular tab.
  */
 function _getFormFromCurrentTab(&$form, &$notificationKey, $request)
 {
     parent::_getFormFromCurrentTab($form, $notificationKey, $request);
     // give PKP-lib a chance to set the form and key.
     if (!$form) {
         // nothing applicable in parent.
         $submission = $this->getSubmission();
         switch ($this->getCurrentTab()) {
             case 'publication':
                 import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
                 $user = $request->getUser();
                 $form = new IssueEntryPublicationMetadataForm($submission->getId(), $user->getId(), $this->getStageId(), array('displayedInContainer' => true, 'tabPos' => $this->getTabPosition()));
                 $notificationKey = 'notification.savedIssueMetadata';
                 import('lib.pkp.classes.log.SubmissionLog');
                 SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
                 break;
         }
     }
 }
Пример #8
0
 /**
  * @copydoc PKPReviewerGridHandler::reviewRead()
  */
 function reviewRead($args, $request)
 {
     // Retrieve review assignment.
     $reviewAssignment = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT);
     /* @var $reviewAssignment ReviewAssignment */
     // Recommendation
     $newRecommendation = $request->getUserVar('recommendation');
     // If editor set or changed the recommendation
     if ($newRecommendation && $reviewAssignment->getRecommendation() != $newRecommendation) {
         $reviewAssignment->setRecommendation($newRecommendation);
         // Add log entry
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         $submission = $this->getSubmission();
         $userDao = DAORegistry::getDAO('UserDAO');
         $reviewer = $userDao->getById($reviewAssignment->getReviewerId());
         $user = $request->getUser();
         AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_APP_EDITOR);
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_RECOMMENDATION_BY_PROXY, 'log.review.reviewRecommendationSetByProxy', array('round' => $reviewAssignment->getRound(), 'submissionId' => $submission->getId(), 'editorName' => $user->getFullName(), 'reviewerName' => $reviewer->getFullName()));
     }
     return parent::reviewRead($args, $request);
 }
Пример #9
0
 /**
  * Records whether or not the reviewer accepts the review assignment.
  * @param $request PKPRequest
  * @param $reviewAssignment ReviewAssignment
  * @param $submission Submission
  * @param $decline boolean
  * @param $emailText string optional
  */
 function confirmReview($request, $reviewAssignment, $submission, $decline, $emailText = null)
 {
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao = DAORegistry::getDAO('UserDAO');
     $reviewer = $userDao->getById($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return true;
     }
     // Only confirm the review for the reviewer if
     // he has not previously done so.
     if ($reviewAssignment->getDateConfirmed() == null) {
         $email = $this->getResponseEmail($submission, $reviewAssignment, $request, $decline);
         // Must explicitly set sender because we may be here on an access
         // key, in which case the user is not technically logged in
         $email->setReplyTo($reviewer->getEmail(), $reviewer->getFullName());
         HookRegistry::call('ReviewerAction::confirmReview', array($request, &$submission, &$email, $decline));
         import('lib.pkp.classes.log.PKPSubmissionEmailLogEntry');
         // Import email event constants
         $email->setEventType($decline ? SUBMISSION_EMAIL_REVIEW_DECLINE : SUBMISSION_EMAIL_REVIEW_CONFIRM);
         if ($emailText) {
             $email->setBody($emailText);
         }
         $email->send($request);
         $reviewAssignment->setDeclined($decline);
         $reviewAssignment->setDateConfirmed(Core::getCurrentDate());
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateObject($reviewAssignment);
         // Add log
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         $entry = new SubmissionEventLogEntry();
         $entry->setSubmissionId($reviewAssignment->getSubmissionId());
         $entry->setUserId($reviewer->getId());
         $entry->setDateLogged(Core::getCurrentDate());
         $entry->setEventType($decline ? SUBMISSION_LOG_REVIEW_DECLINE : SUBMISSION_LOG_REVIEW_ACCEPT);
         SubmissionLog::logEvent($request, $submission, $decline ? SUBMISSION_LOG_REVIEW_DECLINE : SUBMISSION_LOG_REVIEW_ACCEPT, $decline ? 'log.review.reviewDeclined' : 'log.review.reviewAccepted', array('reviewerName' => $reviewer->getFullName(), 'submissionId' => $reviewAssignment->getSubmissionId(), 'round' => $reviewAssignment->getRound()));
     }
 }
Пример #10
0
 /**
  * Approve a galley submission file.
  * @param $args array
  * @param $request PKPRequest
  */
 function saveApproveProof($args, $request)
 {
     $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     // Make sure we only alter files associated with a galley.
     if ($submissionFile->getAssocType() !== ASSOC_TYPE_GALLEY) {
         fatalError('The requested file is not associated with any galley.');
     }
     if ($submissionFile->getViewable()) {
         // No longer expose the file to readers.
         $submissionFile->setViewable(false);
     } else {
         // Expose the file to readers (e.g. via e-commerce).
         $submissionFile->setViewable(true);
         // Log the approve proof event.
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         // constants
         $user = $request->getUser();
         $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
         $galley = $articleGalleyDao->getByBestGalleyId($submissionFile->getAssocId(), $submission->getId());
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_PROOFS_APPROVED, 'submission.event.proofsApproved', array('formatName' => $galley->getLabel(), 'name' => $user->getFullName(), 'username' => $user->getUsername()));
     }
     $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
     $submissionFileDao->updateObject($submissionFile);
     // update the submission's file index
     import('classes.search.ArticleSearchIndex');
     ArticleSearchIndex::submissionFilesChanged($submission);
     return DAO::getDataChangedEvent($submissionFile->getId());
 }
 /**
  * Set a galley's "available" state
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function setAvailable($args, $request)
 {
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
     $articleGalley = $articleGalleyDao->getByBestGalleyId($request->getUserVar('representationId'), $submission->getId());
     if ($articleGalley) {
         $newAvailableState = (int) $request->getUserVar('newAvailableState');
         $articleGalley->setIsAvailable($newAvailableState);
         $articleGalleyDao->updateObject($articleGalley);
         // log the state changing of the format.
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         SubmissionLog::logEvent($request, $submission, $newAvailableState ? SUBMISSION_LOG_LAYOUT_GALLEY_AVAILABLE : SUBMISSION_LOG_LAYOUT_GALLEY_UNAVAILABLE, $newAvailableState ? 'submission.event.articleGalleyMadeAvailable' : 'submission.event.articleGalleyMadeUnavailable', array('galleyFormatName' => $articleGalley->getLocalizedName()));
         return DAO::getDataChangedEvent($articleGalley->getId());
     } else {
         return new JSONMessage(false, __('manager.setup.errorDeletingItem'));
     }
 }
 /**
  * Save changes to submission.
  * @param $args array
  * @param $request PKPRequest
  * @return int the submission ID
  */
 function execute($args, $request)
 {
     parent::execute($args, $request);
     // handle category assignment.
     ListbuilderHandler::unpack($request, $this->getData('categories'));
     $submissionDao = Application::getSubmissionDAO();
     $submission = $submissionDao->getById($this->submissionId);
     // Send author notification email
     import('classes.mail.MonographMailTemplate');
     $mail = new MonographMailTemplate($submission, 'SUBMISSION_ACK', null, null, null, false);
     $authorMail = new MonographMailTemplate($submission, 'SUBMISSION_ACK_NOT_USER', null, null, null, false);
     $context = $request->getContext();
     $router = $request->getRouter();
     if ($mail->isEnabled()) {
         // submission ack emails should be from the contact.
         $mail->setReplyTo($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $authorMail->setReplyTo($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $user = $request->getUser();
         $primaryAuthor = $submission->getPrimaryAuthor();
         if (!isset($primaryAuthor)) {
             $authors = $submission->getAuthors();
             $primaryAuthor = $authors[0];
         }
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         if ($user->getEmail() != $primaryAuthor->getEmail()) {
             $authorMail->addRecipient($primaryAuthor->getEmail(), $primaryAuthor->getFullName());
         }
         if ($context->getSetting('copySubmissionAckPrimaryContact')) {
             $authorMail->addBcc($context->getSetting('contactEmail'), $context->getSetting('contactName'));
         }
         if ($copyAddress = $context->getSetting('copySubmissionAckAddress')) {
             $authorMail->addBcc($copyAddress);
         }
         $assignedAuthors = $submission->getAuthors();
         foreach ($assignedAuthors as $author) {
             $authorEmail = $author->getEmail();
             // only add the author email if they have not already been added as the primary author
             // or user creating the submission.
             if ($authorEmail != $primaryAuthor->getEmail() && $authorEmail != $user->getEmail()) {
                 $authorMail->addRecipient($author->getEmail(), $author->getFullName());
             }
         }
         $mail->bccAssignedSeriesEditors($submission->getId(), WORKFLOW_STAGE_ID_SUBMISSION);
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName(), 'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $submission->getId())));
         $authorMail->assignParams(array('submitterName' => $user->getFullName(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName()));
         $mail->send($request);
         $recipients = $authorMail->getRecipients();
         if (!empty($recipients)) {
             $authorMail->send($request);
         }
     }
     // Log submission.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     // constants
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_SUBMISSION_SUBMIT, 'submission.event.submissionSubmitted');
     return $this->submissionId;
 }
 /**
  * Save the metadata and store the catalog data for this published
  * monograph.
  */
 function execute($request)
 {
     parent::execute();
     $monograph = $this->getMonograph();
     $monographDao = DAORegistry::getDAO('MonographDAO');
     $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO');
     $publishedMonograph = $publishedMonographDao->getById($monograph->getId(), null, false);
     /* @var $publishedMonograph PublishedMonograph */
     $isExistingEntry = $publishedMonograph ? true : false;
     if (!$publishedMonograph) {
         $publishedMonograph = $publishedMonographDao->newDataObject();
         $publishedMonograph->setId($monograph->getId());
     }
     // Populate the published monograph with the cataloging metadata
     $publishedMonograph->setAudience($this->getData('audience'));
     $publishedMonograph->setAudienceRangeQualifier($this->getData('audienceRangeQualifier'));
     $publishedMonograph->setAudienceRangeFrom($this->getData('audienceRangeFrom'));
     $publishedMonograph->setAudienceRangeTo($this->getData('audienceRangeTo'));
     $publishedMonograph->setAudienceRangeExact($this->getData('audienceRangeExact'));
     // If a cover image was uploaded, deal with it.
     if ($temporaryFileId = $this->getData('temporaryFileId')) {
         // Fetch the temporary file storing the uploaded library file
         $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
         $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $this->_userId);
         $temporaryFilePath = $temporaryFile->getFilePath();
         import('classes.file.SimpleMonographFileManager');
         $simpleMonographFileManager = new SimpleMonographFileManager($monograph->getPressId(), $publishedMonograph->getId());
         $basePath = $simpleMonographFileManager->getBasePath();
         // Delete the old file if it exists
         $oldSetting = $publishedMonograph->getCoverImage();
         if ($oldSetting) {
             $simpleMonographFileManager->deleteFile($basePath . $oldSetting['thumbnailName']);
             $simpleMonographFileManager->deleteFile($basePath . $oldSetting['catalogName']);
             $simpleMonographFileManager->deleteFile($basePath . $oldSetting['name']);
         }
         // The following variables were fetched in validation
         assert($this->_sizeArray && $this->_imageExtension);
         // Load the cover image for surrogate production
         $cover = null;
         // Scrutinizer
         switch ($this->_imageExtension) {
             case '.jpg':
                 $cover = imagecreatefromjpeg($temporaryFilePath);
                 break;
             case '.png':
                 $cover = imagecreatefrompng($temporaryFilePath);
                 break;
             case '.gif':
                 $cover = imagecreatefromgif($temporaryFilePath);
                 break;
         }
         assert(isset($cover));
         // Copy the new file over (involves creating the appropriate subdirectory too)
         $filename = 'cover' . $this->_imageExtension;
         $simpleMonographFileManager->copyFile($temporaryFile->getFilePath(), $basePath . $filename);
         // Generate surrogate images (thumbnail and catalog image)
         $press = $request->getPress();
         $coverThumbnailsMaxWidth = $press->getSetting('coverThumbnailsMaxWidth');
         $coverThumbnailsMaxHeight = $press->getSetting('coverThumbnailsMaxHeight');
         $thumbnailImageInfo = $this->_buildSurrogateImage($cover, $basePath, SUBMISSION_IMAGE_TYPE_THUMBNAIL, $coverThumbnailsMaxWidth, $coverThumbnailsMaxHeight);
         $catalogImageInfo = $this->_buildSurrogateImage($cover, $basePath, SUBMISSION_IMAGE_TYPE_CATALOG);
         // Clean up
         imagedestroy($cover);
         $publishedMonograph->setCoverImage(array('name' => $filename, 'width' => $this->_sizeArray[0], 'height' => $this->_sizeArray[1], 'thumbnailName' => $thumbnailImageInfo['filename'], 'thumbnailWidth' => $thumbnailImageInfo['width'], 'thumbnailHeight' => $thumbnailImageInfo['height'], 'catalogName' => $catalogImageInfo['filename'], 'catalogWidth' => $catalogImageInfo['width'], 'catalogHeight' => $catalogImageInfo['height'], 'uploadName' => $temporaryFile->getOriginalFileName(), 'dateUploaded' => Core::getCurrentDate()));
         // Clean up the temporary file
         import('lib.pkp.classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
         $temporaryFileManager->deleteFile($temporaryFileId, $this->_userId);
     }
     if ($this->getData('attachPermissions')) {
         $monograph->setCopyrightYear($this->getData('copyrightYear'));
         $monograph->setCopyrightHolder($this->getData('copyrightHolder'), null);
         // Localized
         $monograph->setLicenseURL($this->getData('licenseURL'));
     } else {
         $monograph->setCopyrightYear(null);
         $monograph->setCopyrightHolder(null, null);
         $monograph->setLicenseURL(null);
     }
     $monographDao->updateObject($monograph);
     // Update the modified fields or insert new.
     if ($isExistingEntry) {
         $publishedMonographDao->updateObject($publishedMonograph);
     } else {
         $publishedMonographDao->insertObject($publishedMonograph);
     }
     import('classes.publicationFormat.PublicationFormatTombstoneManager');
     $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
     $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
     $publicationFormatFactory = $publicationFormatDao->getBySubmissionId($monograph->getId());
     $publicationFormats = $publicationFormatFactory->toAssociativeArray();
     $notificationMgr = new NotificationManager();
     if ($this->getData('confirm')) {
         // Update the monograph status.
         $monograph->setStatus(STATUS_PUBLISHED);
         $monographDao->updateObject($monograph);
         $publishedMonograph->setDatePublished(Core::getCurrentDate());
         $publishedMonographDao->updateObject($publishedMonograph);
         $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_APPROVE_SUBMISSION), null, ASSOC_TYPE_MONOGRAPH, $publishedMonograph->getId());
         // Remove publication format tombstones.
         $publicationFormatTombstoneMgr->deleteTombstonesByPublicationFormats($publicationFormats);
         // Update the search index for this published monograph.
         import('classes.search.MonographSearchIndex');
         MonographSearchIndex::indexMonographMetadata($monograph);
         // Log the publication event.
         import('lib.pkp.classes.log.SubmissionLog');
         SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_METADATA_PUBLISH, 'submission.event.metadataPublished');
     } else {
         if ($isExistingEntry) {
             // Update the monograph status.
             $monograph->setStatus(STATUS_QUEUED);
             $monographDao->updateObject($monograph);
             // Unpublish monograph.
             $publishedMonograph->setDatePublished(null);
             $publishedMonographDao->updateObject($publishedMonograph);
             $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_APPROVE_SUBMISSION), null, ASSOC_TYPE_MONOGRAPH, $publishedMonograph->getId());
             // Create tombstones for each publication format.
             $publicationFormatTombstoneMgr->insertTombstonesByPublicationFormats($publicationFormats, $request->getContext());
             // Log the unpublication event.
             import('lib.pkp.classes.log.SubmissionLog');
             SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_METADATA_UNPUBLISH, 'submission.event.metadataUnpublished');
         }
     }
 }
 /**
  * Save the assigned format
  * @param PKPRequest request
  * @return int Publication format ID
  * @see Form::execute()
  */
 function execute($request)
 {
     $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
     $monograph = $this->getMonograph();
     $publicationFormat = $this->getPublicationFormat();
     if (!$publicationFormat) {
         // this is a new format to this published monograph
         $publicationFormat = $publicationFormatDao->newDataObject();
         $publicationFormat->setMonographId($monograph->getId());
         $existingFormat = false;
     } else {
         $existingFormat = true;
         if ($monograph->getId() !== $publicationFormat->getMonographId()) {
             fatalError('Invalid format!');
         }
     }
     $publicationFormat->setName($this->getData('name'));
     $publicationFormat->setEntryKey($this->getData('entryKey'));
     $publicationFormat->setPhysicalFormat($this->getData('isPhysicalFormat') ? true : false);
     $publicationFormat->setRemoteURL($this->getData('remoteURL'));
     if ($existingFormat) {
         $publicationFormatDao->updateObject($publicationFormat);
         $representationId = $publicationFormat->getId();
     } else {
         $representationId = $publicationFormatDao->insertObject($publicationFormat);
         // log the creation of the format.
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_PUBLICATION_FORMAT_CREATE, 'submission.event.publicationFormatCreated', array('formatName' => $publicationFormat->getLocalizedName()));
     }
     return $representationId;
 }
 /**
  * Set a format's "available" state
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function setAvailable($args, $request)
 {
     $context = $request->getContext();
     $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
     $publicationFormat = $publicationFormatDao->getById($request->getUserVar('representationId'), null, $context->getId());
     if (!$publicationFormat) {
         return new JSONMessage(false, __('manager.setup.errorDeletingItem'));
     }
     $newAvailableState = (int) $request->getUserVar('newAvailableState');
     $publicationFormat->setIsAvailable($newAvailableState);
     $publicationFormatDao->updateObject($publicationFormat);
     // log the state changing of the format.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     SubmissionLog::logEvent($request, $this->getSubmission(), $newAvailableState ? SUBMISSION_LOG_PUBLICATION_FORMAT_AVAILABLE : SUBMISSION_LOG_PUBLICATION_FORMAT_UNAVAILABLE, $newAvailableState ? 'submission.event.publicationFormatMadeAvailable' : 'submission.event.publicationFormatMadeUnavailable', array('publicationFormatName' => $publicationFormat->getLocalizedName()));
     // Update the formats tombstones.
     import('classes.publicationFormat.PublicationFormatTombstoneManager');
     $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
     if ($publicationFormat->getIsAvailable() && $publicationFormat->getIsApproved()) {
         // Delete any existing tombstone.
         $publicationFormatTombstoneMgr->deleteTombstonesByPublicationFormats(array($publicationFormat));
     } else {
         // (Re)create a tombstone for this publication format.
         $publicationFormatTombstoneMgr->deleteTombstonesByPublicationFormats(array($publicationFormat));
         $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($publicationFormat, $context);
     }
     return DAO::getDataChangedEvent($publicationFormat->getId());
 }
Пример #16
0
 /**
  * Update article pub ids.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function updateIdentifiers($args, $request)
 {
     import('controllers.tab.pubIds.form.PublicIdentifiersForm');
     $submission = $this->getSubmission();
     $stageId = $this->getStageId();
     $form = new PublicIdentifiersForm($submission, $stageId, array('displayedInContainer' => true));
     $form->readInputData();
     if ($form->validate($request)) {
         $form->execute($request);
         $json = new JSONMessage();
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         // Log consts
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.publicIdentifiers');
         if ($request->getUserVar('displayedInContainer')) {
             $router = $request->getRouter();
             $dispatcher = $router->getDispatcher();
             $url = $dispatcher->url($request, ROUTE_COMPONENT, null, $this->_getHandlerClassPath(), 'fetch', null, array('submissionId' => $submission->getId(), 'stageId' => $stageId, 'tabPos' => $this->getTabPosition(), 'hideHelp' => true));
             $json->setAdditionalAttributes(array('reloadContainer' => true, 'tabsUrl' => $url));
             $json->setContent(true);
             // prevents modal closure
         }
         return $json;
     } else {
         return new JSONMessage(true, $form->fetch($request));
     }
 }
Пример #17
0
 /**
  * Sets the due date for a review assignment.
  * @param $request PKPRequest
  * @param $submission Submission
  * @param $reviewId int
  * @param $dueDate string
  * @param $numWeeks int
  * @param $logEntry boolean
  */
 function setDueDates($request, $submission, $reviewAssignment, $reviewDueDate = null, $responseDueDate = null, $logEntry = false)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $context = $request->getContext();
     $reviewer = $userDao->getById($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return false;
     }
     if ($reviewAssignment->getSubmissionId() == $submission->getId() && !HookRegistry::call('EditorAction::setDueDates', array(&$reviewAssignment, &$reviewer, &$reviewDueDate, &$responseDueDate))) {
         // Set the review due date
         $defaultNumWeeks = $context->getSetting('numWeeksPerReview');
         $reviewAssignment->setDateDue(DAO::formatDateToDB($reviewDueDate, $defaultNumWeeks, false));
         // Set the response due date
         $defaultNumWeeks = $context->getSetting('numWeeksPerReponse');
         $reviewAssignment->setDateResponseDue(DAO::formatDateToDB($responseDueDate, $defaultNumWeeks, false));
         // update the assignment (with both the new dates)
         $reviewAssignment->stampModified();
         $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
         /* @var $reviewAssignmentDao ReviewAssignmentDAO */
         $reviewAssignmentDao->updateObject($reviewAssignment);
         // N.B. Only logging Date Due
         if ($logEntry) {
             // Add log
             import('lib.pkp.classes.log.SubmissionLog');
             import('classes.log.SubmissionEventLogEntry');
             SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_SET_DUE_DATE, 'log.review.reviewDueDateSet', array('reviewerName' => $reviewer->getFullName(), 'dueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'submissionId' => $submission->getId(), 'stageId' => $reviewAssignment->getStageId(), 'round' => $reviewAssignment->getRound()));
         }
     }
 }
 /**
  * Save the metadata and store the catalog data for this specific publication format.
  */
 function execute($request)
 {
     parent::execute();
     $monograph = $this->getMonograph();
     $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
     $publicationFormat = $publicationFormatDao->getById($this->getPublicationFormatId(), $monograph->getId());
     assert($publicationFormat);
     // Manage tombstones for the publication format.
     if ($publicationFormat->getIsApproved() && !$this->getData('isApproved')) {
         // Publication format was approved and its being disabled. Create
         // a tombstone for it.
         $press = $request->getPress();
         import('classes.publicationFormat.PublicationFormatTombstoneManager');
         $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
         $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($publicationFormat, $press);
         // Log unpublish event.
         import('lib.pkp.classes.log.SubmissionLog');
         SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_PUBLICATION_FORMAT_UNPUBLISH, 'submission.event.publicationFormatUnpublished', array('publicationFormatName' => $publicationFormat->getLocalizedName()));
     } elseif (!$publicationFormat->getIsApproved() && $this->getData('isApproved')) {
         // Wasn't approved and now it is. Delete tombstone.
         $tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO');
         $tombstoneDao->deleteByDataObjectId($publicationFormat->getId());
         // Log publish event.
         import('lib.pkp.classes.log.SubmissionLog');
         SubmissionLog::logEvent($request, $monograph, SUBMISSION_LOG_PUBLICATION_FORMAT_PUBLISH, 'submission.event.publicationFormatPublished', array('publicationFormatName' => $publicationFormat->getLocalizedName()));
     }
     // populate the published monograph with the cataloging metadata
     $publicationFormat->setFileSize($this->getData('override') ? $this->getData('fileSize') : null);
     $publicationFormat->setFrontMatter($this->getData('frontMatter'));
     $publicationFormat->setBackMatter($this->getData('backMatter'));
     $publicationFormat->setHeight($this->getData('height'));
     $publicationFormat->setHeightUnitCode($this->getData('heightUnitCode'));
     $publicationFormat->setWidth($this->getData('width'));
     $publicationFormat->setWidthUnitCode($this->getData('widthUnitCode'));
     $publicationFormat->setThickness($this->getData('thickness'));
     $publicationFormat->setThicknessUnitCode($this->getData('thicknessUnitCode'));
     $publicationFormat->setWeight($this->getData('weight'));
     $publicationFormat->setWeightUnitCode($this->getData('weightUnitCode'));
     $publicationFormat->setProductCompositionCode($this->getData('productCompositionCode'));
     $publicationFormat->setProductFormDetailCode($this->getData('productFormDetailCode'));
     $publicationFormat->setCountryManufactureCode($this->getData('countryManufactureCode'));
     $publicationFormat->setImprint($this->getData('imprint'));
     $publicationFormat->setProductAvailabilityCode($this->getData('productAvailabilityCode'));
     $publicationFormat->setTechnicalProtectionCode($this->getData('technicalProtectionCode'));
     $publicationFormat->setReturnableIndicatorCode($this->getData('returnableIndicatorCode'));
     $publicationFormat->setIsApproved($this->getData('isApproved') ? true : false);
     // consider the additional field names from the public identifer plugins
     $pubIdPluginHelper = $this->_getPubIdPluginHelper();
     $pubIdPluginHelper->execute($this, $publicationFormat);
     $publicationFormatDao->updateObject($publicationFormat);
 }
 /**
  * Delete the participant from the user groups
  * @param $args
  * @param $request
  * @return JSONMessage JSON object
  */
 function deleteParticipant($args, $request)
 {
     $submission = $this->getSubmission();
     $stageId = $this->getStageId();
     $assignmentId = (int) $request->getUserVar('assignmentId');
     $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
     /* @var $stageAssignmentDao StageAssignmentDAO */
     $stageAssignment = $stageAssignmentDao->getById($assignmentId);
     if (!$stageAssignment || $stageAssignment->getSubmissionId() != $submission->getId()) {
         fatalError('Invalid Assignment');
     }
     // Delete the assignment
     $stageAssignmentDao->deleteObject($stageAssignment);
     // FIXME: perhaps we can just insert the notification on page load
     // instead of having it there all the time?
     $stages = Application::getApplicationStages();
     foreach ($stages as $workingStageId) {
         // remove user's assignment from this user group from all the stages
         // (no need to check if user group is assigned, since nothing will be deleted if there isn't)
         $stageAssignmentDao->deleteByAll($submission->getId(), $workingStageId, $stageAssignment->getUserGroupId(), $stageAssignment->getUserId());
     }
     $notificationMgr = new NotificationManager();
     import('classes.workflow.EditorDecisionActionsManager');
     $notificationMgr->updateNotification($request, EditorDecisionActionsManager::getStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $submission->getId());
     // Log removal.
     $userDao = DAORegistry::getDAO('UserDAO');
     $assignedUser = $userDao->getById($userId);
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId());
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REMOVE_PARTICIPANT, 'submission.event.participantRemoved', array('name' => $assignedUser->getFullName(), 'username' => $assignedUser->getUsername(), 'userGroupName' => $userGroup->getLocalizedName()));
     // Redraw the category
     return DAO::getDataChangedEvent($stageAssignment->getUserGroupId());
 }
 /**
  * Save changes to submission.
  * @param $submission Submission
  * @param $request PKPRequest
  * @return Submission
  */
 function execute($submission, $request)
 {
     $submissionDao = Application::getSubmissionDAO();
     // Update submission
     $submission->setTitle($this->_parentForm->getData('title'), null);
     // Localized
     $submission->setPrefix($this->_parentForm->getData('prefix'), null);
     // Localized
     $submission->setSubtitle($this->_parentForm->getData('subtitle'), null);
     // Localized
     $submission->setAbstract($this->_parentForm->getData('abstract'), null);
     // Localized
     $submission->setCoverage($this->_parentForm->getData('coverage'), null);
     // Localized
     $submission->setType($this->_parentForm->getData('type'), null);
     // Localized
     $submission->setRights($this->_parentForm->getData('rights'), null);
     // Localized
     $submission->setSource($this->_parentForm->getData('source'), null);
     // Localized
     $submission->setCitations($this->_parentForm->getData('citations'));
     // Update submission locale
     $newLocale = $this->_parentForm->getData('locale');
     $context = $request->getContext();
     $supportedSubmissionLocales = $context->getSetting('supportedSubmissionLocales');
     if (empty($supportedSubmissionLocales)) {
         $supportedSubmissionLocales = array($context->getPrimaryLocale());
     }
     if (in_array($newLocale, $supportedSubmissionLocales)) {
         $submission->setLocale($newLocale);
     }
     // Save the submission
     $submissionDao->updateObject($submission);
     // get the supported locale keys
     $locales = array_keys($this->_parentForm->supportedLocales);
     // persist the metadata/keyword fields.
     $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO');
     $submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO');
     $submissionDisciplineDao = DAORegistry::getDAO('SubmissionDisciplineDAO');
     $submissionAgencyDao = DAORegistry::getDAO('SubmissionAgencyDAO');
     $submissionLanguageDao = DAORegistry::getDAO('SubmissionLanguageDAO');
     $keywords = array();
     $agencies = array();
     $disciplines = array();
     $languages = array();
     $subjects = array();
     $tagitKeywords = $this->_parentForm->getData('keywords');
     if (is_array($tagitKeywords)) {
         foreach ($locales as $locale) {
             $keywords[$locale] = array_key_exists($locale . '-keywords', $tagitKeywords) ? $tagitKeywords[$locale . '-keywords'] : array();
             $agencies[$locale] = array_key_exists($locale . '-agencies', $tagitKeywords) ? $tagitKeywords[$locale . '-agencies'] : array();
             $disciplines[$locale] = array_key_exists($locale . '-disciplines', $tagitKeywords) ? $tagitKeywords[$locale . '-disciplines'] : array();
             $languages[$locale] = array_key_exists($locale . '-languages', $tagitKeywords) ? $tagitKeywords[$locale . '-languages'] : array();
             $subjects[$locale] = array_key_exists($locale . '-subjects', $tagitKeywords) ? $tagitKeywords[$locale . '-subjects'] : array();
         }
     }
     // persist the controlled vocabs
     $submissionKeywordDao->insertKeywords($keywords, $submission->getId());
     $submissionAgencyDao->insertAgencies($agencies, $submission->getId());
     $submissionDisciplineDao->insertDisciplines($disciplines, $submission->getId());
     $submissionLanguageDao->insertLanguages($languages, $submission->getId());
     $submissionSubjectDao->insertSubjects($subjects, $submission->getId());
     // Resequence the authors (this ensures a primary contact).
     $authorDao = DAORegistry::getDAO('AuthorDAO');
     $authorDao->resequenceAuthors($submission->getId());
     // Only log modifications on completed submissions
     if ($submission->getSubmissionProgress() == 0) {
         // Log the metadata modification event.
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_METADATA_UPDATE, 'submission.event.general.metadataUpdated');
     }
 }
 /**
  * Save the metadata of the latest revision of
  * the requested submission file
  * @param $args array
  * @param $request Request
  * @return string a serialized JSON object
  */
 function saveMetadata($args, $request)
 {
     $submission = $this->getSubmission();
     $metadataForm = $this->_getMetadataForm($request);
     $metadataForm->readInputData();
     if ($metadataForm->validate()) {
         $metadataForm->execute($args, $request);
         $submissionFile = $metadataForm->getSubmissionFile();
         $notificationMgr = new NotificationManager();
         /* @var $notificationMgr NotificationManager */
         $submission = $this->getSubmission();
         $notificationMgr->updateNotification($request, $this->_getUpdateNotifications(), array($submission->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
         $reviewRound = $this->getReviewRound();
         if ($reviewRound) {
             $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
             // Delete any 'revision requested' notifications since all revisions are now in.
             $context = $request->getContext();
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), $submission->getUserId(), NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS, $context->getId());
         }
         // Log the upload event
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
         // constants
         $user = $request->getUser();
         SubmissionLog::logEvent($request, $submission, $submissionFile->getRevision() > 1 ? SUBMISSION_LOG_FILE_REVISION_UPLOAD : SUBMISSION_LOG_FILE_UPLOAD, $submissionFile->getRevision() > 1 ? 'submission.event.fileRevised' : 'submission.event.fileUploaded', array('fileStage' => $submissionFile->getFileStage(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
         return DAO::getDataChangedEvent();
     } else {
         $json = new JSONMessage(false, $metadataForm->fetch($request));
     }
     return $json->getString();
 }
 /**
  * Convenience function for logging the message sent event and creating the notification.  Called from more than one place.
  * @param PKPRequest $request
  */
 function _logEventAndCreateNotification($request)
 {
     import('lib.pkp.classes.log.SubmissionLog');
     SubmissionLog::logEvent($request, $this->getSubmission(), SUBMISSION_LOG_MESSAGE_SENT, 'informationCenter.history.messageSent');
     // Create trivial notification.
     $currentUser = $request->getUser();
     $notificationMgr = new NotificationManager();
     $notificationMgr->createTrivialNotification($currentUser->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('stageParticipants.history.messageSent')));
 }
 /**
  * Get the form for a particular tab.
  */
 function _getFormFromCurrentTab(&$form, &$notificationKey, $request)
 {
     parent::_getFormFromCurrentTab($form, $notificationKey, $request);
     // give PKP-lib a chance to set the form and key.
     if (!$form) {
         // nothing applicable in parent.
         $submission = $this->getSubmission();
         switch ($this->getCurrentTab()) {
             case 'catalog':
                 import('controllers.tab.catalogEntry.form.CatalogEntryCatalogMetadataForm');
                 $user = $request->getUser();
                 $form = new CatalogEntryCatalogMetadataForm($submission->getId(), $user->getId(), $this->getStageId(), array('displayedInContainer' => true, 'tabPos' => $this->getTabPosition()));
                 $notificationKey = 'notification.savedCatalogMetadata';
                 SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_CATALOG_METADATA_UPDATE, 'submission.event.catalogMetadataUpdated');
                 break;
             case 'identifiers':
                 import('lib.pkp.controllers.tab.pubIds.form.PKPPublicIdentifiersForm');
                 $form = new PKPPublicIdentifiersForm($submission, $this->getStageId(), array('displayedInContainer' => true, 'tabPos' => $this->getTabPosition()));
                 $notificationKey = 'common.changesSaved';
                 break;
             default:
                 // publication format tabs
                 import('controllers.tab.catalogEntry.form.CatalogEntryFormatMetadataForm');
                 $representationId = $request->getUserVar('representationId');
                 // perform some validation to make sure this format is enabled and assigned to this monograph
                 $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO');
                 $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
                 $formats = $publicationFormatDao->getBySubmissionId($submission->getId());
                 $form = null;
                 while ($format = $formats->next()) {
                     if ($format->getId() == $representationId) {
                         $form = new CatalogEntryFormatMetadataForm($submission->getId(), $representationId, $format->getPhysicalFormat(), $format->getRemoteURL(), $this->getStageId(), array('displayedInContainer' => true, 'tabPos' => $this->getTabPosition()));
                         $notificationKey = 'notification.savedPublicationFormatMetadata';
                         SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_PUBLICATION_FORMAT_METADATA_UPDATE, 'submission.event.publicationMetadataUpdated', array('formatName' => $format->getLocalizedName()));
                         break;
                     }
                 }
                 break;
         }
     }
 }
 /**
  * Save the metadata of the latest revision of
  * the requested submission file.
  * @param $args array
  * @param $request Request
  * @return JSONMessage JSON object
  */
 function saveMetadata($args, $request)
 {
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
     $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
     $stageId = $request->getUserVar('stageId');
     $metadataForm = $submissionFile->getMetadataForm($stageId, $reviewRound);
     $metadataForm->readInputData();
     if ($metadataForm->validate()) {
         $metadataForm->execute($args, $request);
         $submissionFile = $metadataForm->getSubmissionFile();
         // Get a list of author user IDs
         $authorUserIds = array();
         $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
         $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR);
         while ($assignment = $submitterAssignments->next()) {
             $authorUserIds[] = $assignment->getUserId();
         }
         // Update the notifications
         $notificationMgr = new NotificationManager();
         /* @var $notificationMgr NotificationManager */
         $notificationMgr->updateNotification($request, $this->getUpdateNotifications(), $authorUserIds, ASSOC_TYPE_SUBMISSION, $submission->getId());
         if ($reviewRound) {
             $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
             // Delete any 'revision requested' notifications since all revisions are now in.
             $context = $request->getContext();
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
             $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR);
             while ($assignment = $submitterAssignments->next()) {
                 $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), $assignment->getUserId(), NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS, $context->getId());
             }
         }
         // Log the upload event
         import('lib.pkp.classes.log.SubmissionLog');
         import('classes.log.SubmissionEventLogEntry');
         import('lib.pkp.classes.log.SubmissionFileEventLogEntry');
         // constants
         $user = $request->getUser();
         SubmissionLog::logEvent($request, $submission, $submissionFile->getRevision() > 1 ? SUBMISSION_LOG_FILE_REVISION_UPLOAD : SUBMISSION_LOG_FILE_UPLOAD, $submissionFile->getRevision() > 1 ? 'submission.event.fileRevised' : 'submission.event.fileUploaded', array('fileStage' => $submissionFile->getFileStage(), 'fileId' => $submissionFile->getFileId(), 'fileRevision' => $submissionFile->getRevision(), 'originalFileName' => $submissionFile->getOriginalFileName(), 'submissionId' => $submissionFile->getSubmissionId(), 'username' => $user->getUsername()));
         return DAO::getDataChangedEvent();
     } else {
         return new JSONMessage(true, $metadataForm->fetch($request));
     }
 }
 /**
  * An action triggered by a confirmation modal to allow an editor to unconsider a review.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function unconsiderReview($args, $request)
 {
     if (!$request->checkCSRF()) {
         return new JSONMessage(false);
     }
     // This resets the state of the review to 'unread', but does not delete note history.
     $submission = $this->getSubmission();
     $user = $request->getUser();
     $reviewAssignment = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT);
     $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment->setUnconsidered(REVIEW_ASSIGNMENT_UNCONSIDERED);
     $reviewAssignmentDao->updateObject($reviewAssignment);
     $this->_updateReviewRoundStatus($reviewAssignment);
     // log the unconsider.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     $entry = new SubmissionEventLogEntry();
     $entry->setSubmissionId($reviewAssignment->getSubmissionId());
     $entry->setUserId($user->getId());
     $entry->setDateLogged(Core::getCurrentDate());
     $entry->setEventType(SUBMISSION_LOG_REVIEW_UNCONSIDERED);
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_UNCONSIDERED, 'log.review.reviewUnconsidered', array('editorName' => $user->getFullName(), 'submissionId' => $submission->getId(), 'round' => $reviewAssignment->getRound()));
     return DAO::getDataChangedEvent($reviewAssignment->getId());
 }