Skip to content

Commit

Permalink
pkp#10670 Update urls to new dashboard and workflow page
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Jan 8, 2025
1 parent 2762150 commit 803e31f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 49 deletions.
2 changes: 1 addition & 1 deletion classes/mail/variables/ContextEmailVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected function getSubmissionsUrl(): string
$this->request,
PKPApplication::ROUTE_PAGE,
$this->context->getPath(),
'submissions',
'dashboard',
);
}

Expand Down
7 changes: 4 additions & 3 deletions classes/mail/variables/SubmissionEmailVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ protected function getAuthorSubmissionUrl(Context $context): string
$request,
PKPApplication::ROUTE_PAGE,
$context->getData('urlPath'),
'authorDashboard',
'submission',
[$this->submission->getId()]
'dashboard',
'mySubmissions',
null,
['workflowSubmissionId' => $this->submission->getId()]
);
}

Expand Down
16 changes: 9 additions & 7 deletions classes/submission/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ public function getWorkflowUrlByUserRoles(Submission $submission, ?int $userId =
$request,
Application::ROUTE_PAGE,
$submissionContext->getPath(),
'authorDashboard',
'submission',
[$submission->getId()]
'dashboard',
'mySubmissions',
null,
['workflowSubmissionId' => $submission->getId()]
);
}

Expand Down Expand Up @@ -376,7 +377,7 @@ public function validateSubmit(Submission $submission, Context $context): array
Application::get()->getRequest(),
Application::ROUTE_PAGE,
$context->getData('path'),
'submissions'
'dashboard'
)
]
);
Expand Down Expand Up @@ -770,9 +771,10 @@ public function getUrlAuthorWorkflow(Context $context, int $submissionId): strin
Application::get()->getRequest(),
Application::ROUTE_PAGE,
$context->getData('urlPath'),
'authorDashboard',
'submission',
[$submissionId]
'dashboard',
'mySubmissions',
null,
['workflowSubmissionId' => $submissionId]
);
}

Expand Down
2 changes: 1 addition & 1 deletion classes/template/PKPTemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ public function setupBackendPage()
// Admins should switch to the same page on another context where possible
$requestedOp = $request->getRequestedOp() === 'index' ? null : $request->getRequestedOp();
$isSwitchable = $isAdmin && in_array($request->getRequestedPage(), [
'submissions',
'dashboard',
'manageIssues',
'management',
'payment',
Expand Down
13 changes: 8 additions & 5 deletions pages/dashboard/PKPDashboardHandlerNext.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ abstract class PKPDashboardHandlerNext extends Handler
public int $perPage = 30;

/** Identify in which context is looking at the submissions */
public DashboardPage $dashboardPage;
public ?DashboardPage $dashboardPage;

/**
* editorial, review_assignments
Expand All @@ -69,10 +69,9 @@ abstract class PKPDashboardHandlerNext extends Handler
/**
* Constructor
*/
public function __construct(DashboardPage $dashboardPage)
public function __construct(?DashboardPage $dashboardPage = null)
{
parent::__construct();

$this->dashboardPage = $dashboardPage;

if($this->dashboardPage === DashboardPage::EditorialDashboard) {
Expand All @@ -85,7 +84,7 @@ public function __construct(DashboardPage $dashboardPage)

$this->addRoleAssignment(
[Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT],
['index', 'editorial']
['editorial']
);

$this->addRoleAssignment(
Expand All @@ -104,6 +103,11 @@ public function __construct(DashboardPage $dashboardPage)
*/
public function authorize($request, &$args, $roleAssignments)
{
if(!$this->dashboardPage) {
$pkpPageRouter = $request->getRouter(); /** @var \PKP\core\PKPPageRouter $pkpPageRouter */
$pkpPageRouter->redirectHome($request);
}

$this->addPolicy(new PKPSiteAccessPolicy($request, null, $roleAssignments));
return parent::authorize($request, $args, $roleAssignments);
}
Expand All @@ -117,7 +121,6 @@ public function authorize($request, &$args, $roleAssignments)
public function index($args, $request)
{
$context = $request->getContext();
$dispatcher = $request->getDispatcher();

if (!$context) {
$request->redirect(null, 'user');
Expand Down
29 changes: 0 additions & 29 deletions pages/dashboard/index.php

This file was deleted.

6 changes: 3 additions & 3 deletions pages/decision/DecisionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ protected function getBreadcrumb(Submission $submission, Context $context, Reque

return [
[
'id' => 'submissions',
'name' => __('navigation.submissions'),
'id' => 'dashboard',
'name' => __('navigation.dashboard'),
'url' => $dispatcher->url(
$request,
Application::ROUTE_PAGE,
$context->getData('urlPath'),
'submissions'
'dashboard'
),
],
[
Expand Down

0 comments on commit 803e31f

Please sign in to comment.