Ejemplo n.º 1
0
 /**
  * Display section editor index page.
  */
 function index($args)
 {
     SectionEditorHandler::validate();
     SectionEditorHandler::setupTemplate();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $rangeInfo = Handler::getRangeInfo('submissions');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $fromDate = Request::getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     $sections =& $sectionDao->getSectionTitles($journal->getJournalId());
     switch ($page) {
         case 'submissionsInEditing':
             $functionName = 'getSectionEditorSubmissionsInEditing';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.inEditing';
             break;
         case 'submissionsArchives':
             $functionName = 'getSectionEditorSubmissionsArchives';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.archives';
             break;
         default:
             $page = 'submissionsInReview';
             $functionName = 'getSectionEditorSubmissionsInReview';
             $helpTopicId = 'editorial.sectionEditorsRole.submissions.inReview';
     }
     $submissions =& $sectionEditorSubmissionDao->{$functionName}($user->getUserId(), $journal->getJournalId(), Request::getUserVar('section'), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', $helpTopicId);
     $templateMgr->assign('sectionOptions', array(0 => Locale::Translate('editor.allSections')) + $sections);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $templateMgr->assign('section', Request::getUserVar('section'));
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign('sectionEditor', $user->getFullName());
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
     import('issue.IssueAction');
     $issueAction =& new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->display('sectionEditor/index.tpl');
 }
 /**
  * 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);
 }
 /**
  * Constructor
  **/
 function SubmissionCommentsHandler()
 {
     parent::SectionEditorHandler();
 }
Ejemplo n.º 4
0
 /**
  * Setup common template variables.
  * @param $level int set to 0 if caller is at the same level as this handler in the hierarchy; otherwise the number of levels below this handler
  */
 function setupTemplate($level = EDITOR_SECTION_HOME, $articleId = 0, $parentPage = null)
 {
     parent::setupTemplate();
     // Layout Editors have access to some Issue Mgmt functions. Make sure we give them
     // the appropriate breadcrumbs and sidebar.
     $isLayoutEditor = Request::getRequestedPage() == 'layoutEditor';
     $journal =& Request::getJournal();
     $templateMgr =& TemplateManager::getManager();
     if ($level == EDITOR_SECTION_HOME) {
         $pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user'));
     } else {
         if ($level == EDITOR_SECTION_SUBMISSIONS) {
             $pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'editor'), 'user.role.editor'), array(Request::url(null, 'editor', 'submissions'), 'article.submissions'));
         } else {
             if ($level == EDITOR_SECTION_ISSUES) {
                 $pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, $isLayoutEditor ? 'layoutEditor' : 'editor'), $isLayoutEditor ? 'user.role.layoutEditor' : 'user.role.editor'), array(Request::url(null, $isLayoutEditor ? 'layoutEditor' : 'editor', 'futureIssues'), 'issue.issues'));
             }
         }
     }
     import('classes.submission.sectionEditor.SectionEditorAction');
     $submissionCrumb = SectionEditorAction::submissionBreadcrumb($articleId, $parentPage, 'editor');
     if (isset($submissionCrumb)) {
         $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
     }
     $templateMgr->assign('pageHierarchy', $pageHierarchy);
 }
Ejemplo n.º 5
0
 /**
  * Delete a submission.
  */
 function deleteSubmission($args)
 {
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     EditorHandler::validate($articleId);
     parent::setupTemplate(true);
     $journal =& Request::getJournal();
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $article =& $articleDao->getArticle($articleId);
     $status = $article->getStatus();
     if ($article->getJournalId() == $journal->getJournalId() && ($status == STATUS_DECLINED || $status == STATUS_ARCHIVED)) {
         // Delete article files
         import('file.ArticleFileManager');
         $articleFileManager =& new ArticleFileManager($articleId);
         $articleFileManager->deleteArticleTree();
         // Delete article database entries
         $articleDao->deleteArticleById($articleId);
     }
     Request::redirect(null, null, 'submissions', 'submissionsArchives');
 }
Ejemplo n.º 6
0
 /**
  * Validate that the user is the author of the comment.
  */
 function validate($commentId)
 {
     parent::validate();
     $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
     $user =& Request::getUser();
     $comment =& $articleCommentDao->getArticleCommentById($commentId);
     if ($comment == null || $comment->getAuthorId() != $user->getUserId()) {
         Request::redirect(null, Request::getRequestedPage());
     }
     return array($comment);
 }
 /**
  * Preview a review form.
  * @param $args array ($reviewId, $reviewFormId)
  * @param $request PKPRequest
  */
 function previewReviewForm($args, &$request)
 {
     parent::validate();
     $this->setupTemplate(true);
     $reviewId = (int) array_shift($args);
     $reviewFormId = (int) array_shift($args);
     $journal =& $request->getJournal();
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm =& $reviewFormDao->getReviewForm($reviewFormId, ASSOC_TYPE_JOURNAL, $journal->getId());
     $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
     $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($reviewFormId);
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageTitle', 'manager.reviewForms.preview');
     $templateMgr->assign_by_ref('reviewForm', $reviewForm);
     $templateMgr->assign('reviewFormElements', $reviewFormElements);
     $templateMgr->assign('reviewId', $reviewId);
     $templateMgr->assign('articleId', $reviewAssignment->getSubmissionId());
     //$templateMgr->assign('helpTopicId','journal.managementPages.reviewForms');
     $templateMgr->display('sectionEditor/previewReviewForm.tpl');
 }
Ejemplo n.º 8
0
 /**
  * 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;
 }