From 6e5283899c8e10a3042f333c16d3adb615ed22dd Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Mon, 29 Sep 2025 07:00:36 -0400 Subject: [PATCH 01/13] Add Translations --- Makefile | 4 + locale/loris.pot | 7 + .../mri_violations/jsx/mriViolationsIndex.js | 68 ++++--- modules/mri_violations/jsx/protocolModal.js | 126 +++++++------ .../locale/hi/LC_MESSAGES/mri_violations.json | 51 ++++++ .../locale/hi/LC_MESSAGES/mri_violations.po | 166 ++++++++++++++++++ .../mri_violations/locale/mri_violations.pot | 143 +++++++++++++++ modules/mri_violations/php/resolve.class.inc | 8 +- .../php/usercentermatchornull.class.inc | 3 +- ...centermatchornulloranypermission.class.inc | 3 +- .../php/userprojectmatchornull.class.inc | 3 +- 11 files changed, 495 insertions(+), 87 deletions(-) create mode 100644 modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json create mode 100644 modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po diff --git a/Makefile b/Makefile index c7dec64e0a2..d58dcd162d3 100755 --- a/Makefile +++ b/Makefile @@ -120,6 +120,8 @@ locales: msgfmt -o modules/media/locale/ja/LC_MESSAGES/media.mo modules/media/locale/ja/LC_MESSAGES/media.po msgfmt -o modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo modules/module_manager/locale/ja/LC_MESSAGES/module_manager.po msgfmt -o modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po + msgfmt -o modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po + npx i18next-conv -l hi -s modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json msgfmt -o modules/next_stage/locale/ja/LC_MESSAGES/next_stage.mo modules/next_stage/locale/ja/LC_MESSAGES/next_stage.po msgfmt -o modules/oidc/locale/ja/LC_MESSAGES/oidc.mo modules/oidc/locale/ja/LC_MESSAGES/oidc.po msgfmt -o modules/publication/locale/ja/LC_MESSAGES/publication.mo modules/publication/locale/ja/LC_MESSAGES/publication.po @@ -160,6 +162,8 @@ module_manager: target=module_manager npm run compile mri_violations: + msgfmt -o modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po + npx i18next-conv -l hi -s modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json target=mri_violations npm run compile issue_tracker: diff --git a/locale/loris.pot b/locale/loris.pot index 5d0d10f350e..fffcdb83ce3 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -202,6 +202,12 @@ msgstr "" msgid "Language" msgstr "" +msgid "Access denied" +msgstr "" + +msgid "No." +msgstr "" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "" @@ -259,3 +265,4 @@ msgstr "" msgid "In Progress" msgstr "" + diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index 9008bf7617c..a8a46d3546b 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -3,6 +3,10 @@ import FilterableDataTable from 'FilterableDataTable'; import React, {useEffect, useState} from 'react'; import PropTypes from 'prop-types'; import ProtocolModal from './protocolModal.js'; +import i18n from 'I18nSetup'; +import {withTranslation} from 'react-i18next'; + +import hiStrings from '../locale/hi/LC_MESSAGES/mri_violations.json'; /** * Entry point for the MRI Violatons module. @@ -17,6 +21,8 @@ function MRIViolationsIndex(props) { const [isError, setIsError] = useState(false); const [data, setData] = useState([]); const mapper = columnMapper(fieldOptions); + const {t} = props; + const violationsModal = (violationModal !== false) ? setViolationModal(false)} @@ -109,7 +115,8 @@ function MRIViolationsIndex(props) { let resolutionStatusStyle; let resolutionStatus; - if (column === 'Type of Problem' && cell === 'Protocol Violation') { + if (column === t('Type of Problem', {ns: 'mri_violations'}) && + cell === t('Protocol Violation', {ns: 'mri_violations'})) { return ( Protocol Violation + }>{t('Protocol Violation', {ns: 'mri_violations'})} ); } if ( - column === 'Type of Problem' && - cell === 'Could not identify scan type' + column === t('Type of Problem', {ns: 'mri_violations'}) && + cell === t('Could not identify scan type', {ns: 'mri_violations'}) ) { const seriesDescription = rowData[ - 'Series Description or Scan Type' + t('Series Description or Scan Type', {ns: 'mri_violations'}) ]; return ( @@ -259,74 +266,77 @@ function MRIViolationsIndex(props) { } return [ { - label: 'Patient Name', show: true, filter: { + label: t('Patient Name', {ns: 'mri_violations'}), show: true, filter: { name: 'patientName', type: 'text', }, }, { - label: 'Project', show: true, filter: { + label: t('Project', {ns: 'loris'}), show: true, filter: { name: 'project', type: 'select', options: fieldoptions.projects, }, }, { - label: 'Cohort', show: true, filter: { + label: t('Cohort', {ns: 'loris'}), show: true, filter: { name: 'cohort', type: 'select', options: fieldoptions.cohorts, }, }, { - label: 'Site', show: true, filter: { + label: t('Site', {ns: 'loris'}), show: true, filter: { name: 'site', type: 'select', options: fieldoptions.sites, }, }, { - label: 'Time Run', show: true, filter: { + label: t('Time Run', {ns: 'mri_violations'}), show: true, filter: { name: 'timeRun', type: 'datetime', }, }, { - label: 'Image File', show: true, filter: { + label: t('Image File', {ns: 'mri_violations'}), show: true, filter: { name: 'mincFile', type: 'text', }, }, { - label: 'Series Description or Scan Type', show: true, filter: { + label: t('Series Description or Scan Type', {ns: 'mri_violations'}), + show: true, filter: { name: 'seriesOrType', type: 'text', }, }, { - label: 'Type of Problem', show: true, filter: { + label: t('Type of Problem', {ns: 'mri_violations'}), + show: true, filter: { name: 'typeOfProblem', type: 'select', options: problemtypes, }, }, { - label: 'Resolution Status', show: true, filter: { + label: t('Resolution Status', {ns: 'mri_violations'}), + show: true, filter: { name: 'resolutionStatus', type: 'select', options: { - 'unresolved': 'Unresolved', - 'reran': 'Reran', - 'emailed': 'emailed site/pending', - 'inserted': 'Inserted', - 'rejected': 'Rejected', - 'inserted_flag': 'Inserted with flag', - 'other': 'Other', + 'unresolved': t('Unresolved', {ns: 'mri_violations'}), + 'reran': t('Reran', {ns: 'mri_violations'}), + 'emailed': t('emailed site/pending', {ns: 'mri_violations'}), + 'inserted': t('inserted', {ns: 'mri_violations'}), + 'rejected': t('rejected', {ns: 'mri_violations'}), + 'inserted_flag': t('inserted with flag', {ns: 'mri_violations'}), + 'other': t('other', {ns: 'mri_violations'}), }, }, }, { - label: 'Series UID', show: false, filter: { + label: t('Series UID', {ns: 'mri_violations'}), show: false, filter: { name: 'seriesUID', type: 'text', }, @@ -338,7 +348,7 @@ function MRIViolationsIndex(props) { {label: 'PSCID', show: false}, // Add fake column for resolution dropdown - {label: 'Select Resolution', show: true}, + {label: t('Select Resolution', {ns: 'mri_violations'}), show: true}, ]; }; @@ -348,7 +358,8 @@ function MRIViolationsIndex(props) { {!isLoaded ? : isError ? -

An error occurred while loading the page.

: +

{t('An error occurred while loading the page.', + {ns: 'mri_violations'})}

: { + i18n.addResourceBundle('hi', 'mri_violations', hiStrings); + + const ViolationsIndex = withTranslation( + ['mri_violations', 'loris'] + )(MRIViolationsIndex); + ReactDOM.createRoot( document.getElementById('lorisworkspace') ).render( - , diff --git a/modules/mri_violations/jsx/protocolModal.js b/modules/mri_violations/jsx/protocolModal.js index 8e3d542d1c5..9baea4796f9 100644 --- a/modules/mri_violations/jsx/protocolModal.js +++ b/modules/mri_violations/jsx/protocolModal.js @@ -3,7 +3,7 @@ import StaticDataTable from 'StaticDataTable'; import React, {useEffect, useState} from 'react'; import PropTypes from 'prop-types'; - +import {withTranslation} from 'react-i18next'; /** * A Modal popup to display a protocol violation of any @@ -13,16 +13,18 @@ import PropTypes from 'prop-types'; * @return {JSX} */ function ProtocolModal(props) { + const {t} = props; switch (props.Type) { case 'protocolviolation': - return ; + return ; case 'protocolcheck': - return ; + return ; default: return null; } } ProtocolModal.propTypes = { Type: PropTypes.string, + t: PropTypes.func, }; /** @@ -38,6 +40,7 @@ ProtocolModal.propTypes = { function ProtocolViolationModal(props) { const [data, setData] = useState([]); const [protocols, setMRIProtocols] = useState([]); + const {t} = props; useEffect(() => { fetch(props.URL + '?format=json' + @@ -57,42 +60,43 @@ function ProtocolViolationModal(props) { let violations = []; - let title = 'Violations for SeriesUID ' + props.SeriesUID; + let title = t('Violations for SeriesUID', {ns: 'mri_violations'}) + + ' ' + props.SeriesUID; for (const violation of data) { - title = 'Violations for ' + violation[4]; + title = t('Violations for', {ns: 'mri_violations'}) + ' ' + violation[4]; violations.push(
-
CandID
+
{t('CandID', {ns: 'mri_violations'})}
{violation[0]}
-
PSCID
+
{t('PSCID', {ns: 'loris'})}
{violation[1]}
-
Time Run
+
{t('Time Run', {ns: 'mri_violations'})}
{violation[2]}
-
Series Description
+
{t('Series Description', {ns: 'mri_violations'})}
{violation[3]}
-
Image Location
+
{t('Image Location', {ns: 'mri_violations'})}
{violation[4]}
-
Patient Name
+
{t('Patient Name', {ns: 'mri_violations'})}
{violation[5]}
-
Series UID
+
{t('Series UID', {ns: 'mri_violations'})}
{props.SeriesUID}
-
Echo Time
+
{t('Echo Time', {ns: 'mri_violations'})}
{violation[8]}
@@ -100,21 +104,21 @@ function ProtocolViolationModal(props) { - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -166,23 +170,23 @@ function ProtocolViolationModal(props) {
Protocol GroupTRTETISlice ThicknessXspaceYspaceZspaceXstepYstepZstepTimeImage TypePhase Encoding DirectionEcho Number{t('Protocol Group', {ns: 'mri_violations'})}{t('TR', {ns: 'mri_violations'})}{t('TE', {ns: 'mri_violations'})}{t('TI', {ns: 'mri_violations'})}{t('Slice Thickness', {ns: 'mri_violations'})}{t('Xspace', {ns: 'mri_violations'})}{t('Yspace', {ns: 'mri_violations'})}{t('Zspace', {ns: 'mri_violations'})}{t('Xstep', {ns: 'mri_violations'})}{t('Ystep', {ns: 'mri_violations'})}{t('Zstep', {ns: 'mri_violations'})}{t('Time', {ns: 'mri_violations'})}{t('Image Type', {ns: 'mri_violations'})}{t('Phase Encoding Direction', {ns: 'mri_violations'})}{t('Echo Number', {ns: 'mri_violations'})}
- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -204,7 +208,7 @@ function ProtocolViolationModal(props) { ); } if ( - column === t('Type of Problem', {ns: 'mri_violations'}) && - cell === t('Could not identify scan type', {ns: 'mri_violations'}) + (column === 'Type of Problem' || column === labelTypeOfProblem) && + (cell === 'Could not identify scan type' || cell === labelCouldNotIdentifyScanType) ) { const seriesDescription = rowData[ - t('Series Description or Scan Type', {ns: 'mri_violations'}) + labelSeriesDescriptionOrScanType ]; return ( ); } - if (column === 'Resolution Status') { - switch (rowData['Resolution Status']) { + if (column === 'Resolution Status' || column === labelResolutionStatus) { + switch (rowData[labelResolutionStatus]) { case 'unresolved': fontColor = {color: '#000000'}; - resolutionStatus = 'Unresolved'; + resolutionStatus = t('Unresolved', {ns: 'mri_violations'}); break; case 'reran': resolutionStatusStyle = 'label-success'; - resolutionStatus = 'Reran'; + resolutionStatus = t('Reran', {ns: 'mri_violations'}); break; case 'emailed': resolutionStatusStyle = 'label-info'; - resolutionStatus = 'Emailed site/pending'; + resolutionStatus = t('Emailed site/pending', {ns: 'mri_violations'}); break; case 'rejected': resolutionStatusStyle = 'label-danger'; - resolutionStatus = 'Rejected'; + resolutionStatus = t('Rejected', {ns: 'mri_violations'}); break; case 'inserted': resolutionStatusStyle = 'label-warning'; - resolutionStatus = 'Inserted'; + resolutionStatus = t('Inserted', {ns: 'mri_violations'}); break; case 'other': resolutionStatusStyle = 'label-primary'; - resolutionStatus = 'Other'; + resolutionStatus = t('Other', {ns: 'mri_violations'}); break; case 'inserted_flag': resolutionStatusStyle = 'label-default'; - resolutionStatus = 'Inserted with flag'; + resolutionStatus = t('Inserted with flag', {ns: 'mri_violations'}); break; } return ( @@ -200,7 +210,7 @@ function MRIViolationsIndex(props) { ); } - if (column === 'Select Resolution') { + if (column === 'Select Resolution' || column === labelSelectResolution) { return ( ); } - if (column === 'Image File') { + if (column === 'Image File' || column === labelImageFile) { let log; - if (rowData['Type of Problem'] === 'Could not identify scan type') { + if (rowData[labelTypeOfProblem] === 'Could not identify scan type') { log = 1; - } else if (rowData['Type of Problem'] === 'Protocol Violation') { + } else if (rowData[labelTypeOfProblem] === 'Protocol Violation') { log = 2; } else { log = 3; @@ -272,21 +282,21 @@ function MRIViolationsIndex(props) { }, }, { - label: t('Project', {ns: 'loris'}), show: true, filter: { + label: t('Project', {ns: 'loris', count: 0}), show: true, filter: { name: 'project', type: 'select', options: fieldoptions.projects, }, }, { - label: t('Cohort', {ns: 'loris'}), show: true, filter: { + label: t('Cohort', {ns: 'loris', count: 0}), show: true, filter: { name: 'cohort', type: 'select', options: fieldoptions.cohorts, }, }, { - label: t('Site', {ns: 'loris'}), show: true, filter: { + label: t('Site', {ns: 'loris', count: 0}), show: true, filter: { name: 'site', type: 'select', options: fieldoptions.sites, @@ -327,11 +337,11 @@ function MRIViolationsIndex(props) { options: { 'unresolved': t('Unresolved', {ns: 'mri_violations'}), 'reran': t('Reran', {ns: 'mri_violations'}), - 'emailed': t('emailed site/pending', {ns: 'mri_violations'}), - 'inserted': t('inserted', {ns: 'mri_violations'}), - 'rejected': t('rejected', {ns: 'mri_violations'}), - 'inserted_flag': t('inserted with flag', {ns: 'mri_violations'}), - 'other': t('other', {ns: 'mri_violations'}), + 'emailed': t('Emailed site/pending', {ns: 'mri_violations'}), + 'inserted': t('Inserted', {ns: 'mri_violations'}), + 'rejected': t('Rejected', {ns: 'mri_violations'}), + 'inserted_flag': t('Inserted with flag', {ns: 'mri_violations'}), + 'other': t('Other', {ns: 'mri_violations'}), }, }, }, @@ -341,11 +351,11 @@ function MRIViolationsIndex(props) { type: 'text', }, }, - {label: 'hash', show: false}, - {label: 'JoinID', show: false}, - {label: 'TarchiveID', show: false}, - {label: 'CandID', show: false}, - {label: 'PSCID', show: false}, + {label: t('hash', {ns: 'mri_violations'}), show: false}, + {label: t('JoinID', {ns: 'mri_violations'}), show: false}, + {label: t('TarchiveID', {ns: 'mri_violations'}), show: false}, + {label: t('CandID', {ns: 'loris'}), show: false}, + {label: t('PSCID', {ns: 'loris'}), show: false}, // Add fake column for resolution dropdown {label: t('Select Resolution', {ns: 'mri_violations'}), show: true}, @@ -414,6 +424,9 @@ function columnMapper(fieldOptions) { window.addEventListener('load', () => { i18n.addResourceBundle('hi', 'mri_violations', hiStrings); + i18n.addResourceBundle('ja', 'mri_violations', jaStrings); + i18n.addResourceBundle('fr', 'mri_violations', frStrings); + i18n.addResourceBundle('es', 'mri_violations', esStrings); const ViolationsIndex = withTranslation( ['mri_violations', 'loris'] diff --git a/modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po new file mode 100644 index 00000000000..5f77257935d --- /dev/null +++ b/modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po @@ -0,0 +1,175 @@ +# Default LORIS strings to be translated (English). +# 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 , 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 \n" +"Language-Team: LANGUAGE \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "MRI Violated Scans" +msgstr "Escaneos de resonancia magnética violados" + +msgid "Violations for SeriesUID" +msgstr "Infracciones para SeriesUID" + +msgid "Violations for" +msgstr "Violaciones por" + +msgid "Time Run" +msgstr "Ejecución del tiempo" + +msgid "Series Description" +msgstr "Descripción de la serie" + +msgid "Image Location" +msgstr "Ubicación de la imagen" + +msgid "Patient Name" +msgstr "Nombre del paciente" + +msgid "Series UID" +msgstr "UID de serie" + +msgid "Echo Time" +msgstr "Tiempo de eco" + +msgid "Protocol Group" +msgstr "Grupo de protocolo" + +msgid "TR" +msgstr "TR" + +msgid "TE" +msgstr "TE" + +msgid "TI" +msgstr "TI" + +msgid "Slice Thickness" +msgstr "Grosor de la rebanada" + +msgid "Xspace" +msgstr "espacio x" + +msgid "Yspace" +msgstr "Yespacio" + +msgid "Zspace" +msgstr "Espacio Z" + +msgid "Xstep" +msgstr "xpaso" + +msgid "Ystep" +msgstr "Y paso" + +msgid "Zstep" +msgstr "Zpaso" + +msgid "Time" +msgstr "Tiempo" + +msgid "Image Type" +msgstr "Tipo de imagen" + +msgid "Phase Encoding Direction" +msgstr "Dirección de codificación de fase" + +msgid "Echo Number" +msgstr "Número de eco" + +msgid "Image Protocol" +msgstr "Protocolo de imagen" + +msgid "Study Protocols" +msgstr "Protocolos de estudio" + +msgid "Scan Problems" +msgstr "Problemas de escaneo" + +msgid "Scan Type" +msgstr "Tipo de escaneo" + +msgid "Severity" +msgstr "Gravedad" + +msgid "Header" +msgstr "Encabezamiento" + +msgid "Value" +msgstr "Valor" + +msgid "Valid Values" +msgstr "Valores válidos" + +msgid "Protocol Violation" +msgstr "Violación del protocolo" + +msgid "Could not identify scan type" +msgstr "No se pudo identificar el tipo de escaneo." + +msgid "Series Description or Scan Type" +msgstr "Descripción de la serie o tipo de escaneo" + +msgid "Resolution Status" +msgstr "Estado de resolución" + +msgid "Unresolved" +msgstr "Irresoluto" + +msgid "Reran" +msgstr "reran" + +msgid "Emailed site/pending" +msgstr "Sitio enviado por correo electrónico/pendiente" + +msgid "Inserted" +msgstr "Insertado" + +msgid "Rejected" +msgstr "Rechazado" + +msgid "Inserted with flag" +msgstr "Insertado con bandera" + +msgid "Other" +msgstr "Otro" + +msgid "Type of Problem" +msgstr "Tipo de problema" + +msgid "Select Resolution" +msgstr "Seleccionar resolución" + +msgid "Image File" +msgstr "Archivo de imagen" + +msgid "Must submit data in JSON format" +msgstr "Debe enviar los datos en formato JSON." + +msgid "Can not implement filter on a resource type that has no centers." +msgstr "No se puede implementar un filtro en un tipo de recurso que no tenga centros." + +msgid "hash" +msgstr "picadillo" + +msgid "JoinID" +msgstr "UnirseID" + +msgid "TarchiveID" +msgstr "ID de archivo" + +msgid "Can not implement filter on a resource type that has no projects." +msgstr "No se puede implementar un filtro en un tipo de recurso que no tenga proyectos." diff --git a/modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po new file mode 100644 index 00000000000..66b719992d4 --- /dev/null +++ b/modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po @@ -0,0 +1,175 @@ +# Default LORIS strings to be translated (English). +# 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 , 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 \n" +"Language-Team: LANGUAGE \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "MRI Violated Scans" +msgstr "MRI Scans violés" + +msgid "Violations for SeriesUID" +msgstr "Violations pour SeriesUID" + +msgid "Violations for" +msgstr "Violations pour" + +msgid "Time Run" +msgstr "Temps d'exécution" + +msgid "Series Description" +msgstr "Description de la série" + +msgid "Image Location" +msgstr "Emplacement de l'image" + +msgid "Patient Name" +msgstr "Nom du patient" + +msgid "Series UID" +msgstr "UID de la série" + +msgid "Echo Time" +msgstr "Temps d'écho" + +msgid "Protocol Group" +msgstr "Groupe de protocole" + +msgid "TR" +msgstr "TR" + +msgid "TE" +msgstr "TE" + +msgid "TI" +msgstr "TI" + +msgid "Slice Thickness" +msgstr "Épaisseur de tranche" + +msgid "Xspace" +msgstr "Xespace" + +msgid "Yspace" +msgstr "Yspace" + +msgid "Zspace" +msgstr "EspaceZ" + +msgid "Xstep" +msgstr "Xétape" + +msgid "Ystep" +msgstr "Étape Y" + +msgid "Zstep" +msgstr "Zétape" + +msgid "Time" +msgstr "Temps" + +msgid "Image Type" +msgstr "Type d'image" + +msgid "Phase Encoding Direction" +msgstr "Direction de codage de phase" + +msgid "Echo Number" +msgstr "Numéro d'écho" + +msgid "Image Protocol" +msgstr "Protocole d'image" + +msgid "Study Protocols" +msgstr "Protocoles d'étude" + +msgid "Scan Problems" +msgstr "Problèmes de numérisation" + +msgid "Scan Type" +msgstr "Type de numérisation" + +msgid "Severity" +msgstr "Gravité" + +msgid "Header" +msgstr "En-tête" + +msgid "Value" +msgstr "Valeur" + +msgid "Valid Values" +msgstr "Valeurs valides" + +msgid "Protocol Violation" +msgstr "Violation du protocole" + +msgid "Could not identify scan type" +msgstr "Type de numérisation non identifié" + +msgid "Series Description or Scan Type" +msgstr "Description de la série ou type de numérisation" + +msgid "Resolution Status" +msgstr "Statut de résolution" + +msgid "Unresolved" +msgstr "Non résolu" + +msgid "Reran" +msgstr "Réexécuter" + +msgid "Emailed site/pending" +msgstr "Site envoyé par courriel/en attente" + +msgid "Inserted" +msgstr "Inséré" + +msgid "Rejected" +msgstr "Rejeté" + +msgid "Inserted with flag" +msgstr "Inséré avec un drapeau" + +msgid "Other" +msgstr "Autre" + +msgid "Type of Problem" +msgstr "Type de problème" + +msgid "Select Resolution" +msgstr "Sélectionnez la résolution" + +msgid "Image File" +msgstr "Fichier image" + +msgid "Must submit data in JSON format" +msgstr "Les données doivent être soumises au format JSON." + +msgid "Can not implement filter on a resource type that has no centers." +msgstr "Impossible d'appliquer un filtre à un type de ressource sans centre." + +msgid "hash" +msgstr "hacher" + +msgid "JoinID" +msgstr "ID de jointure" + +msgid "TarchiveID" +msgstr "TarchiveID" + +msgid "Can not implement filter on a resource type that has no projects." +msgstr "Impossible d'appliquer un filtre à un type de ressource qui ne comporte aucun projet." diff --git a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po index 38e5baa24af..d631c1ecdbd 100644 --- a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po +++ b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po @@ -132,19 +132,19 @@ msgstr "अनसुलझा" msgid "Reran" msgstr "पुनः चलाया गया" -msgid "emailed site/pending" +msgid "Emailed site/pending" msgstr "साइट को ईमेल किया/लंबित" -msgid "inserted" +msgid "Inserted" msgstr "डाला गया" -msgid "rejected" +msgid "Rejected" msgstr "अस्वीकृत" msgid "Inserted with flag" msgstr "फ्लैग के साथ डाला गया" -msgid "other" +msgid "Other" msgstr "अन्य" msgid "Type of Problem" @@ -162,5 +162,14 @@ msgstr "डेटा JSON प्रारूप में जमा करना msgid "Can not implement filter on a resource type that has no centers." msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई केंद्र नहीं हैं।" +msgid "hash" +msgstr "हैश" + +msgid "JoinID" +msgstr "जॉइनआईडी" + +msgid "TarchiveID" +msgstr "टार्चिवआईडी" + msgid "Can not implement filter on a resource type that has no projects." -msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई प्रोजेक्ट नहीं हैं।" +msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई परियोजना नहीं है." diff --git a/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po index c39ffc52fe2..90f00b403e9 100644 --- a/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po +++ b/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po @@ -21,10 +21,159 @@ msgstr "" msgid "MRI Violated Scans" msgstr "MRI違反スキャン" - msgid "Violated scan" msgstr "違反スキャン" -msgid "Violated scans" -msgstr "違反スキャン" +msgid "Violations for SeriesUID" +msgstr "SeriesUIDの違反" + +msgid "Violations for" +msgstr "違反行為" + +msgid "Time Run" +msgstr "タイムラン" + +msgid "Series Description" +msgstr "シリーズ説明" + +msgid "Image Location" +msgstr "画像の場所" + +msgid "Patient Name" +msgstr "患者名" + +msgid "Series UID" +msgstr "シリーズUID" + +msgid "Echo Time" +msgstr "エコータイム" + +msgid "Protocol Group" +msgstr "プロトコルグループ" + +msgid "TR" +msgstr "TR" + +msgid "TE" +msgstr "TE" + +msgid "TI" +msgstr "TI" + +msgid "Slice Thickness" +msgstr "スライスの厚さ" + +msgid "Xspace" +msgstr "エックススペース" + +msgid "Yspace" +msgstr "ワイスペース" + +msgid "Zspace" +msgstr "Zspace" + +msgid "Xstep" +msgstr "エクスステップ" + +msgid "Ystep" +msgstr "ワイステップ" + +msgid "Zstep" +msgstr "ゼットステップ" + +msgid "Time" +msgstr "時間" + +msgid "Image Type" +msgstr "画像の種類" + +msgid "Phase Encoding Direction" +msgstr "位相エンコード方向" + +msgid "Echo Number" +msgstr "エコー番号" + +msgid "Image Protocol" +msgstr "画像プロトコル" + +msgid "Study Protocols" +msgstr "研究プロトコル" + +msgid "Scan Problems" +msgstr "スキャンの問題" + +msgid "Scan Type" +msgstr "スキャンタイプ" + +msgid "Severity" +msgstr "重大度" + +msgid "Header" +msgstr "ヘッダ" + +msgid "Value" +msgstr "価値" + +msgid "Valid Values" +msgstr "有効な値" + +msgid "Protocol Violation" +msgstr "プロトコル違反" + +msgid "Could not identify scan type" +msgstr "スキャンの種類を識別できませんでした" + +msgid "Series Description or Scan Type" +msgstr "シリーズの説明またはスキャンタイプ" + +msgid "Resolution Status" +msgstr "解決ステータス" + +msgid "Unresolved" +msgstr "未解決" + +msgid "Reran" +msgstr "リラン" + +msgid "Emailed site/pending" +msgstr "メールを送信したサイト/保留中" + +msgid "Inserted" +msgstr "挿入された" + +msgid "Rejected" +msgstr "拒否されました" + +msgid "Inserted with flag" +msgstr "フラグ付きで挿入" + +msgid "Other" +msgstr "他の" + +msgid "Type of Problem" +msgstr "問題の種類" + +msgid "Select Resolution" +msgstr "解像度の選択" + +msgid "Image File" +msgstr "画像ファイル" + +msgid "Must submit data in JSON format" +msgstr "データはJSON形式で送信する必要があります" + +msgid "Can not implement filter on a resource type that has no centers." +msgstr "センターのないリソース タイプにフィルターを実装することはできません." + +msgid "hash" +msgstr "ハッシュ" + +msgid "JoinID" +msgstr "参加ID" + +msgid "TarchiveID" +msgstr "アーカイブID" + +msgid "Can not implement filter on a resource type that has no projects." +msgstr "プロジェクトがないリソース タイプにフィルターを実装することはできません。" diff --git a/modules/mri_violations/locale/mri_violations.pot b/modules/mri_violations/locale/mri_violations.pot index 1ee312bc191..2a460b11c6d 100644 --- a/modules/mri_violations/locale/mri_violations.pot +++ b/modules/mri_violations/locale/mri_violations.pot @@ -138,19 +138,19 @@ msgstr "" msgid "Reran" msgstr "" -msgid "emailed site/pending" +msgid "Emailed site/pending" msgstr "" -msgid "inserted" +msgid "Inserted" msgstr "" -msgid "rejected" +msgid "Rejected" msgstr "" msgid "Inserted with flag" msgstr "" -msgid "other" +msgid "Other" msgstr "" msgid "Type of Problem" @@ -170,3 +170,12 @@ msgstr "" msgid "Can not implement filter on a resource type that has no projects." msgstr "" + +msgid "hash" +msgstr "" + +msgid "JoinID" +msgstr "" + +msgid "TarchiveID" +msgstr "" From 8f6c0eec92dae1abaaa27c6e6afb01ed34c3dde0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 20 Nov 2025 11:07:58 -0500 Subject: [PATCH 06/13] fix lint --- .../mri_violations/jsx/mriViolationsIndex.js | 542 ++++++++++-------- 1 file changed, 302 insertions(+), 240 deletions(-) diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index 7cf665bf148..419f5484487 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -1,21 +1,21 @@ -import Loader from 'Loader'; -import FilterableDataTable from 'FilterableDataTable'; -import React, {useEffect, useState} from 'react'; -import PropTypes from 'prop-types'; -import ProtocolModal from './protocolModal.js'; -import i18n from 'I18nSetup'; -import {withTranslation} from 'react-i18next'; +import Loader from "Loader"; +import FilterableDataTable from "FilterableDataTable"; +import React, { useEffect, useState } from "react"; +import PropTypes from "prop-types"; +import ProtocolModal from "./protocolModal.js"; +import i18n from "I18nSetup"; +import { withTranslation } from "react-i18next"; -import hiStrings from '../locale/hi/LC_MESSAGES/mri_violations.json'; -import jaStrings from '../locale/ja/LC_MESSAGES/mri_violations.json'; -import frStrings from '../locale/fr/LC_MESSAGES/mri_violations.json'; -import esStrings from '../locale/es/LC_MESSAGES/mri_violations.json'; +import hiStrings from "../locale/hi/LC_MESSAGES/mri_violations.json"; +import jaStrings from "../locale/ja/LC_MESSAGES/mri_violations.json"; +import frStrings from "../locale/fr/LC_MESSAGES/mri_violations.json"; +import esStrings from "../locale/es/LC_MESSAGES/mri_violations.json"; /** * Entry point for the MRI Violatons module. * - * @param {object} props - React Component properties - * @return {JSX} + * @param {object} props - React Component properties + * @return {JSX} */ function MRIViolationsIndex(props) { const [fieldOptions, setFieldOptions] = useState({}); @@ -24,47 +24,52 @@ function MRIViolationsIndex(props) { const [isError, setIsError] = useState(false); const [data, setData] = useState([]); const mapper = columnMapper(fieldOptions); - const {t} = props; + const { t } = props; - const violationsModal = (violationModal !== false) ? - setViolationModal(false)} - URL={props.ModuleURL} - SeriesUID={violationModal.SeriesUID} - Type={violationModal.ViolationType} - /> : null; + const violationsModal = + violationModal !== false ? ( + setViolationModal(false)} + URL={props.ModuleURL} + SeriesUID={violationModal.SeriesUID} + Type={violationModal.ViolationType} + /> + ) : null; - useEffect(() => { - fetch(props.dataURL) - .then((res) => res.json()) - .then( - (result) => { - setIsLoaded(true); - setData(result.Data); - if (setFieldOptions) { - setFieldOptions(result.fieldOptions); - } - }, - (error) => { - setIsError(true); - } - ); - }, []); + useEffect( + () => { + fetch(props.dataURL) + .then((res) => res.json()) + .then( + (result) => { + setIsLoaded(true); + setData(result.Data); + if (setFieldOptions) { + setFieldOptions(result.fieldOptions); + } + }, + (error) => { + setIsError(true); + }, + ); + }, [] + ); /** - * onResolutionUpdate - * Callback executed when the resolution - * status is updated - * - * @param {string} value - New resolution status value - * @param {string} hashname - The violation hash - */ + * OnResolutionUpdate + * Callback executed when the resolution + * status is updated + * + * @param {string} value - New resolution status value + * @param {string} hashname - The violation hash + */ const onResolutionUpdate = (value, hashname) => { if (value) { - fetch(props.ModuleURL + '/resolve', { - method: 'POST', - mode: 'same-origin', - cache: 'no-cache', + fetch( + props.ModuleURL + "/resolve", { + method: "POST", + mode: "same-origin", + cache: "no-cache", body: JSON.stringify({ value: value, hash: hashname, @@ -72,28 +77,30 @@ function MRIViolationsIndex(props) { }).then(() => { // Update the Resolution Status const filtersData = filters(fieldOptions); - const resolutionStatusfilterIndex = filtersData - .findIndex( - (filter) => filter.label === t('Resolution Status', {ns: 'mri_violations'}) - ); - const hashfilterIndex = filtersData - .findIndex((filter) => filter.label === 'hash'); - const dataIndex = data - .findIndex((row) => row[hashfilterIndex] === hashname); + const resolutionStatusfilterIndex = filtersData.findIndex( + (filter) => + filter.label === t("Resolution Status", { ns: "mri_violations" }), + ); + const hashfilterIndex = filtersData.findIndex( + (filter) => filter.label === "hash", + ); + const dataIndex = data.findIndex( + (row) => row[hashfilterIndex] === hashname, + ); const dataCopy = data.map((row) => row.slice()); dataCopy[dataIndex][resolutionStatusfilterIndex] = value; setData(dataCopy); // Add animation on the updated row - const row = document.getElementById( - `select-resolution-${hashname}` - ).closest('tr'); - row.classList.add('highlighted'); + const row = document + .getElementById(`select-resolution-${hashname}`) + .closest("tr"); + row.classList.add("highlighted"); setTimeout(() => { - row.classList.remove('highlighted'); - }, '3500'); + row.classList.remove("highlighted"); + }, "3500"); }); } }; @@ -105,104 +112,127 @@ function MRIViolationsIndex(props) { * @param {function} setPage - a callback to set the current page * @return {function} a formatter callback which uses mapper for data mapping */ - const formatColumn = ( - mapper, - setPage, - ) => { - const Mapper = function(column, cell, rowData) { + const formatColumn = (mapper, setPage) => { + const Mapper = function (column, cell, rowData) { cell = mapper(column, cell); const hashname = rowData.hash; - const labelTypeOfProblem = t('Type of Problem', {ns: 'mri_violations'}); - const labelProtocolViolation = t('Protocol Violation', {ns: 'mri_violations'}); - const labelCouldNotIdentifyScanType = t('Could not identify scan type', {ns: 'mri_violations'}); - const labelResolutionStatus = t('Resolution Status', {ns: 'mri_violations'}); - const labelSelectResolution = t('Select Resolution', {ns: 'mri_violations'}); - const labelImageFile = t('Image File', {ns: 'mri_violations'}); - const labelSeriesDescriptionOrScanType = t('Series Description or Scan Type', {ns: 'mri_violations'}); + const labelTypeOfProblem = t("Type of Problem", { ns: "mri_violations" }); + const labelProtocolViolation = t("Protocol Violation", { + ns: "mri_violations", + }); + const labelCouldNotIdentifyScanType = t("Could not identify scan type", { + ns: "mri_violations", + }); + const labelResolutionStatus = t("Resolution Status", { + ns: "mri_violations", + }); + const labelSelectResolution = t("Select Resolution", { + ns: "mri_violations", + }); + const labelImageFile = t("Image File", { ns: "mri_violations" }); + const labelSeriesDescriptionOrScanType = t( + "Series Description or Scan Type", + { ns: "mri_violations" }, + ); // Create the mapping between rowHeaders and rowData in a row object. - let fontColor = {color: '#FFFFFF'}; + let fontColor = { color: "#FFFFFF" }; let resolutionStatusStyle; let resolutionStatus; - if ((column === 'Type of Problem' || column === labelTypeOfProblem) && - (cell === 'Protocol Violation' || cell === labelProtocolViolation)) { + if ( + (column === "Type of Problem" || column === labelTypeOfProblem) && + (cell === "Protocol Violation" || cell === labelProtocolViolation) + ) { return ( ); } if ( - (column === 'Type of Problem' || column === labelTypeOfProblem) && - (cell === 'Could not identify scan type' || cell === labelCouldNotIdentifyScanType) + (column === "Type of Problem" || column === labelTypeOfProblem) && + (cell === "Could not identify scan type" || + cell === labelCouldNotIdentifyScanType) ) { - const seriesDescription = rowData[ - labelSeriesDescriptionOrScanType - ]; + const seriesDescription = rowData[labelSeriesDescriptionOrScanType]; return ( ); } - if (column === 'Resolution Status' || column === labelResolutionStatus) { + if (column === "Resolution Status" || column === labelResolutionStatus) { switch (rowData[labelResolutionStatus]) { - case 'unresolved': - fontColor = {color: '#000000'}; - resolutionStatus = t('Unresolved', {ns: 'mri_violations'}); - break; + case "unresolved": + fontColor = { color: "#000000" }; + resolutionStatus = t("Unresolved", { ns: "mri_violations" }); + break; - case 'reran': - resolutionStatusStyle = 'label-success'; - resolutionStatus = t('Reran', {ns: 'mri_violations'}); - break; + case "reran": + resolutionStatusStyle = "label-success"; + resolutionStatus = t("Reran", { ns: "mri_violations" }); + break; - case 'emailed': - resolutionStatusStyle = 'label-info'; - resolutionStatus = t('Emailed site/pending', {ns: 'mri_violations'}); - break; + case "emailed": + resolutionStatusStyle = "label-info"; + resolutionStatus = t("Emailed site/pending", { + ns: "mri_violations", + }); + break; - case 'rejected': - resolutionStatusStyle = 'label-danger'; - resolutionStatus = t('Rejected', {ns: 'mri_violations'}); - break; + case "rejected": + resolutionStatusStyle = "label-danger"; + resolutionStatus = t("Rejected", { ns: "mri_violations" }); + break; - case 'inserted': - resolutionStatusStyle = 'label-warning'; - resolutionStatus = t('Inserted', {ns: 'mri_violations'}); - break; + case "inserted": + resolutionStatusStyle = "label-warning"; + resolutionStatus = t("Inserted", { ns: "mri_violations" }); + break; - case 'other': - resolutionStatusStyle = 'label-primary'; - resolutionStatus = t('Other', {ns: 'mri_violations'}); - break; + case "other": + resolutionStatusStyle = "label-primary"; + resolutionStatus = t("Other", { ns: "mri_violations" }); + break; - case 'inserted_flag': - resolutionStatusStyle = 'label-default'; - resolutionStatus = t('Inserted with flag', {ns: 'mri_violations'}); - break; + case "inserted_flag": + resolutionStatusStyle = "label-default"; + resolutionStatus = t("Inserted with flag", { + ns: "mri_violations", + }); + break; } return ( ); } - if (column === 'Select Resolution' || column === labelSelectResolution) { + if (column === "Select Resolution" || column === labelSelectResolution) { return ( ); } - if (column === 'Image File' || column === labelImageFile) { + if (column === "Image File" || column === labelImageFile) { let log; - if (rowData[labelTypeOfProblem] === 'Could not identify scan type') { + if (rowData[labelTypeOfProblem] === "Could not identify scan type") { log = 1; - } else if (rowData[labelTypeOfProblem] === 'Protocol Violation') { + } else if (rowData[labelTypeOfProblem] === "Protocol Violation") { log = 2; } else { log = 3; } - let url = loris.BaseURL + - '/brainbrowser/?minc_id=' + - log + - 'l' + - rowData.JoinID; + let url = + loris.BaseURL + + "/brainbrowser/?minc_id=" + + log + + "l" + + rowData.JoinID; return ( ); } - return (); + return ; }; return Mapper; }; @@ -276,111 +323,129 @@ function MRIViolationsIndex(props) { } return [ { - label: t('Patient Name', {ns: 'mri_violations'}), show: true, filter: { - name: 'patientName', - type: 'text', + label: t("Patient Name", { ns: "mri_violations" }), + show: true, + filter: { + name: "patientName", + type: "text", }, }, { - label: t('Project', {ns: 'loris', count: 0}), show: true, filter: { - name: 'project', - type: 'select', + label: t("Project", { ns: "loris", count: 0 }), + show: true, + filter: { + name: "project", + type: "select", options: fieldoptions.projects, }, }, { - label: t('Cohort', {ns: 'loris', count: 0}), show: true, filter: { - name: 'cohort', - type: 'select', + label: t("Cohort", { ns: "loris", count: 0 }), + show: true, + filter: { + name: "cohort", + type: "select", options: fieldoptions.cohorts, }, }, { - label: t('Site', {ns: 'loris', count: 0}), show: true, filter: { - name: 'site', - type: 'select', + label: t("Site", { ns: "loris", count: 0 }), + show: true, + filter: { + name: "site", + type: "select", options: fieldoptions.sites, }, }, { - label: t('Time Run', {ns: 'mri_violations'}), show: true, filter: { - name: 'timeRun', - type: 'datetime', + label: t("Time Run", { ns: "mri_violations" }), + show: true, + filter: { + name: "timeRun", + type: "datetime", }, }, { - label: t('Image File', {ns: 'mri_violations'}), show: true, filter: { - name: 'mincFile', - type: 'text', + label: t("Image File", { ns: "mri_violations" }), + show: true, + filter: { + name: "mincFile", + type: "text", }, }, { - label: t('Series Description or Scan Type', {ns: 'mri_violations'}), - show: true, filter: { - name: 'seriesOrType', - type: 'text', + label: t("Series Description or Scan Type", { ns: "mri_violations" }), + show: true, + filter: { + name: "seriesOrType", + type: "text", }, }, { - label: t('Type of Problem', {ns: 'mri_violations'}), - show: true, filter: { - name: 'typeOfProblem', - type: 'select', + label: t("Type of Problem", { ns: "mri_violations" }), + show: true, + filter: { + name: "typeOfProblem", + type: "select", options: problemtypes, }, }, { - label: t('Resolution Status', {ns: 'mri_violations'}), - show: true, filter: { - name: 'resolutionStatus', - type: 'select', + label: t("Resolution Status", { ns: "mri_violations" }), + show: true, + filter: { + name: "resolutionStatus", + type: "select", options: { - 'unresolved': t('Unresolved', {ns: 'mri_violations'}), - 'reran': t('Reran', {ns: 'mri_violations'}), - 'emailed': t('Emailed site/pending', {ns: 'mri_violations'}), - 'inserted': t('Inserted', {ns: 'mri_violations'}), - 'rejected': t('Rejected', {ns: 'mri_violations'}), - 'inserted_flag': t('Inserted with flag', {ns: 'mri_violations'}), - 'other': t('Other', {ns: 'mri_violations'}), + unresolved: t("Unresolved", { ns: "mri_violations" }), + reran: t("Reran", { ns: "mri_violations" }), + emailed: t("Emailed site/pending", { ns: "mri_violations" }), + inserted: t("Inserted", { ns: "mri_violations" }), + rejected: t("Rejected", { ns: "mri_violations" }), + inserted_flag: t("Inserted with flag", { ns: "mri_violations" }), + other: t("Other", { ns: "mri_violations" }), }, }, }, { - label: t('Series UID', {ns: 'mri_violations'}), show: false, filter: { - name: 'seriesUID', - type: 'text', + label: t("Series UID", { ns: "mri_violations" }), + show: false, + filter: { + name: "seriesUID", + type: "text", }, }, - {label: t('hash', {ns: 'mri_violations'}), show: false}, - {label: t('JoinID', {ns: 'mri_violations'}), show: false}, - {label: t('TarchiveID', {ns: 'mri_violations'}), show: false}, - {label: t('CandID', {ns: 'loris'}), show: false}, - {label: t('PSCID', {ns: 'loris'}), show: false}, + { label: t("hash", { ns: "mri_violations" }), show: false }, + { label: t("JoinID", { ns: "mri_violations" }), show: false }, + { label: t("TarchiveID", { ns: "mri_violations" }), show: false }, + { label: t("CandID", { ns: "loris" }), show: false }, + { label: t("PSCID", { ns: "loris" }), show: false }, // Add fake column for resolution dropdown - {label: t('Select Resolution', {ns: 'mri_violations'}), show: true}, + { label: t("Select Resolution", { ns: "mri_violations" }), show: true }, ]; }; return (
{violationsModal} - {!isLoaded ? - : - isError ? -

{t('An error occurred while loading the page.', - {ns: 'mri_violations'})}

: - - } + {!isLoaded ? ( + + ) : isError ? ( +

+ {t("An error occurred while loading the page.", { + ns: "mri_violations", + })} +

+ ) : ( + + )}
); } @@ -402,43 +467,40 @@ MRIViolationsIndex.propTypes = { function columnMapper(fieldOptions) { return (column, value) => { switch (column) { - case 'Project': - if (fieldOptions.projects) { - return fieldOptions.projects[value]; - } - break; - case 'Cohort': - if (fieldOptions.cohorts) { - return fieldOptions.cohorts[value]; - } - break; - case 'Site': - if (fieldOptions.sites) { - return fieldOptions.sites[value]; - } - break; + case "Project": + if (fieldOptions.projects) { + return fieldOptions.projects[value]; + } + break; + case "Cohort": + if (fieldOptions.cohorts) { + return fieldOptions.cohorts[value]; + } + break; + case "Site": + if (fieldOptions.sites) { + return fieldOptions.sites[value]; + } + break; } return value; }; } -window.addEventListener('load', () => { - i18n.addResourceBundle('hi', 'mri_violations', hiStrings); - i18n.addResourceBundle('ja', 'mri_violations', jaStrings); - i18n.addResourceBundle('fr', 'mri_violations', frStrings); - i18n.addResourceBundle('es', 'mri_violations', esStrings); +window.addEventListener("load", () => { + i18n.addResourceBundle("hi", "mri_violations", hiStrings); + i18n.addResourceBundle("ja", "mri_violations", jaStrings); + i18n.addResourceBundle("fr", "mri_violations", frStrings); + i18n.addResourceBundle("es", "mri_violations", esStrings); - const ViolationsIndex = withTranslation( - ['mri_violations', 'loris'] - )(MRIViolationsIndex); + const ViolationsIndex = withTranslation(["mri_violations", "loris"])( + MRIViolationsIndex, + ); - ReactDOM.createRoot( - document.getElementById('lorisworkspace') - ).render( + ReactDOM.createRoot(document.getElementById("lorisworkspace")).render( , ); }); - From fe312bc61bcdf6eb3cbf42564382aeaf1fd2b45f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 20 Nov 2025 17:53:53 -0500 Subject: [PATCH 07/13] updates --- .../mri_violations/jsx/mriViolationsIndex.js | 542 ++++++++++-------- 1 file changed, 302 insertions(+), 240 deletions(-) diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index 7cf665bf148..419f5484487 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -1,21 +1,21 @@ -import Loader from 'Loader'; -import FilterableDataTable from 'FilterableDataTable'; -import React, {useEffect, useState} from 'react'; -import PropTypes from 'prop-types'; -import ProtocolModal from './protocolModal.js'; -import i18n from 'I18nSetup'; -import {withTranslation} from 'react-i18next'; +import Loader from "Loader"; +import FilterableDataTable from "FilterableDataTable"; +import React, { useEffect, useState } from "react"; +import PropTypes from "prop-types"; +import ProtocolModal from "./protocolModal.js"; +import i18n from "I18nSetup"; +import { withTranslation } from "react-i18next"; -import hiStrings from '../locale/hi/LC_MESSAGES/mri_violations.json'; -import jaStrings from '../locale/ja/LC_MESSAGES/mri_violations.json'; -import frStrings from '../locale/fr/LC_MESSAGES/mri_violations.json'; -import esStrings from '../locale/es/LC_MESSAGES/mri_violations.json'; +import hiStrings from "../locale/hi/LC_MESSAGES/mri_violations.json"; +import jaStrings from "../locale/ja/LC_MESSAGES/mri_violations.json"; +import frStrings from "../locale/fr/LC_MESSAGES/mri_violations.json"; +import esStrings from "../locale/es/LC_MESSAGES/mri_violations.json"; /** * Entry point for the MRI Violatons module. * - * @param {object} props - React Component properties - * @return {JSX} + * @param {object} props - React Component properties + * @return {JSX} */ function MRIViolationsIndex(props) { const [fieldOptions, setFieldOptions] = useState({}); @@ -24,47 +24,52 @@ function MRIViolationsIndex(props) { const [isError, setIsError] = useState(false); const [data, setData] = useState([]); const mapper = columnMapper(fieldOptions); - const {t} = props; + const { t } = props; - const violationsModal = (violationModal !== false) ? - setViolationModal(false)} - URL={props.ModuleURL} - SeriesUID={violationModal.SeriesUID} - Type={violationModal.ViolationType} - /> : null; + const violationsModal = + violationModal !== false ? ( + setViolationModal(false)} + URL={props.ModuleURL} + SeriesUID={violationModal.SeriesUID} + Type={violationModal.ViolationType} + /> + ) : null; - useEffect(() => { - fetch(props.dataURL) - .then((res) => res.json()) - .then( - (result) => { - setIsLoaded(true); - setData(result.Data); - if (setFieldOptions) { - setFieldOptions(result.fieldOptions); - } - }, - (error) => { - setIsError(true); - } - ); - }, []); + useEffect( + () => { + fetch(props.dataURL) + .then((res) => res.json()) + .then( + (result) => { + setIsLoaded(true); + setData(result.Data); + if (setFieldOptions) { + setFieldOptions(result.fieldOptions); + } + }, + (error) => { + setIsError(true); + }, + ); + }, [] + ); /** - * onResolutionUpdate - * Callback executed when the resolution - * status is updated - * - * @param {string} value - New resolution status value - * @param {string} hashname - The violation hash - */ + * OnResolutionUpdate + * Callback executed when the resolution + * status is updated + * + * @param {string} value - New resolution status value + * @param {string} hashname - The violation hash + */ const onResolutionUpdate = (value, hashname) => { if (value) { - fetch(props.ModuleURL + '/resolve', { - method: 'POST', - mode: 'same-origin', - cache: 'no-cache', + fetch( + props.ModuleURL + "/resolve", { + method: "POST", + mode: "same-origin", + cache: "no-cache", body: JSON.stringify({ value: value, hash: hashname, @@ -72,28 +77,30 @@ function MRIViolationsIndex(props) { }).then(() => { // Update the Resolution Status const filtersData = filters(fieldOptions); - const resolutionStatusfilterIndex = filtersData - .findIndex( - (filter) => filter.label === t('Resolution Status', {ns: 'mri_violations'}) - ); - const hashfilterIndex = filtersData - .findIndex((filter) => filter.label === 'hash'); - const dataIndex = data - .findIndex((row) => row[hashfilterIndex] === hashname); + const resolutionStatusfilterIndex = filtersData.findIndex( + (filter) => + filter.label === t("Resolution Status", { ns: "mri_violations" }), + ); + const hashfilterIndex = filtersData.findIndex( + (filter) => filter.label === "hash", + ); + const dataIndex = data.findIndex( + (row) => row[hashfilterIndex] === hashname, + ); const dataCopy = data.map((row) => row.slice()); dataCopy[dataIndex][resolutionStatusfilterIndex] = value; setData(dataCopy); // Add animation on the updated row - const row = document.getElementById( - `select-resolution-${hashname}` - ).closest('tr'); - row.classList.add('highlighted'); + const row = document + .getElementById(`select-resolution-${hashname}`) + .closest("tr"); + row.classList.add("highlighted"); setTimeout(() => { - row.classList.remove('highlighted'); - }, '3500'); + row.classList.remove("highlighted"); + }, "3500"); }); } }; @@ -105,104 +112,127 @@ function MRIViolationsIndex(props) { * @param {function} setPage - a callback to set the current page * @return {function} a formatter callback which uses mapper for data mapping */ - const formatColumn = ( - mapper, - setPage, - ) => { - const Mapper = function(column, cell, rowData) { + const formatColumn = (mapper, setPage) => { + const Mapper = function (column, cell, rowData) { cell = mapper(column, cell); const hashname = rowData.hash; - const labelTypeOfProblem = t('Type of Problem', {ns: 'mri_violations'}); - const labelProtocolViolation = t('Protocol Violation', {ns: 'mri_violations'}); - const labelCouldNotIdentifyScanType = t('Could not identify scan type', {ns: 'mri_violations'}); - const labelResolutionStatus = t('Resolution Status', {ns: 'mri_violations'}); - const labelSelectResolution = t('Select Resolution', {ns: 'mri_violations'}); - const labelImageFile = t('Image File', {ns: 'mri_violations'}); - const labelSeriesDescriptionOrScanType = t('Series Description or Scan Type', {ns: 'mri_violations'}); + const labelTypeOfProblem = t("Type of Problem", { ns: "mri_violations" }); + const labelProtocolViolation = t("Protocol Violation", { + ns: "mri_violations", + }); + const labelCouldNotIdentifyScanType = t("Could not identify scan type", { + ns: "mri_violations", + }); + const labelResolutionStatus = t("Resolution Status", { + ns: "mri_violations", + }); + const labelSelectResolution = t("Select Resolution", { + ns: "mri_violations", + }); + const labelImageFile = t("Image File", { ns: "mri_violations" }); + const labelSeriesDescriptionOrScanType = t( + "Series Description or Scan Type", + { ns: "mri_violations" }, + ); // Create the mapping between rowHeaders and rowData in a row object. - let fontColor = {color: '#FFFFFF'}; + let fontColor = { color: "#FFFFFF" }; let resolutionStatusStyle; let resolutionStatus; - if ((column === 'Type of Problem' || column === labelTypeOfProblem) && - (cell === 'Protocol Violation' || cell === labelProtocolViolation)) { + if ( + (column === "Type of Problem" || column === labelTypeOfProblem) && + (cell === "Protocol Violation" || cell === labelProtocolViolation) + ) { return ( ); } if ( - (column === 'Type of Problem' || column === labelTypeOfProblem) && - (cell === 'Could not identify scan type' || cell === labelCouldNotIdentifyScanType) + (column === "Type of Problem" || column === labelTypeOfProblem) && + (cell === "Could not identify scan type" || + cell === labelCouldNotIdentifyScanType) ) { - const seriesDescription = rowData[ - labelSeriesDescriptionOrScanType - ]; + const seriesDescription = rowData[labelSeriesDescriptionOrScanType]; return ( ); } - if (column === 'Resolution Status' || column === labelResolutionStatus) { + if (column === "Resolution Status" || column === labelResolutionStatus) { switch (rowData[labelResolutionStatus]) { - case 'unresolved': - fontColor = {color: '#000000'}; - resolutionStatus = t('Unresolved', {ns: 'mri_violations'}); - break; + case "unresolved": + fontColor = { color: "#000000" }; + resolutionStatus = t("Unresolved", { ns: "mri_violations" }); + break; - case 'reran': - resolutionStatusStyle = 'label-success'; - resolutionStatus = t('Reran', {ns: 'mri_violations'}); - break; + case "reran": + resolutionStatusStyle = "label-success"; + resolutionStatus = t("Reran", { ns: "mri_violations" }); + break; - case 'emailed': - resolutionStatusStyle = 'label-info'; - resolutionStatus = t('Emailed site/pending', {ns: 'mri_violations'}); - break; + case "emailed": + resolutionStatusStyle = "label-info"; + resolutionStatus = t("Emailed site/pending", { + ns: "mri_violations", + }); + break; - case 'rejected': - resolutionStatusStyle = 'label-danger'; - resolutionStatus = t('Rejected', {ns: 'mri_violations'}); - break; + case "rejected": + resolutionStatusStyle = "label-danger"; + resolutionStatus = t("Rejected", { ns: "mri_violations" }); + break; - case 'inserted': - resolutionStatusStyle = 'label-warning'; - resolutionStatus = t('Inserted', {ns: 'mri_violations'}); - break; + case "inserted": + resolutionStatusStyle = "label-warning"; + resolutionStatus = t("Inserted", { ns: "mri_violations" }); + break; - case 'other': - resolutionStatusStyle = 'label-primary'; - resolutionStatus = t('Other', {ns: 'mri_violations'}); - break; + case "other": + resolutionStatusStyle = "label-primary"; + resolutionStatus = t("Other", { ns: "mri_violations" }); + break; - case 'inserted_flag': - resolutionStatusStyle = 'label-default'; - resolutionStatus = t('Inserted with flag', {ns: 'mri_violations'}); - break; + case "inserted_flag": + resolutionStatusStyle = "label-default"; + resolutionStatus = t("Inserted with flag", { + ns: "mri_violations", + }); + break; } return ( ); } - if (column === 'Select Resolution' || column === labelSelectResolution) { + if (column === "Select Resolution" || column === labelSelectResolution) { return ( ); } - if (column === 'Image File' || column === labelImageFile) { + if (column === "Image File" || column === labelImageFile) { let log; - if (rowData[labelTypeOfProblem] === 'Could not identify scan type') { + if (rowData[labelTypeOfProblem] === "Could not identify scan type") { log = 1; - } else if (rowData[labelTypeOfProblem] === 'Protocol Violation') { + } else if (rowData[labelTypeOfProblem] === "Protocol Violation") { log = 2; } else { log = 3; } - let url = loris.BaseURL + - '/brainbrowser/?minc_id=' + - log + - 'l' + - rowData.JoinID; + let url = + loris.BaseURL + + "/brainbrowser/?minc_id=" + + log + + "l" + + rowData.JoinID; return ( ); } - return (); + return ; }; return Mapper; }; @@ -276,111 +323,129 @@ function MRIViolationsIndex(props) { } return [ { - label: t('Patient Name', {ns: 'mri_violations'}), show: true, filter: { - name: 'patientName', - type: 'text', + label: t("Patient Name", { ns: "mri_violations" }), + show: true, + filter: { + name: "patientName", + type: "text", }, }, { - label: t('Project', {ns: 'loris', count: 0}), show: true, filter: { - name: 'project', - type: 'select', + label: t("Project", { ns: "loris", count: 0 }), + show: true, + filter: { + name: "project", + type: "select", options: fieldoptions.projects, }, }, { - label: t('Cohort', {ns: 'loris', count: 0}), show: true, filter: { - name: 'cohort', - type: 'select', + label: t("Cohort", { ns: "loris", count: 0 }), + show: true, + filter: { + name: "cohort", + type: "select", options: fieldoptions.cohorts, }, }, { - label: t('Site', {ns: 'loris', count: 0}), show: true, filter: { - name: 'site', - type: 'select', + label: t("Site", { ns: "loris", count: 0 }), + show: true, + filter: { + name: "site", + type: "select", options: fieldoptions.sites, }, }, { - label: t('Time Run', {ns: 'mri_violations'}), show: true, filter: { - name: 'timeRun', - type: 'datetime', + label: t("Time Run", { ns: "mri_violations" }), + show: true, + filter: { + name: "timeRun", + type: "datetime", }, }, { - label: t('Image File', {ns: 'mri_violations'}), show: true, filter: { - name: 'mincFile', - type: 'text', + label: t("Image File", { ns: "mri_violations" }), + show: true, + filter: { + name: "mincFile", + type: "text", }, }, { - label: t('Series Description or Scan Type', {ns: 'mri_violations'}), - show: true, filter: { - name: 'seriesOrType', - type: 'text', + label: t("Series Description or Scan Type", { ns: "mri_violations" }), + show: true, + filter: { + name: "seriesOrType", + type: "text", }, }, { - label: t('Type of Problem', {ns: 'mri_violations'}), - show: true, filter: { - name: 'typeOfProblem', - type: 'select', + label: t("Type of Problem", { ns: "mri_violations" }), + show: true, + filter: { + name: "typeOfProblem", + type: "select", options: problemtypes, }, }, { - label: t('Resolution Status', {ns: 'mri_violations'}), - show: true, filter: { - name: 'resolutionStatus', - type: 'select', + label: t("Resolution Status", { ns: "mri_violations" }), + show: true, + filter: { + name: "resolutionStatus", + type: "select", options: { - 'unresolved': t('Unresolved', {ns: 'mri_violations'}), - 'reran': t('Reran', {ns: 'mri_violations'}), - 'emailed': t('Emailed site/pending', {ns: 'mri_violations'}), - 'inserted': t('Inserted', {ns: 'mri_violations'}), - 'rejected': t('Rejected', {ns: 'mri_violations'}), - 'inserted_flag': t('Inserted with flag', {ns: 'mri_violations'}), - 'other': t('Other', {ns: 'mri_violations'}), + unresolved: t("Unresolved", { ns: "mri_violations" }), + reran: t("Reran", { ns: "mri_violations" }), + emailed: t("Emailed site/pending", { ns: "mri_violations" }), + inserted: t("Inserted", { ns: "mri_violations" }), + rejected: t("Rejected", { ns: "mri_violations" }), + inserted_flag: t("Inserted with flag", { ns: "mri_violations" }), + other: t("Other", { ns: "mri_violations" }), }, }, }, { - label: t('Series UID', {ns: 'mri_violations'}), show: false, filter: { - name: 'seriesUID', - type: 'text', + label: t("Series UID", { ns: "mri_violations" }), + show: false, + filter: { + name: "seriesUID", + type: "text", }, }, - {label: t('hash', {ns: 'mri_violations'}), show: false}, - {label: t('JoinID', {ns: 'mri_violations'}), show: false}, - {label: t('TarchiveID', {ns: 'mri_violations'}), show: false}, - {label: t('CandID', {ns: 'loris'}), show: false}, - {label: t('PSCID', {ns: 'loris'}), show: false}, + { label: t("hash", { ns: "mri_violations" }), show: false }, + { label: t("JoinID", { ns: "mri_violations" }), show: false }, + { label: t("TarchiveID", { ns: "mri_violations" }), show: false }, + { label: t("CandID", { ns: "loris" }), show: false }, + { label: t("PSCID", { ns: "loris" }), show: false }, // Add fake column for resolution dropdown - {label: t('Select Resolution', {ns: 'mri_violations'}), show: true}, + { label: t("Select Resolution", { ns: "mri_violations" }), show: true }, ]; }; return (
{violationsModal} - {!isLoaded ? - : - isError ? -

{t('An error occurred while loading the page.', - {ns: 'mri_violations'})}

: - - } + {!isLoaded ? ( + + ) : isError ? ( +

+ {t("An error occurred while loading the page.", { + ns: "mri_violations", + })} +

+ ) : ( + + )}
); } @@ -402,43 +467,40 @@ MRIViolationsIndex.propTypes = { function columnMapper(fieldOptions) { return (column, value) => { switch (column) { - case 'Project': - if (fieldOptions.projects) { - return fieldOptions.projects[value]; - } - break; - case 'Cohort': - if (fieldOptions.cohorts) { - return fieldOptions.cohorts[value]; - } - break; - case 'Site': - if (fieldOptions.sites) { - return fieldOptions.sites[value]; - } - break; + case "Project": + if (fieldOptions.projects) { + return fieldOptions.projects[value]; + } + break; + case "Cohort": + if (fieldOptions.cohorts) { + return fieldOptions.cohorts[value]; + } + break; + case "Site": + if (fieldOptions.sites) { + return fieldOptions.sites[value]; + } + break; } return value; }; } -window.addEventListener('load', () => { - i18n.addResourceBundle('hi', 'mri_violations', hiStrings); - i18n.addResourceBundle('ja', 'mri_violations', jaStrings); - i18n.addResourceBundle('fr', 'mri_violations', frStrings); - i18n.addResourceBundle('es', 'mri_violations', esStrings); +window.addEventListener("load", () => { + i18n.addResourceBundle("hi", "mri_violations", hiStrings); + i18n.addResourceBundle("ja", "mri_violations", jaStrings); + i18n.addResourceBundle("fr", "mri_violations", frStrings); + i18n.addResourceBundle("es", "mri_violations", esStrings); - const ViolationsIndex = withTranslation( - ['mri_violations', 'loris'] - )(MRIViolationsIndex); + const ViolationsIndex = withTranslation(["mri_violations", "loris"])( + MRIViolationsIndex, + ); - ReactDOM.createRoot( - document.getElementById('lorisworkspace') - ).render( + ReactDOM.createRoot(document.getElementById("lorisworkspace")).render( , ); }); - From e8b808c58e27da69ad8a3851712dd8ef5f546c42 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Nov 2025 14:14:23 -0500 Subject: [PATCH 08/13] fix linter --- .../mri_violations/jsx/mriViolationsIndex.js | 350 +++++++++--------- 1 file changed, 175 insertions(+), 175 deletions(-) diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index 419f5484487..d04cdfd3049 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -1,15 +1,15 @@ -import Loader from "Loader"; -import FilterableDataTable from "FilterableDataTable"; -import React, { useEffect, useState } from "react"; -import PropTypes from "prop-types"; -import ProtocolModal from "./protocolModal.js"; -import i18n from "I18nSetup"; -import { withTranslation } from "react-i18next"; +import Loader from 'Loader'; +import FilterableDataTable from 'FilterableDataTable'; +import React, {useEffect, useState} from 'react'; +import PropTypes from 'prop-types'; +import ProtocolModal from './protocolModal.js'; +import i18n from 'I18nSetup'; +import {withTranslation} from 'react-i18next'; -import hiStrings from "../locale/hi/LC_MESSAGES/mri_violations.json"; -import jaStrings from "../locale/ja/LC_MESSAGES/mri_violations.json"; -import frStrings from "../locale/fr/LC_MESSAGES/mri_violations.json"; -import esStrings from "../locale/es/LC_MESSAGES/mri_violations.json"; +import hiStrings from '../locale/hi/LC_MESSAGES/mri_violations.json'; +import jaStrings from '../locale/ja/LC_MESSAGES/mri_violations.json'; +import frStrings from '../locale/fr/LC_MESSAGES/mri_violations.json'; +import esStrings from '../locale/es/LC_MESSAGES/mri_violations.json'; /** * Entry point for the MRI Violatons module. @@ -24,7 +24,7 @@ function MRIViolationsIndex(props) { const [isError, setIsError] = useState(false); const [data, setData] = useState([]); const mapper = columnMapper(fieldOptions); - const { t } = props; + const {t} = props; const violationsModal = violationModal !== false ? ( @@ -56,33 +56,33 @@ function MRIViolationsIndex(props) { ); /** - * OnResolutionUpdate - * Callback executed when the resolution - * status is updated - * - * @param {string} value - New resolution status value - * @param {string} hashname - The violation hash - */ + * OnResolutionUpdate + * Callback executed when the resolution + * status is updated + * + * @param {string} value - New resolution status value + * @param {string} hashname - The violation hash + */ const onResolutionUpdate = (value, hashname) => { if (value) { fetch( - props.ModuleURL + "/resolve", { - method: "POST", - mode: "same-origin", - cache: "no-cache", - body: JSON.stringify({ - value: value, - hash: hashname, - }), - }).then(() => { + props.ModuleURL + '/resolve', { + method: 'POST', + mode: 'same-origin', + cache: 'no-cache', + body: JSON.stringify({ + value: value, + hash: hashname, + }), + }).then(() => { // Update the Resolution Status const filtersData = filters(fieldOptions); const resolutionStatusfilterIndex = filtersData.findIndex( (filter) => - filter.label === t("Resolution Status", { ns: "mri_violations" }), + filter.label === t('Resolution Status', {ns: 'mri_violations'}), ); const hashfilterIndex = filtersData.findIndex( - (filter) => filter.label === "hash", + (filter) => filter.label === 'hash', ); const dataIndex = data.findIndex( (row) => row[hashfilterIndex] === hashname, @@ -95,12 +95,12 @@ function MRIViolationsIndex(props) { // Add animation on the updated row const row = document .getElementById(`select-resolution-${hashname}`) - .closest("tr"); - row.classList.add("highlighted"); + .closest('tr'); + row.classList.add('highlighted'); setTimeout(() => { - row.classList.remove("highlighted"); - }, "3500"); + row.classList.remove('highlighted'); + }, '3500'); }); } }; @@ -113,36 +113,36 @@ function MRIViolationsIndex(props) { * @return {function} a formatter callback which uses mapper for data mapping */ const formatColumn = (mapper, setPage) => { - const Mapper = function (column, cell, rowData) { + const Mapper = function(column, cell, rowData) { cell = mapper(column, cell); const hashname = rowData.hash; - const labelTypeOfProblem = t("Type of Problem", { ns: "mri_violations" }); - const labelProtocolViolation = t("Protocol Violation", { - ns: "mri_violations", + const labelTypeOfProblem = t('Type of Problem', {ns: 'mri_violations'}); + const labelProtocolViolation = t('Protocol Violation', { + ns: 'mri_violations', }); - const labelCouldNotIdentifyScanType = t("Could not identify scan type", { - ns: "mri_violations", + const labelCouldNotIdentifyScanType = t('Could not identify scan type', { + ns: 'mri_violations', }); - const labelResolutionStatus = t("Resolution Status", { - ns: "mri_violations", + const labelResolutionStatus = t('Resolution Status', { + ns: 'mri_violations', }); - const labelSelectResolution = t("Select Resolution", { - ns: "mri_violations", + const labelSelectResolution = t('Select Resolution', { + ns: 'mri_violations', }); - const labelImageFile = t("Image File", { ns: "mri_violations" }); + const labelImageFile = t('Image File', {ns: 'mri_violations'}); const labelSeriesDescriptionOrScanType = t( - "Series Description or Scan Type", - { ns: "mri_violations" }, + 'Series Description or Scan Type', + {ns: 'mri_violations'}, ); // Create the mapping between rowHeaders and rowData in a row object. - let fontColor = { color: "#FFFFFF" }; + let fontColor = {color: '#FFFFFF'}; let resolutionStatusStyle; let resolutionStatus; if ( - (column === "Type of Problem" || column === labelTypeOfProblem) && - (cell === "Protocol Violation" || cell === labelProtocolViolation) + (column === 'Type of Problem' || column === labelTypeOfProblem) && + (cell === 'Protocol Violation' || cell === labelProtocolViolation) ) { return ( ); } - if (column === "Select Resolution" || column === labelSelectResolution) { + if (column === 'Select Resolution' || column === labelSelectResolution) { return ( ); } - if (column === "Image File" || column === labelImageFile) { + if (column === 'Image File' || column === labelImageFile) { let log; - if (rowData[labelTypeOfProblem] === "Could not identify scan type") { + if (rowData[labelTypeOfProblem] === 'Could not identify scan type') { log = 1; - } else if (rowData[labelTypeOfProblem] === "Protocol Violation") { + } else if (rowData[labelTypeOfProblem] === 'Protocol Violation') { log = 2; } else { log = 3; @@ -291,9 +291,9 @@ function MRIViolationsIndex(props) { let url = loris.BaseURL + - "/brainbrowser/?minc_id=" + + '/brainbrowser/?minc_id=' + log + - "l" + + 'l' + rowData.JoinID; return (
Center NameScanner IDScan TypeTR RangeTE RangeTI RangeSlice Thickness RangeXspace RangeYspace RangeZspace RangeXstep RangeYstep RangeZstep RangeTime RangeImage TypePhase Encoding DirectionEcho Number{t('Center Name', {ns: 'mri_violations'})}{t('Scanner ID', {ns: 'mri_violations'})}{t('Scan Type', {ns: 'mri_violations'})}{t('TR Range', {ns: 'mri_violations'})}{t('TE Range', {ns: 'mri_violations'})}{t('TI Range', {ns: 'mri_violations'})}{t('Slice Thickness Range', {ns: 'mri_violations'})}{t('Xspace Range', {ns: 'mri_violations'})}{t('Yspace Range', {ns: 'mri_violations'})}{t('Zspace Range', {ns: 'mri_violations'})}{t('Xstep Range', {ns: 'mri_violations'})}{t('Ystep Range', {ns: 'mri_violations'})}{t('Zstep Range', {ns: 'mri_violations'})}{t('Time Range', {ns: 'mri_violations'})}{t('Image Type', {ns: 'mri_violations'})}{t('Phase Encoding Direction', {ns: 'mri_violations'})}{t('Echo Number', {ns: 'mri_violations'})}
{protocol['ScannerID']} {protocol['ScanType']} - Series Description Regex: + {t('Series Description Regex:', {ns: 'mri_violations'})} {protocol['series_description_regex']} @@ -244,9 +248,9 @@ function ProtocolViolationModal(props) { show={true} width="90%" title={title}> -

Image Protocol

+

{t('Image Protocol', {ns: 'mri_violations'})}

{violations} -

Study Protocols

+

{t('Study Protocols', {ns: 'mri_violations'})}

{protocolgroups} ; } @@ -254,6 +258,7 @@ ProtocolViolationModal.propTypes = { URL: PropTypes.string, SeriesUID: PropTypes.string, onClose: PropTypes.func, + t: PropTypes.func, }; /** @@ -268,6 +273,7 @@ ProtocolViolationModal.propTypes = { */ function ProtocolCheckViolationModal(props) { const [data, setData] = useState([]); + const {t} = props; useEffect(() => { fetch(props.URL + '?format=json' + '&violationtype=protocolcheck' + @@ -286,12 +292,20 @@ function ProtocolCheckViolationModal(props) { return -

Scan Problems

- +

{t('Scan Problems', {ns: 'mri_violations'})}

+ @@ -301,5 +315,7 @@ ProtocolCheckViolationModal.propTypes = { URL: PropTypes.string, SeriesUID: PropTypes.string, onClose: PropTypes.func, + t: PropTypes.func, }; -export default ProtocolModal; + +export default withTranslation(['mri_violations', 'loris'])(ProtocolModal); diff --git a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json new file mode 100644 index 00000000000..a7c534164e7 --- /dev/null +++ b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json @@ -0,0 +1,51 @@ +{ + "MRI Violated Scans": "एमआरआई उल्लंघन स्कैन", + "Violations for SeriesUID": "सीरीज़UID के लिए उल्लंघन", + "Violations for": "के लिए उल्लंघन", + "Time Run": "चलने का समय", + "Series Description": "श्रृंखला विवरण", + "Image Location": "छवि स्थान", + "Patient Name": "मरीज़ का नाम", + "Series UID": "श्रृंखला UID", + "Echo Time": "इको समय", + "Protocol Group": "प्रोटोकॉल समूह", + "TR": "टीआर", + "TE": "टीई", + "TI": "टीआई", + "Slice Thickness": "स्लाइस की मोटाई", + "Xspace": "एक्स स्पेस", + "Yspace": "वाई स्पेस", + "Zspace": "ज़ेड स्पेस", + "Xstep": "एक्स स्टेप", + "Ystep": "वाई स्टेप", + "Zstep": "ज़ेड स्टेप", + "Time": "समय", + "Image Type": "छवि प्रकार", + "Phase Encoding Direction": "फेज एन्कोडिंग दिशा", + "Echo Number": "इको संख्या", + "Image Protocol": "छवि प्रोटोकॉल", + "Study Protocols": "अध्ययन प्रोटोकॉल", + "Scan Problems": "स्कैन समस्याएँ", + "Scan Type": "स्कैन प्रकार", + "Severity": "गंभीरता", + "Header": "शीर्षक", + "Value": "मान", + "Valid Values": "मान्य मान", + "Protocol Violation": "प्रोटोकॉल उल्लंघन", + "Could not identify scan type": "स्कैन प्रकार की पहचान नहीं हो सकी", + "Series Description or Scan Type": "श्रृंखला विवरण या स्कैन प्रकार", + "Resolution Status": "समाधान स्थिति", + "Unresolved": "अनसुलझा", + "Reran": "पुनः चलाया गया", + "emailed site/pending": "साइट को ईमेल किया/लंबित", + "inserted": "डाला गया", + "rejected": "अस्वीकृत", + "Inserted with flag": "फ्लैग के साथ डाला गया", + "other": "अन्य", + "Type of Problem": "समस्या का प्रकार", + "Select Resolution": "समाधान चुनें", + "Image File": "छवि फ़ाइल", + "Must submit data in JSON format": "डेटा JSON प्रारूप में जमा करना आवश्यक है", + "Can not implement filter on a resource type that has no centers.": "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई केंद्र नहीं हैं।", + "Can not implement filter on a resource type that has no projects.": "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई प्रोजेक्ट नहीं हैं।" +} \ No newline at end of file diff --git a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po new file mode 100644 index 00000000000..38e5baa24af --- /dev/null +++ b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po @@ -0,0 +1,166 @@ +# Default LORIS strings to be translated (English). +# 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 , 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 \n" +"Language-Team: LANGUAGE \n" +"Language: hi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "MRI Violated Scans" +msgstr "एमआरआई उल्लंघन स्कैन" + +msgid "Violations for SeriesUID" +msgstr "सीरीज़UID के लिए उल्लंघन" + +msgid "Violations for" +msgstr "के लिए उल्लंघन" + +msgid "Time Run" +msgstr "चलने का समय" + +msgid "Series Description" +msgstr "श्रृंखला विवरण" + +msgid "Image Location" +msgstr "छवि स्थान" + +msgid "Patient Name" +msgstr "मरीज़ का नाम" + +msgid "Series UID" +msgstr "श्रृंखला UID" + +msgid "Echo Time" +msgstr "इको समय" + +msgid "Protocol Group" +msgstr "प्रोटोकॉल समूह" + +msgid "TR" +msgstr "टीआर" + +msgid "TE" +msgstr "टीई" + +msgid "TI" +msgstr "टीआई" + +msgid "Slice Thickness" +msgstr "स्लाइस की मोटाई" + +msgid "Xspace" +msgstr "एक्स स्पेस" + +msgid "Yspace" +msgstr "वाई स्पेस" + +msgid "Zspace" +msgstr "ज़ेड स्पेस" + +msgid "Xstep" +msgstr "एक्स स्टेप" + +msgid "Ystep" +msgstr "वाई स्टेप" + +msgid "Zstep" +msgstr "ज़ेड स्टेप" + +msgid "Time" +msgstr "समय" + +msgid "Image Type" +msgstr "छवि प्रकार" + +msgid "Phase Encoding Direction" +msgstr "फेज एन्कोडिंग दिशा" + +msgid "Echo Number" +msgstr "इको संख्या" + +msgid "Image Protocol" +msgstr "छवि प्रोटोकॉल" + +msgid "Study Protocols" +msgstr "अध्ययन प्रोटोकॉल" + +msgid "Scan Problems" +msgstr "स्कैन समस्याएँ" + +msgid "Scan Type" +msgstr "स्कैन प्रकार" + +msgid "Severity" +msgstr "गंभीरता" + +msgid "Header" +msgstr "शीर्षक" + +msgid "Value" +msgstr "मान" + +msgid "Valid Values" +msgstr "मान्य मान" + +msgid "Protocol Violation" +msgstr "प्रोटोकॉल उल्लंघन" + +msgid "Could not identify scan type" +msgstr "स्कैन प्रकार की पहचान नहीं हो सकी" + +msgid "Series Description or Scan Type" +msgstr "श्रृंखला विवरण या स्कैन प्रकार" + +msgid "Resolution Status" +msgstr "समाधान स्थिति" + +msgid "Unresolved" +msgstr "अनसुलझा" + +msgid "Reran" +msgstr "पुनः चलाया गया" + +msgid "emailed site/pending" +msgstr "साइट को ईमेल किया/लंबित" + +msgid "inserted" +msgstr "डाला गया" + +msgid "rejected" +msgstr "अस्वीकृत" + +msgid "Inserted with flag" +msgstr "फ्लैग के साथ डाला गया" + +msgid "other" +msgstr "अन्य" + +msgid "Type of Problem" +msgstr "समस्या का प्रकार" + +msgid "Select Resolution" +msgstr "समाधान चुनें" + +msgid "Image File" +msgstr "छवि फ़ाइल" + +msgid "Must submit data in JSON format" +msgstr "डेटा JSON प्रारूप में जमा करना आवश्यक है" + +msgid "Can not implement filter on a resource type that has no centers." +msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई केंद्र नहीं हैं।" + +msgid "Can not implement filter on a resource type that has no projects." +msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई प्रोजेक्ट नहीं हैं।" diff --git a/modules/mri_violations/locale/mri_violations.pot b/modules/mri_violations/locale/mri_violations.pot index bd5bc3cb494..1ee312bc191 100644 --- a/modules/mri_violations/locale/mri_violations.pot +++ b/modules/mri_violations/locale/mri_violations.pot @@ -27,3 +27,146 @@ msgstr "" msgid "Violated scans" msgstr "" +msgid "Violations for SeriesUID" +msgstr "" + +msgid "Violations for" +msgstr "" + +msgid "Time Run" +msgstr "" + +msgid "Series Description" +msgstr "" + +msgid "Image Location" +msgstr "" + +msgid "Patient Name" +msgstr "" + +msgid "Series UID" +msgstr "" + +msgid "Echo Time" +msgstr "" + +msgid "Protocol Group" +msgstr "" + +msgid "TR" +msgstr "" + +msgid "TE" +msgstr "" + +msgid "TI" +msgstr "" + +msgid "Slice Thickness" +msgstr "" + +msgid "Xspace" +msgstr "" + +msgid "Yspace" +msgstr "" + +msgid "Zspace" +msgstr "" + +msgid "Xstep" +msgstr "" + +msgid "Ystep" +msgstr "" + +msgid "Zstep" +msgstr "" + +msgid "Time" +msgstr "" + +msgid "Image Type" +msgstr "" + +msgid "Phase Encoding Direction" +msgstr "" + +msgid "Echo Number" +msgstr "" + +msgid "Image Protocol" +msgstr "" + +msgid "Study Protocols" +msgstr "" + +msgid "Scan Problems" +msgstr "" + +msgid "Scan Type" +msgstr "" + +msgid "Severity" +msgstr "" + +msgid "Header" +msgstr "" + +msgid "Value" +msgstr "" + +msgid "Valid Values" +msgstr "" + +msgid "Protocol Violation" +msgstr "" + +msgid "Could not identify scan type" +msgstr "" + +msgid "Series Description or Scan Type" +msgstr "" + +msgid "Resolution Status" +msgstr "" + +msgid "Unresolved" +msgstr "" + +msgid "Reran" +msgstr "" + +msgid "emailed site/pending" +msgstr "" + +msgid "inserted" +msgstr "" + +msgid "rejected" +msgstr "" + +msgid "Inserted with flag" +msgstr "" + +msgid "other" +msgstr "" + +msgid "Type of Problem" +msgstr "" + +msgid "Select Resolution" +msgstr "" + +msgid "Image File" +msgstr "" + +msgid "Must submit data in JSON format" +msgstr "" + +msgid "Can not implement filter on a resource type that has no centers." +msgstr "" + +msgid "Can not implement filter on a resource type that has no projects." +msgstr "" diff --git a/modules/mri_violations/php/resolve.class.inc b/modules/mri_violations/php/resolve.class.inc index 3264e0fc835..990852e8567 100644 --- a/modules/mri_violations/php/resolve.class.inc +++ b/modules/mri_violations/php/resolve.class.inc @@ -41,14 +41,14 @@ class Resolve extends \NDB_Page { $user = $request->getAttribute("user"); if (!$this->_hasAccess($user)) { - return new \LORIS\Http\Response\JSON\Forbidden("Access denied"); + return new \LORIS\Http\Response\JSON\Forbidden(dgettext('loris', + "Access denied")); } $requestdata = json_decode((string) $request->getBody(), true); if (!is_array($requestdata)) { - return new \LORIS\Http\Response\JSON\BadRequest( - "Must submit data in JSON format" - ); + return new \LORIS\Http\Response\JSON\BadRequest(dgettext('loris', + "Must submit data in JSON format")); } $DB = $this->loris->getDatabaseConnection(); diff --git a/modules/mri_violations/php/usercentermatchornull.class.inc b/modules/mri_violations/php/usercentermatchornull.class.inc index 8459e5ee855..6a2812d4874 100644 --- a/modules/mri_violations/php/usercentermatchornull.class.inc +++ b/modules/mri_violations/php/usercentermatchornull.class.inc @@ -37,7 +37,8 @@ class UserCenterMatchOrNull implements \LORIS\Data\Filter return true; } throw new \LorisException( - "Can not implement filter on a resource type that has no centers." + dgettext('mri_violations', + "Can not implement filter on a resource type that has no centers.") ); } } diff --git a/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc b/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc index 3518a8b0190..5c35302dd56 100644 --- a/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc +++ b/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc @@ -51,7 +51,8 @@ class UserCenterMatchOrNullOrAnyPermission implements \LORIS\Data\Filter return true; } throw new \LorisException( - "Can not implement filter on a resource type that has no centers." + dgettext('loris', + "Can not implement filter on a resource type that has no centers.") ); } } diff --git a/modules/mri_violations/php/userprojectmatchornull.class.inc b/modules/mri_violations/php/userprojectmatchornull.class.inc index d1699704133..7c359889a75 100644 --- a/modules/mri_violations/php/userprojectmatchornull.class.inc +++ b/modules/mri_violations/php/userprojectmatchornull.class.inc @@ -57,7 +57,8 @@ class UserProjectMatchOrNull implements \LORIS\Data\Filter return true; } throw new \LorisException( - "Can not implement filter on a resource type that has no projects." + dgettext('loris', + "Can not implement filter on a resource type that has no projects.") ); } } From 150761142f2d181ab6e68cf57e3b7b71dc04ea2f Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Tue, 30 Sep 2025 06:13:03 -0400 Subject: [PATCH 02/13] lint --- locale/hi/LC_MESSAGES/loris.po | 9 ++++++ modules/mri_violations/php/resolve.class.inc | 28 ++++++++++++------- .../php/usercentermatchornull.class.inc | 8 ++++-- ...centermatchornulloranypermission.class.inc | 8 ++++-- .../php/userprojectmatchornull.class.inc | 9 ++++-- 5 files changed, 43 insertions(+), 19 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 32d08fba0ca..ee832f91a59 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -187,6 +187,15 @@ msgstr "उन्नत फ़िल्टर दिखाएँ" msgid "Hide Advanced Filters" msgstr "उन्नत फ़िल्टर छुपाएँ" +msgid "Language" +msgstr "भाषा" + +msgid "Access denied" +msgstr "पहुँच अस्वीकृत" + +msgid "No." +msgstr "क्रमांक" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{totalCount}} में से {{pageCount}} पंक्तियाँ प्रदर्शित" diff --git a/modules/mri_violations/php/resolve.class.inc b/modules/mri_violations/php/resolve.class.inc index 990852e8567..d614a898567 100644 --- a/modules/mri_violations/php/resolve.class.inc +++ b/modules/mri_violations/php/resolve.class.inc @@ -1,8 +1,9 @@ hasAnyPermission( [ @@ -37,18 +38,26 @@ class Resolve extends \NDB_Page * * @return ResponseInterface */ - public function handle(ServerRequestInterface $request) : ResponseInterface + public function handle(ServerRequestInterface $request): ResponseInterface { $user = $request->getAttribute("user"); if (!$this->_hasAccess($user)) { - return new \LORIS\Http\Response\JSON\Forbidden(dgettext('loris', - "Access denied")); + return new \LORIS\Http\Response\JSON\Forbidden( + dgettext( + 'loris', + "Access denied" + ) + ); } $requestdata = json_decode((string) $request->getBody(), true); if (!is_array($requestdata)) { - return new \LORIS\Http\Response\JSON\BadRequest(dgettext('loris', - "Must submit data in JSON format")); + return new \LORIS\Http\Response\JSON\BadRequest( + dgettext( + 'loris', + "Must submit data in JSON format" + ) + ); } $DB = $this->loris->getDatabaseConnection(); @@ -80,7 +89,7 @@ class Resolve extends \NDB_Page // Not modified $response = $response->withStatus(304); } - } else if ($val !== 'unresolved') { + } elseif ($val !== 'unresolved') { // no need to insert to DB for Unresolved value. // Base of the insert @@ -154,4 +163,3 @@ class Resolve extends \NDB_Page return $response; } } - diff --git a/modules/mri_violations/php/usercentermatchornull.class.inc b/modules/mri_violations/php/usercentermatchornull.class.inc index 6a2812d4874..8278d7ab6bc 100644 --- a/modules/mri_violations/php/usercentermatchornull.class.inc +++ b/modules/mri_violations/php/usercentermatchornull.class.inc @@ -20,7 +20,7 @@ class UserCenterMatchOrNull implements \LORIS\Data\Filter * * @return bool */ - public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool + public function filter(\User $user, \Loris\Data\DataInstance $resource): bool { // phan only understands method_exists on simple variables. // Assigning to a variable is the a workaround @@ -37,8 +37,10 @@ class UserCenterMatchOrNull implements \LORIS\Data\Filter return true; } throw new \LorisException( - dgettext('mri_violations', - "Can not implement filter on a resource type that has no centers.") + dgettext( + 'mri_violations', + "Can not implement filter on a resource type that has no centers." + ) ); } } diff --git a/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc b/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc index 5c35302dd56..a3fbce96899 100644 --- a/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc +++ b/modules/mri_violations/php/usercentermatchornulloranypermission.class.inc @@ -30,7 +30,7 @@ class UserCenterMatchOrNullOrAnyPermission implements \LORIS\Data\Filter * * @return bool */ - public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool + public function filter(\User $user, \Loris\Data\DataInstance $resource): bool { // phan only understands method_exists on simple variables. // Assigning to a variable is the a workaround @@ -51,8 +51,10 @@ class UserCenterMatchOrNullOrAnyPermission implements \LORIS\Data\Filter return true; } throw new \LorisException( - dgettext('loris', - "Can not implement filter on a resource type that has no centers.") + dgettext( + 'loris', + "Can not implement filter on a resource type that has no centers." + ) ); } } diff --git a/modules/mri_violations/php/userprojectmatchornull.class.inc b/modules/mri_violations/php/userprojectmatchornull.class.inc index 7c359889a75..105f65b5571 100644 --- a/modules/mri_violations/php/userprojectmatchornull.class.inc +++ b/modules/mri_violations/php/userprojectmatchornull.class.inc @@ -12,6 +12,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @link https://www.github.com/aces/Loris/ */ + namespace LORIS\mri_violations; /** @@ -40,7 +41,7 @@ class UserProjectMatchOrNull implements \LORIS\Data\Filter * * @return bool true if the user has a project in common with the data */ - public function filter(\User $user, \Loris\Data\DataInstance $resource) : bool + public function filter(\User $user, \Loris\Data\DataInstance $resource): bool { // phan only understands method_exists on simple variables. // Assigning to a variable is the a workaround @@ -57,8 +58,10 @@ class UserProjectMatchOrNull implements \LORIS\Data\Filter return true; } throw new \LorisException( - dgettext('loris', - "Can not implement filter on a resource type that has no projects.") + dgettext( + 'loris', + "Can not implement filter on a resource type that has no projects." + ) ); } } From c4d5574e9bf037e5fa7ff1cd72bb9ccb97a7726f Mon Sep 17 00:00:00 2001 From: T Saket Hatwar <112693309+SKADE2303@users.noreply.github.com> Date: Tue, 30 Sep 2025 16:11:46 +0530 Subject: [PATCH 03/13] Delete modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json --- .../locale/hi/LC_MESSAGES/mri_violations.json | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json diff --git a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json deleted file mode 100644 index a7c534164e7..00000000000 --- a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "MRI Violated Scans": "एमआरआई उल्लंघन स्कैन", - "Violations for SeriesUID": "सीरीज़UID के लिए उल्लंघन", - "Violations for": "के लिए उल्लंघन", - "Time Run": "चलने का समय", - "Series Description": "श्रृंखला विवरण", - "Image Location": "छवि स्थान", - "Patient Name": "मरीज़ का नाम", - "Series UID": "श्रृंखला UID", - "Echo Time": "इको समय", - "Protocol Group": "प्रोटोकॉल समूह", - "TR": "टीआर", - "TE": "टीई", - "TI": "टीआई", - "Slice Thickness": "स्लाइस की मोटाई", - "Xspace": "एक्स स्पेस", - "Yspace": "वाई स्पेस", - "Zspace": "ज़ेड स्पेस", - "Xstep": "एक्स स्टेप", - "Ystep": "वाई स्टेप", - "Zstep": "ज़ेड स्टेप", - "Time": "समय", - "Image Type": "छवि प्रकार", - "Phase Encoding Direction": "फेज एन्कोडिंग दिशा", - "Echo Number": "इको संख्या", - "Image Protocol": "छवि प्रोटोकॉल", - "Study Protocols": "अध्ययन प्रोटोकॉल", - "Scan Problems": "स्कैन समस्याएँ", - "Scan Type": "स्कैन प्रकार", - "Severity": "गंभीरता", - "Header": "शीर्षक", - "Value": "मान", - "Valid Values": "मान्य मान", - "Protocol Violation": "प्रोटोकॉल उल्लंघन", - "Could not identify scan type": "स्कैन प्रकार की पहचान नहीं हो सकी", - "Series Description or Scan Type": "श्रृंखला विवरण या स्कैन प्रकार", - "Resolution Status": "समाधान स्थिति", - "Unresolved": "अनसुलझा", - "Reran": "पुनः चलाया गया", - "emailed site/pending": "साइट को ईमेल किया/लंबित", - "inserted": "डाला गया", - "rejected": "अस्वीकृत", - "Inserted with flag": "फ्लैग के साथ डाला गया", - "other": "अन्य", - "Type of Problem": "समस्या का प्रकार", - "Select Resolution": "समाधान चुनें", - "Image File": "छवि फ़ाइल", - "Must submit data in JSON format": "डेटा JSON प्रारूप में जमा करना आवश्यक है", - "Can not implement filter on a resource type that has no centers.": "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई केंद्र नहीं हैं।", - "Can not implement filter on a resource type that has no projects.": "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई प्रोजेक्ट नहीं हैं।" -} \ No newline at end of file From 4cd5a3ef1e9dabff8ee5053778aaf3eaafb99d26 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Nov 2025 10:40:15 -0500 Subject: [PATCH 04/13] fix lint --- locale/loris.pot | 3 --- 1 file changed, 3 deletions(-) diff --git a/locale/loris.pot b/locale/loris.pot index dd081daf70d..fe0b3e5a3b1 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -57,14 +57,12 @@ msgstr "" #: modules/user_accounts/php/module.class.inc:53 msgid "Admin" msgstr "" - #: modules/acknowledgements/php/module.class.inc:54 #: modules/api_docs/php/module.class.inc:66 #: modules/battery_manager/php/module.class.inc:55 #: modules/datadict/php/module.class.inc:49 #: modules/data_release/php/module.class.inc:56 #: modules/dictionary/php/module.class.inc:49 - msgid "Data Dictionary" msgstr "" @@ -196,7 +194,6 @@ msgid "Cohort" msgid_plural "Cohorts" msgstr[0] "" - msgid "Session" msgstr "" From 92fa98f03200b174d796fd039dd7e57e0c26cae9 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Nov 2025 20:21:20 -0500 Subject: [PATCH 05/13] add es,fr,and updates ja --- Makefile | 5 + locale/es/LC_MESSAGES/loris.po | 6 + locale/fr/LC_MESSAGES/loris.po | 6 + locale/hi/LC_MESSAGES/loris.po | 3 - locale/ja/LC_MESSAGES/loris.po | 6 + locale/loris.pot | 1 + .../mri_violations/jsx/mriViolationsIndex.js | 95 ++++++---- .../locale/es/LC_MESSAGES/mri_violations.po | 175 ++++++++++++++++++ .../locale/fr/LC_MESSAGES/mri_violations.po | 175 ++++++++++++++++++ .../locale/hi/LC_MESSAGES/mri_violations.po | 19 +- .../locale/ja/LC_MESSAGES/mri_violations.po | 155 +++++++++++++++- .../mri_violations/locale/mri_violations.pot | 17 +- 12 files changed, 607 insertions(+), 56 deletions(-) create mode 100644 modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po create mode 100644 modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po diff --git a/Makefile b/Makefile index 189c7361a9b..b22bec8cc64 100755 --- a/Makefile +++ b/Makefile @@ -148,8 +148,13 @@ locales: msgfmt -o modules/login/locale/ja/LC_MESSAGES/login.mo modules/login/locale/ja/LC_MESSAGES/login.po msgfmt -o modules/media/locale/ja/LC_MESSAGES/media.mo modules/media/locale/ja/LC_MESSAGES/media.po msgfmt -o modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo modules/module_manager/locale/ja/LC_MESSAGES/module_manager.po + msgfmt -o modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po + msgfmt -o modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po msgfmt -o modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po msgfmt -o modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po + npx i18next-conv -l es -s modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.json + npx i18next-conv -l fr -s modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.json + npx i18next-conv -l ja -s modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.json npx i18next-conv -l hi -s modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po -t modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.json msgfmt -o modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.mo modules/my_preferences/locale/hi/LC_MESSAGES/my_preferences.po npx i18next-conv -l ja -s modules/my_preferences/locale/ja/LC_MESSAGES/my_preferences.po -t modules/my_preferences/locale/ja/LC_MESSAGES/my_preferences.json --compatibilityJSON v4 diff --git a/locale/es/LC_MESSAGES/loris.po b/locale/es/LC_MESSAGES/loris.po index a7b6d3959e1..9fbf9ec7f8b 100644 --- a/locale/es/LC_MESSAGES/loris.po +++ b/locale/es/LC_MESSAGES/loris.po @@ -239,6 +239,12 @@ msgstr "Scan hecho" msgid "Language" msgstr "Lenguaje" +msgid "Access denied" +msgstr "Acceso denegado" + +msgid "No." +msgstr "número" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{pageCount}} filas mostradas de {{totalCount}}." diff --git a/locale/fr/LC_MESSAGES/loris.po b/locale/fr/LC_MESSAGES/loris.po index 0e92b7cc8ce..9f254260efc 100644 --- a/locale/fr/LC_MESSAGES/loris.po +++ b/locale/fr/LC_MESSAGES/loris.po @@ -241,6 +241,12 @@ msgstr "Scan complété" msgid "Language" msgstr "Langue" +msgid "Access denied" +msgstr "Accès refusé" + +msgid "No." +msgstr "Nombre" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{pageCount}} lignes affichées de {{totalCount}}." diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 2b2d21c1d44..6554d62591a 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -264,9 +264,6 @@ msgstr "भाषा" msgid "Ethnicity" msgstr "जातीयता" -msgid "Language" -msgstr "भाषा" - msgid "Access denied" msgstr "पहुँच अस्वीकृत" diff --git a/locale/ja/LC_MESSAGES/loris.po b/locale/ja/LC_MESSAGES/loris.po index 95544e70758..ecd2f282ab5 100644 --- a/locale/ja/LC_MESSAGES/loris.po +++ b/locale/ja/LC_MESSAGES/loris.po @@ -255,6 +255,12 @@ msgstr "言語" msgid "Ethnicity" msgstr "民族" +msgid "Access denied" +msgstr "アクセスが拒否されました" + +msgid "No." +msgstr "番号" + msgid "Save" msgstr "保存" diff --git a/locale/loris.pot b/locale/loris.pot index fe0b3e5a3b1..f17fdf38d23 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -57,6 +57,7 @@ msgstr "" #: modules/user_accounts/php/module.class.inc:53 msgid "Admin" msgstr "" + #: modules/acknowledgements/php/module.class.inc:54 #: modules/api_docs/php/module.class.inc:66 #: modules/battery_manager/php/module.class.inc:55 diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index a8a46d3546b..7cf665bf148 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -7,6 +7,9 @@ import i18n from 'I18nSetup'; import {withTranslation} from 'react-i18next'; import hiStrings from '../locale/hi/LC_MESSAGES/mri_violations.json'; +import jaStrings from '../locale/ja/LC_MESSAGES/mri_violations.json'; +import frStrings from '../locale/fr/LC_MESSAGES/mri_violations.json'; +import esStrings from '../locale/es/LC_MESSAGES/mri_violations.json'; /** * Entry point for the MRI Violatons module. @@ -71,7 +74,7 @@ function MRIViolationsIndex(props) { const filtersData = filters(fieldOptions); const resolutionStatusfilterIndex = filtersData .findIndex( - (filter) => filter.label === 'Resolution Status' + (filter) => filter.label === t('Resolution Status', {ns: 'mri_violations'}) ); const hashfilterIndex = filtersData .findIndex((filter) => filter.label === 'hash'); @@ -109,14 +112,21 @@ function MRIViolationsIndex(props) { const Mapper = function(column, cell, rowData) { cell = mapper(column, cell); const hashname = rowData.hash; + const labelTypeOfProblem = t('Type of Problem', {ns: 'mri_violations'}); + const labelProtocolViolation = t('Protocol Violation', {ns: 'mri_violations'}); + const labelCouldNotIdentifyScanType = t('Could not identify scan type', {ns: 'mri_violations'}); + const labelResolutionStatus = t('Resolution Status', {ns: 'mri_violations'}); + const labelSelectResolution = t('Select Resolution', {ns: 'mri_violations'}); + const labelImageFile = t('Image File', {ns: 'mri_violations'}); + const labelSeriesDescriptionOrScanType = t('Series Description or Scan Type', {ns: 'mri_violations'}); // Create the mapping between rowHeaders and rowData in a row object. let fontColor = {color: '#FFFFFF'}; let resolutionStatusStyle; let resolutionStatus; - if (column === t('Type of Problem', {ns: 'mri_violations'}) && - cell === t('Protocol Violation', {ns: 'mri_violations'})) { + if ((column === 'Type of Problem' || column === labelTypeOfProblem) && + (cell === 'Protocol Violation' || cell === labelProtocolViolation)) { return (
{t('Protocol Violation', {ns: 'mri_violations'})} + }>{labelProtocolViolation} @@ -152,46 +162,46 @@ function MRIViolationsIndex(props) { TimeRun: rowData['Time Run'], SeriesDescription: seriesDescription, })} - >Could not identify scan type + >{labelCouldNotIdentifyScanType} - setPage({ - ViolationType: 'protocolcheck', - PatientName: rowData['Patient Name'], - SeriesUID: rowData['Series UID'], - TarchiveID: rowData['TarchiveID'], - CandID: rowData.CandId, - }) - }>{labelProtocolViolation} + + setPage({ + ViolationType: "protocolcheck", + PatientName: rowData["Patient Name"], + SeriesUID: rowData["Series UID"], + TarchiveID: rowData["TarchiveID"], + CandID: rowData.CandId, + }) + } + > + {labelProtocolViolation} + - setPage({ - ViolationType: 'protocolviolation', - PatientName: rowData['Patient Name'], - SeriesUID: rowData['Series UID'], - TarchiveID: rowData['TarchiveId'], - CandID: rowData.CandID, - PSCID: rowData.PSCID, - TimeRun: rowData['Time Run'], - SeriesDescription: seriesDescription, - })} - >{labelCouldNotIdentifyScanType} + + setPage({ + ViolationType: "protocolviolation", + PatientName: rowData["Patient Name"], + SeriesUID: rowData["Series UID"], + TarchiveID: rowData["TarchiveId"], + CandID: rowData.CandID, + PSCID: rowData.PSCID, + TimeRun: rowData["Time Run"], + SeriesDescription: seriesDescription, + }) + } + > + {labelCouldNotIdentifyScanType} + @@ -210,53 +240,70 @@ function MRIViolationsIndex(props) { - {cell} + + {cell} + {cell}{cell} - setPage({ - ViolationType: 'protocolcheck', - PatientName: rowData['Patient Name'], - SeriesUID: rowData['Series UID'], - TarchiveID: rowData['TarchiveID'], - CandID: rowData.CandId, - }) - }>{labelProtocolViolation} + + setPage({ + ViolationType: "protocolcheck", + PatientName: rowData["Patient Name"], + SeriesUID: rowData["Series UID"], + TarchiveID: rowData["TarchiveID"], + CandID: rowData.CandId, + }) + } + > + {labelProtocolViolation} + - setPage({ - ViolationType: 'protocolviolation', - PatientName: rowData['Patient Name'], - SeriesUID: rowData['Series UID'], - TarchiveID: rowData['TarchiveId'], - CandID: rowData.CandID, - PSCID: rowData.PSCID, - TimeRun: rowData['Time Run'], - SeriesDescription: seriesDescription, - })} - >{labelCouldNotIdentifyScanType} + + setPage({ + ViolationType: "protocolviolation", + PatientName: rowData["Patient Name"], + SeriesUID: rowData["Series UID"], + TarchiveID: rowData["TarchiveId"], + CandID: rowData.CandID, + PSCID: rowData.PSCID, + TimeRun: rowData["Time Run"], + SeriesDescription: seriesDescription, + }) + } + > + {labelCouldNotIdentifyScanType} + @@ -210,53 +240,70 @@ function MRIViolationsIndex(props) { - {cell} + + {cell} + {cell}{cell} @@ -150,10 +150,10 @@ function MRIViolationsIndex(props) { href="#" onClick={() => setPage({ - ViolationType: "protocolcheck", - PatientName: rowData["Patient Name"], - SeriesUID: rowData["Series UID"], - TarchiveID: rowData["TarchiveID"], + ViolationType: 'protocolcheck', + PatientName: rowData['Patient Name'], + SeriesUID: rowData['Series UID'], + TarchiveID: rowData['TarchiveID'], CandID: rowData.CandId, }) } @@ -165,8 +165,8 @@ function MRIViolationsIndex(props) { } if ( - (column === "Type of Problem" || column === labelTypeOfProblem) && - (cell === "Could not identify scan type" || + (column === 'Type of Problem' || column === labelTypeOfProblem) && + (cell === 'Could not identify scan type' || cell === labelCouldNotIdentifyScanType) ) { const seriesDescription = rowData[labelSeriesDescriptionOrScanType]; @@ -176,13 +176,13 @@ function MRIViolationsIndex(props) { href="#" onClick={() => setPage({ - ViolationType: "protocolviolation", - PatientName: rowData["Patient Name"], - SeriesUID: rowData["Series UID"], - TarchiveID: rowData["TarchiveId"], + ViolationType: 'protocolviolation', + PatientName: rowData['Patient Name'], + SeriesUID: rowData['Series UID'], + TarchiveID: rowData['TarchiveId'], CandID: rowData.CandID, PSCID: rowData.PSCID, - TimeRun: rowData["Time Run"], + TimeRun: rowData['Time Run'], SeriesDescription: seriesDescription, }) } @@ -193,46 +193,46 @@ function MRIViolationsIndex(props) { ); } - if (column === "Resolution Status" || column === labelResolutionStatus) { + if (column === 'Resolution Status' || column === labelResolutionStatus) { switch (rowData[labelResolutionStatus]) { - case "unresolved": - fontColor = { color: "#000000" }; - resolutionStatus = t("Unresolved", { ns: "mri_violations" }); - break; + case 'unresolved': + fontColor = {color: '#000000'}; + resolutionStatus = t('Unresolved', {ns: 'mri_violations'}); + break; - case "reran": - resolutionStatusStyle = "label-success"; - resolutionStatus = t("Reran", { ns: "mri_violations" }); - break; + case 'reran': + resolutionStatusStyle = 'label-success'; + resolutionStatus = t('Reran', {ns: 'mri_violations'}); + break; - case "emailed": - resolutionStatusStyle = "label-info"; - resolutionStatus = t("Emailed site/pending", { - ns: "mri_violations", - }); - break; + case 'emailed': + resolutionStatusStyle = 'label-info'; + resolutionStatus = t('Emailed site/pending', { + ns: 'mri_violations', + }); + break; - case "rejected": - resolutionStatusStyle = "label-danger"; - resolutionStatus = t("Rejected", { ns: "mri_violations" }); - break; + case 'rejected': + resolutionStatusStyle = 'label-danger'; + resolutionStatus = t('Rejected', {ns: 'mri_violations'}); + break; - case "inserted": - resolutionStatusStyle = "label-warning"; - resolutionStatus = t("Inserted", { ns: "mri_violations" }); - break; + case 'inserted': + resolutionStatusStyle = 'label-warning'; + resolutionStatus = t('Inserted', {ns: 'mri_violations'}); + break; - case "other": - resolutionStatusStyle = "label-primary"; - resolutionStatus = t("Other", { ns: "mri_violations" }); - break; + case 'other': + resolutionStatusStyle = 'label-primary'; + resolutionStatus = t('Other', {ns: 'mri_violations'}); + break; - case "inserted_flag": - resolutionStatusStyle = "label-default"; - resolutionStatus = t("Inserted with flag", { - ns: "mri_violations", - }); - break; + case 'inserted_flag': + resolutionStatusStyle = 'label-default'; + resolutionStatus = t('Inserted with flag', { + ns: 'mri_violations', + }); + break; } return ( @@ -240,14 +240,14 @@ function MRIViolationsIndex(props) { @@ -323,106 +323,106 @@ function MRIViolationsIndex(props) { } return [ { - label: t("Patient Name", { ns: "mri_violations" }), + label: t('Patient Name', {ns: 'mri_violations'}), show: true, filter: { - name: "patientName", - type: "text", + name: 'patientName', + type: 'text', }, }, { - label: t("Project", { ns: "loris", count: 0 }), + label: t('Project', {ns: 'loris', count: 1}), show: true, filter: { - name: "project", - type: "select", + name: 'project', + type: 'select', options: fieldoptions.projects, }, }, { - label: t("Cohort", { ns: "loris", count: 0 }), + label: t('Cohort', {ns: 'loris', count: 1}), show: true, filter: { - name: "cohort", - type: "select", + name: 'cohort', + type: 'select', options: fieldoptions.cohorts, }, }, { - label: t("Site", { ns: "loris", count: 0 }), + label: t('Site', {ns: 'loris', count: 1}), show: true, filter: { - name: "site", - type: "select", + name: 'site', + type: 'select', options: fieldoptions.sites, }, }, { - label: t("Time Run", { ns: "mri_violations" }), + label: t('Time Run', {ns: 'mri_violations'}), show: true, filter: { - name: "timeRun", - type: "datetime", + name: 'timeRun', + type: 'datetime', }, }, { - label: t("Image File", { ns: "mri_violations" }), + label: t('Image File', {ns: 'mri_violations'}), show: true, filter: { - name: "mincFile", - type: "text", + name: 'mincFile', + type: 'text', }, }, { - label: t("Series Description or Scan Type", { ns: "mri_violations" }), + label: t('Series Description or Scan Type', {ns: 'mri_violations'}), show: true, filter: { - name: "seriesOrType", - type: "text", + name: 'seriesOrType', + type: 'text', }, }, { - label: t("Type of Problem", { ns: "mri_violations" }), + label: t('Type of Problem', {ns: 'mri_violations'}), show: true, filter: { - name: "typeOfProblem", - type: "select", + name: 'typeOfProblem', + type: 'select', options: problemtypes, }, }, { - label: t("Resolution Status", { ns: "mri_violations" }), + label: t('Resolution Status', {ns: 'mri_violations'}), show: true, filter: { - name: "resolutionStatus", - type: "select", + name: 'resolutionStatus', + type: 'select', options: { - unresolved: t("Unresolved", { ns: "mri_violations" }), - reran: t("Reran", { ns: "mri_violations" }), - emailed: t("Emailed site/pending", { ns: "mri_violations" }), - inserted: t("Inserted", { ns: "mri_violations" }), - rejected: t("Rejected", { ns: "mri_violations" }), - inserted_flag: t("Inserted with flag", { ns: "mri_violations" }), - other: t("Other", { ns: "mri_violations" }), + unresolved: t('Unresolved', {ns: 'mri_violations'}), + reran: t('Reran', {ns: 'mri_violations'}), + emailed: t('Emailed site/pending', {ns: 'mri_violations'}), + inserted: t('Inserted', {ns: 'mri_violations'}), + rejected: t('Rejected', {ns: 'mri_violations'}), + inserted_flag: t('Inserted with flag', {ns: 'mri_violations'}), + other: t('Other', {ns: 'mri_violations'}), }, }, }, { - label: t("Series UID", { ns: "mri_violations" }), + label: t('Series UID', {ns: 'mri_violations'}), show: false, filter: { - name: "seriesUID", - type: "text", + name: 'seriesUID', + type: 'text', }, }, - { label: t("hash", { ns: "mri_violations" }), show: false }, - { label: t("JoinID", { ns: "mri_violations" }), show: false }, - { label: t("TarchiveID", { ns: "mri_violations" }), show: false }, - { label: t("CandID", { ns: "loris" }), show: false }, - { label: t("PSCID", { ns: "loris" }), show: false }, + {label: t('hash', {ns: 'mri_violations'}), show: false}, + {label: t('JoinID', {ns: 'mri_violations'}), show: false}, + {label: t('TarchiveID', {ns: 'mri_violations'}), show: false}, + {label: t('CandID', {ns: 'loris'}), show: false}, + {label: t('PSCID', {ns: 'loris'}), show: false}, // Add fake column for resolution dropdown - { label: t("Select Resolution", { ns: "mri_violations" }), show: true }, + {label: t('Select Resolution', {ns: 'mri_violations'}), show: true}, ]; }; @@ -433,8 +433,8 @@ function MRIViolationsIndex(props) { ) : isError ? (

- {t("An error occurred while loading the page.", { - ns: "mri_violations", + {t('An error occurred while loading the page.', { + ns: 'mri_violations', })}

) : ( @@ -467,37 +467,37 @@ MRIViolationsIndex.propTypes = { function columnMapper(fieldOptions) { return (column, value) => { switch (column) { - case "Project": - if (fieldOptions.projects) { - return fieldOptions.projects[value]; - } - break; - case "Cohort": - if (fieldOptions.cohorts) { - return fieldOptions.cohorts[value]; - } - break; - case "Site": - if (fieldOptions.sites) { - return fieldOptions.sites[value]; - } - break; + case 'Project': + if (fieldOptions.projects) { + return fieldOptions.projects[value]; + } + break; + case 'Cohort': + if (fieldOptions.cohorts) { + return fieldOptions.cohorts[value]; + } + break; + case 'Site': + if (fieldOptions.sites) { + return fieldOptions.sites[value]; + } + break; } return value; }; } -window.addEventListener("load", () => { - i18n.addResourceBundle("hi", "mri_violations", hiStrings); - i18n.addResourceBundle("ja", "mri_violations", jaStrings); - i18n.addResourceBundle("fr", "mri_violations", frStrings); - i18n.addResourceBundle("es", "mri_violations", esStrings); +window.addEventListener('load', () => { + i18n.addResourceBundle('hi', 'mri_violations', hiStrings); + i18n.addResourceBundle('ja', 'mri_violations', jaStrings); + i18n.addResourceBundle('fr', 'mri_violations', frStrings); + i18n.addResourceBundle('es', 'mri_violations', esStrings); - const ViolationsIndex = withTranslation(["mri_violations", "loris"])( + const ViolationsIndex = withTranslation(['mri_violations', 'loris'])( MRIViolationsIndex, ); - ReactDOM.createRoot(document.getElementById("lorisworkspace")).render( + ReactDOM.createRoot(document.getElementById('lorisworkspace')).render( Date: Fri, 21 Nov 2025 14:25:42 -0500 Subject: [PATCH 09/13] fix error --- locale/hi/LC_MESSAGES/loris.po | 3 --- 1 file changed, 3 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 58f268af62b..d8a2aafa947 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -282,9 +282,6 @@ msgstr "जातीयता" msgid "Access denied" msgstr "पहुँच अस्वीकृत" -msgid "No." -msgstr "क्रमांक" - # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{totalCount}} में से {{pageCount}} पंक्तियाँ प्रदर्शित" From 2600d0c78c6d8807af3df1cf1c561e6df533f9b0 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 24 Nov 2025 19:24:36 -0500 Subject: [PATCH 10/13] updates --- .../mri_violations/jsx/mriViolationsIndex.js | 16 +++--- modules/mri_violations/jsx/protocolModal.js | 2 +- .../locale/es/LC_MESSAGES/mri_violations.po | 39 ++++++++++++++ .../locale/fr/LC_MESSAGES/mri_violations.po | 39 ++++++++++++++ .../locale/hi/LC_MESSAGES/mri_violations.po | 39 ++++++++++++++ .../locale/ja/LC_MESSAGES/mri_violations.po | 39 ++++++++++++++ .../mri_violations/locale/mri_violations.pot | 52 +++++++++++++++++++ 7 files changed, 217 insertions(+), 9 deletions(-) diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index d04cdfd3049..0cfb3465c8b 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -151,10 +151,10 @@ function MRIViolationsIndex(props) { onClick={() => setPage({ ViolationType: 'protocolcheck', - PatientName: rowData['Patient Name'], - SeriesUID: rowData['Series UID'], - TarchiveID: rowData['TarchiveID'], - CandID: rowData.CandId, + PatientName: rowData[t('Patient Name', {ns: 'mri_violations'})], + SeriesUID: rowData[t('Series UID', {ns: 'mri_violations'})], + TarchiveID: rowData[t('TarchiveID', {ns: 'mri_violations'})], + CandID: rowData.CandID, }) } > @@ -177,12 +177,12 @@ function MRIViolationsIndex(props) { onClick={() => setPage({ ViolationType: 'protocolviolation', - PatientName: rowData['Patient Name'], - SeriesUID: rowData['Series UID'], - TarchiveID: rowData['TarchiveId'], + PatientName: rowData[t('Patient Name', {ns: 'mri_violations'})], + SeriesUID: rowData[t('Series UID', {ns: 'mri_violations'})], + TarchiveID: rowData[t('TarchiveID', {ns: 'mri_violations'})], CandID: rowData.CandID, PSCID: rowData.PSCID, - TimeRun: rowData['Time Run'], + TimeRun: rowData[t('Time Run', {ns: 'mri_violations'})], SeriesDescription: seriesDescription, }) } diff --git a/modules/mri_violations/jsx/protocolModal.js b/modules/mri_violations/jsx/protocolModal.js index 9baea4796f9..782f024b766 100644 --- a/modules/mri_violations/jsx/protocolModal.js +++ b/modules/mri_violations/jsx/protocolModal.js @@ -68,7 +68,7 @@ function ProtocolViolationModal(props) {
-
{t('CandID', {ns: 'mri_violations'})}
+
{t('CandID', {ns: 'loris'})}
{violation[0]}
diff --git a/modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po index 5f77257935d..f8797766b29 100644 --- a/modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po +++ b/modules/mri_violations/locale/es/LC_MESSAGES/mri_violations.po @@ -171,5 +171,44 @@ msgstr "UnirseID" msgid "TarchiveID" msgstr "ID de archivo" +msgid "Center Name" +msgstr "Nombre del centro" + +msgid "Scanner ID" +msgstr "ID del escáner" + +msgid "TR Range" +msgstr "Gama TR" + +msgid "TE Range" +msgstr "LA GAMA" + +msgid "TI Range" +msgstr "Rango TI" + +msgid "Slice Thickness Range" +msgstr "Rango de espesor de rebanada" + +msgid "Xspace Range" +msgstr "Gama Xspace" + +msgid "Yspace Range" +msgstr "Gama Yspace" + +msgid "Zspace Range" +msgstr "Gama Zspace" + +msgid "Xstep Range" +msgstr "Gama Xstep" + +msgid "Ystep Range" +msgstr "Rango de paso Y" + +msgid "Zstep Range" +msgstr "Rango de paso Z" + +msgid "Time Range" +msgstr "Rango de tiempo" + msgid "Can not implement filter on a resource type that has no projects." msgstr "No se puede implementar un filtro en un tipo de recurso que no tenga proyectos." diff --git a/modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po index 66b719992d4..4a8a8903f77 100644 --- a/modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po +++ b/modules/mri_violations/locale/fr/LC_MESSAGES/mri_violations.po @@ -171,5 +171,44 @@ msgstr "ID de jointure" msgid "TarchiveID" msgstr "TarchiveID" +msgid "Center Name" +msgstr "Nom du centre" + +msgid "Scanner ID" +msgstr "ID du scanner" + +msgid "TR Range" +msgstr "Gamme TR" + +msgid "TE Range" +msgstr "LA GAMME" + +msgid "TI Range" +msgstr "Gamme TI" + +msgid "Slice Thickness Range" +msgstr "Plage d'épaisseur de tranche" + +msgid "Xspace Range" +msgstr "Gamme Xspace" + +msgid "Yspace Range" +msgstr "Gamme Yspace" + +msgid "Zspace Range" +msgstr "Gamme Zspace" + +msgid "Xstep Range" +msgstr "Gamme Xstep" + +msgid "Ystep Range" +msgstr "Plage Ystep" + +msgid "Zstep Range" +msgstr "Plage de pas Z" + +msgid "Time Range" +msgstr "Plage de temps" + msgid "Can not implement filter on a resource type that has no projects." msgstr "Impossible d'appliquer un filtre à un type de ressource qui ne comporte aucun projet." diff --git a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po index d631c1ecdbd..448e92ea393 100644 --- a/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po +++ b/modules/mri_violations/locale/hi/LC_MESSAGES/mri_violations.po @@ -171,5 +171,44 @@ msgstr "जॉइनआईडी" msgid "TarchiveID" msgstr "टार्चिवआईडी" +msgid "Center Name" +msgstr "केंद्र का नाम" + +msgid "Scanner ID" +msgstr "स्कैनर आईडी" + +msgid "TR Range" +msgstr "टीआर रेंज" + +msgid "TE Range" +msgstr "सीमा" + +msgid "TI Range" +msgstr "टीआई रेंज" + +msgid "Slice Thickness Range" +msgstr "स्लाइस मोटाई रेंज" + +msgid "Xspace Range" +msgstr "एक्सस्पेस रेंज" + +msgid "Yspace Range" +msgstr "वाईस्पेस रेंज" + +msgid "Zspace Range" +msgstr "ज़ेडस्पेस रेंज" + +msgid "Xstep Range" +msgstr "एक्सस्टेप रेंज" + +msgid "Ystep Range" +msgstr "यस्टेप रेंज" + +msgid "Zstep Range" +msgstr "ज़स्टेप रेंज" + +msgid "Time Range" +msgstr "समय सीमा" + msgid "Can not implement filter on a resource type that has no projects." msgstr "ऐसे संसाधन प्रकार पर फ़िल्टर लागू नहीं किया जा सकता जिसमें कोई परियोजना नहीं है." diff --git a/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po b/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po index 90f00b403e9..a689f4be06f 100644 --- a/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po +++ b/modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po @@ -174,6 +174,45 @@ msgstr "参加ID" msgid "TarchiveID" msgstr "アーカイブID" +msgid "Center Name" +msgstr "センター名" + +msgid "Scanner ID" +msgstr "スキャナID" + +msgid "TR Range" +msgstr "TR範囲" + +msgid "TE Range" +msgstr "THE レンジ" + +msgid "TI Range" +msgstr "TI 範囲" + +msgid "Slice Thickness Range" +msgstr "スライス厚さ範囲" + +msgid "Xspace Range" +msgstr "Xspace 範囲" + +msgid "Yspace Range" +msgstr "Yspace 範囲" + +msgid "Zspace Range" +msgstr "Zspace 範囲" + +msgid "Xstep Range" +msgstr "Xstep 範囲" + +msgid "Ystep Range" +msgstr "Yステップ範囲" + +msgid "Zstep Range" +msgstr "Zstep 範囲" + +msgid "Time Range" +msgstr "時間範囲" + msgid "Can not implement filter on a resource type that has no projects." msgstr "プロジェクトがないリソース タイプにフィルターを実装することはできません。" diff --git a/modules/mri_violations/locale/mri_violations.pot b/modules/mri_violations/locale/mri_violations.pot index 2a460b11c6d..936951f4ffb 100644 --- a/modules/mri_violations/locale/mri_violations.pot +++ b/modules/mri_violations/locale/mri_violations.pot @@ -179,3 +179,55 @@ msgstr "" msgid "TarchiveID" msgstr "" + +msgid "Center Name" +msgstr "" + +msgid "Scanner ID" +msgstr "" + +msgid "Scan Type" +msgstr "" + +msgid "TR Range" +msgstr "" + +msgid "TE Range" +msgstr "" + +msgid "TI Range" +msgstr "" + +msgid "Slice Thickness Range" +msgstr "" + +msgid "Xspace Range" +msgstr "" + +msgid "Yspace Range" +msgstr "" + +msgid "Zspace Range" +msgstr "" + +msgid "Xstep Range" +msgstr "" + +msgid "Ystep Range" +msgstr "" + +msgid "Zstep Range" +msgstr "" + +msgid "Time Range" +msgstr "" + +msgid "Image Type" +msgstr "" + +msgid "Phase Encoding Direction" +msgstr "" + +msgid "Echo Number" +msgstr "" + From ca63e75a4170d7863bc100aad01c428d7b4f53df Mon Sep 17 00:00:00 2001 From: root Date: Mon, 24 Nov 2025 19:36:08 -0500 Subject: [PATCH 11/13] updates --- modules/mri_violations/jsx/mriViolationsIndex.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index 0cfb3465c8b..847da5d584c 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -151,7 +151,8 @@ function MRIViolationsIndex(props) { onClick={() => setPage({ ViolationType: 'protocolcheck', - PatientName: rowData[t('Patient Name', {ns: 'mri_violations'})], + PatientName: rowData[t('Patient Name', {ns: 'mri_violations'}) + ], SeriesUID: rowData[t('Series UID', {ns: 'mri_violations'})], TarchiveID: rowData[t('TarchiveID', {ns: 'mri_violations'})], CandID: rowData.CandID, @@ -177,7 +178,8 @@ function MRIViolationsIndex(props) { onClick={() => setPage({ ViolationType: 'protocolviolation', - PatientName: rowData[t('Patient Name', {ns: 'mri_violations'})], + PatientName: rowData[t('Patient Name', {ns: 'mri_violations'}) + ], SeriesUID: rowData[t('Series UID', {ns: 'mri_violations'})], TarchiveID: rowData[t('TarchiveID', {ns: 'mri_violations'})], CandID: rowData.CandID, From c8724d49b6b045f4b98e5a8b8d562a9ba4f57b13 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 27 Nov 2025 21:52:46 -0500 Subject: [PATCH 12/13] change CandID => DCCID --- modules/mri_violations/jsx/protocolModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mri_violations/jsx/protocolModal.js b/modules/mri_violations/jsx/protocolModal.js index 782f024b766..0bf33e56708 100644 --- a/modules/mri_violations/jsx/protocolModal.js +++ b/modules/mri_violations/jsx/protocolModal.js @@ -68,7 +68,7 @@ function ProtocolViolationModal(props) {
-
{t('CandID', {ns: 'loris'})}
+
{t('DCCID', {ns: 'loris'})}
{violation[0]}
From 151652606ee080fe9a29aa362703eb50233fbc28 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 3 Dec 2025 09:55:44 -0500 Subject: [PATCH 13/13] updates changes --- modules/mri_violations/jsx/mriViolationsIndex.js | 4 ++-- modules/mri_violations/jsx/protocolModal.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/mri_violations/jsx/mriViolationsIndex.js b/modules/mri_violations/jsx/mriViolationsIndex.js index 847da5d584c..8ba86f9c275 100644 --- a/modules/mri_violations/jsx/mriViolationsIndex.js +++ b/modules/mri_violations/jsx/mriViolationsIndex.js @@ -420,7 +420,7 @@ function MRIViolationsIndex(props) { {label: t('hash', {ns: 'mri_violations'}), show: false}, {label: t('JoinID', {ns: 'mri_violations'}), show: false}, {label: t('TarchiveID', {ns: 'mri_violations'}), show: false}, - {label: t('CandID', {ns: 'loris'}), show: false}, + {label: t('DCCID', {ns: 'loris'}), show: false}, {label: t('PSCID', {ns: 'loris'}), show: false}, // Add fake column for resolution dropdown @@ -436,7 +436,7 @@ function MRIViolationsIndex(props) { ) : isError ? (

{t('An error occurred while loading the page.', { - ns: 'mri_violations', + ns: 'loris', })}

) : ( diff --git a/modules/mri_violations/jsx/protocolModal.js b/modules/mri_violations/jsx/protocolModal.js index 0bf33e56708..b4466495471 100644 --- a/modules/mri_violations/jsx/protocolModal.js +++ b/modules/mri_violations/jsx/protocolModal.js @@ -297,7 +297,7 @@ function ProtocolCheckViolationModal(props) {

{t('Scan Problems', {ns: 'mri_violations'})}