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#5885 Review remainder update #9612

Merged
merged 23 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6553659
pkp/pkp-lib#5885 Review remainder update
touhidurabir Jan 11, 2024
1c6b007
pkp/pkp-lib#5885 Review remainder update issues fixed
touhidurabir Jan 29, 2024
4634d89
pkp/pkp-lib#5885 typo fixed
touhidurabir Jan 29, 2024
763efa1
pkp/pkp-lib#5885 update remainder calculation
touhidurabir Feb 16, 2024
b5f216f
pkp/pkp-lib#5885 removed unnecessary select from migration
touhidurabir Feb 18, 2024
9534d0b
pkp/pkp-lib#5885 updated and added new from component to handle reminder
touhidurabir Feb 28, 2024
10c5684
pkp/pkp-lib#5885 removed unnecessary fields and controls with field r…
touhidurabir Mar 14, 2024
1c252e1
pkp/pkp-lib#5885 updated using new slider component
touhidurabir Apr 15, 2024
9eabe38
pkp/pkp-lib#5885 updated job class properties to public
touhidurabir Apr 19, 2024
88250e1
pkp/pkp-lib#5885 updated date validation rules to enum
touhidurabir Apr 22, 2024
7644c86
pkp/pkp-lib#5885 fixed displaying error on date comparison validation…
touhidurabir Apr 23, 2024
3c6e156
pkp/pkp-lib#5885 test added for queue job
touhidurabir Apr 24, 2024
25881f3
pkp/pkp-lib#5885 added mocked context service and context class for j…
touhidurabir Apr 28, 2024
c87ff62
pkp/pkp-lib#5885 added context checking first if available to resolve…
touhidurabir May 2, 2024
2f3f023
pkp/pkp-lib#5885 job test update
touhidurabir May 24, 2024
a10b50a
pkp/pkp-lib#5885 job test update
touhidurabir Jun 13, 2024
8b0ff12
pkp/pkp-lib#5885 removed mistakenly pulled BaseInvitation during rebase
touhidurabir Jun 13, 2024
182d711
pkp/pkp-lib#5885 updated job and test based on new inviation function…
touhidurabir Jun 13, 2024
2391787
pkp/pkp-lib#5885 updated task
touhidurabir Jun 30, 2024
0c1cc5d
pkp/pkp-lib#5885 translation update
touhidurabir Jul 25, 2024
f77d1e6
pkp/pkp-lib#5885 tests updated and removed reference of deprecated Se…
touhidurabir Aug 14, 2024
98a5db2
pkp/pkp-lib#5885 test update
touhidurabir Aug 14, 2024
e967484
pkp/pkp-lib#5885 test update
touhidurabir Aug 30, 2024
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
15 changes: 3 additions & 12 deletions classes/components/forms/FieldSlider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,20 @@ class FieldSlider extends Field
/** @copydoc Field::$component */
public $component = 'field-slider';


/**
* Range min value
*
* @var int|float
*/
public $min;
public int|float $min;

/**
* Range max value
*
* @var int|float
*/
public $max;
public int|float $max;

/**
* Range step value
*
* @var int|float
*/
public $step = 1;
public int|float $step = 1;

/**
* Label for min value, it displays actual value when not present
Expand All @@ -67,8 +60,6 @@ class FieldSlider extends Field
*/
public ?string $valueLabelMax = null;



/**
* @copydoc Field::getConfig()
*/
Expand Down
125 changes: 100 additions & 25 deletions classes/components/forms/context/PKPReviewSetupForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* @file classes/components/form/context/PKPReviewSetupForm.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* 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 PKPReviewSetupForm
Expand All @@ -17,10 +17,11 @@
namespace PKP\components\forms\context;

use PKP\components\forms\FieldHTML;
use PKP\context\Context;
use PKP\components\forms\FieldOptions;
use PKP\components\forms\FieldSlider;
use PKP\components\forms\FieldText;
use PKP\components\forms\FormComponent;
use PKP\config\Config;
use PKP\submission\reviewAssignment\ReviewAssignment;

class PKPReviewSetupForm extends FormComponent
Expand All @@ -29,6 +30,12 @@ class PKPReviewSetupForm extends FormComponent
public $id = self::FORM_REVIEW_SETUP;
public $method = 'PUT';

protected const REVIEW_SETTINGS_GROUP = 'reviewSettingsGroup';
protected const REVIEW_REMINDER_GROUP = 'reviewReminderGroup';

public const MIN_REMINDER_NOTIFICATION_SEND_IN_DAYS = 0;
public const MAX_REMINDER_NOTIFICATION_SEND_IN_DAYS = 14;

/**
* Constructor
*
Expand All @@ -41,23 +48,39 @@ public function __construct($action, $locales, $context)
$this->action = $action;
$this->locales = $locales;

$this->addField(new FieldOptions('defaultReviewMode', [
'label' => __('manager.setup.reviewOptions.reviewMode'),
'type' => 'radio',
'value' => $context->getData('defaultReviewMode'),
'options' => [
['value' => ReviewAssignment::SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS, 'label' => __('editor.submissionReview.doubleAnonymous')],
['value' => ReviewAssignment::SUBMISSION_REVIEW_METHOD_ANONYMOUS, 'label' => __('editor.submissionReview.anonymous')],
['value' => ReviewAssignment::SUBMISSION_REVIEW_METHOD_OPEN, 'label' => __('editor.submissionReview.open')],
],
]))
$this
->addDefaultFields($context)
->addReminderFields($context);
}

/**
* Add the default review control fields
*/
protected function addDefaultFields(Context $context): static
{
$this
->addGroup([
'id' => self::REVIEW_SETTINGS_GROUP
])
->addField(new FieldOptions('defaultReviewMode', [
'label' => __('manager.setup.reviewOptions.reviewMode'),
'type' => 'radio',
'value' => $context->getData('defaultReviewMode'),
'options' => [
['value' => ReviewAssignment::SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS, 'label' => __('editor.submissionReview.doubleAnonymous')],
['value' => ReviewAssignment::SUBMISSION_REVIEW_METHOD_ANONYMOUS, 'label' => __('editor.submissionReview.anonymous')],
['value' => ReviewAssignment::SUBMISSION_REVIEW_METHOD_OPEN, 'label' => __('editor.submissionReview.open')],
],
'groupId' => self::REVIEW_SETTINGS_GROUP,
]))
->addField(new FieldOptions('restrictReviewerFileAccess', [
'label' => __('manager.setup.reviewOptions.restrictReviewerFileAccess'),
'type' => 'checkbox',
'value' => $context->getData('restrictReviewerFileAccess'),
'options' => [
['value' => true, 'label' => __('manager.setup.reviewOptions.restrictReviewerFileAccess.description')],
]
],
'groupId' => self::REVIEW_SETTINGS_GROUP,
]))
->addField(new FieldOptions('reviewerAccessKeysEnabled', [
'label' => __('manager.setup.reviewOptions.reviewerAccessKeysEnabled'),
Expand All @@ -66,37 +89,89 @@ public function __construct($action, $locales, $context)
'value' => $context->getData('reviewerAccessKeysEnabled'),
'options' => [
['value' => true, 'label' => __('manager.setup.reviewOptions.reviewerAccessKeysEnabled.label')],
]
],
'groupId' => self::REVIEW_SETTINGS_GROUP,
]))
->addField(new FieldText('numWeeksPerResponse', [
'label' => __('manager.setup.reviewOptions.defaultReviewResponseTime'),
'description' => __('manager.setup.reviewOptions.numWeeksPerResponse'),
'value' => $context->getData('numWeeksPerResponse'),
'size' => 'small',
'groupId' => self::REVIEW_SETTINGS_GROUP,
]))
->addField(new FieldText('numWeeksPerReview', [
'label' => __('manager.setup.reviewOptions.defaultReviewCompletionTime'),
'description' => __('manager.setup.reviewOptions.numWeeksPerReview'),
'value' => $context->getData('numWeeksPerReview'),
'size' => 'small',
'groupId' => self::REVIEW_SETTINGS_GROUP,
]))
->addField(new FieldText('numReviewersPerSubmission', [
'label' => __('manager.setup.reviewOptions.numReviewersPerSubmission'),
'description' => __('manager.setup.reviewOptions.numReviewersPerSubmission.description'),
'value' => $context->getData('numReviewersPerSubmission'),
'size' => 'small',
'groupId' => self::REVIEW_SETTINGS_GROUP,
]));

return $this;
}

/**
* Add the review reminder control fields
*/
protected function addReminderFields(Context $context): static
{
$this
->addGroup([
'id' => self::REVIEW_REMINDER_GROUP,
])
->addField(new FieldHTML('reminderForReview', [
'label' => __('manager.setup.reviewOptions.reminders'),
'description' => __('manager.setup.reviewOptions.reminders.description'),
'groupId' => self::REVIEW_REMINDER_GROUP,
]))
->addField(new FieldText('numDaysBeforeInviteReminder', [
'label' => __('manager.setup.reviewOptions.reminders.response'),
'description' => __('manager.setup.reviewOptions.reminders.response.description'),
'value' => $context->getData('numDaysBeforeInviteReminder'),
'size' => 'small',
->addField(new FieldSlider('numDaysBeforeReviewResponseReminderDue', [
'label' => __('manager.setup.reviewOptions.reminders.response.before'),
'value' => $context->getData('numDaysBeforeReviewResponseReminderDue'),
'min' => static::MIN_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'max' => static::MAX_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'minLabel' => __('manager.setup.reviewOptions.reminders.min.label'),
'valueLabel' => __('manager.setup.reviewOptions.reminders.label.before.days'),
'valueLabelMin' => __('manager.setup.reviewOptions.reminders.disbale.label'),
'groupId' => self::REVIEW_REMINDER_GROUP,
]))
->addField(new FieldText('numDaysBeforeSubmitReminder', [
'label' => __('manager.setup.reviewOptions.reminders.submit'),
'description' => __('manager.setup.reviewOptions.reminders.submit.description'),
'value' => $context->getData('numDaysBeforeSubmitReminder'),
'size' => 'small',
->addField(new FieldSlider('numDaysAfterReviewResponseReminderDue', [
'label' => __('manager.setup.reviewOptions.reminders.response.after'),
'value' => $context->getData('numDaysAfterReviewResponseReminderDue'),
'min' => static::MIN_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'max' => static::MAX_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'minLabel' => __('manager.setup.reviewOptions.reminders.min.label'),
'valueLabel' => __('manager.setup.reviewOptions.reminders.label.after.days'),
'valueLabelMin' => __('manager.setup.reviewOptions.reminders.disbale.label'),
'groupId' => self::REVIEW_REMINDER_GROUP,
]))
->addField(new FieldSlider('numDaysBeforeReviewSubmitReminderDue', [
'label' => __('manager.setup.reviewOptions.reminders.submit.before'),
'value' => $context->getData('numDaysBeforeReviewSubmitReminderDue'),
'min' => static::MIN_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'max' => static::MAX_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'minLabel' => __('manager.setup.reviewOptions.reminders.min.label'),
'valueLabel' => __('manager.setup.reviewOptions.reminders.label.before.days'),
'valueLabelMin' => __('manager.setup.reviewOptions.reminders.disbale.label'),
'groupId' => self::REVIEW_REMINDER_GROUP,
]))
->addField(new FieldSlider('numDaysAfterReviewSubmitReminderDue', [
'label' => __('manager.setup.reviewOptions.reminders.submit.after'),
'value' => $context->getData('numDaysAfterReviewSubmitReminderDue'),
'min' => static::MIN_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'max' => static::MAX_REMINDER_NOTIFICATION_SEND_IN_DAYS,
'minLabel' => __('manager.setup.reviewOptions.reminders.min.label'),
'valueLabel' => __('manager.setup.reviewOptions.reminders.label.after.days'),
'valueLabelMin' => __('manager.setup.reviewOptions.reminders.disbale.label'),
'groupId' => self::REVIEW_REMINDER_GROUP,
]));

return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,16 @@ public function updateReviewer($args, $request)
// Form handling
$reviewerForm = new $formClassName($this->getSubmission(), $this->getReviewRound());
$reviewerForm->readInputData();

if ($reviewerForm->validate()) {
$reviewAssignment = $reviewerForm->execute();
$json = DAO::getDataChangedEvent($reviewAssignment->getId());
$json->setGlobalEvent('update:decisions');
return $json;
} else {
// There was an error, redisplay the form
return new JSONMessage(true, $reviewerForm->fetch($request));
}

// There was an error, redisplay the form
return new JSONMessage(false);
}

/**
Expand Down
44 changes: 44 additions & 0 deletions classes/form/validation/FormValidatorDateCompare.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* @file classes/form/validation/FormValidatorDateCompare.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 FormValidatorDateCompare
*
* @ingroup form_validation
*
* @see FormValidator
*
* @brief Form validation to validation comparison rule for a date field
*/

namespace PKP\form\validation;

use PKP\form\Form;
use PKP\validation\ValidatorDateComparison;
use PKP\validation\enums\DateComparisonRule;
use Carbon\Carbon;
use DateTimeInterface;

class FormValidatorDateCompare extends FormValidator
{
/**
* Constructor.
*
* @param Form $form the associated form
* @param string $field the name of the associated field
* @param DateTimeInterface|Carbon $comparingDate the comparing date
* @param DateComparisonRule $comparingRule the comparing rule
* @param string $type the type of check, either "required" or "optional"
* @param string $message the error message for validation failures (i18n key)
*/
public function __construct(&$form, $field, $comparingDate, $comparingRule, $type = 'optional', $message = 'validator.date.comparison')
{
$validator = new ValidatorDateComparison($comparingDate, $comparingRule);
parent::__construct($form, $field, $type, $message, $validator);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class UnableToCreateJATSContentException extends Exception
{
public function __construct(public ?Throwable $innerException = null)
{
parent::__construct(__('publication.jats.defaultContentCreationError'), null, $innerException);
parent::__construct(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these changes be in a different PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these changes be in a different PR?

that is true but because of this I was having some issue with some of workflow page loading to run some tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already been resolved in main in 8ded2f3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it will be removed at next rebase

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still showing up in the PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it because we are passing second param as null at here which is not allowed as that should be a int as specified here

__('publication.jats.defaultContentCreationError'),
$innerException?->getCode() ?? 0,
$innerException
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/**
* @file classes/migration/upgrade/v3_5_0/I5885_RenameReviewReminderSettingsName.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 I5885_RenameReviewReminderSettingsName
*
* @brief Rename the review reminder settings name
*/

namespace PKP\migration\upgrade\v3_5_0;

use Illuminate\Support\Facades\DB;
use PKP\migration\Migration;

abstract class I5885_RenameReviewReminderSettingsName extends Migration
{
abstract protected function getContextSettingsTable(): string;

/**
* Run the migration.
*/
public function up(): void
{
DB::table($this->getContextSettingsTable())
->where('setting_name', 'numDaysBeforeInviteReminder')
->update([
'setting_name' => 'numDaysAfterReviewResponseReminderDue'
]);

DB::table($this->getContextSettingsTable())
->where('setting_name', 'numDaysBeforeSubmitReminder')
->update([
'setting_name' => 'numDaysAfterReviewSubmitReminderDue'
]);
}

/**
* Reverse the migration
*/
public function down(): void
{
DB::table($this->getContextSettingsTable())
->where('setting_name', 'numDaysAfterReviewResponseReminderDue')
->update([
'setting_name' => 'numDaysBeforeInviteReminder'
]);

DB::table($this->getContextSettingsTable())
->where('setting_name', 'numDaysAfterReviewSubmitReminderDue')
->update([
'setting_name' => 'numDaysBeforeSubmitReminder'
]);
}
}
Loading