-
Notifications
You must be signed in to change notification settings - Fork 444
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#3525 Give the possibility to choose language of template … #3579
Closed
forgive38
wants to merge
4
commits into
pkp:ojs-stable-3_1_0
from
forgive38:SelectLanguageForEmailTemplate_reviewerForm
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -651,24 +651,48 @@ function reviewHistory($args, $request) { | |
* @param $request PKPRequest | ||
* @return JSONMessage JSON object | ||
*/ | ||
/** | ||
* @copydoc PKPReviewerGridHandler::fetchTemplateBody() | ||
*/ | ||
function fetchTemplateBody($args, $request) { | ||
import('lib.pkp.classes.mail.SubmissionMailTemplate'); | ||
$template = new SubmissionMailTemplate($this->getSubmission(), $request->getUserVar('template')); | ||
if (!$template) return; | ||
|
||
$user = $request->getUser(); | ||
$dispatcher = $request->getDispatcher(); | ||
$context = $request->getContext(); | ||
|
||
$template->assignParams(array( | ||
'editorialContactSignature' => $user->getContactSignature(), | ||
'signatureFullName' => $user->getFullname(), | ||
)); | ||
|
||
return new JSONMessage(true, $template->getBody()); | ||
$templateLocale = $request->getUserVar('templateLocale'); | ||
$templateId = $request->getUserVar('template_'.$templateLocale); | ||
if (strlen($templateLocale) < 2 ) { | ||
$templateLocale = NULL; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Extra indent) |
||
import('lib.pkp.classes.mail.SubmissionMailTemplate'); | ||
$template = new SubmissionMailTemplate($this->getSubmission(), $templateId, $templateLocale); | ||
if ($template) { | ||
$user = $request->getUser(); | ||
$dispatcher = $request->getDispatcher(); | ||
$context = $request->getContext(); | ||
$template->assignParams(array( | ||
'contextUrl' => $dispatcher->url($request, ROUTE_PAGE, $context->getPath()), | ||
'editorialContactSignature' => $user->getContactSignature(), | ||
'signatureFullName' => $user->getFullname(), | ||
'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'login', 'lostPassword'), | ||
'messageToReviewer' => __('reviewer.step1.requestBoilerplate'), | ||
'abstractTermIfEnabled' => ($this->getSubmission()->getLocalizedAbstract() == '' ? '' : __('common.abstract')), // Deprecated; for OJS 2.x templates | ||
// submissionReviewUrl -> we can't prepopulate, it depends if oneclick is enabled | ||
)); | ||
$template->replaceParams(); | ||
|
||
return new JSONMessage( | ||
true, | ||
array( | ||
'body' => $template->getBody(), | ||
'variables' => array( | ||
'reviewerName' => __('user.name'), | ||
'responseDueDate' => __('reviewer.submission.responseDueDate'), | ||
'reviewDueDate' => __('reviewer.submission.reviewDueDate'), | ||
'submissionReviewUrl' => __('common.url'), | ||
'reviewerUserName' => __('user.username'), | ||
) | ||
) | ||
); | ||
} | ||
} | ||
|
||
|
||
|
||
// | ||
// Private helper methods | ||
// | ||
|
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 |
---|---|---|
|
@@ -118,6 +118,22 @@ function getLocaleEmailTemplate($emailKey, $contextId) { | |
function getEmailTemplate($emailKey, $locale, $contextId) { | ||
$primaryLocale = AppLocale::getPrimaryLocale(); | ||
|
||
// $context = $request->getContext(); | ||
// | ||
// propose tous les templates si mail settings language est ok | ||
// AIE, visiblement on ne peut retourner un seul mail settings | ||
// | ||
// $permittedSettings = array('supportedFormLocales', 'supportedSubmissionLocales', 'supportedLocales','supportedMailLocales'); | ||
// if (in_array($settingName, $permittedSettings) && $locale) { | ||
// $currentSettingValue = (array) $context->getSetting($settingName); | ||
// if (AppLocale::isLocaleValid($locale) && array_key_exists($locale, $availableLocales)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Dead code should be removed) |
||
// if ($settingValue) { | ||
// array_push($currentSettingValue, $locale); | ||
// if ($settingName == 'supportedFormLocales') { | ||
// // reload localized default context settings | ||
// | ||
// | ||
|
||
$result = $this->retrieve( | ||
'SELECT COALESCE(edl.subject, ddl.subject, edpl.subject, ddpl.subject) AS subject, | ||
COALESCE(edl.body, ddl.body, edpl.body, ddpl.body) AS body, | ||
|
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good to replace duplicated code self-documentation with
@copydoc
, but this PR leaves the old header in as well. I'd suggest removing the old one.