Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024 debug cm project filter #398

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e96d5a8
[notification] Fix sender name in email (#9203)
MaximeMulder Apr 16, 2024
92dbd76
[publication] Fix number of files in Upload tab (#9179)
CamilleBeau Apr 16, 2024
65ad4b5
[statistics] Recruitment graph optimization (#9196)
driusan Apr 16, 2024
5b5170a
[Publication] Fix for auto-selecting Project in edit (#9187)
skarya22 Apr 16, 2024
f96d9e4
[media] 413 error improperly handled (#9175)
kongtiaowang Apr 16, 2024
f111b9c
[publication] Fix download prevention by overriding download notifica…
jeffersoncasimir Apr 16, 2024
3d53b05
[Publication] Fix baseurl missing from emails (#9186)
skarya22 Apr 16, 2024
da70abd
Fix display of help text (#9210)
laemtl Apr 18, 2024
aca44a6
Make candidate_list use LORIS streamable binary format (#9195)
driusan Apr 18, 2024
fe303a4
Add to configuration server_processes_manager module (#9189)
GeorgeMurad Apr 18, 2024
07c9ca4
[instrument_builder] blank page when trying to add a score (#9212)
miladheshmati Apr 18, 2024
9c590b5
[dataquery] Use batch insert instead of prepared statement (#9205)
driusan Apr 18, 2024
ab5caa7
[RB_files] Removed erroneous insertions in RB_physiological_file (#9211)
jeffersoncasimir Apr 18, 2024
2167094
[Acknowledgements] Fix for selecting all roles (#9209)
skarya22 Apr 19, 2024
e33fcd7
[dicom archive] Remove superfluous newline in dicom archive view deta…
MaximeMulder Apr 23, 2024
43f53e9
data_dictionary_builder.php unique constraint fix (#9201)
laemtl Apr 23, 2024
8e21e88
[behavioural_qc ] Auto-open behavioural panel with query parameter (#…
jeffersoncasimir Apr 23, 2024
7eafeef
[genomic_browser] Minor edits to the test plan (#9198)
nicolasbrossard Apr 23, 2024
bff9931
[examiner] Adds permission check when adding examiner to site. (#9188)
racostas Apr 24, 2024
1dcf6fc
[dashboard] Add project filter for tasks widget
CamilleBeau Apr 25, 2024
8417f4c
Add changelog
CamilleBeau Apr 25, 2024
62dc5a9
debug
kongtiaowang Apr 29, 2024
3f335da
debug
kongtiaowang Apr 29, 2024
a8229f4
phpcs
kongtiaowang Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ changes in the following format: PR #1234***

#### Updates and Improvements
- Create new `sex` table to hold candidate sex options, and change Sex and ProbandSex columns of `candidate` table to a varchar(255) datatype that is restricted by the `sex` table (PR #9025)
- Add Project filter for "My tasks" counts in dashboard (PR #9220)

#### Bug Fixes
- Fix examiner site display (PR #8967)
- bvl_feedback updates in real-time (PR #8966)
- DoB and DoD format respected in candidate parameters (PR #9001)
- Fix delete file in upload (PR #9181)
- Fix profile level feedback display in behavioural QC module (PR #9192)
- While proposing a project or editing a project in publications module, prevent indefinite "File to upload" fields from being added if files are browsed then cancelled (PR #9179)

## LORIS 25.0 (Release Date: ????-??-??)
### Core
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ mri_violations:
issue_tracker:
target=issue_tracker npm run compile

candidate_list:
target=candidate_list npm run compile

candidate_parameters:
target=candidate_parameters npm run compile

Expand Down
6 changes: 3 additions & 3 deletions SQL/0000-00-00-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2111,9 +2111,9 @@ CREATE TABLE `acknowledgements` (
`ordering` varchar(255) DEFAULT NULL,
`full_name` varchar(255) DEFAULT NULL,
`citation_name` varchar(255) DEFAULT NULL,
`affiliations` varchar(255) DEFAULT NULL,
`degrees` varchar(255) DEFAULT NULL,
`roles` varchar(255) DEFAULT NULL,
`affiliations` text DEFAULT NULL,
`degrees` text DEFAULT NULL,
`roles` text DEFAULT NULL,
`start_date` date DEFAULT NULL,
`end_date` date DEFAULT NULL,
`present` enum('Yes', 'No') DEFAULT NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE acknowledgements MODIFY affiliations TEXT DEFAULT NULL;
ALTER TABLE acknowledgements MODIFY degrees TEXT DEFAULT NULL;
ALTER TABLE acknowledgements MODIFY roles TEXT DEFAULT NULL;
10 changes: 7 additions & 3 deletions htdocs/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -676,19 +676,23 @@ tr.directentry {
border: none;
}

.help-container {
position: static;
}

.help-content {
background: #E4EBF2;
border-style: solid;
border-color: #246EB6;
border-top: none;
border-width: 1px;
position: fixed;
right: 0;
position: absolute;
left: 0;
overflow-y: auto;
z-index: 999;
transition: all 0.6s ease 0s;
width: 320px;
max-height: 100vh;
max-height: calc(100vh - 100px);
}

.help-content h1 {
Expand Down
14 changes: 7 additions & 7 deletions modules/acknowledgements/php/acknowledgements.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,22 @@ class Acknowledgements extends \NDB_Menu_Filter_Form
if ($values['addPresent'] === 'Yes') {
$values['addEndDate'] = null;
}
$affiliations = is_array($values['addAffiliations']) ?
$affils = is_array($values['addAffiliations']) ?
implode(', ', $values['addAffiliations']) :
$values['addAffiliations'];
$degrees = is_array($values['addDegrees']) ?
$degs = is_array($values['addDegrees']) ?
implode(', ', $values['addDegrees']) :
$values['addDegrees'];
$roles = is_array($values['addRoles']) ?
$roles = is_array($values['addRoles']) ?
implode(', ', $values['addRoles']) :
$values['addRoles'];
$results = [
$results = [
'ordering' => $values['addOrdering'],
'full_name' => $values['addFullName'],
'citation_name' => $values['addCitationName'],
'affiliations' => $affiliations,
'degrees' => $degrees,
'roles' => $roles,
'affiliations' => implode(',', array_filter(explode(',', $affils))),
'degrees' => implode(',', array_filter(explode(',', $degs))),
'roles' => implode(',', array_filter(explode(',', $roles))),
'start_date' => $values['addStartDate'],
'end_date' => $values['addEndDate'],
'present' => $values['addPresent'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class BehaviouralFeedback extends Component {
rowData['sessionID'] +
'&commentID=' +
rowData['commentID'];
// Open feedback panel
bvlLink += '&showFeedback=true';
bvlLevel ='Instrument : ' + rowData['Instrument'];
} else if (rowData['Visit']) {
bvlLink = this.props.baseURL +
Expand All @@ -127,10 +129,14 @@ class BehaviouralFeedback extends Component {
rowData['DCCID'] +
'&sessionID=' +
rowData['sessionID'];
// Open feedback panel
bvlLink += '&showFeedback=true';
bvlLevel ='Visit : ' + rowData['Visit'];
} else {
bvlLink = this.props.baseURL +
'/' + rowData['DCCID'];
// Open feedback panel
bvlLink += '/?showFeedback=true';
bvlLevel ='Profile : ' + rowData['PSCID'];
}
reactElement = (
Expand Down
25 changes: 15 additions & 10 deletions modules/bvl_feedback/js/bvl_feedback_panel_jquery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
function toggleBVLMenu() {
$("#bvl_feedback_menu").toggleClass("active_panel");
$("#bvl_panel_wrapper").toggleClass("bvl_panel");

// We check if a sidebar exists on the page and toggle it if such.
if ($("#page_wrapper_sidebar").length){
$("#sidebar-wrapper").toggle("#sidebar-wrapper hide_sidebar");
$("#page_wrapper_sidebar").toggleClass("wrapper");
}
$('.dynamictable').DynamicTable();
}
/**
* Created by evanmcilroy on 15-06-09.
*/
Expand All @@ -7,17 +17,12 @@ $(document).ready(function() {
var sessionID = $('meta[itemprop="sessionID"]').attr("context");
var commentID = $('meta[itemprop="commentID"]').attr("context");

$('.navbar-toggle').on('click',function(event){
$("#bvl_feedback_menu").toggleClass("active_panel");
$("#bvl_panel_wrapper").toggleClass("bvl_panel");
$('.navbar-toggle').on('click', toggleBVLMenu);

//We check if a sidebar exists on the page and toggle it if such.
if ($("#page_wrapper_sidebar").length){
$("#sidebar-wrapper").toggle("#sidebar-wrapper hide_sidebar");
$("#page_wrapper_sidebar").toggleClass("wrapper");
}
$('.dynamictable').DynamicTable();
});
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('showFeedback') === 'true') {
toggleBVLMenu();
}
}); // end of document


54 changes: 29 additions & 25 deletions modules/candidate_list/jsx/candidateListIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Loader from 'Loader';
import FilterableDataTable from 'FilterableDataTable';
import Modal from 'Modal';

import fetchDataStream from 'jslib/fetchDataStream';
import OpenProfileForm from './openProfileForm';

/**
Expand All @@ -25,10 +26,11 @@ class CandidateListIndex extends Component {
super(props);

this.state = {
data: {},
data: [],
error: false,
isLoaded: false,
hideFilter: true,
fieldOptions: {},
show: {profileForm: false},
};

Expand Down Expand Up @@ -63,8 +65,18 @@ class CandidateListIndex extends Component {
* Called by React when the component has been rendered on the page.
*/
componentDidMount() {
this.fetchData()
.then(() => this.setState({isLoaded: true}));
fetch('options',
{credentials: 'same-origin'}).then(
(resp) => resp.json()
).then(
(json) => {
this.setState({
fieldOptions: json,
});
}
);

this.fetchData();

const searchParams = new URLSearchParams(location.search);
if (searchParams.has('hide')) {
Expand All @@ -80,23 +92,15 @@ class CandidateListIndex extends Component {
* @return {object}
*/
fetchData() {
return fetch(this.props.dataURL, {credentials: 'same-origin'})
.then((resp) => resp.json())
.then((data) => {
// Convert concatenated string of cohort and visit labels to array
data.Data = data.Data.map((row) => {
// Visit label
row[2] = (row[2]) ? row[2].split(',') : null;
// Cohort
row[4] = (row[4]) ? row[4].split(',') : null;
return row;
});
this.setState({data});
})
.catch((error) => {
this.setState({error: true});
console.error(error);
});
fetchDataStream(this.props.dataURL,
(row) => this.state.data.push(row),
(end) => {
this.setState({data: this.state.data});
},
() => {
this.setState({isLoaded: true});
},
);
}

/**
Expand Down Expand Up @@ -149,8 +153,7 @@ class CandidateListIndex extends Component {
}

if (column === 'Cohort') {
// If user has multiple cohorts, join array into string
let result = (cell) ? <td>{cell.join(', ')}</td> : <td></td>;
let result = (cell) ? <td>{cell}</td> : <td></td>;
return result;
}

Expand Down Expand Up @@ -178,7 +181,8 @@ class CandidateListIndex extends Component {
* XXX: Currently, the order of these fields MUST match the order of the
* queried columns in _setupVariables() in candidate_list.class.inc
*/
const options = this.state.data.fieldOptions;
// const options = this.state.data.fieldOptions;
const options = this.state.fieldOptions;
const fields = [
{
label: 'PSCID',
Expand Down Expand Up @@ -371,7 +375,7 @@ class CandidateListIndex extends Component {
{profileForm}
<FilterableDataTable
name="candidateList"
data={this.state.data.Data}
data={this.state.data}
fields={fields}
actions={actions}
getFormattedCell={this.formatColumn}
Expand All @@ -394,7 +398,7 @@ window.addEventListener('load', () => {
document.getElementById('lorisworkspace')
).render(
<CandidateListIndex
dataURL={`${loris.BaseURL}/candidate_list/?format=json`}
dataURL={`${loris.BaseURL}/candidate_list/?format=binary`}
hasPermission={loris.userHasPermission}
baseURL={loris.BaseURL}
betaProfileLink={args['betaprofile']}
Expand Down
109 changes: 109 additions & 0 deletions modules/candidate_list/php/options.class.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php declare(strict_types=1);
namespace LORIS\candidate_list;
use \Psr\Http\Message\ServerRequestInterface;
use \Psr\Http\Message\ResponseInterface;

/**
* Implements the candidate_list menu
*
* @category Main
* @package Candidate_List
* @author Loris Team <loris.mni@bic.mni.mcgill.ca>
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link https://www.github.com/aces/Loris/
*/
class Options extends \LORIS\Http\Endpoint
{
/**
* Overloading this method to allow access to site users (their own site only)
* and users w/ multisite privs
*
* @param \User $user The user whose access is being checked
*
* @return bool true if user has access, false otherwise
*/
function _hasAccess(\User $user) : bool
{
return (
$user->hasPermission('access_all_profiles')
|| ($user->hasStudySite() && $user->hasPermission('data_entry'))

);
}

/**
* Return the list of field options required to be serialized to JSON
* in order to render the frontend.
*
* @return array
*/
function getFieldOptions() : array
{
$this->loris->getModule('candidate_parameters')->registerAutoloader();

// create user object
$factory = \NDB_Factory::singleton();
$user = $factory->user();
$config = $factory->config();

// get the list of visit labels
$visit_label_options = \Utility::getVisitList();

// get the list of sites available for the user
if ($user->hasPermission('access_all_profiles')) {
$list_of_sites = \Utility::getSiteList();
} else {
$list_of_sites = $user->getStudySites();
}
$site_options = [];
foreach (array_values($list_of_sites) as $name) {
$site_options[$name] = $name;
}

// get the list of projects
$list_of_projects = \Utility::getProjectList();
$project_options = [];
foreach (array_values($list_of_projects) as $name) {
$project_options[$name] = $name;
}

// get the list of cohorts
$list_of_cohorts = \Utility::getCohortList();
$cohort_options = [];
foreach (array_values($list_of_cohorts) as $name) {
$cohort_options[$name] = $name;
}

// get the list participant status options
$list_of_participant_status
= \Candidate::getParticipantStatusOptions();
$participant_status_options = [];
foreach (array_values($list_of_participant_status) as $name) {
$participant_status_options[$name] = $name;
}

return [
'visitlabel' => $visit_label_options,
'site' => $site_options,
'project' => $project_options,
'cohort' => $cohort_options,
'participantstatus' => $participant_status_options,
'useedc' => $config->getSetting("useEDC"),
'Sex' => \Utility::getSexList(),
];
}

/**
* An Endpoint acts as middleware which will calculate ETag if applicable.
*
* @param ServerRequestInterface $request The incoming PSR7 request
*
* @return ResponseInterface The outgoing PSR7 response
*/
public function handle(
ServerRequestInterface $request,
): ResponseInterface {
return new \LORIS\Http\Response\JSON\OK($this->getFieldOptions());
}
}