Skip to content
Merged
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
16 changes: 11 additions & 5 deletions modules/survey_accounts/ajax/ValidateEmailSubmitInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
if ($numSessions != 1) {
echo json_encode(
[
'error_msg' => dgettext('loris', 'Visit').' '. $_REQUEST['VL'].' '.
'error_msg' => dgettext('loris', 'Visit').' '.
$_REQUEST['VL'].' '.
dgettext('survey_accounts', 'does not exist for given candidate'),
]
);
Expand All @@ -78,7 +79,7 @@

if (empty($_REQUEST['TN'])) {
echo json_encode(
['error_msg' => dgettext('survey_accounts', 'Please choose an instrument')]
['error_msg' => dgettext('survey_accounts', 'Please choose an instrument.')]
);
exit(0);
}
Expand All @@ -100,8 +101,13 @@
if ($_REQUEST['TN'] == $instrument['Test_name']) {
echo json_encode(
[
'error_msg' => dgettext('loris', 'Instrument').' '. $_REQUEST['TN']
.' ' .dgettext(
'error_msg' => dcngettext(
'loris',
'Instrument',
'Instruments',
1,
LC_MESSAGES
).' '. $_REQUEST['TN'].' ' .dgettext(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This error message should use an interpolated string instead of string concatenation, but since it's already done this way I'm not going to block merging over it.

'survey_accounts',
'already exists for given candidate for visit'
).' '. $_REQUEST['VL'],
Expand All @@ -116,7 +122,7 @@
echo json_encode(
['error_msg' => dgettext(
'survey_accounts',
'The email address is not valid.'
'Email is not valid.'
)
]
);
Expand Down
6 changes: 4 additions & 2 deletions modules/survey_accounts/js/survey_accounts_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ $(document).ready(function () {
}
if (email.length > 0 && email2.length > 0 && email !== email2)
{
$("#email-error").show().html("Emails do not match");
$("#email-error")
.show()
.html($("#email-error").data("email-mismatch"));
}
} );
$("#emailData").click(function(){
Expand All @@ -60,7 +62,7 @@ $(document).ready(function () {
}).appendTo("#participant_accounts_form");
$("#participant_accounts_form").submit();
});
$("input[type=submit]").click(function (e) {
$("input[type=submit], button[type=submit]").click(function (e) {
if(e.currentTarget.classList.contains('email')) {
$.get(loris.BaseURL + "/survey_accounts/ajax/ValidateEmailSubmitInput.php", {
dccid: $("input[name=CandID]").val(),
Expand Down
17 changes: 13 additions & 4 deletions modules/survey_accounts/jsx/surveyAccountsIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import Loader from 'Loader';
import FilterableDataTable from 'FilterableDataTable';

import hiStrings from '../locale/hi/LC_MESSAGES/survey_accounts.json';
import jaStrings from '../locale/ja/LC_MESSAGES/survey_accounts.json';
import frStrings from '../locale/fr/LC_MESSAGES/survey_accounts.json';
import zhStrings from '../locale/zh/LC_MESSAGES/survey_accounts.json';
/**
* Survey Account React Component
*/
Expand Down Expand Up @@ -123,7 +126,9 @@ class SurveyAccountsIndex extends Component {
},
},
{
label: t('Instrument', {ns: 'loris', count: 1}), show: true, filter: {
label: t('Instrument', {ns: 'loris', count: 1}),
show: true,
filter: {
name: 'instrument',
type: 'select',
options: options.instruments,
Expand All @@ -139,7 +144,10 @@ class SurveyAccountsIndex extends Component {
},
];
const addSurvey = () => {
location.href = '/survey_accounts/addSurvey/';
const params = new URLSearchParams(window.location.search);
const lang = params.get('lang');
const query = lang ? `?lang=${encodeURIComponent(lang)}` : '';
location.href = `${loris.BaseURL}/survey_accounts/addSurvey/${query}`;
};
const actions = [
{label: t('Add Survey', {ns: 'survey_accounts'}), action: addSurvey},
Expand Down Expand Up @@ -167,8 +175,9 @@ SurveyAccountsIndex.propTypes = {
window.addEventListener(
'load', () => {
i18n.addResourceBundle('hi', 'survey_accounts', hiStrings);
i18n.addResourceBundle('ja', 'survey_accounts', {});
i18n.addResourceBundle('zh', 'survey_accounts', {});
i18n.addResourceBundle('ja', 'survey_accounts', jaStrings);
i18n.addResourceBundle('fr', 'survey_accounts', frStrings);
i18n.addResourceBundle('zh', 'survey_accounts', zhStrings);
const Index = withTranslation(
['survey_accounts']
)(SurveyAccountsIndex);
Expand Down
98 changes: 98 additions & 0 deletions modules/survey_accounts/locale/fr/LC_MESSAGES/survey_accounts.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Default LORIS strings to be translated (French Canadian).
# Copy this to a language specific file and add translations to the
# new file.
# Copyright (C) 2025
# This file is distributed under the same license as the LORIS package.
# Dave MacFarlane <dave.macfarlane@mcin.ca>, 2025.
#
msgid ""
msgstr ""
"Project-Id-Version: LORIS 27\n"
"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n"
"POT-Creation-Date: 2025-04-08 14:37-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: French <fr@li.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

Comment thread
GeorgeMurad marked this conversation as resolved.
msgid "Survey Accounts"
msgstr "Comptes de sondage"

msgid "Survey was added successfully."
msgstr "Le sondage a été ajouté avec succès."

msgid "Click here to go back to view the list of survey's created"
msgstr "Cliquez ici pour revenir à la liste des sondages créés"

msgid "Survey List"
msgstr "Liste des sondages"

msgid "Usage"
msgstr "Utilisation"

msgid "Use this form to create a link for a study participant to use in order to directly enter a form/data into Loris."
msgstr "Utilisez ce formulaire pour créer un lien permettant à un participant à l'étude de saisir directement un formulaire/des données dans LORIS."

msgid "Add Survey"
msgstr "Ajouter un sondage"

msgid "Create survey"
msgstr "Créer un sondage"

msgid "Email survey"
msgstr "Envoyer le sondage par courriel"

msgid "Close"
msgstr "Fermer"

msgid "Email to Study Participant"
msgstr "Courriel au participant à l'étude"

msgid "Optionally enter a customized message here. A default email will be sent if left blank."
msgstr "Saisissez éventuellement un message personnalisé ici. Un courriel par défaut sera envoyé si ce champ est laissé vide."

msgid "This is where your message goes."
msgstr "Votre message s'inscrit ici."

msgid "Email"
msgstr "Adresse courriel"

msgid "URL"
msgstr "URL"

msgid "Status"
msgstr "Statut"

msgid "PSCID and DCCID do not match or candidate does not exist."
msgstr "Le PSCID et le DCCID ne correspondent pas ou le candidat n'existe pas."

msgid "does not exist for given candidate"
msgstr "n'existe pas pour le candidat donné"

msgid "Please choose an instrument."
msgstr "Veuillez choisir un instrument."

msgid "already exists for given candidate for visit"
msgstr "existe déjà pour le candidat donné pour la visite"

msgid "Email is not valid."
msgstr "L'adresse courriel n'est pas valide."

msgid "Please confirm the email address."
msgstr "Veuillez confirmer l'adresse courriel."

msgid "The email addresses do not match."
msgstr "Les adresses courriel ne correspondent pas."

msgid "You must specify a valid Visit Label."
msgstr "Vous devez préciser un libellé de visite valide."

msgid "You are not affiliated with this session's project"
msgstr "Vous n'êtes pas affilié au projet de cette session"

msgid "Confirm Email address"
msgstr "Confirmer l'adresse courriel"
8 changes: 1 addition & 7 deletions modules/survey_accounts/locale/survey_accounts.pot
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ msgstr ""
msgid "Email"
msgstr ""

msgid "Instrument"
msgstr ""

msgid "URL"
msgstr ""

Expand All @@ -81,7 +78,7 @@ msgstr ""
msgid "already exists for given candidate for visit"
msgstr ""

msgid "The email address is not valid."
msgid "Email is not valid."
msgstr ""

msgid "Please confirm the email address."
Expand All @@ -96,8 +93,5 @@ msgstr ""
msgid "You are not affiliated with this session's project"
msgstr ""

msgid "Email is not valid."
msgstr ""

msgid "Confirm Email address"
msgstr ""
32 changes: 24 additions & 8 deletions modules/survey_accounts/php/addsurvey.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AddSurvey extends \NDB_Form
if (!filter_var($values['Email'], FILTER_VALIDATE_EMAIL) ) {
return ['Email' => dgettext(
'survey_accounts',
'The email address is not valid.'
'Email is not valid.'
)
];
}
Expand Down Expand Up @@ -193,14 +193,20 @@ class AddSurvey extends \NDB_Form
$instrument['Test_name']
);
return [
'Test_name' => "Instrument ".
'Test_name' => dcngettext(
'loris',
'Instrument',
'Instruments',
1,
LC_MESSAGES
)." ".
$instrument_instance->getFullName().
$reminder. $values['VL'],
];
}
}
if (!isset($_REQUEST['fire_away'])
|| ($_REQUEST['fire_away'] !== 'Create survey')
|| ($_REQUEST['fire_away'] !== 'create_survey')
) {
if (!filter_var(
$values['Email'],
Expand Down Expand Up @@ -326,18 +332,28 @@ class AddSurvey extends \NDB_Form
parent::setup();

$this->redirect = "test_name=$this->name";
$this->addBasicText("CandID", "DCCID");
$this->addBasicText("PSCID", "PSCID");
$this->addSelect("VL", "Visit Label", \Utility::getVisitList());
$this->addBasicText("CandID", dgettext('loris', 'DCCID'));
$this->addBasicText("PSCID", dgettext('loris', 'PSCID'));
$this->addSelect(
"VL",
dgettext('loris', 'Visit Label'),
\Utility::getVisitList()
);
$this->addSelect(
"Test_name",
"Instrument",
dcngettext(
'loris',
'Instrument',
'Instruments',
1,
LC_MESSAGES
),
array_merge(
['' => ''],
\NDB_BVL_Instrument::getDirectEntryInstrumentNamesList($this->loris)
)
);
$this->addBasicText("Email", "Email address");
$this->addBasicText("Email", dgettext('loris', 'Email address'));
$this->addBasicText(
"Email2",
dgettext('survey_accounts', 'Confirm Email address')
Expand Down
6 changes: 3 additions & 3 deletions modules/survey_accounts/templates/form_addSurvey.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{/foreach}

<tr>
<td id="email-error" nowrap="nowrap" colspan="2" style="display: none;" class="error"></td>
<td id="email-error" nowrap="nowrap" colspan="2" style="display: none;" class="error" data-email-mismatch="{dgettext("survey_accounts", "The email addresses do not match.")|escape}"></td>
</tr>

<tr>
Expand Down Expand Up @@ -60,8 +60,8 @@
</tr>
<tr>
<td nowrap="nowrap" colspan="2">
<input class="btn btn-sm btn-primary" name="fire_away" value="{dgettext("survey_accounts", "Create survey")}" id="create_survey" type="submit" />
<input class="btn btn-sm btn-primary email" name="fire_away" value="{dgettext("survey_accounts", "Email survey")}" id="email_survey" type="submit" />
<button class="btn btn-sm btn-primary" name="fire_away" value="create_survey" id="create_survey" type="submit">{dgettext("survey_accounts", "Create survey")}</button>
<button class="btn btn-sm btn-primary email" name="fire_away" value="email_survey" id="email_survey" type="submit">{dgettext("survey_accounts", "Email survey")}</button>
{/if}
</td>
</tr>
Expand Down
Loading