75 lines
3.1 KiB
HTML
75 lines
3.1 KiB
HTML
{% extends 'index.html' %}
|
|
{% block content %}
|
|
<div class="card">
|
|
<div id="main-div" class="card-body">
|
|
<form action="{{ url_for('matDecStim') }}" method="POST">
|
|
<div class="form-group">
|
|
<select class="form-control" name="participant" id="participant">
|
|
<option>--</option>
|
|
{% for p in part_keys %}
|
|
<option>{{ p }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="open-mat-folder-container">Matrix data folder: </label>
|
|
<br>
|
|
<input type="text" id="mat-dir" name='mat_dir' value="./matrix_test/speech_components/" style="width:85%"></input>
|
|
<button type="button" id="mat-dir-button" class="btn btn-primary">Browse...</button>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="listN">Number of lists:</label>
|
|
<br>
|
|
<input id="listN" name="listN" type="number" value="3" max="18" min="1" style="width:85%">
|
|
</div>
|
|
<div class="form-group d-flex justify-content-center">
|
|
<button type="button" id="submit" class="btn btn-primary mx-3">Start new test</button>
|
|
<button type="button" id="load-saved" class="btn btn-primary mx-3">Load saved session</button>
|
|
<button type="button" id="load-backup" class="btn btn-primary mx-3">Load previous automatic backup</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function(){
|
|
// Initialise socketio with a namespace called "main"
|
|
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + '/main');
|
|
|
|
$('#load-backup').click(function(event) {
|
|
socket.emit('load_mat_backup', {part_key: $("#participant").val()});
|
|
return false;
|
|
})
|
|
$('#load-saved').click(function(event) {
|
|
socket.emit('load_mat_session', {part_key: $("#participant").val()});
|
|
return false;
|
|
})
|
|
$('#submit').click(function(event) {
|
|
socket.emit('start_mat_test', {listN: $("#listN").val(), part_key: $("#participant").val()});
|
|
return false;
|
|
})
|
|
|
|
socket.on('participant_start_mat', function(msg) {
|
|
// Set form test to filepath returned by dialog
|
|
window.location.href = '/matrix_test/clinician/control';
|
|
});
|
|
|
|
|
|
socket.on('save-dialog-resp', function(msg) {
|
|
// Set form test to filepath returned by dialog
|
|
document.getElementById("save-dir").value = msg.data
|
|
});
|
|
|
|
$('#mat-dir-button').click(function(event) {
|
|
// Send message to call stimulus generation function in Python
|
|
socket.emit('open_mat_dialog');
|
|
return false;
|
|
})
|
|
|
|
socket.on('mat-dialog-resp', function(msg) {
|
|
// Set form test to filepath returned by dialog
|
|
document.getElementById("mat-dir").value = msg.data
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|