Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#1660 Customizable Reviewer Recommendations #4505

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions api/v1/contexts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@
* @brief Handle API requests for contexts (journals/presses).
*/

$urlParts = explode('/', trim($_SERVER['PATH_INFO'], '/'));

if (in_array('recommendations', $urlParts)) {
return new \PKP\handler\APIHandler(
new \PKP\API\v1\reviewers\recommendations\ReviewerRecommendationController()
);
}

return new \PKP\handler\APIHandler(new \PKP\API\v1\contexts\PKPContextController());
42 changes: 42 additions & 0 deletions classes/migration/install/ReviewerRecommendationsMigration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* @file classes/migration/install/ReviewerRecommendationsMigration.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class ReviewerRecommendationsMigration
*
* @brief Describe database table structures .
*/

namespace APP\migration\install;

class ReviewerRecommendationsMigration extends \PKP\migration\install\ReviewerRecommendationsMigration
{
/**
* @copydoc \PKP\migration\install\ReviewerRecommendationsMigratio::contextTable()
*/
public function contextTable(): string
{
return 'journals';
}

/**
* @copydoc \PKP\migration\install\ReviewerRecommendationsMigratio::settingTable()
*/
public function settingTable(): string
{
return 'journal_settings';
}

/**
* @copydoc \PKP\migration\install\ReviewerRecommendationsMigratio::contextPrimaryKey()
*/
public function contextPrimaryKey(): string
{
return 'journal_id';
}
}
29 changes: 29 additions & 0 deletions classes/migration/upgrade/v3_6_0/I1660_ReviewerRecommendations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* @file classes/migration/upgrade/v3_6_0/I1660_ReviewerRecommendations.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I1660_ReviewerRecommendations.php
*
* @brief Upgrade migration add recommendations
*
*/

namespace APP\migration\upgrade\v3_6_0;

use PKP\submission\reviewer\recommendation\ReviewerRecommendation;

class I1660_ReviewerRecommendations extends \PKP\migration\upgrade\v3_6_0\I1660_ReviewerRecommendations
{
/**
* @copydoc \PKP\migration\upgrade\v3_6_0\I1660_ReviewerRecommendations::systemDefineNonRemovableRecommendations()
*/
protected function systemDefineNonRemovableRecommendations(): array
{
return ReviewerRecommendation::seedableRecommendations();
}
}
1 change: 1 addition & 0 deletions dbscripts/xml/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

<migration class="APP\migration\install\OJSMigration" />

<migration class="APP\migration\install\ReviewerRecommendationsMigration" />
<migration class="PKP\migration\install\MetadataMigration" />
<migration class="PKP\migration\install\AnnouncementsMigration" />
<migration class="PKP\migration\install\CategoriesMigration" />
Expand Down
1 change: 1 addition & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
<migration class="APP\migration\upgrade\v3_5_0\I10620_EditorialBoardMemberRole"/>
<migration class="APP\migration\upgrade\v3_5_0\I9707_WeblateUILocales"/>
<note file="docs/release-notes/README-3.5.0" />
<migration class="APP\migration\upgrade\v3_6_0\I1660_ReviewerRecommendations"/>
</upgrade>

<!-- update plugin configuration - should be done as the final upgrade task -->
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 31 files
+219 −0 api/v1/reviewers/recommendations/ReviewerRecommendationController.php
+59 −0 api/v1/reviewers/recommendations/formRequests/AddReviewerRecommendation.php
+39 −0 api/v1/reviewers/recommendations/formRequests/EditReviewerRecommendation.php
+34 −0 api/v1/reviewers/recommendations/formRequests/UpdateStatusReviewerRecommendation.php
+37 −0 api/v1/reviewers/recommendations/resources/ReviewerRecommendationResource.php
+16 −4 classes/announcement/Announcement.php
+61 −0 classes/components/forms/context/ReviewerRecommendationForm.php
+126 −0 classes/components/listPanels/ReviewerRecommendationsListPanel.php
+5 −2 classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php
+4 −0 classes/core/PKPContainer.php
+1 −1 classes/mail/variables/ReviewAssignmentEmailVariable.php
+103 −0 classes/migration/install/ReviewerRecommendationsMigration.php
+151 −0 classes/migration/upgrade/v3_6_0/I1660_ReviewerRecommendations.php
+1 −0 classes/navigationMenu/NavigationMenuDAO.php
+24 −2 classes/services/PKPContextService.php
+5 −0 classes/services/PKPSchemaService.php
+1 −1 classes/statistics/PKPStatisticsHelper.php
+16 −0 classes/submission/reviewAssignment/Collector.php
+41 −33 classes/submission/reviewAssignment/ReviewAssignment.php
+5 −5 classes/submission/reviewer/form/PKPReviewerReviewStep3Form.php
+221 −0 classes/submission/reviewer/recommendation/ReviewerRecommendation.php
+20 −15 classes/user/Report.php
+1 −1 classes/userGroup/Repository.php
+2 −2 controllers/grid/users/reviewer/AuthorReviewerGridHandler.php
+3 −0 locale/en/api.po
+3 −0 locale/en/grid.po
+36 −0 locale/en/manager.po
+8 −9 pages/dashboard/PKPDashboardHandlerNext.php
+1 −0 pages/management/ManagementHandler.php
+1 −1 pages/stats/PKPStatsHandler.php
+8 −0 templates/management/workflow.tpl
33 changes: 33 additions & 0 deletions pages/management/SettingsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use APP\components\forms\context\AccessForm;
use APP\components\forms\context\ArchivingLockssForm;
use APP\template\TemplateManager;
use PKP\API\v1\reviewers\recommendations\resources\ReviewerRecommendationResource;
use PKP\components\forms\context\PKPContextStatisticsForm;
use PKP\components\forms\context\PKPDisableSubmissionsForm;
use PKP\components\forms\context\PKPDoiRegistrationSettingsForm;
Expand All @@ -29,11 +30,14 @@
use PKP\components\forms\context\PKPReviewGuidanceForm;
use PKP\components\forms\context\PKPReviewSetupForm;
use PKP\components\forms\context\PKPSearchIndexingForm;
use PKP\components\listPanels\ReviewerRecommendationsListPanel;
use PKP\core\PKPApplication;
use PKP\core\PKPRequest;
use PKP\pages\management\ManagementHandler;
use PKP\plugins\Hook;
use PKP\plugins\PluginRegistry;
use PKP\security\Role;
use PKP\submission\reviewer\recommendation\ReviewerRecommendation;

class SettingsHandler extends ManagementHandler
{
Expand Down Expand Up @@ -77,6 +81,35 @@ public function workflow($args, $request)
$templateMgr->display('management/workflow.tpl');
}

/**
* Add support for review related forms in workflow.
*/
protected function addReviewFormWorkflowSupport(PKPRequest $request): void
{
parent::addReviewFormWorkflowSupport($request);

$templateManager = TemplateManager::getManager($request);
$components = $templateManager->getState('components');

$context = $request->getContext();
$recommendations = ReviewerRecommendation::withContextId($context->getId())->get();

$reviewerRecommendationsListPanel = new ReviewerRecommendationsListPanel(
__('manager.reviewerRecommendations'),
$context,
$this->getSupportedFormLocales($context),
array_values(
ReviewerRecommendationResource::collection($recommendations)
->toArray(app()->get('request'))
),
ReviewerRecommendation::withContextId($context->getId())->count()
);

$components[$reviewerRecommendationsListPanel->id] = $reviewerRecommendationsListPanel->getConfig();
$templateManager->setState(['components' => $components]);
$templateManager->assign('hasCustomizableRecommendation', true);
}

/**
* Add the archive and payments tabs to the distribution settings page
*
Expand Down
2 changes: 1 addition & 1 deletion plugins/reports/reviewReport
8 changes: 1 addition & 7 deletions registry/uiLocaleKeysBackend.json
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,9 @@
"publication.version",
"publication.version.all",
"publication.version.confirm",
"reviewer.article.decision.accept",
"reviewer.article.decision.decline",
"reviewer.article.decision.pendingRevisions",
"reviewer.article.decision.resubmitElsewhere",
"reviewer.article.decision.resubmitHere",
"reviewer.article.decision.seeComments",
"reviewer.article.recommendation",
"reviewer.competingInterests",
"reviewer.recommendation.management.options",
"reviewer.submission.acceptedOn",
"reviewer.submission.responseDueDate",
"reviewer.submission.reviewDueDate",
Expand Down Expand Up @@ -494,7 +489,6 @@
"submission.list.revisionsSubmitted",
"submission.production",
"submission.publication",
"submission.recommendation",
"submission.review",
"submission.stage.externalReviewWithRound",
"submission.stage.internalReviewWithRound",
Expand Down
20 changes: 16 additions & 4 deletions templates/reviewer/review/reviewerRecommendations.tpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
{**
* templates/reviewer/review/reviewerRecommendations.tpl
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2003-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* Include reviewer recommendations for OJS review assignment responses.
*}

{fbvFormSection label="reviewer.article.recommendation" description=$description|default:"reviewer.article.selectRecommendation"}
{fbvElement type="select" id="recommendation" from=$reviewerRecommendationOptions selected=$reviewAssignment->getRecommendation() size=$fbvStyles.size.MEDIUM required=$required|default:true disabled=$readOnly}
{fbvFormSection
label="reviewer.article.recommendation"
description=$description|default:"reviewer.article.selectRecommendation"
}
{fbvElement
type="select"
id="recommendation"
from=$reviewerRecommendationOptions
selected=$reviewAssignment->getRecommendation()
size=$fbvStyles.size.MEDIUM
required=$required|default:true
disabled=$readOnly
translate=false
}
{/fbvFormSection}