Skip to content

Commit

Permalink
I7495 submission listing (pkp#9815)
Browse files Browse the repository at this point in the history
* pkp#7495 Separate dashboard to separate pages, add missing data to schema

* pkp#7495 Add new locale keys
  • Loading branch information
jardakotesovec authored Apr 2, 2024
1 parent 52ff2ba commit c867c8c
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 64 deletions.
6 changes: 5 additions & 1 deletion classes/submission/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ public function getUrlSubmissionWizard(Context $context, ?int $submissionId = nu
/**
* Get all views, views count to be retrieved separately due to performance reasons
*/
public function getDashboardViews(Context $context, User $user): Collection
public function getDashboardViews(Context $context, User $user, array $selectedRoleIds = []): Collection
{
$types = DashboardView::getTypes()->flip();
$roleDao = DAORegistry::getDAO('RoleDAO'); /** @var RoleDAO $roleDao */
Expand All @@ -804,6 +804,10 @@ public function getDashboardViews(Context $context, User $user): Collection
foreach ($roles as $role) {
$roleIds[] = $role->getRoleId();
}
if($selectedRoleIds) {
$roleIds = array_values(array_intersect($roleIds, $selectedRoleIds));
}

$canAccessUnassignedSubmission = !empty(array_intersect([Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER], $roleIds));

$views = $this->mapDashboardViews($types, $context, $user, $canAccessUnassignedSubmission);
Expand Down
16 changes: 11 additions & 5 deletions classes/submission/maps/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,25 @@ protected function getPropertyReviewAssignments(Submission $submission): array

$request = Application::get()->getRequest();
$currentUser = $request->getUser();
$context = $request->getContext();
$due = is_null($reviewAssignment->getDateDue()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateDue()));
$responseDue = is_null($reviewAssignment->getDateResponseDue()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateResponseDue()));
$dateDue = is_null($reviewAssignment->getDateDue()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateDue()));
$dateResponseDue = is_null($reviewAssignment->getDateResponseDue()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateResponseDue()));
$dateConfirmed = is_null($reviewAssignment->getDateConfirmed()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateConfirmed()));
$dateCompleted = is_null($reviewAssignment->getDateCompleted()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateCompleted()));
$dateAssigned = is_null($reviewAssignment->getDateAssigned()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateAssigned()));

$reviews[] = [
'id' => (int) $reviewAssignment->getId(),
'isCurrentUserAssigned' => $currentUser->getId() == (int) $reviewAssignment->getReviewerId(),
'statusId' => (int) $reviewAssignment->getStatus(),
'status' => __($reviewAssignment->getStatusKey()),
'due' => $due,
'responseDue' => $responseDue,
'dateDue' => $dateDue,
'dateResponseDue' => $dateResponseDue,
'dateConfirmed' => $dateConfirmed,
'dateCompleted' => $dateCompleted,
'dateAssigned' => $dateAssigned,
'round' => (int) $reviewAssignment->getRound(),
'roundId' => (int) $reviewAssignment->getReviewRoundId(),
'recommendation' => $reviewAssignment->getRecommendation()
];
}

Expand Down
42 changes: 34 additions & 8 deletions classes/template/PKPTemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -975,11 +975,36 @@ public function setupBackendPage()

if ($request->getContext()) {
if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_REVIEWER, Role::ROLE_ID_AUTHOR], $userRoles))) {
$menu['submissions'] = [
'name' => __('navigation.submissions'),
'url' => $router->url($request, null, 'submissions'),
'isCurrent' => $router->getRequestedPage($request) === 'submissions',
];
if(Config::getVar('features', 'enable_new_submission_listing')) {
if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], $userRoles))) {
$menu['dashboards'] = [
'name' => __('navigation.dashboards'),
'url' => $router->url($request, null, 'dashboard', 'editorial'),
'isCurrent' => $router->getRequestedPage($request) === 'dashboards',
];
}
if(count(array_intersect([ Role::ROLE_ID_REVIEWER], $userRoles))) {
$menu['reviewAssignments'] = [
'name' => __('navigation.reviewAssignments'),
'url' => $router->url($request, null, 'dashboard', 'reviewAssignments'),
'isCurrent' => $router->getRequestedPage($request) === 'reviewAssignments',
];
}
if(count(array_intersect([ Role::ROLE_ID_AUTHOR], $userRoles))) {
$menu['mySubmissions'] = [
'name' => __('navigation.mySubmissions'),
'url' => $router->url($request, null, 'dashboard', 'mySubmissions'),
'isCurrent' => $router->getRequestedPage($request) === 'mySubmissions',
];
}
} else {
$menu['submissions'] = [
'name' => __('navigation.submissions'),
'url' => $router->url($request, null, 'submissions'),
'isCurrent' => $router->getRequestedPage($request) === 'submissions',
];

}
} elseif (count($userRoles) === 1 && in_array(Role::ROLE_ID_READER, $userRoles)) {
$menu['submit'] = [
'name' => __('author.submit'),
Expand Down Expand Up @@ -1206,7 +1231,7 @@ public function fetchJson($template, $status = true)
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
// Output global constants and locale keys used in new component library
$output = '';
$output = 'window.pkp = window.pkp || {};';
if (!empty($this->_constants)) {
$output .= 'pkp.const = ' . json_encode($this->_constants) . ';';
}
Expand All @@ -1217,7 +1242,8 @@ public function display($template = null, $cache_id = null, $compile_id = null,
$context = $request->getContext();

$pageContext = [
'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: 'index')
'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: 'index'),
'pageBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context?->getPath() ?: 'index') . '/'
];
$output .= 'pkp.context = ' . json_encode($pageContext) . ';';

Expand Down Expand Up @@ -1246,7 +1272,7 @@ public function display($template = null, $cache_id = null, $compile_id = null,
'pkpAppData',
$output,
[
'priority' => self::STYLE_SEQUENCE_LATE,
'priority' => self::STYLE_SEQUENCE_NORMAL,
'contexts' => ['backend'],
'inline' => true,
]
Expand Down
9 changes: 9 additions & 0 deletions locale/en/common.po
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,15 @@ msgstr "Step {$step}"
msgid "navigation.submissions"
msgstr "Submissions"

msgid "navigation.dashboards"
msgstr "Dashboards"

msgid "navigation.reviewAssignments"
msgstr "Review Assignments"

msgid "navigation.mySubmissions"
msgstr "My Submissions"

msgid "navigation.system"
msgstr "System"

Expand Down
75 changes: 75 additions & 0 deletions locale/en/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -2425,3 +2425,78 @@ msgstr "Competing Interests"

msgid "author.competingInterests.description"
msgstr "Please disclose any competing interests this author may have with the research subject."

msgid "submission.list.reviewAssignment.statusAwaitingResponse.title"
msgstr "Awaiting Response from the reviewer"

msgid "submission.list.reviewAssignment.statusAwaitingResponse.description"
msgstr "Review request has been shared with reviewer. Awaiting response in <b>{$days} days on {$date}</b>"

msgid "submission.list.reviewAssignment.statusDeclined.title"
msgstr "Review Request declined on {$date}"

msgid "submission.list.reviewAssignment.statusDeclined.description"
msgstr "Reviewer declined the review request on <b>{$date}</b>"

msgid "submission.list.reviewAssignment.statusResponseOverdue.title"
msgstr "Review Request overdue by {$days} days"

msgid "submission.list.reviewAssignment.statusResponseOverdue.description"
msgstr "This reviewer has not responded to the review request. A response was due on <b>{$date}</b>"

msgid "submission.list.reviewAssignment.statusAccepted.title"
msgstr "Ongoing review - request accepted"

msgid "submission.list.reviewAssignment.statusAccepted.description"
msgstr "This reviewer has accepted the review request. Their review is due in <b>{$days} days on {$date}.</b>"

msgid "submission.list.reviewAssignment.statusReviewOverdue.title"
msgstr "Review overdue by {$days} days"

msgid "submission.list.reviewAssignment.statusReviewOverdue.description"
msgstr "This reviewer has not completed their review. A response was due on <b>{$date}.</b>"

msgid "submission.list.reviewAssignment.statusReceived.title"
msgstr "Review completed on {$date}"

msgid "submission.list.reviewAssignment.statusReceived.description"
msgstr "The review was completed on {$date} with the following recommendation: <b>{$recommendation}</b>"

msgid "submission.list.reviewAssignment.statusComplete.title"
msgstr "Review was confirmed by editor"

msgid "submission.list.reviewAssignment.statusComplete.description"
msgstr "The review was accepted by the editor on {$date}.</b>"

msgid "submission.list.reviewAssignment.statusCancelled.title"
msgstr "Reviewer cancelled review request"

msgid "submission.list.reviewAssignment.statusCancelled.description"
msgstr "Reviewer has cancelled the review request on <b>{$date}</b>"

msgid "submission.list.reviewAssignment.statusRequestResend.title"
msgstr "Awaiting Response from the reviewer"

msgid "submission.list.reviewAssignment.statusRequestResend.description"
msgstr "Review request has been reshared with reviewer. Awaiting response in {$days} days on {$date}"

msgid "submission.list.reviewAssignment.action.viewDetails"
msgstr "View details"

msgid "submission.list.reviewAssignment.action.resendReviewRequest"
msgstr "Resend Review Request"

msgid "submission.list.reviewAssignment.action.cancelReviewer"
msgstr "Cancel Reviewer"

msgid "submission.list.reviewAssignment.action.unassignReviewer"
msgstr "Unassign"

msgid "submission.list.reviewAssignment.action.editDueDate"
msgstr "Edit Due Date"

msgid "submission.list.reviewAssignment.action.viewRecommendation"
msgstr "View recommendation"

msgid "submission.list.reviewAssignment.action.viewUnreadRecommendation"
msgstr "View unread recommendation"
Loading

0 comments on commit c867c8c

Please sign in to comment.