/**
  * Display the form.
  * @param $request Request
  */
 function display($request)
 {
     $canOnlyRead = true;
     $canOnlyReview = false;
     if (Validation::isReviewer()) {
         $canOnlyRead = false;
         $canOnlyReview = true;
     }
     if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) {
         $canOnlyRead = false;
         $canOnlyReview = false;
     }
     $templateMgr =& TemplateManager::getManager();
     // Remove the notification setting categories that the user will not be receiving (to simplify the form)
     $notificationSettingCategories = $this->_getNotificationSettingCategories();
     if ($canOnlyRead || $canOnlyReview) {
         unset($notificationSettingCategories['submissions']);
     }
     if ($canOnlyRead) {
         unset($notificationSettingCategories['reviewing']);
     }
     $templateMgr->assign('notificationSettingCategories', $notificationSettingCategories);
     $templateMgr->assign('notificationSettings', $this->_getNotificationSettingsMap());
     $templateMgr->assign('titleVar', __('common.title'));
     return parent::display($request);
 }
Beispiel #2
0
 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate()
 {
     parent::setupTemplate();
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OJS_AUTHOR, LOCALE_COMPONENT_OJS_MANAGER));
     $templateMgr =& TemplateManager::getManager();
     $isEditor = Validation::isEditor();
     if (Request::getRequestedPage() == 'editor') {
         $templateMgr->assign('helpTopicId', 'editorial.editorsRole');
     } else {
         $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole');
     }
     $roleSymbolic = $isEditor ? 'editor' : 'sectionEditor';
     $roleKey = $isEditor ? 'user.role.coordinator' : 'user.role.sectionEditor';
     $pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'user'), $roleKey), array(Request::url(null, $roleSymbolic, 'submissionsReport'), 'editor.reports.reportGenerator'));
     $templateMgr->assign('pageHierarchy', $pageHierarchy);
 }
 /**
  * Display the form.
  */
 function display()
 {
     $canOnlyRead = true;
     $canOnlyReview = false;
     if (Validation::isReviewer()) {
         $canOnlyRead = false;
         $canOnlyReview = true;
     }
     if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) {
         $canOnlyRead = false;
         $canOnlyReview = false;
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('canOnlyRead', $canOnlyRead);
     $templateMgr->assign('canOnlyReview', $canOnlyReview);
     return parent::display();
 }
Beispiel #4
0
 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate($subclass = false, $meetingId = 0, $parentPage = null, $showSidebar = true)
 {
     parent::setupTemplate();
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OJS_AUTHOR, LOCALE_COMPONENT_OJS_MANAGER));
     $templateMgr =& TemplateManager::getManager();
     $isEditor = Validation::isEditor();
     if (Request::getRequestedPage() == 'editor') {
         $templateMgr->assign('helpTopicId', 'editorial.editorsRole');
     } else {
         $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole');
     }
     $roleSymbolic = $isEditor ? 'editor' : 'sectionEditor';
     $roleKey = $isEditor ? 'user.role.editor' : 'user.role.sectionEditor';
     $pageHierarchy = $subclass ? array(array(Request::url(null, 'user'), $roleKey), array(Request::url(null, $roleSymbolic, 'meetings'), 'editor.meetings')) : array(array(Request::url(null, 'user'), $roleKey));
     if ($meetingId != 0) {
         $meetingDao =& DAORegistry::getDAO('MeetingDAO');
         $meeting =& $meetingDao->getMeetingById($meetingId);
         $publicId = $meeting->getPublicId();
         $pageHierarchy[] = array(Request::url(null, 'sectionEditor', 'viewMeeting', $meetingId), "#{$publicId}", true);
     }
     $templateMgr->assign('pageHierarchy', $pageHierarchy);
 }
Beispiel #5
0
 /**
  * Display submission monograph submission.
  * Displays submission index page if a valid step is not specified.
  * @param $args array
  * @param $request Request
  */
 function wizard($args, &$request)
 {
     $step = isset($args[0]) ? (int) $args[0] : 1;
     $router =& $request->getRouter();
     $press =& $router->getContext($request);
     $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
     $this->setupTemplate($request);
     if ($step < 4) {
         $formClass = "SubmissionSubmitStep{$step}Form";
         import("classes.submission.form.submit.{$formClass}");
         $submitForm = new $formClass($monograph);
         if ($submitForm->isLocaleResubmit()) {
             $submitForm->readInputData();
         } else {
             $submitForm->initData();
         }
         $submitForm->display();
     } elseif ($step == 4) {
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign_by_ref('press', $press);
         // If this is an editor and there is a
         // submission file, monograph can be expedited.
         if (Validation::isEditor($press->getId()) && $monograph->getSubmissionFileId()) {
             $templateMgr->assign('canExpedite', true);
         }
         $templateMgr->assign('monographId', $monograph->getId());
         $templateMgr->assign('submitStep', $step);
         $templateMgr->assign('submissionProgress', $monograph->getSubmissionProgress());
         $templateMgr->assign('helpTopicId', 'submission.index');
         $templateMgr->display('submission/form/submit/complete.tpl');
     }
 }
 /**
  * Gather information about a user's role within a journal.
  * @param $userId int
  * @param $journalId int
  * @param $submissionsCount array reference
  * @param $isValid array reference
  */
 function _getRoleDataForJournal($userId, $journalId, &$submissionsCount, &$isValid)
 {
     if (Validation::isJournalManager($journalId)) {
         $journalDao =& DAORegistry::getDAO('JournalDAO');
         $isValid["JournalManager"][$journalId] = true;
     }
     if (Validation::isSubscriptionManager($journalId)) {
         $isValid["SubscriptionManager"][$journalId] = true;
     }
     if (Validation::isAuthor($journalId)) {
         $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
         $submissionsCount["Author"][$journalId] = $authorSubmissionDao->getSubmissionsCount($userId, $journalId);
         $isValid["Author"][$journalId] = true;
     }
     if (Validation::isCopyeditor($journalId)) {
         $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
         $submissionsCount["Copyeditor"][$journalId] = $copyeditorSubmissionDao->getSubmissionsCount($userId, $journalId);
         $isValid["Copyeditor"][$journalId] = true;
     }
     if (Validation::isLayoutEditor($journalId)) {
         $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
         $submissionsCount["LayoutEditor"][$journalId] = $layoutEditorSubmissionDao->getSubmissionsCount($userId, $journalId);
         $isValid["LayoutEditor"][$journalId] = true;
     }
     if (Validation::isEditor($journalId)) {
         $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
         $submissionsCount["Editor"][$journalId] = $editorSubmissionDao->getEditorSubmissionsCount($journalId);
         $isValid["Editor"][$journalId] = true;
     }
     if (Validation::isSectionEditor($journalId)) {
         $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
         $submissionsCount["SectionEditor"][$journalId] = $sectionEditorSubmissionDao->getSectionEditorSubmissionsCount($userId, $journalId);
         $isValid["SectionEditor"][$journalId] = true;
     }
     if (Validation::isProofreader($journalId)) {
         $proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
         $submissionsCount["Proofreader"][$journalId] = $proofreaderSubmissionDao->getSubmissionsCount($userId, $journalId);
         $isValid["Proofreader"][$journalId] = true;
     }
     if (Validation::isReviewer($journalId)) {
         $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
         $submissionsCount["Reviewer"][$journalId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $journalId);
         $isValid["Reviewer"][$journalId] = true;
     }
 }
 /**
  * Validate that the user is the assigned section editor for
  * the citation's article, or is a managing editor. Raises a
  * fatal error if validation fails.
  * @param $requiredContexts array
  * @param $request PKPRequest
  * @return boolean
  */
 function validate($requiredContexts, $request)
 {
     // Retrieve the request context
     $router =& $request->getRouter();
     $journal =& $router->getContext($request);
     // Authorization and validation checks
     // NB: Error messages are in plain English as they directly go to fatal errors.
     // (Validation errors in components are either programming errors or somebody
     // trying to call components directly which is no legal use case anyway.)
     // 1) restricted site access
     if (isset($journal) && $journal->getSetting('restrictSiteAccess')) {
         import('handler.validation.HandlerValidatorCustom');
         $this->addCheck(new HandlerValidatorCustom($this, false, 'Restricted site access!', null, create_function('', 'if (!Validation::isLoggedIn()) return false; else return true;')));
     }
     // 2) we need a journal
     $this->addCheck(new HandlerValidatorJournal($this, false, 'No journal in context!'));
     // 3) only editors or section editors may access
     $this->addCheck(new HandlerValidatorRoles($this, false, 'Insufficient privileges!', null, array(ROLE_ID_EDITOR, ROLE_ID_SECTION_EDITOR)));
     // Execute standard checks
     if (!parent::validate($requiredContexts, $request)) {
         return false;
     }
     // Retrieve and validate the article id
     $articleId =& $request->getUserVar('articleId');
     if (!is_numeric($articleId)) {
         return false;
     }
     // Retrieve the article associated with this citation grid
     $articleDAO =& DAORegistry::getDAO('ArticleDAO');
     $article =& $articleDAO->getArticle($articleId);
     // Article and editor validation
     if (!is_a($article, 'Article')) {
         return false;
     }
     if ($article->getJournalId() != $journal->getId()) {
         return false;
     }
     // Editors have access to all articles, section editors will be
     // checked individually.
     if (!Validation::isEditor()) {
         // Retrieve the edit assignments
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $editAssignmentDao->getEditAssignmentsByArticleId($article->getId());
         assert(is_a($editAssignments, 'DAOResultFactory'));
         $editAssignmentsArray =& $editAssignments->toArray();
         // Check whether the user is the article's editor,
         // otherwise deny access.
         $user =& $request->getUser();
         $userId = $user->getId();
         $wasFound = false;
         foreach ($editAssignmentsArray as $editAssignment) {
             if ($editAssignment->getEditorId() == $userId) {
                 if ($editAssignment->getCanEdit()) {
                     $wasFound = true;
                 }
                 break;
             }
         }
         if (!$wasFound) {
             return false;
         }
     }
     // Validation successful
     $this->_article =& $article;
     return true;
 }
 /**
  * Given an issue and journal id, return whether the current user can view the issue in the journal
  * @param $issue object The issue to display
  * @param $journalId int The id of the journal
  */
 function _isVisibleIssue($issue, $journalId)
 {
     if (isset($issue) && ($issue->getPublished() || Validation::isEditor($journalId) || Validation::isLayoutEditor($journalId) || Validation::isProofreader($journalId)) && $issue->getJournalId() == $journalId) {
         return true;
     } else {
         return false;
     }
 }
 function validate($referralId = null)
 {
     parent::validate();
     if ($referralId) {
         $referralDao =& DAORegistry::getDAO('ReferralDAO');
         $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
         $referral =& $referralDao->getReferral($referralId);
         if (!$referral) {
             Request::redirect(null, 'index');
         }
         $user =& Request::getUser();
         $journal =& Request::getJournal();
         $article =& $publishedArticleDao->getPublishedArticleByArticleId($referral->getArticleId());
         if (!$article || !$journal) {
             Request::redirect(null, 'index');
         }
         if ($article->getJournalId() != $journal->getId()) {
             Request::redirect(null, 'index');
         }
         // The article's submitter, journal SE, and journal Editors are allowed.
         if ($article->getUserId() != $user->getId() && !Validation::isSectionEditor($journal->getId()) && !Validation::isEditor($journal->getId())) {
             Request::redirect(null, 'index');
         }
     } else {
         $referral = $article = null;
     }
     $plugin =& Registry::get('plugin');
     return array(&$plugin, &$referral, &$article);
 }
 /**
  * Validate that the user is the assigned section editor for
  * the article, or is a managing editor.
  * Redirects to sectionEditor index page if validation fails.
  * @param $articleId int Article ID to validate
  * @param $access int Optional name of access level required -- see SECTION_EDITOR_ACCESS_... constants
  */
 function validate($articleId, $access = null)
 {
     parent::validate();
     $isValid = true;
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
     if ($sectionEditorSubmission == null) {
         $isValid = false;
     } else {
         if ($sectionEditorSubmission->getJournalId() != $journal->getJournalId()) {
             $isValid = false;
         } else {
             if ($sectionEditorSubmission->getDateSubmitted() == null) {
                 $isValid = false;
             } else {
                 $templateMgr =& TemplateManager::getManager();
                 if (Validation::isEditor()) {
                     // Make canReview and canEdit available to templates.
                     // Since this user is an editor, both are available.
                     $templateMgr->assign('canReview', true);
                     $templateMgr->assign('canEdit', true);
                 } else {
                     // If this user isn't the submission's editor, they don't have access.
                     $editAssignments =& $sectionEditorSubmission->getEditAssignments();
                     $wasFound = false;
                     foreach ($editAssignments as $editAssignment) {
                         if ($editAssignment->getEditorId() == $user->getUserId()) {
                             $templateMgr->assign('canReview', $editAssignment->getCanReview());
                             $templateMgr->assign('canEdit', $editAssignment->getCanEdit());
                             switch ($access) {
                                 case SECTION_EDITOR_ACCESS_EDIT:
                                     if ($editAssignment->getCanEdit()) {
                                         $wasFound = true;
                                     }
                                     break;
                                 case SECTION_EDITOR_ACCESS_REVIEW:
                                     if ($editAssignment->getCanReview()) {
                                         $wasFound = true;
                                     }
                                     break;
                                 default:
                                     $wasFound = true;
                             }
                             break;
                         }
                     }
                     if (!$wasFound) {
                         $isValid = false;
                     }
                 }
             }
         }
     }
     if (!$isValid) {
         Request::redirect(null, Request::getRequestedPage());
     }
     // If necessary, note the current date and time as the "underway" date/time
     $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
     $editAssignments =& $sectionEditorSubmission->getEditAssignments();
     foreach ($editAssignments as $editAssignment) {
         if ($editAssignment->getEditorId() == $user->getUserId() && $editAssignment->getDateUnderway() === null) {
             $editAssignment->setDateUnderway(Core::getCurrentDate());
             $editAssignmentDao->updateEditAssignment($editAssignment);
         }
     }
     return array(&$journal, &$sectionEditorSubmission);
 }
 /**
  * Validate that user is an editor in the selected journal and if the issue id is valid
  * Redirects to issue create issue page if not properly authenticated.
  * NOTE: As of OJS 2.2, Layout Editors are allowed if specified in args.
  */
 function validate($issueId = null, $allowLayoutEditor = false)
 {
     $issue = null;
     $journal =& Request::getJournal();
     if (!isset($journal)) {
         Validation::redirectLogin();
     }
     if (isset($issueId)) {
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         $issue = $issueDao->getIssueById($issueId, $journal->getJournalId());
         if (!$issue) {
             Request::redirect(null, null, 'createIssue');
         }
     }
     if (!Validation::isEditor($journal->getJournalId())) {
         if (isset($journal) && $allowLayoutEditor && Validation::isLayoutEditor($journal->getJournalId())) {
             // We're a Layout Editor. If specified, make sure that the issue is not published.
             if ($issue && !$issue->getPublished()) {
                 Validation::redirectLogin();
             }
         } else {
             Validation::redirectLogin();
         }
     }
     return $issue;
 }
 /**
  * Ensure that we have a journal, plugin is enabled, and user is editor.
  */
 function authorize(&$request, &$args, $roleAssignments)
 {
     $journal =& $request->getJournal();
     if (!isset($journal)) {
         return false;
     }
     $bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
     if (!isset($bfrPlugin)) {
         return false;
     }
     if (!$bfrPlugin->getEnabled()) {
         return false;
     }
     if (!Validation::isEditor($journal->getId())) {
         Validation::redirectLogin();
     }
     return parent::authorize($request, $args, $roleAssignments);
 }
 /**
  * Post proofread comment.
  * @param $article object
  * @param $emailComment boolean
  */
 function postProofreadComment($article, $emailComment)
 {
     if (HookRegistry::call('SectionEditorAction::postProofreadComment', array(&$article, &$emailComment))) {
         return;
     }
     import('submission.form.comment.ProofreadCommentForm');
     $commentForm =& new ProofreadCommentForm($article, Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR);
     $commentForm->readInputData();
     if ($commentForm->validate()) {
         $commentForm->execute();
         if ($emailComment) {
             $commentForm->email();
         }
     } else {
         $commentForm->display();
         return false;
     }
     return true;
 }
Beispiel #14
0
 function expediteSubmission()
 {
     $articleId = (int) Request::getUserVar('articleId');
     list($journal, $article) = SubmitHandler::validate($articleId);
     // The author must also be an editor to perform this task.
     if (Validation::isEditor($journal->getJournalId()) && $article->getSubmissionFileId()) {
         import('submission.editor.EditorAction');
         EditorAction::expediteSubmission($article);
         Request::redirect(null, 'editor', 'submissionEditing', array($article->getArticleId()));
     }
     Request::redirect(null, null, 'track');
 }
 /**
  * Validate that the user is the assigned section editor for
  * the article, or is a managing editor.
  * Redirects to sectionEditor index page if validation fails.
  * @param $articleId int Article ID to validate
  * @param $access int Optional name of access level required -- see SECTION_EDITOR_ACCESS_... constants
  */
 function validate($articleId, $access = null)
 {
     parent::validate();
     $isValid = true;
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
     if ($sectionEditorSubmission == null) {
         $isValid = false;
     } else {
         if ($sectionEditorSubmission->getJournalId() != $journal->getId()) {
             $isValid = false;
         } else {
             if ($sectionEditorSubmission->getDateSubmitted() == null) {
                 $isValid = false;
             } else {
                 $templateMgr =& TemplateManager::getManager();
                 if (Validation::isEditor() || Validation::isSectionEditor()) {
                     // Make canReview and canEdit available to templates.
                     // Since this user is an editor, both are available.
                     $templateMgr->assign('canReview', true);
                     $templateMgr->assign('canEdit', true);
                 } else {
                     // If this user isn't the submission's editor, they don't have access.
                     $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
                     $sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $sectionEditorSubmission->getSectionId());
                     $wasFound = false;
                     foreach ($sectionEditors as $sectionEditor) {
                         if ($sectionEditor->getId() == $user->getId()) {
                             $templateMgr->assign('canReview', true);
                             $templateMgr->assign('canEdit', true);
                             switch ($access) {
                                 case SECTION_EDITOR_ACCESS_EDIT:
                                     $wasFound = true;
                                     break;
                                 case SECTION_EDITOR_ACCESS_REVIEW:
                                     $wasFound = true;
                                     break;
                                 default:
                                     $wasFound = true;
                                     break;
                             }
                         }
                     }
                     if (!$wasFound) {
                         $isValid = false;
                     }
                 }
             }
         }
     }
     if (!$isValid) {
         Request::redirect(null, Request::getRequestedPage());
     }
     $this->submission =& $sectionEditorSubmission;
     return true;
 }
 /**
  * Ensure that we have a journal, plugin is enabled, and user is editor.
  * @see PKPHandler::authorize()
  */
 function authorize(&$request, &$args, $roleAssignments)
 {
     $journal =& $request->getJournal();
     if (!isset($journal)) {
         return false;
     }
     $plugin =& $this->_getObjectsForReviewPlugin();
     if (!isset($plugin)) {
         return false;
     }
     if (!$plugin->getEnabled()) {
         return false;
     }
     if (!Validation::isEditor($journal->getId())) {
         Validation::redirectLogin();
     }
     return parent::authorize($request, $args, $roleAssignments);
 }
 /**
  * Given an issue, set up the template with all the required variables for
  * issues/view.tpl to function properly.
  * @param $issue object The issue to display
  * @param $showToc boolean iff false and a custom cover page exists,
  * 	the cover page will be displayed. Otherwise table of contents
  * 	will be displayed.
  */
 function setupIssueTemplate(&$issue, $showToc = false)
 {
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $templateMgr =& TemplateManager::getManager();
     if (isset($issue) && ($issue->getPublished() || Validation::isEditor($journalId) || Validation::isLayoutEditor($journalId) || Validation::isProofreader($journalId)) && $issue->getJournalId() == $journalId) {
         $issueHeadingTitle = $issue->getIssueIdentification(false, true);
         $issueCrumbTitle = $issue->getIssueIdentification(false, true);
         $locale = Locale::getLocale();
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $coverPagePath = Request::getBaseUrl() . '/';
         $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
         $templateMgr->assign('coverPagePath', $coverPagePath);
         $templateMgr->assign('locale', $locale);
         if ($issue->getFileName($locale) && $issue->getShowCoverPage($locale) && !$issue->getHideCoverPageCover($locale)) {
             //%LP% show thumbnail version rather than full-size front cover
             $filename = $issue->getThumbFileName($issue->getFileName($locale));
             $templateMgr->assign('fileName', $filename);
             $templateMgr->assign('coverPageAltText', $issue->getCoverPageAltText($locale));
             $templateMgr->assign('originalFileName', $issue->getOriginalFileName($locale));
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticles =& $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true);
             $publicFileManager = new PublicFileManager();
             $templateMgr->assign('publishedArticles', $publishedArticles);
         }
         $templateMgr->assign('showToc', $showToc);
         $templateMgr->assign('issueId', $issue->getBestIssueId());
         $templateMgr->assign('issue', $issue);
         // Subscription Access
         import('classes.issue.IssueAction');
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $subscribedUser = IssueAction::subscribedUser($journal);
         $subscribedDomain = IssueAction::subscribedDomain($journal);
         $subscriptionExpiryPartial = $journal->getSetting('subscriptionExpiryPartial');
         if ($showToc && $subscriptionRequired && !$subscribedUser && !$subscribedDomain && $subscriptionExpiryPartial) {
             $templateMgr->assign('subscriptionExpiryPartial', true);
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticlesTemp =& $publishedArticleDao->getPublishedArticles($issue->getId());
             $articleExpiryPartial = array();
             foreach ($publishedArticlesTemp as $publishedArticle) {
                 $partial = IssueAction::subscribedUser($journal, $issue->getId(), $publishedArticle->getId());
                 if (!$partial) {
                     IssueAction::subscribedDomain($journal, $issue->getId(), $publishedArticle->getId());
                 }
                 $articleExpiryPartial[$publishedArticle->getId()] = $partial;
             }
             $templateMgr->assign_by_ref('articleExpiryPartial', $articleExpiryPartial);
         }
         $templateMgr->assign('subscriptionRequired', $subscriptionRequired);
         $templateMgr->assign('subscribedUser', $subscribedUser);
         $templateMgr->assign('subscribedDomain', $subscribedDomain);
         $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
         import('classes.payment.ojs.OJSPaymentManager');
         $paymentManager =& OJSPaymentManager::getManager();
         if ($paymentManager->onlyPdfEnabled()) {
             $templateMgr->assign('restrictOnlyPdf', true);
         }
         if ($paymentManager->purchaseArticleEnabled()) {
             $templateMgr->assign('purchaseArticleEnabled', true);
         }
     } else {
         $issueCrumbTitle = Locale::translate('archive.issueUnavailable');
         $issueHeadingTitle = Locale::translate('archive.issueUnavailable');
     }
     if ($styleFileName = $issue->getStyleFileName()) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/' . $styleFileName);
     }
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     //%CBP% get repository object information for download links
     $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
     $issueObject = $CBPPlatformDao->getFedoraIssueObjectInformation($issue->getIssueId());
     $objectPid = $issueObject['fedora_namespace'] . ":" . $issueObject['fedora_pid'];
     $objectDsid = $issueObject['fedora_dsid'];
     $templateMgr->assign_by_ref('repositoryObjectPid', $objectPid);
     $templateMgr->assign_by_ref('repositoryObjectDsid', $objectDsid);
     $locale = Config::getVar('i18n', 'locale');
     //%LP% show associated artefacts (supplementary files) related to the submission
     foreach ($publishedArticles as $section) {
         foreach ($section['articles'] as $article) {
             $supplementaryFilesTemp[] = $article->getSuppFiles();
         }
     }
     foreach ($supplementaryFilesTemp as $supplementaryFile) {
         if ($supplementaryFile[0]) {
             $suppFile = $supplementaryFile[0];
             $article = $articleDao->getArticle($suppFile->getArticleId());
             $title = $suppFile->getTitle();
             if (stristr($title['en_US'], "Author Biography") == false) {
                 // don't list author biographies
                 $supplementaryFiles[] = array('title' => $title['en_US'], 'articleTitle' => $article->getArticleTitle(), 'articleId' => $article->getArticleId(), 'fileId' => $suppFile->getFileId());
             }
         }
     }
     $templateMgr->assign_by_ref('supplementaryFiles', $supplementaryFiles);
     $atomistic = $templateMgr->_tpl_vars;
     $atomistic = $atomistic['atomistic'];
     $templateMgr->assign_by_ref('atomistic', $atomistic);
     //%CBP% show issue/book ISBN
     $isbn = $CBPPlatformDao->getIssueISBN($issue->getIssueId());
     $templateMgr->assign_by_ref('isbn', $isbn);
     $templateMgr->assign('pageCrumbTitleTranslated', $issueCrumbTitle);
     $templateMgr->assign('issueHeadingTitle', $issueHeadingTitle);
 }
 /**
  * Ensure that we have a journal, plugin is enabled, and user is editor.
  * @see PKPHandler::authorize()
  */
 function authorize(&$request, &$args, $roleAssignments)
 {
     $journal =& $request->getJournal();
     if (!isset($journal)) {
         return false;
     }
     $ofrPlugin =& $this->_getObjectsForReviewPlugin();
     if (!isset($ofrPlugin)) {
         return false;
     }
     if (!$ofrPlugin->getEnabled()) {
         return false;
     }
     $ofrEADao =& DAORegistry::getDAO('ObjectForReviewEditorAssignmentDAO');
     $user =& $request->getUser();
     $assignments = $ofrEADao->getAllByUserId($user->getId());
     if (!Validation::isEditor($journal->getId()) && count($assignments) == 0) {
         Validation::redirectLogin();
     }
     return parent::authorize($request, $args, $roleAssignments);
 }
Beispiel #19
0
 /**
  * Given an issue, set up the template with all the required variables for
  * issues/view.tpl to function properly (i.e. current issue and view issue).
  * @param $issue object The issue to display
  * @param $showToc boolean iff false and a custom cover page exists,
  * 	the cover page will be displayed. Otherwise table of contents
  * 	will be displayed.
  */
 function _setupIssueTemplate($request, $issue, $showToc = false)
 {
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $templateMgr =& TemplateManager::getManager();
     if (isset($issue) && ($issue->getPublished() || Validation::isEditor($journalId) || Validation::isLayoutEditor($journalId) || Validation::isProofreader($journalId)) && $issue->getJournalId() == $journalId) {
         $issueHeadingTitle = $issue->getIssueIdentification(false, true);
         $issueCrumbTitle = $issue->getIssueIdentification(false, true);
         $locale = AppLocale::getLocale();
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $coverPagePath = $request->getBaseUrl() . '/';
         $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
         $templateMgr->assign('coverPagePath', $coverPagePath);
         $templateMgr->assign('locale', $locale);
         if (!$showToc && $issue->getFileName($locale) && $issue->getShowCoverPage($locale) && !$issue->getHideCoverPageCover($locale)) {
             $templateMgr->assign('fileName', $issue->getFileName($locale));
             $templateMgr->assign('width', $issue->getWidth($locale));
             $templateMgr->assign('height', $issue->getHeight($locale));
             $templateMgr->assign('coverPageAltText', $issue->getCoverPageAltText($locale));
             $templateMgr->assign('originalFileName', $issue->getOriginalFileName($locale));
             $showToc = false;
         } else {
             // Issue galleys
             $issueGalleyDao =& DAORegistry::getDAO('IssueGalleyDAO');
             $issueGalleys =& $issueGalleyDao->getGalleysByIssue($issue->getId());
             $templateMgr->assign_by_ref('issueGalleys', $issueGalleys);
             // Published articles
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticles =& $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true);
             $publicFileManager = new PublicFileManager();
             $templateMgr->assign_by_ref('publishedArticles', $publishedArticles);
             $showToc = true;
         }
         $templateMgr->assign('showToc', $showToc);
         $templateMgr->assign_by_ref('issue', $issue);
         // Subscription Access
         import('classes.issue.IssueAction');
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $subscribedUser = IssueAction::subscribedUser($journal);
         $subscribedDomain = IssueAction::subscribedDomain($journal);
         $subscriptionExpiryPartial = $journal->getSetting('subscriptionExpiryPartial');
         if ($showToc && $subscriptionRequired && !$subscribedUser && !$subscribedDomain && $subscriptionExpiryPartial) {
             $templateMgr->assign('subscriptionExpiryPartial', true);
             // Partial subscription expiry for issue
             $partial = IssueAction::subscribedUser($journal, $issue->getId());
             if (!$partial) {
                 IssueAction::subscribedDomain($journal, $issue->getId());
             }
             $templateMgr->assign('issueExpiryPartial', $partial);
             // Partial subscription expiry for articles
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticlesTemp =& $publishedArticleDao->getPublishedArticles($issue->getId());
             $articleExpiryPartial = array();
             foreach ($publishedArticlesTemp as $publishedArticle) {
                 $partial = IssueAction::subscribedUser($journal, $issue->getId(), $publishedArticle->getId());
                 if (!$partial) {
                     IssueAction::subscribedDomain($journal, $issue->getId(), $publishedArticle->getId());
                 }
                 $articleExpiryPartial[$publishedArticle->getId()] = $partial;
             }
             $templateMgr->assign_by_ref('articleExpiryPartial', $articleExpiryPartial);
         }
         $templateMgr->assign('subscriptionRequired', $subscriptionRequired);
         $templateMgr->assign('subscribedUser', $subscribedUser);
         $templateMgr->assign('subscribedDomain', $subscribedDomain);
         $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
         import('classes.payment.ojs.OJSPaymentManager');
         $paymentManager = new OJSPaymentManager($request);
         if ($paymentManager->onlyPdfEnabled()) {
             $templateMgr->assign('restrictOnlyPdf', true);
         }
         if ($paymentManager->purchaseArticleEnabled()) {
             $templateMgr->assign('purchaseArticleEnabled', true);
         }
     } else {
         $issueCrumbTitle = __('archive.issueUnavailable');
         $issueHeadingTitle = __('archive.issueUnavailable');
     }
     if ($styleFileName = $issue->getStyleFileName()) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $templateMgr->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/' . $styleFileName);
     }
     $templateMgr->assign('pageCrumbTitleTranslated', $issueCrumbTitle);
     $templateMgr->assign('issueHeadingTitle', $issueHeadingTitle);
 }
 /**
  * Setup common template variables.
  * @param $subclass int set to 1 if caller is below submissions, set to 2 if the caller is below ERC
  * Lasot modification: EL on February 22th 2013
  */
 function setupTemplate($subclass = 0, $articleId = 0, $parentPage = null, $showSidebar = true)
 {
     parent::setupTemplate();
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OJS_AUTHOR, LOCALE_COMPONENT_OJS_MANAGER));
     $templateMgr =& TemplateManager::getManager();
     $isEditor = Validation::isEditor();
     if (Request::getRequestedPage() == 'editor') {
         $templateMgr->assign('helpTopicId', 'editorial.editorsRole');
     } else {
         $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole');
     }
     $thisUser =& Request::getUser();
     $roleSymbolic = $isEditor ? 'editor' : 'sectionEditor';
     $roleKey = $isEditor ? 'user.role.editor' : 'user.role.sectionEditor';
     if ($subclass == 1) {
         $pageHierarchy = array(array(Request::url(null, 'user'), $roleKey), array(Request::url(null, $roleSymbolic), 'article.submissions'));
     } elseif ($subclass == 2) {
         $pageHierarchy = array(array(Request::url(null, 'user'), $roleKey), array(Request::url(null, $roleSymbolic, 'section', $thisUser->getSecretaryCommitteeId()), 'section.section'));
     } else {
         $pageHierarchy = array(array(Request::url(null, 'user'), $roleKey));
     }
     import('classes.submission.sectionEditor.SectionEditorAction');
     $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, $roleSymbolic);
     if (isset($submissionCrumb)) {
         $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
     }
     $templateMgr->assign('pageHierarchy', $pageHierarchy);
 }
 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate($subclass = false, $articleId = 0, $parentPage = null, $showSidebar = true)
 {
     $templateMgr =& TemplateManager::getManager();
     $isEditor = Validation::isEditor();
     if (Request::getRequestedPage() == 'editor') {
         EditorHandler::setupTemplate(EDITOR_SECTION_SUBMISSIONS, $articleId, $parentPage);
         $templateMgr->assign('helpTopicId', 'editorial.editorsRole');
     } else {
         $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole');
         $pageHierarchy = $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $isEditor ? 'editor' : 'sectionEditor'), $isEditor ? 'user.role.editor' : 'user.role.sectionEditor'), array(Request::url(null, 'sectionEditor'), 'article.submissions')) : array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $isEditor ? 'editor' : 'sectionEditor'), $isEditor ? 'user.role.editor' : 'user.role.sectionEditor'));
         import('submission.sectionEditor.SectionEditorAction');
         $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'sectionEditor');
         if (isset($submissionCrumb)) {
             $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
         }
         $templateMgr->assign('pageHierarchy', $pageHierarchy);
     }
 }
 /**
  * View submission email log.
  * @param $args array
  * @param $request PKPRequest
  */
 function submissionEmailLog($args, $request)
 {
     $articleId = (int) array_shift($args);
     $logId = (int) array_shift($args);
     $this->validate($articleId);
     $submission =& $this->submission;
     $this->setupTemplate(true, $articleId, 'history');
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('isEditor', Validation::isEditor());
     $templateMgr->assign_by_ref('submission', $submission);
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     import('classes.file.ArticleFileManager');
     $templateMgr->assign('attachments', $articleFileDao->getArticleFilesByAssocId($logId, ARTICLE_FILE_ATTACHMENT));
     if ($logId) {
         $logDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
         $logEntry =& $logDao->getById($logId, ASSOC_TYPE_ARTICLE, $articleId);
     }
     if (isset($logEntry)) {
         $templateMgr->assign_by_ref('logEntry', $logEntry);
         $templateMgr->display('sectionEditor/submissionEmailLogEntry.tpl');
     } else {
         $rangeInfo =& $this->getRangeInfo('emailLogEntries');
         $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
         $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId, $rangeInfo);
         $templateMgr->assign_by_ref('emailLogEntries', $emailLogEntries);
         $templateMgr->display('sectionEditor/submissionEmailLog.tpl');
     }
 }
 /**
  * Post proofread comment.
  * @param $article object
  * @param $emailComment boolean
  * @param $request Request
  */
 function postProofreadComment($article, $emailComment, $request)
 {
     if (HookRegistry::call('SectionEditorAction::postProofreadComment', array(&$article, &$emailComment))) {
         return;
     }
     import('classes.submission.form.comment.ProofreadCommentForm');
     $commentForm = new ProofreadCommentForm($article, Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR);
     $commentForm->readInputData();
     if ($commentForm->validate()) {
         $commentForm->execute();
         // Send a notification to associated users
         import('classes.notification.NotificationManager');
         $notificationManager = new NotificationManager();
         $notificationUsers = $article->getAssociatedUserIds(true, false);
         foreach ($notificationUsers as $userRole) {
             $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PROOFREAD_COMMENT, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId());
         }
         if ($emailComment) {
             $commentForm->email($request);
         }
     } else {
         $commentForm->display();
         return false;
     }
     return true;
 }
 /**
  * Post proofread comment.
  * @param $article object
  * @param $emailComment boolean
  */
 function postProofreadComment($article, $emailComment)
 {
     if (HookRegistry::call('SectionEditorAction::postProofreadComment', array(&$article, &$emailComment))) {
         return;
     }
     import('classes.submission.form.comment.ProofreadCommentForm');
     $commentForm = new ProofreadCommentForm($article, Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR);
     $commentForm->readInputData();
     if ($commentForm->validate()) {
         $commentForm->execute();
         // Send a notification to associated users
         import('lib.pkp.classes.notification.NotificationManager');
         $notificationManager = new NotificationManager();
         $notificationUsers = $article->getAssociatedUserIds(true, false);
         foreach ($notificationUsers as $userRole) {
             $url = Request::url(null, $userRole['role'], 'submissionEditing', $article->getId(), null, 'proofread');
             $notificationManager->createNotification($userRole['id'], 'notification.type.proofreadComment', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_PROOFREAD_COMMENT);
         }
         if ($emailComment) {
             $commentForm->email();
         }
     } else {
         $commentForm->display();
         return false;
     }
     return true;
 }
Beispiel #25
0
 /**
  * Expedite a submission -- rush it through the editorial process, for
  * users who are both authors and editors.
  * @param $args array
  * @param $request PKPRequest
  */
 function expediteSubmission($args, $request)
 {
     $articleId = (int) $request->getUserVar('articleId');
     $this->validate($request, $articleId);
     $journal =& $request->getJournal();
     $article =& $this->article;
     // The author must also be an editor to perform this task.
     if (Validation::isEditor($journal->getId()) && $article->getSubmissionFileId()) {
         import('classes.submission.editor.EditorAction');
         EditorAction::expediteSubmission($article, $request);
         $request->redirect(null, 'editor', 'submissionEditing', array($article->getId()));
     }
     $request->redirect(null, null, 'track');
 }
Beispiel #26
0
 /**
  * Validate that user is an editor in the selected journal.
  * Redirects to user index page if not properly authenticated.
  */
 function validate()
 {
     $journal =& Request::getJournal();
     if (!isset($journal) || !Validation::isEditor($journal->getJournalId())) {
         Validation::redirectLogin();
     }
 }
 function email($args)
 {
     parent::validate();
     parent::setupTemplate(true);
     $templateMgr =& TemplateManager::getManager();
     $userDao =& DAORegistry::getDAO('UserDAO');
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     // See if this is the Editor or Manager and an email template has been chosen
     $template = Request::getUserVar('template');
     if (!$journal || empty($template) || !Validation::isJournalManager($journal->getJournalId()) && !Validation::isEditor($journal->getJournalId()) && !Validation::isSectionEditor($journal->getJournalId())) {
         $template = null;
     }
     // Determine whether or not this account is subject to
     // email sending restrictions.
     $canSendUnlimitedEmails = Validation::isSiteAdmin();
     $unlimitedEmailRoles = array(ROLE_ID_JOURNAL_MANAGER, ROLE_ID_EDITOR, ROLE_ID_SECTION_EDITOR);
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     if ($journal) {
         $roles =& $roleDao->getRolesByUserId($user->getUserId(), $journal->getJournalId());
         foreach ($roles as $role) {
             if (in_array($role->getRoleId(), $unlimitedEmailRoles)) {
                 $canSendUnlimitedEmails = true;
             }
         }
     }
     // Check when this user last sent an email, and if it's too
     // recent, make them wait.
     if (!$canSendUnlimitedEmails) {
         $dateLastEmail = $user->getDateLastEmail();
         if ($dateLastEmail && strtotime($dateLastEmail) + (int) Config::getVar('email', 'time_between_emails') > strtotime(Core::getCurrentDate())) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooSoon');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
     }
     $email = null;
     if ($articleId = Request::getUserVar('articleId')) {
         // This message is in reference to an article.
         // Determine whether the current user has access
         // to the article in some form, and if so, use an
         // ArticleMailTemplate.
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         $article =& $articleDao->getArticle($articleId);
         $hasAccess = false;
         // First, conditions where access is OK.
         // 1. User is submitter
         if ($article && $article->getUserId() == $user->getUserId()) {
             $hasAccess = true;
         }
         // 2. User is section editor of article or full editor
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $editAssignmentDao->getEditAssignmentsByArticleId($articleId);
         while ($editAssignment =& $editAssignments->next()) {
             if ($editAssignment->getEditorId() === $user->getUserId()) {
                 $hasAccess = true;
             }
         }
         if (Validation::isEditor($journal->getJournalId())) {
             $hasAccess = true;
         }
         // 3. User is reviewer
         $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
         foreach ($reviewAssignmentDao->getReviewAssignmentsByArticleId($articleId) as $reviewAssignment) {
             if ($reviewAssignment->getReviewerId() === $user->getUserId()) {
                 $hasAccess = true;
             }
         }
         // 4. User is copyeditor
         $copyAssignmentDao =& DAORegistry::getDAO('CopyAssignmentDAO');
         $copyAssignment =& $copyAssignmentDao->getCopyAssignmentByArticleId($articleId);
         if ($copyAssignment && $copyAssignment->getCopyeditorId() === $user->getUserId()) {
             $hasAccess = true;
         }
         // 5. User is layout editor
         $layoutAssignmentDao =& DAORegistry::getDAO('LayoutAssignmentDAO');
         $layoutAssignment =& $layoutAssignmentDao->getLayoutAssignmentByArticleId($articleId);
         if ($layoutAssignment && $layoutAssignment->getEditorId() === $user->getUserId()) {
             $hasAccess = true;
         }
         // 6. User is proofreader
         $proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO');
         $proofAssignment =& $proofAssignmentDao->getProofAssignmentByArticleId($articleId);
         if ($proofAssignment && $proofAssignment->getProofreaderId() === $user->getUserId()) {
             $hasAccess = true;
         }
         // Last, "deal-breakers" -- access is not allowed.
         if (!$article || $article && $article->getJournalId() !== $journal->getJournalId()) {
             $hasAccess = false;
         }
         if ($hasAccess) {
             import('mail.ArticleMailTemplate');
             $email =& new ArticleMailTemplate($articleDao->getArticle($articleId, $template));
         }
     }
     if ($email === null) {
         import('mail.MailTemplate');
         $email =& new MailTemplate($template);
     }
     if (Request::getUserVar('send') && !$email->hasErrors()) {
         $recipients = $email->getRecipients();
         $ccs = $email->getCcs();
         $bccs = $email->getBccs();
         // Make sure there aren't too many recipients (to
         // prevent use as a spam relay)
         $recipientCount = 0;
         if (is_array($recipients)) {
             $recipientCount += count($recipients);
         }
         if (is_array($ccs)) {
             $recipientCount += count($ccs);
         }
         if (is_array($bccs)) {
             $recipientCount += count($bccs);
         }
         if (!$canSendUnlimitedEmails && $recipientCount > (int) Config::getVar('email', 'max_recipients')) {
             $templateMgr->assign('pageTitle', 'email.compose');
             $templateMgr->assign('message', 'email.compose.tooManyRecipients');
             $templateMgr->assign('backLink', 'javascript:history.back()');
             $templateMgr->assign('backLinkLabel', 'email.compose');
             return $templateMgr->display('common/message.tpl');
         }
         $email->send();
         $redirectUrl = Request::getUserVar('redirectUrl');
         if (empty($redirectUrl)) {
             $redirectUrl = Request::url(null, 'user');
         }
         $user->setDateLastEmail(Core::getCurrentDate());
         $userDao->updateUser($user);
         Request::redirectUrl($redirectUrl);
     } else {
         $email->displayEditForm(Request::url(null, null, 'email'), array('redirectUrl' => Request::getUserVar('redirectUrl'), 'articleId' => $articleId), null, array('disableSkipButton' => true, 'articleId' => $articleId));
     }
 }
 function getContents(&$templateMgr)
 {
     $templateMgr->assign('editor', Validation::isEditor());
     return parent::getContents($templateMgr);
 }
 /**
  * Get a list of the most 'privileged' roles a user has associated with an article.  This will
  *  determine the URL to point them to for notifications about articles.  Returns roles in
  *  order of 'importance'
  * @param $articleId
  * @return array
  */
 function _getHighestPrivilegedRolesForArticle(&$request, $articleId)
 {
     $user =& $request->getUser();
     $userId = $user->getId();
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     /* @var $roleDao RoleDAO */
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     /* @var $articleDao ArticleDAO */
     $roles = array();
     // Check if user is editor
     $article =& $articleDao->getArticle($articleId);
     if ($article && Validation::isEditor($article->getJournalId())) {
         $roles[] = ROLE_ID_EDITOR;
     }
     $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
     /* @var $editAssignmentDao EditAssignmentDAO */
     $editAssignments =& $editAssignmentDao->getEditingSectionEditorAssignmentsByArticleId($articleId);
     while ($editAssignment =& $editAssignments->next()) {
         if ($userId == $editAssignment->getEditorId()) {
             $roles[] = ROLE_ID_SECTION_EDITOR;
         }
         unset($editAssignment);
     }
     // Check if user is copy/layout editor or proofreader
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     /* @var $signoffDao SignoffDAO */
     $copyedSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
     if ($userId == $copyedSignoff->getUserId()) {
         $roles[] = ROLE_ID_COPYEDITOR;
     }
     $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
     if ($userId == $layoutSignoff->getUserId()) {
         $roles[] = ROLE_ID_LAYOUT_EDITOR;
     }
     $proofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
     if ($userId == $proofSignoff->getUserId()) {
         $roles[] = ROLE_ID_PROOFREADER;
     }
     // Check if user is author
     if ($article && $userId == $article->getUserId()) {
         $roles[] = ROLE_ID_AUTHOR;
     }
     // Check if user is reviewer
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     /* @var $reviewAssignmentDao ReviewAssignmentDAO */
     $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($articleId);
     foreach ($reviewAssignments as $reviewAssignment) {
         if ($userId == $reviewAssignment->getReviewerId()) {
             $roles[] = ROLE_ID_REVIEWER;
         }
     }
     return $roles;
 }
 /**
  * Setup common template variables.
  * @param $subclass boolean set to true if caller is below this handler in the hierarchy
  */
 function setupTemplate($subclass = false, $articleId = 0, $parentPage = null, $showSidebar = true)
 {
     parent::setupTemplate();
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OJS_AUTHOR, LOCALE_COMPONENT_OJS_MANAGER));
     $templateMgr =& TemplateManager::getManager();
     $isEditor = Validation::isEditor();
     if (Request::getRequestedPage() == 'editor') {
         $templateMgr->assign('helpTopicId', 'editorial.editorsRole');
     } else {
         $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole');
     }
     $pageHierarchy = $subclass ? array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $isEditor ? 'editor' : 'sectionEditor'), $isEditor ? 'user.role.editor' : 'user.role.sectionEditor'), array(Request::url(null, 'sectionEditor'), 'article.submissions')) : array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $isEditor ? 'editor' : 'sectionEditor'), $isEditor ? 'user.role.editor' : 'user.role.sectionEditor'));
     import('submission.sectionEditor.SectionEditorAction');
     $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'sectionEditor');
     if (isset($submissionCrumb)) {
         $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
     }
     $templateMgr->assign('pageHierarchy', $pageHierarchy);
 }