-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp/pkp-lib#7495 Move OJS specific items for dashboard to own handler
pkp/pkp-lib#7495 PHP formatting
- Loading branch information
1 parent
4fadada
commit 99c2e30
Showing
6 changed files
with
184 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | ||
])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters