Skip to content

Commit

Permalink
Merge pull request #1484 from Vitaliy-1/i8887_views_counts
Browse files Browse the repository at this point in the history
pkp/pkp-lib#8887 Implement dashboard views
  • Loading branch information
Vitaliy-1 authored Nov 13, 2023
2 parents 32a821d + b8f7c61 commit 25307b0
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
9 changes: 4 additions & 5 deletions classes/decision/types/traits/InInternalReviewRound.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
use PKP\components\fileAttachers\ReviewFiles;
use PKP\components\fileAttachers\Upload;
use PKP\context\Context;
use PKP\db\DAORegistry;
use PKP\decision\types\traits\WithReviewAssignments;
use PKP\submission\reviewAssignment\ReviewAssignmentDAO;
use PKP\submission\reviewRound\ReviewRound;
use PKP\submissionFile\SubmissionFile;

Expand Down Expand Up @@ -79,9 +77,10 @@ protected function getFileAttachers(Submission $submission, Context $context, ?R
];

if ($reviewRound) {
/** @var ReviewAssignmentDAO $reviewAssignmentDAO */
$reviewAssignmentDAO = DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignments = $reviewAssignmentDAO->getByReviewRoundId($reviewRound->getId());
$reviewAssignments = Repo::reviewAssignment()->getCollector()
->filterByReviewRoundIds([$reviewRound->getId()])
->getMany()
->toArray();
$reviewerFiles = [];
if (!empty($reviewAssignments)) {
$reviewerFiles = Repo::submissionFile()->getCollector()
Expand Down
6 changes: 6 additions & 0 deletions classes/facades/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use APP\submission\Repository as SubmissionRepository;
use APP\submissionFile\Repository as SubmissionFileRepository;
use APP\user\Repository as UserRepository;
use PKP\submission\reviewAssignment\Repository as ReviewAssignmentRepository;

class Repo extends \PKP\facades\Repo
{
Expand Down Expand Up @@ -70,4 +71,9 @@ public static function mailable(): MailRepository
{
return app(MailRepository::class);
}

public static function reviewAssignment(): ReviewAssignmentRepository
{
return app(ReviewAssignmentRepository::class);
}
}
5 changes: 5 additions & 0 deletions classes/submission/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,9 @@ public function getQueryBuilder(): Builder

return $q;
}

protected function getReviewStages(): array
{
return [WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, WORKFLOW_STAGE_ID_INTERNAL_REVIEW];
}
}
25 changes: 25 additions & 0 deletions classes/submission/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@
use APP\press\PressDAO;
use APP\publicationFormat\PublicationFormat;
use APP\publicationFormat\PublicationFormatDAO;
use Illuminate\Support\Collection;
use PKP\context\Context;
use PKP\db\DAORegistry;
use PKP\doi\exceptions\DoiException;
use PKP\security\Role;
use PKP\submission\DashboardView;
use PKP\submission\PKPSubmission;
use PKP\submissionFile\SubmissionFile;
use PKP\user\User;

class Repository extends \PKP\submission\Repository
{
Expand Down Expand Up @@ -131,4 +137,23 @@ public function createDois(Submission $submission): array

return $doiCreationFailures;
}

protected function mapDashboardViews($types, Context $context, User $user, bool $canAccessUnassignedSubmission): Collection
{
$views = parent::mapDashboardViews($types, $context, $user, $canAccessUnassignedSubmission);

$collector = Repo::submission()->getCollector()
->filterByContextIds([$context->getId()])
->filterByStageIds([WORKFLOW_STAGE_ID_INTERNAL_REVIEW])
->filterByStatus([PKPSubmission::STATUS_QUEUED]);

return $views->put(DashboardView::TYPE_REVIEW_INTERNAL, new DashboardView(
DashboardView::TYPE_REVIEW_INTERNAL,
__('submission.dashboard.view.reviewInternal'),
[Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT],
$canAccessUnassignedSubmission ? $collector : $collector->assignedTo([$user->getId()]),
$canAccessUnassignedSubmission ? null : 'assigned',
['stageIds' => [WORKFLOW_STAGE_ID_INTERNAL_REVIEW], 'status' => [PKPSubmission::STATUS_QUEUED]]
));
}
}
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 63 files
+166 −9 api/v1/_submissions/PKPBackendSubmissionsController.php
+7 −5 api/v1/submissions/PKPSubmissionController.php
+6 −0 classes/components/forms/context/PKPReviewSetupForm.php
+17 −23 classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php
+0 −1 classes/core/PKPApplication.php
+4 −2 classes/decision/types/CancelReviewRound.php
+8 −5 classes/decision/types/traits/InExternalReviewRound.php
+8 −9 classes/decision/types/traits/NotifyReviewers.php
+6 −5 classes/decision/types/traits/WithReviewAssignments.php
+2 −5 classes/invitation/invitations/ReviewerAccessInvite.php
+2 −4 classes/log/event/EventLogEntry.php
+3 −7 classes/notification/PKPNotificationManager.php
+2 −5 classes/security/authorization/ReviewAssignmentFileWritePolicy.php
+2 −4 classes/security/authorization/internal/QueryUserAccessibleWorkflowStageRequiredPolicy.php
+6 −5 classes/security/authorization/internal/ReviewAssignmentAccessPolicy.php
+2 −4 classes/security/authorization/internal/ReviewAssignmentRequiredPolicy.php
+2 −3 classes/security/authorization/internal/SubmissionFileAssignedReviewerAccessPolicy.php
+2 −4 classes/security/authorization/internal/SubmissionFileAuthorEditorPolicy.php
+2 −4 classes/security/authorization/internal/SubmissionFileStageRequiredPolicy.php
+207 −10 classes/submission/Collector.php
+3 −3 classes/submission/DAO.php
+131 −0 classes/submission/DashboardView.php
+316 −3 classes/submission/Repository.php
+29 −0 classes/submission/ViewsCount.php
+25 −26 classes/submission/action/EditorAction.php
+7 −8 classes/submission/maps/Schema.php
+335 −0 classes/submission/reviewAssignment/Collector.php
+179 −0 classes/submission/reviewAssignment/DAO.php
+262 −0 classes/submission/reviewAssignment/Repository.php
+2 −4 classes/submission/reviewAssignment/ReviewAssignment.php
+0 −676 classes/submission/reviewAssignment/ReviewAssignmentDAO.php
+96 −0 classes/submission/reviewAssignment/maps/Schema.php
+5 −4 classes/submission/reviewRound/ReviewRound.php
+6 −8 classes/submission/reviewer/ReviewerAction.php
+7 −19 classes/submission/reviewer/form/PKPReviewerReviewStep3Form.php
+2 −5 classes/submission/reviewer/form/ReviewerReviewForm.php
+2 −3 classes/submissionFile/DAO.php
+5 −12 classes/task/ReviewReminder.php
+3 −5 classes/user/Repository.php
+2 −5 controllers/grid/eventLog/EventLogGridCellProvider.php
+1 −4 controllers/grid/eventLog/EventLogGridRow.php
+1 −5 controllers/grid/files/attachment/ReviewerReviewAttachmentGridDataProvider.php
+1 −3 controllers/grid/notifications/NotificationsGridCellProvider.php
+8 −6 controllers/grid/queries/form/QueryForm.php
+3 −5 controllers/grid/settings/reviewForms/ReviewFormGridHandler.php
+8 −3 controllers/grid/users/reviewer/AuthorReviewerGridHandler.php
+7 −6 controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php
+13 −10 controllers/grid/users/reviewer/form/EditReviewForm.php
+3 −5 controllers/grid/users/reviewer/form/ReinstateReviewerForm.php
+5 −7 controllers/grid/users/reviewer/form/ResendRequestReviewerForm.php
+3 −6 controllers/grid/users/reviewer/form/ReviewReminderForm.php
+22 −15 controllers/grid/users/reviewer/form/ReviewerForm.php
+5 −10 controllers/grid/users/reviewer/form/ThankReviewerForm.php
+2 −6 controllers/grid/users/reviewer/form/UnassignReviewerForm.php
+9 −6 controllers/grid/users/stageParticipant/form/AddParticipantForm.php
+8 −3 controllers/tab/authorDashboard/AuthorDashboardReviewRoundTabHandler.php
+1 −5 controllers/wizard/fileUpload/form/PKPSubmissionFilesUploadBaseForm.php
+6 −0 locale/en/api.po
+6 −0 locale/en/manager.po
+65 −0 locale/en/submission.po
+6 −136 pages/dashboard/DashboardHandlerNext.php
+9 −1 schemas/context.json
+224 −0 schemas/reviewAssignment.json
3 changes: 3 additions & 0 deletions locale/en/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,6 @@ msgstr ""
"Please provide all of the chapters of this submission. If you are submitting "
"an edited volume, please make sure that each chapter indicates the "
"contributors for that chapter."

msgid "submission.dashboard.view.reviewInternal"
msgstr "All in internal review"
2 changes: 1 addition & 1 deletion plugins/reports/reviewReport

0 comments on commit 25307b0

Please sign in to comment.