diff --git a/classes/components/forms/FieldRangeSlider.php b/classes/components/forms/FieldRangeSlider.php deleted file mode 100644 index b807b888bd9..00000000000 --- a/classes/components/forms/FieldRangeSlider.php +++ /dev/null @@ -1,173 +0,0 @@ -size, static::RANGE_SLIDER_SIZES)) { - throw new Exception( - sprintf( - 'Invalid size %s give, must be among [%s]', - $this->size, - implode(static::RANGE_SLIDER_SIZES) - ) - ); - } - - if (!in_array($this->valuePositionInUpdateLabel, static::RANGE_SLIDER_VALUE_POSITION_IN_UPDATE_LABEL)) { - throw new Exception( - sprintf( - 'Invalid value position %s give, must be among [%s]', - $this->valuePositionInUpdateLabel, - implode(static::RANGE_SLIDER_VALUE_POSITION_IN_UPDATE_LABEL) - ) - ); - } - - $config = parent::getConfig(); - - if (!isset($this->controlLabelOnDisable)) { - $this->controlLabelOnDisable = __('common.enable'); - } - - if (!isset($this->controlLabelOnEnable)) { - $this->controlLabelOnEnable = __('common.disable'); - } - - if (!isset($this->onResetValue)) { - $this->onResetValue = $this->value ?? $this->default ?? null; - } - - return array_merge($config, [ - 'disable' => $this->disable, - 'disableOnNull' => $this->disableOnNull, - 'options' => $this->options, - 'max' => $this->max, - 'min' => $this->min, - 'size' => $this->size, - 'step' => $this->step, - 'onResetValue' => $this->onResetValue, - 'updateLabel' => $this->updateLabel, - 'allowStateToggle' => $this->allowStateToggle, - 'controlLabelOnDisable' => $this->controlLabelOnDisable, - 'controlLabelOnEnable' => $this->controlLabelOnEnable, - ]); - } -} diff --git a/classes/components/forms/FieldSlider.php b/classes/components/forms/FieldSlider.php index c8299c5bb7e..a30489a757c 100644 --- a/classes/components/forms/FieldSlider.php +++ b/classes/components/forms/FieldSlider.php @@ -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 @@ -67,8 +60,6 @@ class FieldSlider extends Field */ public ?string $valueLabelMax = null; - - /** * @copydoc Field::getConfig() */ diff --git a/classes/components/forms/context/PKPReviewSetupForm.php b/classes/components/forms/context/PKPReviewSetupForm.php index db7d762e03c..ffcc7612862 100644 --- a/classes/components/forms/context/PKPReviewSetupForm.php +++ b/classes/components/forms/context/PKPReviewSetupForm.php @@ -19,7 +19,7 @@ use PKP\components\forms\FieldHTML; use PKP\context\Context; use PKP\components\forms\FieldOptions; -use PKP\components\forms\FieldRangeSlider; +use PKP\components\forms\FieldSlider; use PKP\components\forms\FieldText; use PKP\components\forms\FormComponent; use PKP\config\Config; @@ -38,9 +38,8 @@ class PKPReviewSetupForm extends FormComponent protected const REVIEW_SETTINGS_GROUP = 'reviewSettingsGroup'; protected const REVIEW_REMINDER_GROUP = 'reviewReminderGroup'; - public const MIN_REMINDER_NOTIFICATION_SEND_IN_DAYS = 1; + public const MIN_REMINDER_NOTIFICATION_SEND_IN_DAYS = 0; public const MAX_REMINDER_NOTIFICATION_SEND_IN_DAYS = 14; - public const DEFAULT_REMINDER_NOTIFICATION_SEND_IN_DAYS = 7; /** * Constructor @@ -135,63 +134,51 @@ protected function addReminderFields(Context $context): static $this ->addGroup([ - 'id' => self::REVIEW_REMINDER_GROUP + '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 FieldHTML('reviewRequestResponseReminder', [ - 'label' => __('manager.setup.reviewOptions.reminders.response'), - 'groupId' => self::REVIEW_REMINDER_GROUP, - ])) - ->addField(new FieldRangeSlider('numDaysBeforeReviewResponseReminderDue', [ - 'label' => __('manager.setup.reviewOptions.reminders.description.before'), + ->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, - 'onResetValue' => $context->getData('numDaysBeforeReviewResponseReminderDue') ?? static::DEFAULT_REMINDER_NOTIFICATION_SEND_IN_DAYS, - 'updateLabel' => __('manager.setup.reviewOptions.reminders.description.before.days'), - 'controlLabelOnDisable' => __('manager.setup.reviewOptions.reminders.enable'), - 'controlLabelOnEnable' => __('manager.setup.reviewOptions.reminders.disable'), + '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 FieldRangeSlider('numDaysAfterReviewResponseReminderDue', [ - 'label' => __('manager.setup.reviewOptions.reminders.description.after'), + ->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, - 'onResetValue' => $context->getData('numDaysAfterReviewResponseReminderDue') ?? static::DEFAULT_REMINDER_NOTIFICATION_SEND_IN_DAYS, - 'updateLabel' => __('manager.setup.reviewOptions.reminders.description.after.days'), - 'controlLabelOnDisable' => __('manager.setup.reviewOptions.reminders.enable'), - 'controlLabelOnEnable' => __('manager.setup.reviewOptions.reminders.disable'), - 'groupId' => self::REVIEW_REMINDER_GROUP, - ])) - ->addField(new FieldHTML('submissionReviewResponseReminder', [ - 'label' => __('manager.setup.reviewOptions.reminders.submit'), + '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 FieldRangeSlider('numDaysBeforeReviewSubmitReminderDue', [ - 'label' => __('manager.setup.reviewOptions.reminders.description.before'), + ->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, - 'onResetValue' => $context->getData('numDaysBeforeReviewSubmitReminderDue') ?? static::DEFAULT_REMINDER_NOTIFICATION_SEND_IN_DAYS, - 'updateLabel' => __('manager.setup.reviewOptions.reminders.description.before.days'), - 'controlLabelOnDisable' => __('manager.setup.reviewOptions.reminders.enable'), - 'controlLabelOnEnable' => __('manager.setup.reviewOptions.reminders.disable'), + '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 FieldRangeSlider('numDaysAfterReviewSubmitReminderDue', [ - 'label' => __('manager.setup.reviewOptions.reminders.description.after'), + ->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, - 'onResetValue' => $context->getData('numDaysAfterReviewSubmitReminderDue') ?? static::DEFAULT_REMINDER_NOTIFICATION_SEND_IN_DAYS, - 'updateLabel' => __('manager.setup.reviewOptions.reminders.description.after.days'), - 'controlLabelOnDisable' => __('manager.setup.reviewOptions.reminders.enable'), - 'controlLabelOnEnable' => __('manager.setup.reviewOptions.reminders.disable'), + '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, ])); diff --git a/classes/task/ReviewReminder.php b/classes/task/ReviewReminder.php index fc255fab7d8..bad6f28792d 100644 --- a/classes/task/ReviewReminder.php +++ b/classes/task/ReviewReminder.php @@ -71,10 +71,10 @@ public function executeActions() unset($context); $context = $contextDao->getById($submission->getData('contextId')); - $numDaysBeforeReviewResponseReminderDue = $context->getData('numDaysBeforeReviewResponseReminderDue'); - $numDaysAfterReviewResponseReminderDue = $context->getData('numDaysAfterReviewResponseReminderDue'); - $numDaysBeforeReviewSubmitReminderDue = $context->getData('numDaysBeforeReviewSubmitReminderDue'); - $numDaysAfterReviewSubmitReminderDue = $context->getData('numDaysAfterReviewSubmitReminderDue'); + $numDaysBeforeReviewResponseReminderDue = (int) $context->getData('numDaysBeforeReviewResponseReminderDue'); + $numDaysAfterReviewResponseReminderDue = (int) $context->getData('numDaysAfterReviewResponseReminderDue'); + $numDaysBeforeReviewSubmitReminderDue = (int) $context->getData('numDaysBeforeReviewSubmitReminderDue'); + $numDaysAfterReviewSubmitReminderDue = (int) $context->getData('numDaysAfterReviewSubmitReminderDue'); } $mailable = null; @@ -85,7 +85,6 @@ public function executeActions() // after a REVIEW REQUEST has been responded, the value of `dateReminded` and `reminderWasAutomatic` // get reset, see \PKP\submission\reviewer\ReviewerAction::confirmReview. - // if ($reviewAssignment->getDateConfirmed() === null) { // REVIEW REQUEST has not been responded // only need to concern with BEFORE/AFTER REVIEW REQUEST RESPONSE reminder @@ -93,7 +92,7 @@ public function executeActions() if ($reviewAssignment->getDateReminded() === null) { // There has not been any reminder sent yet // need to check should we sent a BEFORE REVIEW REQUEST RESPONSE reminder - if ($numDaysBeforeReviewResponseReminderDue && + if ($numDaysBeforeReviewResponseReminderDue > 0 && $dateResponseDue->gt($currentDate) && $dateResponseDue->diffInDays($currentDate) <= $numDaysBeforeReviewResponseReminderDue) { @@ -106,7 +105,7 @@ public function executeActions() $dateReminded = Carbon::parse($reviewAssignment->getDateReminded()); - if ($numDaysAfterReviewResponseReminderDue && + if ($numDaysAfterReviewResponseReminderDue > 0 && $currentDate->gt($dateResponseDue) && $dateReminded->lt($dateResponseDue) && $currentDate->diffInDays($dateResponseDue) >= $numDaysAfterReviewResponseReminderDue) { @@ -122,7 +121,7 @@ public function executeActions() if ($reviewAssignment->getDateReminded() === null) { // There has not been any reminder sent after responding to REVIEW REQUEST // no REVIEW SUBMIT reminder has been sent - if ($numDaysBeforeReviewSubmitReminderDue && + if ($numDaysBeforeReviewSubmitReminderDue > 0 && $currentDate->lt($dateDue) && $dateDue->diffInDays($currentDate) <= $numDaysBeforeReviewSubmitReminderDue) { @@ -135,7 +134,7 @@ public function executeActions() $dateReminded = Carbon::parse($reviewAssignment->getDateReminded()); - if ($numDaysAfterReviewSubmitReminderDue && + if ($numDaysAfterReviewSubmitReminderDue > 0 && $currentDate->gt($dateDue) && $dateReminded->lt($dateDue) && $currentDate->diffInDays($dateDue) >= $numDaysAfterReviewSubmitReminderDue) { diff --git a/js/load.js b/js/load.js index 1f44ddf2b0b..3b875fb2467 100644 --- a/js/load.js +++ b/js/load.js @@ -79,7 +79,6 @@ import FieldControlledVocab from '@/components/Form/fields/FieldControlledVocab. import FieldHtml from '@/components/Form/fields/FieldHtml.vue'; import FieldMetadataSetting from '@/components/Form/fields/FieldMetadataSetting.vue'; import FieldOptions from '@/components/Form/fields/FieldOptions.vue'; -import FieldRangeSlider from '@/components/Form/fields/FieldRangeSlider.vue'; import FieldPreparedContent from '@/components/Form/fields/FieldPreparedContent.vue'; import FieldPubId from '@/components/Form/fields/FieldPubId.vue'; import FieldRadioInput from '@/components/Form/fields/FieldRadioInput.vue'; @@ -176,7 +175,6 @@ VueRegistry.registerComponent('PkpFieldControlledVocab', FieldControlledVocab); VueRegistry.registerComponent('PkpFieldHtml', FieldHtml); VueRegistry.registerComponent('PkpFieldMetadataSetting', FieldMetadataSetting); VueRegistry.registerComponent('PkpFieldOptions', FieldOptions); -VueRegistry.registerComponent('PkpFieldRangeSlider', FieldRangeSlider); VueRegistry.registerComponent('PkpFieldPreparedContent', FieldPreparedContent); VueRegistry.registerComponent('PkpFieldPubId', FieldPubId); VueRegistry.registerComponent('PkpFieldRadioInput', FieldRadioInput); diff --git a/locale/en/manager.po b/locale/en/manager.po index 2491c4f4dc9..9a9e1116ed0 100644 --- a/locale/en/manager.po +++ b/locale/en/manager.po @@ -1246,29 +1246,29 @@ msgstr "" "Send an email reminder before or after for review request response(if reviewer has not responded " "to review request yet) or review submission (if reviewer has not submitted review yet)" -msgid "manager.setup.reviewOptions.reminders.response" -msgstr "Response Reminder" +msgid "manager.setup.reviewOptions.reminders.response.before" +msgstr "Response Request Response - Before Due Date" -msgid "manager.setup.reviewOptions.reminders.description.before" -msgstr "Before due date" +msgid "manager.setup.reviewOptions.reminders.response.after" +msgstr "Response Request Response - After Due Date" -msgid "manager.setup.reviewOptions.reminders.description.before.days" -msgstr "days before" +msgid "manager.setup.reviewOptions.reminders.submit.before" +msgstr "Review Submission - Before Due Date" -msgid "manager.setup.reviewOptions.reminders.description.after" -msgstr "After due date" +msgid "manager.setup.reviewOptions.reminders.submit.after" +msgstr "Review Submission - After Due Date" -msgid "manager.setup.reviewOptions.reminders.description.after.days" -msgstr "days after" +msgid "manager.setup.reviewOptions.reminders.label.before.days" +msgstr "{$value} days before due date" -msgid "manager.setup.reviewOptions.reminders.disable" -msgstr "Disbale Reminder" +msgid "manager.setup.reviewOptions.reminders.label.after.days" +msgstr "{$value} days after due date" -msgid "manager.setup.reviewOptions.reminders.enable" -msgstr "Enable Reminder" +msgid "manager.setup.reviewOptions.reminders.min.label" +msgstr "None" -msgid "manager.setup.reviewOptions.reminders.submit" -msgstr "Review Reminder" +msgid "manager.setup.reviewOptions.reminders.disbale.label" +msgstr "No reminder set" msgid "manager.setup.reviewOptions.reviewMode" msgstr "Default Review Mode"