/**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     $cacheManager =& CacheManager::getManager();
     $cache =& $cacheManager->getFileCache('keywords_' . AppLocale::getLocale(), $journal->getId(), array(&$this, '_cacheMiss'));
     // If the cache is older than a couple of days, regenerate it
     if (time() - $cache->getCacheTime() > 60 * 60 * 24 * KEYWORD_BLOCK_CACHE_DAYS) {
         $cache->flush();
     }
     $keywords =& $cache->getContents();
     if (empty($keywords)) {
         return '';
     }
     // Get the max occurrences for all keywords
     $maxOccurs = array_shift(array_values($keywords));
     // Now sort the array alphabetically
     ksort($keywords);
     $page = Request::getRequestedPage();
     $op = Request::getRequestedOp();
     $templateMgr->assign_by_ref('cloudKeywords', $keywords);
     $templateMgr->assign_by_ref('maxOccurs', $maxOccurs);
     if ($page == 'index' && $op == 'index' || $page == 'issue' || $page == 'search') {
         return parent::getContents($templateMgr);
     } else {
         return '';
     }
 }
 function saveSettings()
 {
     RTAdminHandler::validate();
     // Bring in the comments constants.
     $commentDao =& DAORegistry::getDao('CommentDAO');
     $journal = Request::getJournal();
     if ($journal) {
         $rtDao =& DAORegistry::getDAO('RTDAO');
         $rt = $rtDao->getJournalRTByJournal($journal);
         if (Request::getUserVar('version') == '') {
             $rt->setVersion(null);
         } else {
             $rt->setVersion(Request::getUserVar('version'));
         }
         $rt->setEnabled(Request::getUserVar('enabled') == true);
         $rt->setAbstract(Request::getUserVar('abstract') == true);
         $rt->setCaptureCite(Request::getUserVar('captureCite') == true);
         $rt->setViewMetadata(Request::getUserVar('viewMetadata') == true);
         $rt->setSupplementaryFiles(Request::getUserVar('supplementaryFiles') == true);
         $rt->setPrinterFriendly(Request::getUserVar('printerFriendly') == true);
         $rt->setAuthorBio(Request::getUserVar('authorBio') == true);
         $rt->setDefineTerms(Request::getUserVar('defineTerms') == true);
         $rt->setEmailAuthor(Request::getUserVar('emailAuthor') == true);
         $rt->setEmailOthers(Request::getUserVar('emailOthers') == true);
         $rt->setFindingReferences(Request::getUserVar('findingReferences') == true);
         $journal->updateSetting('enableComments', Request::getUserVar('enableComments') ? Request::getUserVar('enableCommentsMode') : COMMENTS_DISABLED);
         $rtDao->updateJournalRT($rt);
     }
     Request::redirect(null, Request::getRequestedPage());
 }
Esempio n. 3
0
 /**
  * Sign in as another user.
  * @param $args array ($userId)
  */
 function signInAsUser($args)
 {
     $this->addCheck(new HandlerValidatorConference($this));
     $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_CONFERENCE_MANAGER)));
     $this->validate();
     if (isset($args[0]) && !empty($args[0])) {
         $userId = (int) $args[0];
         $conference =& Request::getConference();
         if (!Validation::canAdminister($conference->getId(), $userId)) {
             $this->setupTemplate();
             // We don't have administrative rights
             // over this user. Display an error.
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('pageTitle', 'manager.people');
             $templateMgr->assign('errorMsg', 'manager.people.noAdministrativeRights');
             $templateMgr->assign('backLink', Request::url(null, null, null, 'people', 'all'));
             $templateMgr->assign('backLinkLabel', 'manager.people.allUsers');
             return $templateMgr->display('common/error.tpl');
         }
         $userDao =& DAORegistry::getDAO('UserDAO');
         $newUser =& $userDao->getUser($userId);
         $session =& Request::getSession();
         // FIXME Support "stack" of signed-in-as user IDs?
         if (isset($newUser) && $session->getUserId() != $newUser->getId()) {
             $session->setSessionVar('signedInAs', $session->getUserId());
             $session->setSessionVar('userId', $userId);
             $session->setUserId($userId);
             $session->setSessionVar('username', $newUser->getUsername());
             Request::redirect(null, null, 'user');
         }
     }
     Request::redirect(null, null, Request::getRequestedPage());
 }
Esempio n. 4
0
 /**
  * Display the form.
  */
 function display()
 {
     $journal =& Request::getJournal();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('enablePublicSuppFileId', $journal->getSetting('enablePublicSuppFileId'));
     $templateMgr->assign('rolePath', Request::getRequestedPage());
     $templateMgr->assign('articleId', $this->article->getId());
     $templateMgr->assign('suppFileId', $this->suppFileId);
     $typeOptionsOutput = array('author.submit.suppFile.researchInstrument', 'author.submit.suppFile.researchMaterials', 'author.submit.suppFile.researchResults', 'author.submit.suppFile.transcripts', 'author.submit.suppFile.dataAnalysis', 'author.submit.suppFile.dataSet', 'author.submit.suppFile.sourceText');
     $typeOptionsValues = $typeOptionsOutput;
     array_push($typeOptionsOutput, 'common.other');
     array_push($typeOptionsValues, '');
     $templateMgr->assign('typeOptionsOutput', $typeOptionsOutput);
     $templateMgr->assign('typeOptionsValues', $typeOptionsValues);
     // Sometimes it's necessary to track the page we came from in
     // order to redirect back to the right place
     $templateMgr->assign('from', Request::getUserVar('from'));
     if (isset($this->article)) {
         $templateMgr->assign('submissionProgress', $this->article->getSubmissionProgress());
     }
     if (isset($this->suppFile)) {
         $templateMgr->assign_by_ref('suppFile', $this->suppFile);
     }
     $templateMgr->assign('helpTopicId', 'submission.supplementaryFiles');
     // consider public identifiers
     $pubIdPlugins =& PluginRegistry::loadCategory('pubIds', true);
     $templateMgr->assign('pubIdPlugins', $pubIdPlugins);
     AppLocale::requireComponents(LOCALE_COMPONENT_OJS_AUTHOR);
     parent::display();
 }
 /**
  * Save changes to program settings.
  */
 function saveProgramSettings()
 {
     $this->validate();
     $this->setupTemplate(true);
     $schedConf =& Request::getSchedConf();
     if (!$schedConf) {
         Request::redirect(null, null, 'index');
     }
     import('classes.manager.form.ProgramSettingsForm');
     $settingsForm = new ProgramSettingsForm();
     $settingsForm->readInputData();
     $formLocale = $settingsForm->getFormLocale();
     $programTitle = Request::getUserVar('programFileTitle');
     $editData = false;
     if (Request::getUserVar('uploadProgramFile')) {
         if (!$settingsForm->uploadProgram('programFile', $formLocale)) {
             $settingsForm->addError('programFile', Locale::translate('common.uploadFailed'));
         }
         $editData = true;
     } elseif (Request::getUserVar('deleteProgramFile')) {
         $settingsForm->deleteProgram('programFile', $formLocale);
         $editData = true;
     }
     if (!$editData && $settingsForm->validate()) {
         $settingsForm->execute();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'program'), 'pageTitle' => 'schedConf.program', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement'));
         $templateMgr->display('common/message.tpl');
     } else {
         $settingsForm->display();
     }
 }
Esempio n. 6
0
    /**
     * Hook callback function for TemplateManager::display
     * @param $hookName string
     * @param $args array
     * @return boolean
     */
    function displayCallback($hookName, $args)
    {
        // Only pages can receive scripts
        $request =& Registry::get('request');
        if (!is_a($request->getRouter(), 'PKPPageRouter')) {
            return null;
        }
        $page = Request::getRequestedPage();
        $op = Request::getRequestedOp();
        $scripts = JQueryPlugin::getEnabledScripts($page, $op);
        if (empty($scripts)) {
            return null;
        }
        $templateManager =& $args[0];
        $additionalHeadData = $templateManager->get_template_vars('additionalHeadData');
        $baseUrl = $templateManager->get_template_vars('baseUrl');
        if (Config::getVar('general', 'enable_cdn')) {
            $jQueryScript = '<script src="http://www.google.com/jsapi"></script>
			<script>
				google.load("jquery", "1");
				google.load("jqueryui", "1");
			</script>';
        } else {
            $jQueryScript = '<script type="text/javascript" src="' . Request::getBaseUrl() . '/lib/pkp/js/lib/jquery/jquery.min.js"></script>
			<script type="text/javascript" src="' . Request::getBaseUrl() . '/lib/pkp/js/lib/jquery/plugins/jqueryUi.min.js"></script>';
        }
        $jQueryScript .= "\n" . JQueryPlugin::addScripts($baseUrl, $scripts);
        $templateManager->assign('additionalHeadData', $additionalHeadData . "\n" . $jQueryScript);
    }
 /**
  * Display the form.
  */
 function display()
 {
     $journal =& Request::getJournal();
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm =& $reviewFormDao->getReviewForm($this->reviewFormId, ASSOC_TYPE_JOURNAL, $journal->getId());
     $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
     $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($this->reviewFormId);
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormResponses =& $reviewFormResponseDao->getReviewReviewFormResponseValues($this->reviewId);
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment = $reviewAssignmentDao->getById($this->reviewId);
     $sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
     $sectionDecision =& $sectionDecisionDao->getSectionDecision($reviewAssignment->getDecisionId());
     $editorPreview = Request::getRequestedPage() != 'reviewer';
     if (!$editorPreview) {
         ReviewerHandler::setupTemplate(true, 0, $sectionDecision->getArticleId());
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageTitle', 'submission.reviewFormResponse');
     $templateMgr->assign_by_ref('reviewForm', $reviewForm);
     $templateMgr->assign('reviewFormElements', $reviewFormElements);
     $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
     $templateMgr->assign('reviewId', $this->reviewId);
     $templateMgr->assign('articleId', $sectionDecision->getArticleId());
     $templateMgr->assign('isLocked', isset($reviewAssignment) && $reviewAssignment->getDateCompleted() != null);
     $templateMgr->assign('editorPreview', $editorPreview);
     parent::display();
 }
Esempio n. 8
0
 /**
  * Display the form.
  */
 function display()
 {
     $conference =& Request::getConference();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('enablePublicSuppFileId', $conference->getSetting('enablePublicSuppFileId'));
     $templateMgr->assign('rolePath', Request::getRequestedPage());
     $templateMgr->assign('paperId', $this->paper->getPaperId());
     $templateMgr->assign('suppFileId', $this->suppFileId);
     $typeOptionsOutput = array('author.submit.suppFile.researchInstrument', 'author.submit.suppFile.researchMaterials', 'author.submit.suppFile.researchResults', 'author.submit.suppFile.transcripts', 'author.submit.suppFile.dataAnalysis', 'author.submit.suppFile.dataSet', 'author.submit.suppFile.sourceText');
     $typeOptionsValues = $typeOptionsOutput;
     array_push($typeOptionsOutput, 'common.other');
     array_push($typeOptionsValues, '');
     $templateMgr->assign('typeOptionsOutput', $typeOptionsOutput);
     $templateMgr->assign('typeOptionsValues', $typeOptionsValues);
     // Sometimes it's necessary to track the page we came from in
     // order to redirect back to the right place
     $templateMgr->assign('from', Request::getUserVar('from'));
     if (isset($this->paper)) {
         $templateMgr->assign('submissionProgress', $this->paper->getSubmissionProgress());
     }
     if (isset($this->suppFile)) {
         $templateMgr->assign_by_ref('suppFile', $this->suppFile);
     }
     $templateMgr->assign('helpTopicId', 'submission.supplementaryFiles');
     parent::display();
 }
Esempio n. 9
0
 function saveSettings()
 {
     $this->validate();
     $conference = Request::getConference();
     if ($conference) {
         $rtDao =& DAORegistry::getDAO('RTDAO');
         $rt = $rtDao->getConferenceRTByConference($conference);
         if (Request::getUserVar('version') == '') {
             $rt->setVersion(null);
         } else {
             $rt->setVersion(Request::getUserVar('version'));
         }
         $rt->setEnabled(Request::getUserVar('enabled') == true);
         $rt->setAbstract(Request::getUserVar('abstract') == true);
         $rt->setCaptureCite(Request::getUserVar('captureCite') == true);
         $rt->setViewMetadata(Request::getUserVar('viewMetadata') == true);
         $rt->setSupplementaryFiles(Request::getUserVar('supplementaryFiles') == true);
         $rt->setPrinterFriendly(Request::getUserVar('printerFriendly') == true);
         $rt->setAuthorBio(Request::getUserVar('authorBio') == true);
         $rt->setDefineTerms(Request::getUserVar('defineTerms') == true);
         $rt->setAddComment(Request::getUserVar('addComment') == true);
         $rt->setEmailAuthor(Request::getUserVar('emailAuthor') == true);
         $rt->setEmailOthers(Request::getUserVar('emailOthers') == true);
         $rt->setFindingReferences(Request::getUserVar('findingReferences') == true);
         $rtDao->updateConferenceRT($rt);
     }
     Request::redirect(null, null, Request::getRequestedPage());
 }
Esempio n. 10
0
 function getContents(&$templateMgr)
 {
     if (Request::getRequestedPage() . '/' . Request::getRequestedOp() !== 'record/view') {
         return '';
     }
     return parent::getContents($templateMgr);
 }
Esempio n. 11
0
 function validateUrls($args)
 {
     $this->validate();
     $rtDao =& DAORegistry::getDAO('RTDAO');
     $conference = Request::getConference();
     if (!$conference) {
         Request::redirect(null, null, Request::getRequestedPage());
         return;
     }
     $versionId = isset($args[0]) ? $args[0] : 0;
     $conferenceId = $conference->getId();
     $version = $rtDao->getVersion($versionId, $conferenceId);
     if ($version) {
         // Validate the URLs for a single version
         $versions = array(&$version);
         import('core.ArrayItemIterator');
         $versions = new ArrayItemIterator($versions, 1, 1);
     } else {
         // Validate all URLs for this conference
         $versions = $rtDao->getVersions($conferenceId);
     }
     $this->setupTemplate(true, $version);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_modifier('validate_url', 'smarty_rtadmin_validate_url');
     $templateMgr->assign_by_ref('versions', $versions);
     $templateMgr->assign('helpTopicId', 'conference.generalManagement.readingTools');
     $templateMgr->display('rtadmin/validate.tpl');
 }
Esempio n. 12
0
/**
 * Handle a new request.
 */
function handleRequest()
{
    if (!Config::getVar('general', 'installed') && pageRequiresInstall()) {
        // Redirect to installer if application has not been installed
        Request::redirect(null, 'install');
    }
    // Determine the handler for this request
    $page = Request::getRequestedPage();
    $op = Request::getRequestedOp();
    $sourceFile = sprintf('pages/%s/index.php', $page);
    // If a hook has been registered to handle this page, give it the
    // opportunity to load required resources and set HANDLER_CLASS.
    if (!HookRegistry::call('LoadHandler', array(&$page, &$op, &$sourceFile))) {
        if (file_exists($sourceFile)) {
            require $sourceFile;
        } else {
            require 'pages/index/index.php';
        }
    }
    if (!defined('SESSION_DISABLE_INIT')) {
        // Initialize session
        $sessionManager =& SessionManager::getManager();
        $session =& $sessionManager->getUserSession();
    }
    $methods = array_map('strtolower', get_class_methods(HANDLER_CLASS));
    if (in_array(strtolower($op), $methods)) {
        // Call a specific operation
        call_user_func(array(HANDLER_CLASS, $op), Request::getRequestedArgs());
    } else {
        // Call the selected handler's index operation
        call_user_func(array(HANDLER_CLASS, 'index'), Request::getRequestedArgs());
    }
}
Esempio n. 13
0
 /**
  * Display the form.
  */
 function display()
 {
     $conference =& Request::getConference();
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $reviewForm =& $reviewFormDao->getReviewForm($this->reviewFormId, $conference->getId());
     $reviewFormElementDao =& DAORegistry::getDAO('ReviewFormElementDAO');
     $reviewFormElements =& $reviewFormElementDao->getReviewFormElements($this->reviewFormId);
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormResponses =& $reviewFormResponseDao->getReviewReviewFormResponseValues($this->reviewId);
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment = $reviewAssignmentDao->getReviewAssignmentById($this->reviewId);
     $editorPreview = Request::getRequestedPage() != 'reviewer';
     if (!$editorPreview) {
         ReviewerHandler::setupTemplate(true, $reviewAssignment->getPaperId(), $this->reviewId);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageTitle', 'submission.reviewFormResponse');
     $templateMgr->assign_by_ref('reviewForm', $reviewForm);
     $templateMgr->assign('reviewFormElements', $reviewFormElements);
     $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
     $templateMgr->assign('reviewId', $this->reviewId);
     $templateMgr->assign('paperId', $reviewAssignment->getPaperId());
     $templateMgr->assign('isLocked', isset($reviewAssignment) && $reviewAssignment->getDateCompleted() != null);
     $templateMgr->assign('editorPreview', $editorPreview);
     parent::display();
 }
Esempio n. 14
0
 /**
  * Display the form.
  */
 function display()
 {
     $journal =& Request::getJournal();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('rolePath', Request::getRequestedPage());
     $templateMgr->assign('articleId', $this->article->getArticleId());
     parent::display();
 }
Esempio n. 15
0
 /**
  * Log a request for an lineable galley (e.g. text file).
  */
 function logRequestInline($hookName, $args)
 {
     $journal =& Request::getJournal();
     if (!$journal || Request::getRequestedPage() != 'article' || Request::getRequestedOp() != 'view') {
         return false;
     }
     $counterReportDao =& DAORegistry::getDAO('CounterReportDAO');
     $counterReportDao->incrementCount($journal->getJournalId(), (int) strftime('%Y'), (int) strftime('%m'), false, false);
 }
Esempio n. 16
0
 function Handler()
 {
     parent::PKPHandler();
     $journal =& Request::getJournal();
     $page = Request::getRequestedPage();
     if ($journal && $journal->getSetting('restrictSiteAccess')) {
         $this->addCheck(new HandlerValidatorCustom($this, true, null, null, create_function('$page', 'if (!Validation::isLoggedIn() && !in_array($page, Handler::getLoginExemptions())) return false; else return true;'), array($page)));
     }
 }
Esempio n. 17
0
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     // Only show the block for article pages.
     switch (Request::getRequestedPage() . '/' . Request::getRequestedOp()) {
         case 'article/view':
             return parent::getContents($templateMgr);
         default:
             return '';
     }
 }
Esempio n. 18
0
 /**
  * Display the form.
  */
 function display()
 {
     $journal = Request::getJournal();
     $articleDetailsDao =& DAORegistry::getDAO('ArticleDetailsDAO');
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('rolePath', Request::getRequestedPage());
     $templateMgr->assign('articleId', $this->article->getArticleId());
     $templateMgr->assign('recruitmentStatusMap', $articleDetailsDao->getRecruitmentStatusMap());
     $templateMgr->assign('articleTextLocales', $journal->getSupportedLocaleNames());
     parent::display();
 }
Esempio n. 19
0
 /**
  * Constructor
  **/
 function SendEmailHandler()
 {
     parent::Handler();
     $this->addCheck(new HandlerValidatorJournal($this));
     // FIXME This is kind of evil
     $page = Request::getRequestedPage();
     if ($page == 'sectionEditor') {
         $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SECTION_EDITOR)));
     } elseif ($page == 'editor') {
         $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_EDITOR)));
     }
 }
 /**
  * Hook callback function
  */
 function redirectRequest($hookName, $args)
 {
     $templateManager =& $args[0];
     $template =& $args[1];
     $page = Request::getRequestedPage();
     $user = Request::getUser();
     if (!$user || $user->getUsername() != 'administrator') {
         if ($page == 'user' || $page == 'about') {
             Request::redirectUrl('http://www.lltjournal.ca/index.php/llt');
         }
     }
     return false;
 }
Esempio n. 21
0
 /**
  * Save user's new password.
  */
 function savePassword()
 {
     parent::validate();
     import('user.form.ChangePasswordForm');
     $passwordForm =& new ChangePasswordForm();
     $passwordForm->readInputData();
     if ($passwordForm->validate()) {
         $passwordForm->execute();
         Request::redirect(null, Request::getRequestedPage());
     } else {
         parent::setupTemplate(true);
         $passwordForm->display();
     }
 }
 /**
  * Index.
  */
 function booksForReview()
 {
     $this->validate();
     $this->setupTemplate();
     $journal =& Request::getJournal();
     $journalId = $journal->getJournalId();
     $user =& Request::getUser();
     $templateMgr =& TemplateManager::getManager();
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $pendingIssuesList = $CBPPlatformDao->getPendingIssues($journalId);
     if (Request::getUserVar('issueId')) {
         $issueId = Request::getUserVar('issueId');
         function in_array_r($needle, $haystack)
         {
             foreach ($haystack as $item) {
                 if ($item === $needle || is_array($item) && in_array_r($needle, $item)) {
                     return true;
                 }
             }
             return false;
         }
         if (in_array_r($issueId, $pendingIssuesList)) {
             $comment = Request::getUserVar('comment');
             $CBPPlatformDao->setReviewerIssueComment($issueId, $user->getUserId(), $comment);
             Request::redirect(Request::getRequestedJournalPath(), Request::getRequestedPage(), Request::getRequestedOp());
         }
     }
     if (count($pendingIssuesList) > 1) {
         foreach ($pendingIssuesList as $pendingIssue) {
             $issues[] = $issueDao->getIssueById($pendingIssue['issue_id']);
             $issueObject = $CBPPlatformDao->getFedoraIssueObjectInformation($pendingIssue['issue_id']);
             $issueComments[$pendingIssue['issue_id']] = $CBPPlatformDao->getReviewerIssueComments($pendingIssue['issue_id']);
             $issueObjects[$pendingIssue['issue_id']]['pid'] = $issueObject['fedora_namespace'] . ":" . $issueObject['fedora_pid'];
             $issueObjects[$pendingIssue['issue_id']]['dsid'] = $issueObject['fedora_dsid'];
             $publishedArticles[$pendingIssue['issue_id']] = $publishedArticleDao->getPublishedArticles($pendingIssue['issue_id']);
         }
         $pendingIssues = $issues;
     } else {
         $pendingIssues = 0;
     }
     $templateMgr->assign('user', $userDao);
     $templateMgr->assign('pendingIssues', $pendingIssues);
     $templateMgr->assign('issueComments', $issueComments);
     $templateMgr->assign('publishedArticles', $publishedArticles);
     $templateMgr->assign('issueObjects', $issueObjects);
     $templateMgr->display('reviewer/booksForReview.tpl');
 }
Esempio n. 23
0
 /**
  * Override the block contents based on the current role being
  * browsed.
  * @return string
  */
 function getBlockTemplateFilename()
 {
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     if (!$conference || !$schedConf || !$user) {
         return null;
     }
     $userId = $user->getId();
     $conferenceId = $conference->getId();
     $schedConfId = $schedConf->getId();
     $templateMgr =& TemplateManager::getManager();
     switch (Request::getRequestedPage()) {
         case 'author':
             switch (Request::getRequestedOp()) {
                 case 'submit':
                 case 'saveSubmit':
                 case 'submitSuppFile':
                 case 'saveSubmitSuppFile':
                 case 'deleteSubmitSuppFile':
                     // Block disabled for submission
                     return null;
                 default:
                     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
                     $submissionsCount = $authorSubmissionDao->getSubmissionsCount($userId, $schedConfId);
                     $templateMgr->assign('submissionsCount', $submissionsCount);
                     return 'author.tpl';
             }
         case 'director':
             if (Request::getRequestedOp() == 'index') {
                 return null;
             }
             $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO');
             $submissionsCount =& $directorSubmissionDao->getDirectorSubmissionsCount($schedConfId);
             $templateMgr->assign('submissionsCount', $submissionsCount);
             return 'director.tpl';
         case 'trackDirector':
             $trackDirectorSubmissionDao =& DAORegistry::getDAO('TrackDirectorSubmissionDAO');
             $submissionsCount =& $trackDirectorSubmissionDao->getTrackDirectorSubmissionsCount($userId, $schedConfId);
             $templateMgr->assign('submissionsCount', $submissionsCount);
             return 'trackDirector.tpl';
         case 'reviewer':
             $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
             $submissionsCount = $reviewerSubmissionDao->getSubmissionsCount($userId, $schedConfId);
             $templateMgr->assign('submissionsCount', $submissionsCount);
             return 'reviewer.tpl';
     }
     return null;
 }
Esempio n. 24
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);
 }
Esempio n. 25
0
 /**
  * Save changes to language settings.
  */
 function saveLanguageSettings()
 {
     parent::validate();
     parent::setupTemplate(true);
     import('manager.form.LanguageSettingsForm');
     $settingsForm =& new LanguageSettingsForm();
     $settingsForm->readInputData();
     if ($settingsForm->validate()) {
         $settingsForm->execute();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'languages'), 'pageTitle' => 'common.languages', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.journalManagement'));
         $templateMgr->display('common/message.tpl');
     } else {
         $settingsForm->display();
     }
 }
 function reloadLocalizedDefaultSettings()
 {
     // make sure the locale is valid
     $locale = Request::getUserVar('localeToLoad');
     if (!Locale::isLocaleValid($locale)) {
         Request::redirect(null, null, 'languages');
     }
     parent::validate();
     parent::setupTemplate(true);
     $journal =& Request::getJournal();
     $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
     $journalSettingsDao->reloadLocalizedDefaultSettings($journal->getJournalId(), 'registry/journalSettings.xml', array('indexUrl' => Request::getIndexUrl(), 'journalPath' => $journal->getData('path'), 'primaryLocale' => $journal->getPrimaryLocale(), 'journalName' => $journal->getTitle($journal->getPrimaryLocale())), $locale);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'languages'), 'pageTitle' => 'common.languages', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.journalManagement'));
     $templateMgr->display('common/message.tpl');
 }
Esempio n. 27
0
 /**
  * Perform request access validation based on security settings.
  * @param $requiresJournal boolean
  */
 function validate($requiresJournal = false)
 {
     if (Config::getVar('security', 'force_ssl') && Request::getProtocol() != 'https') {
         // Force SSL connections site-wide
         Request::redirectSSL();
     }
     $journal = Request::getJournal();
     if ($requiresJournal && $journal == null) {
         // Requested page is only allowed for journals
         Request::redirect(null, 'about');
     }
     $page = Request::getRequestedPage();
     if ($journal != null && !Validation::isLoggedIn() && !in_array($page, Handler::getLoginExemptions()) && $journal->getSetting('restrictSiteAccess')) {
         Request::redirect(null, 'login');
     }
 }
Esempio n. 28
0
 /**
  * Display the form.
  */
 function display()
 {
     $journal =& Request::getJournal();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('rolePath', Request::getRequestedPage());
     $templateMgr->assign('articleId', $this->article->getArticleId());
     $templateMgr->assign('fileId', $this->fileId);
     $templateMgr->assign('status', $this->article->getStatus());
     // Sometimes it's necessary to track the page we came from in
     // order to redirect back to the right place
     $templateMgr->assign('from', Request::getUserVar('from'));
     $templateMgr->assign('saeGuidelines', $journal->getLocalizedSetting('saeGuidelines'));
     if (isset($this->file)) {
         $templateMgr->assign_by_ref('file', $this->file);
     }
     parent::display();
 }
 function callbackAddLinks($hookName, $args)
 {
     if ($this->getEnabled()) {
         $templateManager =& $args[0];
         $currentJournal =& $templateManager->get_template_vars('currentJournal');
         $announcementsEnabled = $currentJournal ? $currentJournal->getSetting('enableAnnouncements') : false;
         $displayPage = $currentJournal ? $this->getSetting($currentJournal->getId(), 'displayPage') : null;
         $requestedPage = Request::getRequestedPage();
         if ($announcementsEnabled && ($displayPage == 'all' || $displayPage == 'homepage' && (empty($requestedPage) || $requestedPage == 'index' || $requestedPage == 'announcement') || $displayPage == $requestedPage)) {
             // if we have a journal selected, append feed meta-links into the header
             $additionalHeadData = $templateManager->get_template_vars('additionalHeadData');
             $feedUrl1 = '<link rel="alternate" type="application/atom+xml" href="' . Request::url(null, 'gateway', 'plugin', array('AnnouncementFeedGatewayPlugin', 'atom')) . '" />';
             $feedUrl2 = '<link rel="alternate" type="application/rdf+xml" href="' . $currentJournal->getUrl() . '/gateway/plugin/AnnouncementFeedGatewayPlugin/rss" />';
             $feedUrl3 = '<link rel="alternate" type="application/rss+xml" href="' . $currentJournal->getUrl() . '/gateway/plugin/AnnouncementFeedGatewayPlugin/rss2" />';
             $templateManager->assign('additionalHeadData', $additionalHeadData . "\n\t" . $feedUrl1 . "\n\t" . $feedUrl2 . "\n\t" . $feedUrl3);
         }
     }
     return false;
 }
 /**
  * Validate that the user is the assigned proofreader for the submission.
  * Redirects to proofreader index page if validation fails.
  */
 function validate($articleId)
 {
     parent::validate();
     $isValid = false;
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $proofreaderDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
     $submission =& $proofreaderDao->getSubmission($articleId, $journal->getJournalId());
     if (isset($submission)) {
         $proofAssignment =& $submission->getProofAssignment();
         if ($proofAssignment->getProofreaderId() == $user->getUserId()) {
             $isValid = true;
         }
     }
     if (!$isValid) {
         Request::redirect(null, Request::getRequestedPage());
     }
     return array($journal, $submission);
 }