diff --git a/api/v1/reviewers/suggestions/formRequests/AddReviewerSuggestion.php b/api/v1/reviewers/suggestions/formRequests/AddReviewerSuggestion.php index 931d8b90848..d34d5cbd211 100644 --- a/api/v1/reviewers/suggestions/formRequests/AddReviewerSuggestion.php +++ b/api/v1/reviewers/suggestions/formRequests/AddReviewerSuggestion.php @@ -72,7 +72,7 @@ public function rules(): array ], 'familyName' => [ 'required', - // 'multilingual:en,fr_CA', // Alternative way to do multilingual validation + // 'multilingual:en,fr_CA', // Alternative way to do multilingual validation, do not use HasMultilingualRule trait with this approach ], 'givenName' => [ 'required', diff --git a/classes/core/ValidationServiceProvider.php b/classes/core/ValidationServiceProvider.php index ca9fa1f7a26..d4376a49f84 100644 --- a/classes/core/ValidationServiceProvider.php +++ b/classes/core/ValidationServiceProvider.php @@ -9,7 +9,7 @@ * * @class ValidationServiceProvider * - * @brief Register session driver, manager and related services + * @brief Extends the core validation service provider */ namespace PKP\core; @@ -29,7 +29,7 @@ class ValidationServiceProvider extends \Illuminate\Validation\ValidationService * Boot service provider * * A good place to add any custom validation rules which will be availbale once the - * Service provider get registered + * service provider get registered * * @return void */ diff --git a/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php b/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php index 14714481e49..e9171727eab 100644 --- a/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php +++ b/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.php @@ -234,6 +234,10 @@ public function fetch($request, $template = null, $display = false) // Used to determine the right email template $templateMgr->assign('lastRoundReviewerIds', $lastRoundReviewerIds); + if ($this->reviewerSuggestion?->existingReviewerRole) { + $templateMgr->assign('reviewerName', $this->reviewerSuggestion->existingUser->getFullName()); + } + $selectReviewerListPanel->set([ 'items' => $selectReviewerListPanel->getItems($request), 'itemsMax' => $selectReviewerListPanel->getItemsMax(), diff --git a/js/controllers/grid/users/reviewer/AdvancedReviewerSearchHandler.js b/js/controllers/grid/users/reviewer/AdvancedReviewerSearchHandler.js index 986f9728a0d..b24d5d2704c 100644 --- a/js/controllers/grid/users/reviewer/AdvancedReviewerSearchHandler.js +++ b/js/controllers/grid/users/reviewer/AdvancedReviewerSearchHandler.js @@ -4,8 +4,8 @@ /** * @file js/controllers/AdvancedReviewerSearchHandler.js * - * 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 AdvancedReviewerSearchHandler @@ -46,7 +46,7 @@ this.initializeTinyMCE(); this.handleReviewerAssign_($container, options, { id: $container.find('input#reviewerId').val(), - fullName: 'some name' + fullName: options.reviewerName }); } }; @@ -69,7 +69,7 @@ */ $.pkp.controllers.grid.users.reviewer.AdvancedReviewerSearchHandler.prototype. handleRefresh_ = function(sourceElement, event, content) { - + if (content) { this.replaceWith(content); } @@ -87,7 +87,8 @@ $templateInput, $templateOption, editor, - templateKey; + templateKey, + templateContent; if ($textarea.val()) { return; // The message is already set; shouldn't happen @@ -100,22 +101,31 @@ $templateOption = $('#reviewerFormFooter select[name="template"]'); editor = tinyMCE.EditorManager.get($textarea.attr('id')); - // console.log(editor); templateKey = ''; if (options.lastRoundReviewerIds.includes(reviewer.id)) { templateKey = 'REVIEW_REQUEST_SUBSEQUENT'; - editor.setContent(options.reviewerMessages[templateKey]); + templateContent = options.reviewerMessages[templateKey]; + editor.setContent(templateContent); $templateInput.val(templateKey); $templateOption.find('[value="REVIEW_REQUEST"]').remove(); } else { templateKey = 'REVIEW_REQUEST'; - // console.log(options.reviewerMessages[templateKey]); - editor.setContent(options.reviewerMessages[templateKey]); + templateContent = options.reviewerMessages[templateKey]; + editor.setContent(templateContent); $templateInput.val(templateKey); $templateOption.find('[value="REVIEW_REQUEST_SUBSEQUENT"]').remove(); } + // TODO : an ugly work around to handle the empty editor issue after a flicker, + // need some help to figure it out. + setTimeout(() => { + console.log(editor.getContent().length); + if (!editor.getContent().length) { + editor.setContent(templateContent); + } + }, 2000); + // Select the right template option to correspond // the one, which is set in TinyMCE $templateOption.find('[value="' + templateKey + '"]').prop('selected', true); diff --git a/templates/controllers/grid/users/reviewer/form/advancedSearchReviewerForm.tpl b/templates/controllers/grid/users/reviewer/form/advancedSearchReviewerForm.tpl index e41b5906b9d..2455055f32a 100644 --- a/templates/controllers/grid/users/reviewer/form/advancedSearchReviewerForm.tpl +++ b/templates/controllers/grid/users/reviewer/form/advancedSearchReviewerForm.tpl @@ -15,16 +15,15 @@ '$.pkp.controllers.grid.users.reviewer.AdvancedReviewerSearchHandler', {ldelim} lastRoundReviewerIds: {$lastRoundReviewerIds|json_encode}, - reviewerMessages: {$reviewerMessages|json_encode} + reviewerMessages: {$reviewerMessages|json_encode}, + reviewerName : {$reviewerName|json_encode} {rdelim} ); {rdelim});