Skip to content

Commit

Permalink
pkp/pkp-lib#7495 Move OJS specific items for dashboard to own handler
Browse files Browse the repository at this point in the history
pkp/pkp-lib#7495 PHP formatting
  • Loading branch information
jardakotesovec committed Oct 17, 2024
1 parent 4fadada commit 99c2e30
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 7 deletions.
54 changes: 54 additions & 0 deletions classes/components/forms/dashboard/SubmissionFilters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* @file classes/components/form/dashboard/SubmissionFilters.php
*
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2000-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SubmissionFilters
*
* @ingroup classes_controllers_form
*
* @brief A preset form to add and remove filters in the submissions dashboard
*/

namespace APP\components\forms\dashboard;

use APP\components\forms\FieldSelectIssues;
use APP\core\Application;
use Illuminate\Support\LazyCollection;
use PKP\components\forms\dashboard\PKPSubmissionFilters;
use PKP\context\Context;

class SubmissionFilters extends PKPSubmissionFilters
{
public function __construct(
public Context $context,
public array $userRoles,
public LazyCollection $sections,
public LazyCollection $categories
) {
$this
->addPage(['id' => 'default', 'submitButton' => null])
->addGroup(['id' => 'default', 'pageId' => 'default'])
->addSectionFields()
->addAssignedTo()
->addIssues()
->addCategories()
->addDaysSinceLastActivity()
;
}

protected function addIssues(): self
{
$request = Application::get()->getRequest();

return $this->addField(new FieldSelectIssues('issueIds', [
'groupId' => 'default',
'label' => __('issue.issues'),
'value' => [],
'apiUrl' => $request->getDispatcher()->url($request, Application::ROUTE_API, $request->getContext()->getPath(), 'issues'),
]));
}
}
4 changes: 3 additions & 1 deletion cypress/tests/data/60-content/AmwandengaSubmission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ describe('Data suite: Amwandenga', function() {
cy.get('button').contains('Create New Version').click();
cy.contains('Are you sure you want to create a new version?');
cy.get('div[role=dialog]:contains("Create New Version")').get('button').contains('Yes').click();
cy.wait(3000);

// Once there is 'in progress' overlay when creating new version this can be improved
cy.wait(10000);

// Toggle between versions
cy.get('button').contains('All Versions').click();
Expand Down
6 changes: 6 additions & 0 deletions js/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import Container from '@/components/Container/Container.vue';
import AdvancedSearchReviewerContainer from '@/components/Container/AdvancedSearchReviewerContainer.vue';
import Page from '@/components/Container/Page.vue';
import PageOJS from '@/components/Container/PageOJS.vue';
import WorkflowPageOJS from '@/pages/workflow/WorkflowPageOJS.vue';

import AccessPage from '@/components/Container/AccessPage.vue';
import AddContextContainer from '@/components/Container/AddContextContainer.vue';
import AdminPage from '@/components/Container/AdminPage.vue';
Expand All @@ -36,6 +38,10 @@ import SubmissionWizardPage from '@/components/Container/SubmissionWizardPage.vu
import WorkflowPage from '@/components/Container/WorkflowPageOJS.vue';
import DashboardPage from '@/pages/dashboard/DashboardPage.vue';

// Helper for initializing and tracking Vue controllers
import VueRegistry from '../lib/pkp/js/classes/VueRegistry.js';
VueRegistry.registerComponent('WorkflowPage', WorkflowPageOJS);

// Expose Vue, the registry and controllers in a global var
window.pkp = Object.assign(PkpLoad, window.pkp || {}, {
controllers: {
Expand Down
74 changes: 74 additions & 0 deletions pages/dashboard/DashboardHandlerNext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
/**
* @file pages/dashboard/DashboardHandlerNext.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class DashboardHandlerNext
*
* @ingroup pages_dashboard
*
* @brief Handle requests for user's dashboard.
*/

namespace APP\pages\dashboard;

use APP\components\forms\dashboard\SubmissionFilters;
use APP\core\Application;
use APP\core\Request;
use APP\facades\Repo;
use APP\template\TemplateManager;
use PKP\pages\dashboard\PKPDashboardHandlerNext;

class_exists(\APP\components\forms\publication\AssignToIssueForm::class); // Force define of FORM_ASSIGN_TO_ISSUE

class DashboardHandlerNext extends PKPDashboardHandlerNext
{
/**
* Setup variables for the template
*
* @param Request $request
*/
public function setupIndex($request)
{
parent::setupIndex($request);

$templateMgr = TemplateManager::getManager($request);

// OJS specific, might need to be adjusted for OMP/OPS
$context = $request->getContext();

$paymentManager = Application::get()->getPaymentManager($context);

$pageInitConfig = $templateMgr->getState('pageInitConfig');
$pageInitConfig['publicationSettings']['submissionPaymentsEnabled'] = $paymentManager->publicationEnabled();
$templateMgr->setState(['pageInitConfig' => $pageInitConfig]);

$templateMgr->setConstants([
'FORM_ASSIGN_TO_ISSUE' => FORM_ASSIGN_TO_ISSUE
]);
}


protected function getSubmissionFiltersForm($userRoles, $context)
{
$sections = Repo::section()
->getCollector()
->filterByContextIds([$context->getId()])
->getMany();

$categories = Repo::category()
->getCollector()
->filterByContextIds([$context->getId()])
->getMany();

return new SubmissionFilters(
$context,
$userRoles,
$sections,
$categories
);
}
}
29 changes: 29 additions & 0 deletions pages/dashboard/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* @defgroup pages_submissions Submissions editorial page
*/

/**
* @file lib/pkp/pages/dashboard/index.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @ingroup pages_submissions
*
* @brief Handle requests for submissions functions.
*
*/


switch ($op) {
case 'index':
case 'editorial':
return new APP\pages\dashboard\DashboardHandlerNext(PKP\pages\dashboard\DashboardPage::EditorialDashboard);
case 'mySubmissions':
return new APP\pages\dashboard\DashboardHandlerNext(PKP\pages\dashboard\DashboardPage::MySubmissions);
case 'reviewAssignments':
return new APP\pages\dashboard\DashboardHandlerNext(PKP\pages\dashboard\DashboardPage::MyReviewAssignments);
}
24 changes: 18 additions & 6 deletions registry/uiLocaleKeysBackend.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
"common.pagination.next",
"common.pagination.previous",
"common.payments",
"common.preview",
"common.publication",
"common.publications",
"common.remove",
"common.removeItem",
Expand Down Expand Up @@ -162,16 +164,13 @@
"dashboard.stage.scheduledForPublication",
"dashboard.stage.submission",
"dashboard.submitRevisions",
"dashboard.summary.assignToIssue",
"dashboard.summary.copyeditedFiles",
"dashboard.summary.copyeditedFilesDescription",
"dashboard.summary.deskReviewFiles",
"dashboard.summary.deskReviewFilesDescription",
"dashboard.summary.draftFiles",
"dashboard.summary.draftFilesDescription",
"dashboard.summary.filesForReview",
"dashboard.summary.issueNo",
"dashboard.summary.notAssigned",
"dashboard.summary.preview",
"dashboard.summary.productionReadyFiles",
"dashboard.summary.productionReadyFilesDescription",
Expand All @@ -181,6 +180,7 @@
"dashboard.summary.reviewers",
"dashboard.summary.revisionsUploaded",
"dashboard.summary.revisionsUploadedDescription",
"dashboard.workflow.reviewRoundN",
"doi.manager.versions.countStatement",
"doi.manager.versions.modalTitle",
"doi.manager.versions.view",
Expand Down Expand Up @@ -220,6 +220,7 @@
"editor.submission.decision.decline",
"editor.submission.decision.requestRevisions",
"editor.submission.decision.sendExternalReview",
"editor.submission.decision.sendInternalReview",
"editor.submission.decision.sendToProduction",
"editor.submission.decision.skipReview",
"editor.submission.editStageParticipant",
Expand Down Expand Up @@ -271,6 +272,8 @@
"grid.action.order",
"grid.action.saveOrdering",
"grid.action.sort",
"grid.catalogEntry.publicationDates",
"grid.catalogEntry.representatives",
"grid.columns.actions",
"grid.libraryFiles.submission.title",
"grid.noItems",
Expand Down Expand Up @@ -350,6 +353,7 @@
"manager.mailables.templates",
"manager.publication.reviewStage",
"manager.workflow",
"monograph.audience",
"navigation.backTo",
"notification.type.roundStatusTitle",
"orcid.field.authorEmailModal.message",
Expand All @@ -360,6 +364,7 @@
"orcid.field.verification.request",
"orcid.field.verification.requested",
"orcid.field.verification.resendRequest",
"publication.catalogEntry",
"publication.contributors",
"publication.createVersion",
"publication.editDisabled",
Expand Down Expand Up @@ -420,6 +425,7 @@
"reviewer.submission.submittedOn",
"search.searchResults",
"semicolon",
"settings.libraryFiles.category.marketing",
"stageParticipants.notify.message",
"stats.context.downloadReport.description",
"stats.context.downloadReport.downloadContext",
Expand All @@ -442,6 +448,7 @@
"stats.timeline",
"stats.timeline.downloadReport.downloadTimeline",
"submission.changeFile",
"submission.chapters",
"submission.citations",
"submission.contributors",
"submission.files",
Expand All @@ -451,6 +458,8 @@
"submission.layout.galleys",
"submission.layout.newGalley",
"submission.list.assignEditor",
"submission.list.changeSubmissionLanguage.buttonLabel",
"submission.list.changeSubmissionLanguage.currentLanguage",
"submission.list.changeSubmissionLanguage.metadataDescription.abstract",
"submission.list.changeSubmissionLanguage.metadataDescription.title",
"submission.list.changeSubmissionLanguage.title",
Expand All @@ -469,18 +478,19 @@
"submission.list.reviewerWorkflowLink",
"submission.list.reviewsCompleted",
"submission.list.revisionsSubmitted",
"submission.metadata",
"submission.publication",
"submission.publicationFormats",
"submission.recommendation",
"submission.review",
"submission.stageParticipants.notify",
"submission.status",
"submission.submit.newSubmissionSingle",
"submission.submit.uploadSubmissionFile",
"submission.upload.percentComplete",
"submission.upload.productionReady",
"submission.upload.proof",
"submission.versions",
"submission.wizard.changeSubmission",
"submission.workflowType.editedVolume.label",
"submissions.declined",
"submissions.incomplete",
"todo",
Expand All @@ -504,5 +514,7 @@
"userInvitation.roleTable.role",
"userInvitation.roleTable.startDate",
"userInvitation.usernameField.description",
"validator.required"
"validator.required",
"workflow.review.externalReview",
"workflow.review.internalReview"
]

0 comments on commit 99c2e30

Please sign in to comment.