/** * Constructor. */ function MetadataForm($paper) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $schedConf =& Request::getSchedConf(); $user =& Request::getUser(); $roleId = $roleDao->getRoleIdFromPath(Request::getRequestedPage()); // If the user is a director of this paper, make the form editable. $this->canEdit = false; if ($roleId != null && ($roleId == ROLE_ID_DIRECTOR || $roleId == ROLE_ID_TRACK_DIRECTOR)) { $this->canEdit = true; } // Check if the author can modify metadata. if ($roleId == ROLE_ID_AUTHOR) { if (AuthorAction::mayEditPaper($paper)) { $this->canEdit = true; } } if ($this->canEdit) { parent::Form('submission/metadata/metadataEdit.tpl'); $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'author.submit.form.titleRequired')); $this->addCheck(new FormValidatorArray($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', array('firstName', 'lastName'))); $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', create_function('$email, $regExp', 'return String::regexp_match($regExp, $email);'), array(ValidatorEmail::getRegexp()), false, array('email'))); $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'user.profile.form.urlInvalid', create_function('$url, $regExp', 'return empty($url) ? true : String::regexp_match($regExp, $url);'), array(ValidatorUrl::getRegexp()), false, array('url'))); } else { parent::Form('submission/metadata/metadataView.tpl'); } // If the user is a reviewer of this paper, do not show authors. $this->canViewAuthors = true; if ($roleId != null && $roleId == ROLE_ID_REVIEWER) { $this->canViewAuthors = false; } $this->paper = $paper; $this->addCheck(new FormValidatorPost($this)); }
/** * Save changes to paper. */ function execute() { $paperDao =& DAORegistry::getDAO('PaperDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $conference = Request::getConference(); $schedConf = Request::getSchedConf(); // Update paper $paper =& $this->paper; $paper->setDateSubmitted(Core::getCurrentDate()); $paper->setSubmissionProgress(0); $paper->stampStatusModified(); // We've collected the paper now -- bump the review progress if ($this->paper->getSubmissionFileId() != null) { $paper->setCurrentStage(REVIEW_STAGE_PRESENTATION); } $paperDao->updatePaper($paper); // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($paper->getId()); AuthorAction::designateReviewVersion($authorSubmission); unset($authorSubmission); // Update any review assignments so they may access the file $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($paper->getId()); $reviewAssignments =& $reviewAssignmentDao->getReviewAssignmentsByPaperId($paper->getId(), REVIEW_STAGE_PRESENTATION); foreach ($reviewAssignments as $reviewAssignment) { $reviewAssignment->setReviewFileId($authorSubmission->getReviewFileId()); $reviewAssignmentDao->updateReviewAssignment($reviewAssignment); } $reviewMode = $authorSubmission->getReviewMode(); $user =& Request::getUser(); if ($reviewMode == REVIEW_MODE_BOTH_SIMULTANEOUS || $reviewMode == REVIEW_MODE_PRESENTATIONS_ALONE) { // Editors have not yet been assigned; assign them. $this->assignDirectors($paper); } $this->confirmSubmission($paper, $user, $schedConf, $conference, $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL ? 'SUBMISSION_UPLOAD_ACK' : 'SUBMISSION_ACK'); // 同時寄一封給大會主席 $this->confirmSubmissionBBC($paper, $user, $schedConf, $conference, $reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL ? 'SUBMISSION_UPLOAD_ACK_BCC' : 'SUBMISSION_ACK_BCC'); import('paper.log.PaperLog'); import('paper.log.PaperEventLogEntry'); PaperLog::logEvent($this->paperId, PAPER_LOG_PRESENTATION_SUBMIT, LOG_TYPE_AUTHOR, $user->getId(), 'log.author.presentationSubmitted', array('submissionId' => $paper->getId(), 'authorName' => $user->getFullName())); return $this->paperId; }
/** * For upgrade to 2.1.1: Designate original versions as review versions * in all cases where review versions aren't designated. (#2144) * @return boolean */ function designateReviewVersions() { $journalDao =& DAORegistry::getDAO('JournalDAO'); $articleDao =& DAORegistry::getDAO('ArticleDAO'); $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); import('classes.submission.author.AuthorAction'); $journals =& $journalDao->getJournals(); while ($journal =& $journals->next()) { $articles =& $articleDao->getArticlesByJournalId($journal->getId()); while ($article =& $articles->next()) { if (!$article->getReviewFileId() && $article->getSubmissionProgress() == 0) { $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId()); AuthorAction::designateReviewVersion($authorSubmission, true); } unset($article); } unset($journal); } return true; }
/** * View a file (inlines file). * @param $args array ($articleId, $fileId, [$revision]) */ function viewFile($args) { $articleId = isset($args[0]) ? $args[0] : 0; $fileId = isset($args[1]) ? $args[1] : 0; $revision = isset($args[2]) ? $args[2] : null; $this->validate($articleId); if (!AuthorAction::viewFile($articleId, $fileId, $revision)) { Request::redirect(null, null, 'submission', $articleId); } }
/** * Delete comment. * @param $args array * @param $request PKPRequest */ function deleteComment($args, $request) { $articleId = (int) array_shift($args); $commentId = (int) array_shift($args); $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId)); $this->validate($request, $articleId); $this->setupTemplate($request, true); AuthorAction::deleteComment($commentId); // Redirect back to initial comments page if ($this->comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) { $request->redirect(null, null, 'viewEditorDecisionComments', $articleId); } else { if ($this->comment->getCommentType() == COMMENT_TYPE_COPYEDIT) { $request->redirect(null, null, 'viewCopyeditComments', $articleId); } else { if ($this->comment->getCommentType() == COMMENT_TYPE_LAYOUT) { $request->redirect(null, null, 'viewLayoutComments', $articleId); } else { if ($this->comment->getCommentType() == COMMENT_TYPE_PROOFREAD) { $request->redirect(null, null, 'viewProofreadComments', $articleId); } } } } }
/** * Delete comment. */ function deleteComment($args) { $articleId = $args[0]; $commentId = $args[1]; $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId)); $this->validate(); $comment =& $this->comment; $this->setupTemplate(true); $trackSubmissionHandler = new TrackSubmissionHandler(); $trackSubmissionHandler->validate($articleId); $authorSubmission =& $trackSubmissionHandler->submission; AuthorAction::deleteComment($commentId); // Redirect back to initial comments page if ($comment->getCommentType() == COMMENT_TYPE_SECTION_DECISION) { Request::redirect(null, null, 'viewEditorDecisionComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_COPYEDIT) { Request::redirect(null, null, 'viewCopyeditComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) { Request::redirect(null, null, 'viewLayoutComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) { Request::redirect(null, null, 'viewProofreadComments', $articleId); } } } } }
/** * Delete comment. */ function deleteComment($args) { AuthorHandler::validate(); AuthorHandler::setupTemplate(true); $articleId = $args[0]; $commentId = $args[1]; $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO'); $comment =& $articleCommentDao->getArticleCommentById($commentId); list($journal, $authorSubmission) = TrackSubmissionHandler::validate($articleId); list($comment) = SubmissionCommentsHandler::validate($commentId); AuthorAction::deleteComment($commentId); // Redirect back to initial comments page if ($comment->getCommentType() == COMMENT_TYPE_EDITOR_DECISION) { Request::redirect(null, null, 'viewEditorDecisionComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_COPYEDIT) { Request::redirect(null, null, 'viewCopyeditComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_LAYOUT) { Request::redirect(null, null, 'viewLayoutComments', $articleId); } else { if ($comment->getCommentType() == COMMENT_TYPE_PROOFREAD) { Request::redirect(null, null, 'viewProofreadComments', $articleId); } } } } }
/** * Validate that the user is the author for the paper. * Redirects to author index page if validation fails. * @param $paperId int * @param $requiresEditAccess boolean True means that the author must * have edit access over the specified paper in order for * validation to be successful. * @param $isDeleting boolean True iff user is deleting a paper, and is not * coming from an old URL (e.g. submission ack email) */ function validate($request, $paperId, $requiresEditAccess = false, $isDeleting = false) { parent::validate(); $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $roleDao =& DAORegistry::getDAO('RoleDAO'); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); $user =& $request->getUser(); $isValid = true; $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($paperId); if ($authorSubmission == null) { $isValid = false; } else { if ($authorSubmission->getSchedConfId() != $schedConf->getId()) { $isValid = false; } else { if ($authorSubmission->getUserId() != $user->getId()) { $isValid = false; } } } if ($isValid && !$isDeleting) { // The user may be coming in on an old URL e.g. from the submission // ack email. If OCS is awaiting the completion of the submission, // send them to the submit page. if ($authorSubmission->getSubmissionProgress() != 0) { $request->redirect(null, null, null, 'submit', array($authorSubmission->getSubmissionProgress()), array('paperId' => $authorSubmission->getId())); } } if ($isValid && $requiresEditAccess) { if (!AuthorAction::mayEditPaper($authorSubmission)) { $isValid = false; } } if (!$isValid) { $request->redirect(null, null, $request->getRequestedPage()); } $this->submission =& $authorSubmission; return true; }
/** * Delete comment. */ function deleteComment($args) { $paperId = $args[0]; $commentId = $args[1]; $this->addCheck(new HandlerValidatorSubmissionComment($this, $commentId)); $this->validate(); $comment =& $this->comment; $this->setupTemplate(true); $trackSubmissionHandler = new TrackSubmissionHandler(); $trackSubmissionHandler->validate($paperId); $authorSubmission =& $trackSubmissionHandler->submission; AuthorAction::deleteComment($commentId); // Redirect back to initial comments page if ($comment->getCommentType() == COMMENT_TYPE_DIRECTOR_DECISION) { Request::redirect(null, null, null, 'viewDirectorDecisionComments', $paperId); } }
/** * Save settings. */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $application =& PKPApplication::getApplication(); $request =& $application->getRequest(); $user =& $request->getUser(); $router =& $request->getRouter(); $journal =& $router->getContext($request); $article = new Article(); $article->setLocale($journal->getPrimaryLocale()); // FIXME in bug #5543 $article->setUserId($user->getId()); $article->setJournalId($journal->getId()); $article->setSectionId($this->getData('sectionId')); $article->setLanguage(String::substr($journal->getPrimaryLocale(), 0, 2)); $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->insertArticle($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 =& $article->getAuthor($authors[$i]['authorId']); $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) { $article->addAuthor($author); } } } // Add the submission files as galleys import('classes.file.TemporaryFileManager'); import('classes.file.ArticleFileManager'); $tempFileIds = $this->getData('tempFileId'); $temporaryFileManager = new TemporaryFileManager(); $articleFileManager = new ArticleFileManager($articleId); foreach (array_keys($tempFileIds) as $locale) { $temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId()); $fileId = null; if ($temporaryFile) { $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_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 ($locale == $journal->getPrimaryLocale()) { $article->setSubmissionFileId($fileId); $article->SetReviewFileId($fileId); } // Update file search index import('classes.search.ArticleSearchIndex'); if (isset($galley)) { ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } } // 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); $sectionEditorSubmission->setReviewFile($articleFileManager->getFile($article->getSubmissionFileId())); import('classes.submission.sectionEditor.SectionEditorAction'); SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT); // Create signoff infrastructure $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); import('classes.author.form.submit.AuthorSubmitForm'); AuthorSubmitForm::assignEditors($article); $articleDao->updateArticle($article); // Add to end of editing queue import('classes.submission.editor.EditorAction'); if (isset($galley)) { EditorAction::expediteSubmission($article); } if ($this->getData('destination') == "issue") { // Add to an existing issue $issueId = $this->getData('issueId'); $this->scheduleForPublication($articleId, $issueId); } // Index article. import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); // Import the references list. $citationDao =& DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList); }
/** * Save changes to article. */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $journal = Request::getJournal(); // Update article $article =& $this->article; if ($this->getData('commentsToEditor') != '') { $article->setCommentsToEditor($this->getData('commentsToEditor')); } $article->setDateSubmitted(Core::getCurrentDate()); $article->setSubmissionProgress(0); $article->stampStatusModified(); $articleDao->updateArticle($article); // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getArticleId()); AuthorAction::designateReviewVersion($authorSubmission, true); unset($authorSubmission); // Create additional submission mangement records $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $copyeditorSubmission =& new CopyeditorSubmission(); $copyeditorSubmission->setArticleId($article->getArticleId()); $copyeditorSubmission->setCopyeditorId(0); $copyeditorSubmissionDao->insertCopyeditorSubmission($copyeditorSubmission); $layoutDao =& DAORegistry::getDAO('LayoutAssignmentDAO'); $layoutAssignment =& new LayoutAssignment(); $layoutAssignment->setArticleId($article->getArticleId()); $layoutAssignment->setEditorId(0); $layoutDao->insertLayoutAssignment($layoutAssignment); $proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO'); $proofAssignment =& new ProofAssignment(); $proofAssignment->setArticleId($article->getArticleId()); $proofAssignment->setProofreaderId(0); $proofAssignmentDao->insertProofAssignment($proofAssignment); $sectionEditors = $this->assignEditors($article); $user =& Request::getUser(); // Update search index import('search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); ArticleSearchIndex::indexArticleFiles($article); // Send author notification email import('mail.ArticleMailTemplate'); $mail =& new ArticleMailTemplate($article, 'SUBMISSION_ACK'); $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); if ($mail->isEnabled()) { $mail->addRecipient($user->getEmail(), $user->getFullName()); // If necessary, BCC the acknowledgement to someone. if ($journal->getSetting('copySubmissionAckPrimaryContact')) { $mail->addBcc($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); } if ($journal->getSetting('copySubmissionAckSpecified')) { $copyAddress = $journal->getSetting('copySubmissionAckAddress'); if (!empty($copyAddress)) { $mail->addBcc($copyAddress); } } // Also BCC automatically assigned section editors foreach ($sectionEditors as $sectionEditorEntry) { $sectionEditor =& $sectionEditorEntry['user']; $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName()); unset($sectionEditor); } $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getJournalTitle(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getArticleId()))); $mail->send(); } import('article.log.ArticleLog'); import('article.log.ArticleEventLogEntry'); ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getUserId(), 'log.author.submitted', array('submissionId' => $article->getArticleId(), 'authorName' => $user->getFullName())); return $this->articleId; }
/** * View a file (inlines file). * @param $args array ($articleId, $fileId, [$revision]) */ function viewFile($args, $request) { $articleId = (int) array_shift($args); $fileId = (int) array_shift($args); $revision = (int) array_shift($args); if (!$revision) { $revision = null; } $this->validate($request, $articleId); if (!AuthorAction::viewFile($articleId, $fileId, $revision)) { $request->redirect(null, null, 'submission', $articleId); } }
/** * View a file (inlines file). * @param $args array ($paperId, $fileId, [$revision]) */ function viewFile($args) { $paperId = (int) array_shift($args); $fileId = (int) array_shift($args); $revision = (int) array_shift($args); $this->validate($paperId); if (!AuthorAction::viewFile($paperId, $fileId, $revision)) { Request::redirect(null, null, null, 'submission', $paperId); } }
/** * Save changes to article. */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $ercReviewersDao =& DAORegistry::getDAO('ErcReviewersDAO'); $institutionDao =& DAORegistry::getDAO('InstitutionDAO'); $journal = Request::getJournal(); $user = Request::getUser(); // Update article $article =& $this->article; if ($article->getDateSubmitted() == null) { $year = substr(Core::getCurrentDate(), 0, 4); $countyear = $articleDao->getSubmissionsForYearCount($year) + 1; $pSponsor = $article->getArticlePrimarySponsor(); $institution = $institutionDao->getInstitutionById($pSponsor->getInstitutionId()); $article->setProposalId($year . '-' . $countyear . '-' . $institution->getInstitutionAcronym()); } if ($this->getData('commentsToEditor') != '') { $article->setCommentsToEditor($this->getData('commentsToEditor')); } $article->setDateSubmitted(Core::getCurrentDate()); $article->setSubmissionProgress(0); $article->stampStatusModified(); $articleDao->updateArticle($article); // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId()); AuthorAction::designateReviewVersion($authorSubmission, true); unset($authorSubmission); $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId()); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO'); $sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $article->getSectionId()); $user =& Request::getUser(); // Update search index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); ArticleSearchIndex::indexArticleFiles($article); // Send author notification email import('classes.mail.ArticleMailTemplate'); $mail = new ArticleMailTemplate($article, null, 'SUBMISSION_ACK', null, null, null, false); foreach ($sectionEditors as $sectionEditor) { // If one of the secretary is the chair of the committee, send from the chair, if not, take the last secretary in the array $from = $mail->getFrom(); if ($ercReviewersDao->isErcReviewer($journal->getId(), $sectionEditor->getId(), REVIEWER_CHAIR)) { $mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName()); } elseif ($from['email'] == $user->getEmail()) { $mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName()); } $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName()); unset($sectionEditor); } if ($mail->isEnabled()) { $mail->addRecipient($user->getEmail(), $user->getFullName()); if ($journal->getSetting('copySubmissionAckSpecified')) { $copyAddress = $journal->getSetting('copySubmissionAckAddress'); if (!empty($copyAddress)) { $mail->addBcc($copyAddress); } } $section = $sectionDao->getSection($article->getSectionId()); $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'address' => $sectionDao->getSettingValue($article->getSectionId(), 'address'), 'bankAccount' => $sectionDao->getSettingValue($article->getSectionId(), 'bankAccount'), 'proposalId' => $article->getProposalId(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getId()))); $mail->send(); } // Send a regular notification to section editors $lastDecision = $article->getLastSectionDecision(); switch ($lastDecision->getReviewType()) { case REVIEW_TYPE_INITIAL: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.initialReview'; } else { $message = 'notification.type.articleReSubmitted.initialReview'; } break; case REVIEW_TYPE_PR: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.continuingReview'; } else { $message = 'notification.type.articleReSubmitted.continuingReview'; } break; case REVIEW_TYPE_AMENDMENT: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.PAAmendmentReview'; } else { $message = 'notification.type.articleReSubmitted.PAAmendmentReview'; } break; case REVIEW_TYPE_SAE: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.SAE'; } else { $message = 'notification.type.articleReSubmitted.SAE'; } break; case REVIEW_TYPE_FR: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.EOS'; } else { $message = 'notification.type.articleReSubmitted.EOS'; } break; } import('lib.pkp.classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $url = Request::url($journal->getPath(), 'sectionEditor', 'submission', array($article->getId(), 'submissionReview')); foreach ($sectionEditors as $sectionEditor) { $notificationManager->createNotification($sectionEditor->getId(), $message, $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_ARTICLE_SUBMITTED); } import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); if ($lastDecision->getRound() == 1) { $message = 'log.author.submitted'; } else { $message = 'log.author.resubmitted'; } ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), $message, array('submissionId' => $article->getProposalId(), 'authorName' => $user->getFullName(), 'reviewType' => Locale::translate($lastDecision->getReviewTypeKey()))); return $this->articleId; }
/** * View a file (inlines file). * @param $args array ($articleId, $fileId, [$revision]) */ function viewFile($args) { $articleId = isset($args[0]) ? $args[0] : 0; $fileId = isset($args[1]) ? $args[1] : 0; $revision = isset($args[2]) ? $args[2] : null; list($journal, $submission) = TrackSubmissionHandler::validate($articleId); if (!AuthorAction::viewFile($articleId, $fileId, $revision)) { Request::redirect(null, null, 'submission', $articleId); } }
/** * 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(); }
/** * Save changes to article. */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $journal = Request::getJournal(); $user = Request::getUser(); // Update article $article =& $this->article; if ($this->getData('commentsToEditor') != '') { $article->setCommentsToEditor($this->getData('commentsToEditor')); } $article->setDateSubmitted(Core::getCurrentDate()); $article->setSubmissionProgress(0); $article->stampStatusModified(); $articleDao->updateArticle($article); // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId()); AuthorAction::designateReviewVersion($authorSubmission, true); unset($authorSubmission); $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId()); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); $sectionEditors = $this->assignEditors($article); $user =& Request::getUser(); // Update search index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); ArticleSearchIndex::indexArticleFiles($article); // Send author notification email import('classes.mail.ArticleMailTemplate'); $mail = new ArticleMailTemplate($article, 'SUBMISSION_ACK', null, null, null, false); $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); if ($mail->isEnabled()) { $mail->addRecipient($user->getEmail(), $user->getFullName()); // If necessary, BCC the acknowledgement to someone. if ($journal->getSetting('copySubmissionAckPrimaryContact')) { $mail->addBcc($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); } if ($journal->getSetting('copySubmissionAckSpecified')) { $copyAddress = $journal->getSetting('copySubmissionAckAddress'); if (!empty($copyAddress)) { $mail->addBcc($copyAddress); } } // Also BCC automatically assigned section editors foreach ($sectionEditors as $sectionEditorEntry) { $sectionEditor =& $sectionEditorEntry['user']; $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName()); unset($sectionEditor); } $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedTitle(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getId()))); $mail->send(); } import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), 'log.author.submitted', array('submissionId' => $article->getId(), 'authorName' => $user->getFullName())); return $this->articleId; }
/** * Validate that the user is the author for the paper. * Redirects to author index page if validation fails. * @param $paperId int * @param $requiresEditAccess boolean True means that the author must * have edit access over the specified paper in order for * validation to be successful. * @param $isDeleting boolean True iff user is deleting a paper */ function validate($request, $paperId, $requiresEditAccess = false, $isDeleting = false) { parent::validate(); $authorSubmissionDao = DAORegistry::getDAO('AuthorSubmissionDAO'); $roleDao = DAORegistry::getDAO('RoleDAO'); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); $user =& $request->getUser(); $isValid = true; $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($paperId); if ($authorSubmission == null) { $isValid = false; } else { if ($authorSubmission->getSchedConfId() != $schedConf->getId()) { $isValid = false; } else { if ($authorSubmission->getUserId() != $user->getId()) { $isValid = false; } } } if ($isValid && $requiresEditAccess) { if (!AuthorAction::mayEditPaper($authorSubmission)) { $isValid = false; } } if (!$isValid) { $request->redirect(null, null, $request->getRequestedPage()); } $this->submission =& $authorSubmission; return true; }