From 440af95453d6840c09c338b9167c989362ed8c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarda=20Kot=C4=9B=C5=A1ovec?= Date: Tue, 16 Jan 2024 15:18:31 +0100 Subject: [PATCH] pkp/pkp-lib#9453 Initial Boilerplate --- classes/template/PKPTemplateManager.php | 12 +++++++++++ pages/reviewer/PKPReviewerHandler.php | 21 +++++++++++++++++++ .../reviewer/review/reviewStepHeader.tpl | 3 +++ 3 files changed, 36 insertions(+) diff --git a/classes/template/PKPTemplateManager.php b/classes/template/PKPTemplateManager.php index 34b27c134bd..65e96ef3331 100644 --- a/classes/template/PKPTemplateManager.php +++ b/classes/template/PKPTemplateManager.php @@ -1210,6 +1210,18 @@ public function display($template = null, $cache_id = null, $compile_id = null, $output .= 'pkp.const = ' . json_encode($this->_constants) . ';'; } + // add apiBaselUrl for useApiUrl composable + $dispatcher = Application::get()->getDispatcher(); + $request = Application::get()->getRequest(); + $context = $request->getContext(); + + $pageContext = [ + 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context->getPath()) + ]; + $output .= 'pkp.context = ' . json_encode($pageContext) . ';'; + + + // Load current user data if (Application::isInstalled()) { $user = $this->_request->getUser(); diff --git a/pages/reviewer/PKPReviewerHandler.php b/pages/reviewer/PKPReviewerHandler.php index 2b8b03b59df..da24bfe8ce9 100644 --- a/pages/reviewer/PKPReviewerHandler.php +++ b/pages/reviewer/PKPReviewerHandler.php @@ -23,6 +23,7 @@ use APP\template\TemplateManager; use Exception; use Illuminate\Support\Facades\Mail; +use PKP\config\Config; use PKP\core\JSONMessage; use PKP\core\PKPApplication; use PKP\core\PKPRequest; @@ -65,6 +66,26 @@ public function submission(array $args, PKPRequest $request): void 'submission' => $reviewSubmission, ]); + $templateMgr->setState([ + 'isReviewRoundHistoryEnabled' => Config::getVar('features', 'enable_review_round_history'), + 'pageInitConfig' => [ + 'reviewRoundHistories' => [ + [ + 'submissionId' => $reviewSubmission->getId(), + // Just as example, not real data + 'reviewRoundId' => 0, + 'reviewRoundNumber' => 1 + ], + [ + 'submissionId' => $reviewSubmission->getId(), + // Just as example, not real data + 'reviewRoundId' => 1, + 'reviewRoundNumber' => 2 + ] + ] + ] + ]); + $templateMgr->display('reviewer/review/reviewStepHeader.tpl'); } diff --git a/templates/reviewer/review/reviewStepHeader.tpl b/templates/reviewer/review/reviewStepHeader.tpl index e993ab43147..389f11850c2 100644 --- a/templates/reviewer/review/reviewStepHeader.tpl +++ b/templates/reviewer/review/reviewStepHeader.tpl @@ -14,6 +14,9 @@ {$pageTitle} + + +