Skip to content

Commit

Permalink
pkp/pkp-lib#7495 Separate OMP specific things to own controller, incl…
Browse files Browse the repository at this point in the history
…uding SubmissonFilters form
  • Loading branch information
jardakotesovec committed Oct 17, 2024
1 parent 65858d7 commit abbc624
Show file tree
Hide file tree
Showing 6 changed files with 448 additions and 2 deletions.
39 changes: 39 additions & 0 deletions classes/components/forms/dashboard/SubmissionFilters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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 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 $categories
) {
$this
->addPage(['id' => 'default', 'submitButton' => null])
->addGroup(['id' => 'default', 'pageId' => 'default'])
->addAssignedTo()
->addCategories()
->addDaysSinceLastActivity()
;
}


}
8 changes: 8 additions & 0 deletions js/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import PkpLoad from '../lib/pkp/js/load.js';
import Container from '@/components/Container/Container.vue';
import AdvancedSearchReviewerContainer from '@/components/Container/AdvancedSearchReviewerContainer.vue';
import Page from '@/components/Container/Page.vue';
import WorkflowPageOMP from '@/pages/workflow/WorkflowPageOMP.vue';

import AccessPage from '@/components/Container/AccessPage.vue';
import AddContextContainer from '@/components/Container/AddContextContainer.vue';
import AdminPage from '@/components/Container/AdminPage.vue';
Expand All @@ -35,6 +37,12 @@ import SubmissionWizardPage from '@/components/Container/SubmissionWizardPageOMP
import WorkflowPage from '@/components/Container/WorkflowPageOMP.vue';
import ManageCatalogPage from '@/components/Container/ManageCatalogPage.vue';

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



// Expose Vue, the registry and controllers in a global var
window.pkp = Object.assign(PkpLoad, window.pkp || {}, {
controllers: {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@
"singleQuote": true,
"useTabs": true,
"htmlWhitespaceSensitivity": "ignore",
"proseWrap": "never"
"proseWrap": "never",
"plugins": [
"prettier-plugin-tailwindcss"
]
},
"postcss": {
"plugins": {
Expand Down
85 changes: 85 additions & 0 deletions pages/dashboard/DashboardHandlerNext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?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\Request;
use APP\facades\Repo;
use APP\submission\Submission;
use APP\template\TemplateManager;
use PKP\decision\Decision;
use PKP\pages\dashboard\PKPDashboardHandlerNext;
use PKP\submissionFile\SubmissionFile;

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

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

$templateMgr->assign([
'pageComponent' => 'Page',
]);

$templateMgr->setConstants([
'DECISION_INTERNAL_REVIEW' => Decision::INTERNAL_REVIEW,
'DECISION_RECOMMEND_EXTERNAL_REVIEW' => Decision::RECOMMEND_EXTERNAL_REVIEW,
'DECISION_SKIP_INTERNAL_REVIEW' => Decision::SKIP_INTERNAL_REVIEW,
'DECISION_ACCEPT_INTERNAL' => Decision::ACCEPT_INTERNAL,
'DECISION_PENDING_REVISIONS_INTERNAL' => Decision::PENDING_REVISIONS_INTERNAL,
'DECISION_RESUBMIT_INTERNAL' => Decision::RESUBMIT_INTERNAL,
'DECISION_DECLINE_INTERNAL' => Decision::DECLINE_INTERNAL,
'DECISION_RECOMMEND_ACCEPT_INTERNAL' => Decision::RECOMMEND_ACCEPT_INTERNAL,
'DECISION_RECOMMEND_PENDING_REVISIONS_INTERNAL' => Decision::RECOMMEND_PENDING_REVISIONS_INTERNAL,
'DECISION_RECOMMEND_RESUBMIT_INTERNAL' => Decision::RECOMMEND_RESUBMIT_INTERNAL,
'DECISION_RECOMMEND_DECLINE_INTERNAL' => Decision::RECOMMEND_DECLINE_INTERNAL,
'DECISION_REVERT_INTERNAL_DECLINE' => Decision::REVERT_INTERNAL_DECLINE,
'DECISION_NEW_INTERNAL_ROUND' => Decision::NEW_INTERNAL_ROUND,
'DECISION_CANCEL_INTERNAL_REVIEW_ROUND' => Decision::CANCEL_INTERNAL_REVIEW_ROUND,

'SUBMISSION_FILE_INTERNAL_REVIEW_FILE' => SubmissionFile::SUBMISSION_FILE_INTERNAL_REVIEW_FILE,
'SUBMISSION_FILE_INTERNAL_REVIEW_REVISION' => SubmissionFile::SUBMISSION_FILE_INTERNAL_REVIEW_REVISION,

'WORK_TYPE_AUTHORED_WORK' => Submission::WORK_TYPE_AUTHORED_WORK,
'WORK_TYPE_EDITED_VOLUME' => Submission::WORK_TYPE_EDITED_VOLUME,

]);
}


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

return new SubmissionFilters(
$context,
$userRoles,
$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);
}
Loading

0 comments on commit abbc624

Please sign in to comment.