Skip to content

Commit

Permalink
Merge remote-tracking branch 'aces/main' into 2024_10_15_NDB_BVL_Inst…
Browse files Browse the repository at this point in the history
…rument_php_warnings
  • Loading branch information
skarya22 committed Nov 11, 2024
2 parents 4d02c92 + ce4f220 commit f00bb2f
Show file tree
Hide file tree
Showing 262 changed files with 15,566 additions and 12,416 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"tabWidth": 2,
"ignoreComments": true
}],
"indent": ["error", 2],
"no-unexpected-multiline": "off",
"no-unused-vars": "error",
"no-useless-escape": "off",
Expand Down Expand Up @@ -110,8 +111,9 @@
}}
],
"jsdoc/require-param-description": "error",
"jsdoc/require-returns": "error",
"jsdoc/require-returns-description": "error",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
"no-undef": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off"
Expand Down
14 changes: 10 additions & 4 deletions SQL/0000-00-00-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ CREATE TABLE `test_battery` (
`CenterID` int(11) default NULL,
`firstVisit` enum('Y','N') default NULL,
`instr_order` tinyint(4) default NULL,
`DoubleDataEntryEnabled` enum('Y','N') default 'N',
PRIMARY KEY (`ID`),
KEY `age_test` (`AgeMinDays`,`AgeMaxDays`,`Test_name`),
KEY `FK_test_battery_1` (`Test_name`),
Expand Down Expand Up @@ -1528,6 +1529,7 @@ CREATE TABLE `issues` (
`candID` int(6) DEFAULT NULL,
`category` varchar(255) DEFAULT NULL,
`description` longtext DEFAULT NULL,
`instrument` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`issueID`),
KEY `fk_issues_1` (`reporter`),
KEY `fk_issues_2` (`assignee`),
Expand All @@ -1536,20 +1538,22 @@ CREATE TABLE `issues` (
KEY `fk_issues_5` (`centerID`),
KEY `fk_issues_6` (`lastUpdatedBy`),
KEY `fk_issues_8` (`category`),
KEY `fk_issues_instrument` (`instrument`),
CONSTRAINT `fk_issues_8` FOREIGN KEY (`category`) REFERENCES `issues_categories` (`categoryName`),
CONSTRAINT `fk_issues_1` FOREIGN KEY (`reporter`) REFERENCES `users` (`UserID`),
CONSTRAINT `fk_issues_2` FOREIGN KEY (`assignee`) REFERENCES `users` (`UserID`),
CONSTRAINT `fk_issues_3` FOREIGN KEY (`candID`) REFERENCES `candidate` (`CandID`),
CONSTRAINT `fk_issues_4` FOREIGN KEY (`sessionID`) REFERENCES `session` (`ID`),
CONSTRAINT `fk_issues_5` FOREIGN KEY (`centerID`) REFERENCES `psc` (`CenterID`),
CONSTRAINT `fk_issues_6` FOREIGN KEY (`lastUpdatedBy`) REFERENCES `users` (`UserID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CONSTRAINT `fk_issues_6` FOREIGN KEY (`lastUpdatedBy`) REFERENCES `users` (`UserID`),
CONSTRAINT `fk_issues_instrument` FOREIGN KEY (`instrument`) REFERENCES `test_names` (`ID`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `issues_history` (
`issueHistoryID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`newValue` longtext NOT NULL,
`dateAdded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`fieldChanged` enum('assignee','status','comment','sessionID','centerID','title','category','module','lastUpdatedBy','priority','candID', 'description','watching') NOT NULL DEFAULT 'comment',
`fieldChanged` enum('assignee','status','comment','sessionID','centerID','title','category','module','lastUpdatedBy','priority','candID', 'description','watching','instrument') NOT NULL DEFAULT 'comment',
`issueID` int(11) unsigned NOT NULL,
`addedBy` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`issueHistoryID`),
Expand Down Expand Up @@ -2095,7 +2099,9 @@ CREATE TABLE `data_release` (
`file_name` varchar(255),
`version` varchar(255),
`upload_date` date,
PRIMARY KEY (`id`)
`ProjectID` INT(10) UNSIGNED NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (ProjectID) REFERENCES Project (ProjectID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `data_release_permissions` (
Expand Down
3 changes: 2 additions & 1 deletion SQL/0000-00-03-ConfigTables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType,
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useConsent', 'Enable if the study uses the loris architecture for consent', 1, 0, 'boolean', ID, 'Use consent', 16 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'additional_user_info', 'Display additional user profile fields on the User accounts page (e.g. Institution, Position, Country, Address)', 1, 0, 'boolean', ID, 'Additional user information', 17 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'excluded_instruments', "Instruments to be excluded from the Data Dictionary and download via the Data Query Tool", 1, 1, 'instrument', ID, 'Excluded instruments', 18 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'DoubleDataEntryInstruments', "Instruments for which double data entry should be enabled", 1, 1, 'instrument', ID, 'Double data entry instruments', 19 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'InstrumentResetting', 'Allows resetting of instrument data', 1, 0, 'boolean', ID, 'Instrument Resetting', 20 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'SupplementalSessionStatus', 'Display supplemental session status information on Timepoint List page', 1, 0, 'boolean', ID, 'Use Supplemental Session Status', 21 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useScanDone', 'Used for identifying timepoints that have (or should have) imaging data', 1, 0, 'boolean', ID, 'Use Scan Done', 22 FROM ConfigSettings WHERE Name="study";
Expand All @@ -63,6 +62,7 @@ INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType,
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'dateDisplayFormat', 'The date format to use throughout LORIS for displaying date information - formats for date inputs are browser- and locale-dependent.', 1, 0, 'text', ID, 'Date display format', 28 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'adminContactEmail', 'An email address that users can write to in order to report issues or ask question', 1, 0, 'text', ID, 'Administrator Email', 29 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'UserMaximumDaysInactive', 'The maximum number of days since last login before making a user inactive', 1, 0, 'text', ID, 'Maximum Days Before Making User Inactive', 30 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useDoB', 'Use DoB (Date of Birth)', 1, 0, 'boolean', ID, 'Use DoB', 31 FROM ConfigSettings WHERE Name="study";

INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, Label, OrderNumber) VALUES ('paths', 'Specify directories where LORIS-related files are stored or created. Take care when editing these fields as changing them incorrectly can cause certain modules to lose functionality.', 1, 0, 'Paths', 2);
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'imagePath', 'Path to images for display in Imaging Browser (e.g. /data/$project/data/) ', 1, 0, 'text', ID, 'Images', 9 FROM ConfigSettings WHERE Name="paths";
Expand Down Expand Up @@ -188,6 +188,7 @@ INSERT INTO Config (ConfigID, Value) SELECT ID, "Example Study" FROM ConfigSetti
INSERT INTO Config (ConfigID, Value) SELECT ID, "<h3>Example Study Description</h3>\r\n <p>This is a sample description for this study, because it is a new LORIS install that has not yet customized this text.</p>\r\n <p>A LORIS administrator can customize this text in the configuration module, under the configuration option labeled \"Study Description\"</p>\r\n <h3>Useful Links</h3>\r\n <ul>\r\n <li><a href=\"https://github.com/aces/Loris\" >LORIS GitHub Repository</a></li>\r\n <li><a href=\"https://github.com/aces/Loris/wiki/Setup\" >LORIS Setup Guide</a></li>\r\n <li><a href=\"https://www.youtube.com/watch?v=2Syd_BUbl5A\" >A video of a loris on YouTube</a></li>\r\n </ul>" FROM ConfigSettings WHERE Name="StudyDescription";
INSERT INTO Config (ConfigID, Value) SELECT ID, "images/neurorgb_web.jpg" FROM ConfigSettings WHERE Name="studylogo";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useEDC";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useDoB";
INSERT INTO Config (ConfigID, Value) SELECT ID, 8 FROM ConfigSettings WHERE Name="ageMin";
INSERT INTO Config (ConfigID, Value) SELECT ID, 11 FROM ConfigSettings WHERE Name="ageMax";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useFamilyID";
Expand Down
2 changes: 2 additions & 0 deletions SQL/New_patches/2023-12-08_useDoB.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useDoB', 'Use DoB (Date of Birth)', 1, 0, 'boolean', ID, 'Use DoB', 31 FROM ConfigSettings WHERE Name="study";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useDoB";
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ALTER TABLE `issues`
ADD `instrument` int(10) unsigned DEFAULT NULL
AFTER `description`;

ALTER TABLE `issues`
ADD CONSTRAINT `fk_issues_instrument`
FOREIGN KEY (`instrument`) REFERENCES `test_names` (`ID`)
ON DELETE RESTRICT ON UPDATE CASCADE;

ALTER TABLE `issues_history`
MODIFY `fieldChanged` enum('assignee','status','comment','sessionID','centerID','title','category','module','lastUpdatedBy','priority','candID', 'description','watching','instrument') NOT NULL DEFAULT 'comment';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE data_release
ADD COLUMN ProjectID INT(10) UNSIGNED NULL DEFAULT NULL,
ADD CONSTRAINT FK_ProjectID
FOREIGN KEY (ProjectID) REFERENCES Project (ProjectID);
9 changes: 9 additions & 0 deletions SQL/New_patches/2024_05_13_Add_DDE_To_Battery.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ALTER TABLE test_battery ADD COLUMN DoubleDataEntryEnabled enum("Y", "N") DEFAULT "N";

UPDATE test_battery SET DoubleDataEntryEnabled = 'Y' WHERE Test_name IN (
SELECT Value from Config WHERE ConfigID = (SELECT ID FROM ConfigSettings WHERE Name = 'DoubleDataEntryInstruments')
);

DELETE FROM Config WHERE ConfigID IN (SELECT ID FROM ConfigSettings WHERE Name = 'DoubleDataEntryInstruments');

DELETE FROM ConfigSettings WHERE Name = 'DoubleDataEntryInstruments';
62 changes: 2 additions & 60 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.8'
services:
db:
build:
Expand All @@ -13,12 +13,9 @@ services:
- MYSQL_RANDOM_ROOT_PASSWORD=yes

selenium:
image: selenium/standalone-firefox-debug:3.141.59-zirconium
volumes:
- /dev/shm:/dev/shm
image: selenium/standalone-firefox:4.25
ports:
- "5900:5900"

web:
build:
context: .
Expand Down Expand Up @@ -62,58 +59,3 @@ services:
- selenium
- web
entrypoint: /app/test/wait-for-services.sh

selenium-debug:
image: selenium/standalone-firefox-debug:3.141.59-zirconium
links:
- web-debug:web
ports:
- "5901:5900"

web-debug:
build:
context: .
dockerfile: Dockerfile.test.php8.debug
volumes:
- ./:/app
- ./test/test_instrument:/app/project/instruments
environment:
- LORIS_DB_CONFIG=/app/test/config.xml
- XDEBUG_CONFIG=remote_host=${XDEBUG_REMOTE_HOST}
- PHP_IDE_CONFIG=serverName=LorisTests
depends_on:
- db
command: php -S 0.0.0.0:8000 -t /app/htdocs /app/htdocs/router.php

unit-tests-debug:
build:
context: .
dockerfile: Dockerfile.test.php8.debug
volumes:
- ./:/app
working_dir: /app
environment:
- LORIS_DB_CONFIG=test/config.xml
- XDEBUG_CONFIG=remote_host=${XDEBUG_REMOTE_HOST}
- PHP_IDE_CONFIG=serverName=LorisTests
depends_on:
- db
entrypoint: /app/test/wait-for-services.sh

integration-tests-debug:
build:
context: .
dockerfile: Dockerfile.test.php8.debug
volumes:
- ./:/app
working_dir: /app
environment:
- LORIS_DB_CONFIG=test/config.xml
- SELENIUM_REQUIRED=true
- XDEBUG_CONFIG=remote_host=${XDEBUG_REMOTE_HOST}
- PHP_IDE_CONFIG=serverName=LorisTests
links:
- db
- selenium-debug:selenium
- web-debug:web
entrypoint: /app/test/wait-for-services.sh
8 changes: 4 additions & 4 deletions htdocs/js/advancedMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ function isElementSet() {
let set = 0;
let options = $('.advancedOptions option:selected'); // get all the selected dropdowns for the TR with the ID advancedOptions
let texts = $('.advancedOptions input[type=text]');
// brows through the selected dropdowns
// if any of the dropdown is not equal to 'All' then set the variable set to true
// brows through the selected dropdowns
// if any of the dropdown is not equal to 'All' then set the variable set to true
options.each(function() {
let value = $(this).text();
if (value !== 'All') {
set = 1;
return;
}
});
// browse though the text elements
// /if any of the text element is not empty then set the variable set to true
// browse though the text elements
// /if any of the text element is not empty then set the variable set to true
texts.each(function() {
let value = $(this).val();
if (value !== '') {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/js/instrument_controlpanel_control.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
$(function() {
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="tooltip"]').tooltip();
});
24 changes: 12 additions & 12 deletions htdocs/js/invalid_form_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@
*/

$(document).ready(function bindInvalidFormListeners() {
// This will make sure that the flag indicating whether we scrolled
// to an invalid element when the form is submitted is reset
// This will make sure that the flag indicating whether we scrolled
// to an invalid element when the form is submitted is reset
document.getElementsByName('fire_away')[0].addEventListener(
'click',
function() {
bindInvalidFormListeners.scrollingDone = false;
}
);

// Override default event handler for invalid input elements
// This will make sure that the invalid element appears at the top
// of the page.
// Override default event handler for invalid input elements
// This will make sure that the invalid element appears at the top
// of the page.
let elements = document.querySelectorAll('input,select,textarea');
let navbarHeader = document.getElementsByClassName('navbar-header');
for (let i = elements.length; i--;) {
elements[i].addEventListener('invalid', function() {
// Only make the uppermost invalid element visible when the
// form is submitted
// Only make the uppermost invalid element visible when the
// form is submitted
if (!bindInvalidFormListeners.scrollingDone) {
this.scrollIntoView(true);
// scrollingIntoView is not enough: the navigation bar will appear
// over the invalid element and hide it.
// We have to scroll an additional number of pixels down so that
// the elements becomes visible.
// scrollingIntoView is not enough: the navigation bar will appear
// over the invalid element and hide it.
// We have to scroll an additional number of pixels down so that
// the elements becomes visible.
if (navbarHeader) {
window.scrollBy(0, -$(navbarHeader).height() - 10);
}

// Only scroll once
// Only scroll once
bindInvalidFormListeners.scrollingDone = true;
}
});
Expand Down
4 changes: 2 additions & 2 deletions htdocs/js/jquery.fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
$(element).change(function() {
let filename = $(this).val().split('\\').pop();
let placeHolder = $(this)
.parent().parent().parent()
.find('.file-caption-name');
.parent().parent().parent()
.find('.file-caption-name');
$(placeHolder).html(filename);
});
});
Expand Down
Loading

0 comments on commit f00bb2f

Please sign in to comment.