Archived
Initial commit
This commit is contained in:
commit
d89b82be4a
103 files changed
+23110
No files matched your search
@@ -0,0 +1,98 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="crm-parent" class="container-fluid">
|
||||
<div class="container-fluid crm-holder">
|
||||
<div id="myProgress">
|
||||
<div id="progressBar"></div>
|
||||
</div>
|
||||
<div id="trial_count" style="text-align: center; margin-bottom: 2%;">
|
||||
<span style="color: white; font-size: 2em;">
|
||||
<span id="current_trial">{{ current_trial }}</span>/<span
|
||||
id="total_trials">{{ total_trials }}</span></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="woman_holding_dog"><img src="{{url_for('static', filename='images/woman+dog.jpg')}}" alt=""></div>
|
||||
<div class="col-md">
|
||||
<table id="crm-grid">
|
||||
<tr>
|
||||
<td class="crm-name" style="color: green">
|
||||
{% if lang == 'nl' %}Groen{% elif lang == 'en' %}Green{% endif %}</th>
|
||||
{% for i in range(1,10) %}
|
||||
{% if i != 7 %}
|
||||
<td class="crm-cell crm-green"><button onclick="submitAnswer('green', {{ i }})"
|
||||
class="crm-button crm-green">{{ i }}</button></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td class="crm-name" style="color: green">
|
||||
{% if lang == 'nl' %}Groen{% elif lang == 'en' %}Green{% endif %}</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="crm-name" style="color: blue">
|
||||
{% if lang == 'nl' %}Blauw{% elif lang == 'en' %}Blue{% endif %}</td>
|
||||
{% for i in range(1,10) %}
|
||||
{% if i != 7 %}
|
||||
<td class="crm-cell crm-blue"><button onclick="submitAnswer('blue', {{ i }})"
|
||||
class="crm-button crm-blue">{{i}}</button></td>
|
||||
{%endif%}
|
||||
{%endfor%}
|
||||
<td class="crm-name" style="color: blue">
|
||||
{% if lang == 'nl' %}Blauw{% elif lang == 'en' %}Blue{% endif %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="crm-name" style="color: red">
|
||||
{% if lang == 'nl' %}Rood{% elif lang == 'en' %}Red{% endif %}</th>
|
||||
{% for i in range(1,10) %}
|
||||
{% if i != 7 %}
|
||||
<td class="crm-cell crm-red"><button onclick="submitAnswer('red', {{ i }})"
|
||||
class="crm-button crm-red">{{ i }}</button></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td class="crm-name" style="color: red">
|
||||
{% if lang == 'nl' %}Rood{% elif lang == 'en' %}Red{% endif %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="crm-name" style="color: pink">
|
||||
{% if lang == 'nl' %}Rose{% elif lang == 'en' %}pink{% endif %}</th>
|
||||
{% for i in range(1,10) %}
|
||||
{% if i != 7 %}
|
||||
<td class="crm-cell crm-pink"><button onclick="submitAnswer('pink', {{ i }})"
|
||||
class="crm-button crm-pink">{{ i }}</button></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td class="crm-name" style="color: pink">
|
||||
{% if lang == 'nl' %}Rose{% elif lang == 'en' %}pink{% endif %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="crm-name" style="color: white">
|
||||
{% if lang == 'nl' %}Wit{% elif lang == 'en' %}White{% endif %}</th>
|
||||
{% for i in range(1,10) %}
|
||||
{% if i != 7 %}
|
||||
<td class="crm-cell crm-white"><button onclick="submitAnswer('white', {{ i }})"
|
||||
class="crm-button crm-white">{{i}}</button></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td class="crm-name" style="color: white">
|
||||
{% if lang == 'nl' %}Wit{% elif lang == 'en' %}White{% endif %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="crm-name" style="color: grey">
|
||||
{% if lang == 'nl' %}Zwart{% elif lang == 'en' %}Black{% endif %}</th>
|
||||
{% for i in range(1,10) %}
|
||||
{% if i != 7 %}
|
||||
<td class="crm-cell crm-black"><button onclick="submitAnswer('black', {{ i }})"
|
||||
class="crm-button crm-black">{{ i }}</button></td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td class="crm-name" style="color: grey">
|
||||
{% if lang == 'nl' %}Zwart{% elif lang == 'en' %}Black{% endif %}</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,279 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='css/bootstrap.min.css')}}">
|
||||
<link rel="stylesheet" href="{{url_for('static', filename='css/styles.css')}}">
|
||||
<link rel="stylesheet" href="{{url_for('static', filename='css/jquery-ui.min.css')}}">
|
||||
<script type="text/javascript" src="{{url_for('static', filename='js/jquery.min.js')}}"></script>
|
||||
<!-- <script src="https://code.jquery.com/jquery-1.12.4.js"></script> -->
|
||||
<script src="{{url_for('static', filename='js/jquery-ui.min.js')}}"></script>
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
</head>
|
||||
<script type="text/javascript">
|
||||
function submitAnswer(colour, number) {
|
||||
console.log(colour)
|
||||
console.log(number)
|
||||
var jqXHR = $.ajax({
|
||||
type: "POST",
|
||||
url: "/crm_answer",
|
||||
async: true,
|
||||
data: {
|
||||
colour: colour,
|
||||
number: number
|
||||
},
|
||||
success: function (response) {
|
||||
|
||||
if (response.trials.current_trial > response.trials.total_trials) {
|
||||
response.trials.current_trial = response.trials.total_trials;
|
||||
};
|
||||
$('#current_trial').text(response.trials.current_trial)
|
||||
$('#total_trials').text(response.trials.total_trials)
|
||||
|
||||
// if (response.trials.current_trial == 4) {
|
||||
|
||||
// var timer = 10;
|
||||
// setTimeout(checkBreak, 1000);
|
||||
// console.log("Running break")
|
||||
|
||||
// function checkBreak() {
|
||||
// var b = window.confirm("You can now take a break.")
|
||||
|
||||
// if (b == true) {
|
||||
// return
|
||||
// } else {
|
||||
// return
|
||||
// }
|
||||
// timer--;
|
||||
// if (timer >= 0) setTimeout(checkBreak, 1000);
|
||||
// }
|
||||
|
||||
// };
|
||||
|
||||
$(function () {
|
||||
$('#progressBar').progressbar({
|
||||
value: (response.trials.current_trial / response.trials
|
||||
.total_trials) * 100
|
||||
})
|
||||
})
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
$(function () {
|
||||
var dialog, form,
|
||||
|
||||
participant = $("#p_id"),
|
||||
phase = $("#phase"),
|
||||
language = $("#lang"),
|
||||
game = ""
|
||||
parent = this
|
||||
allFields = $([]).add(participant).add(phase).add(language),
|
||||
tips = $(".validateTips");
|
||||
|
||||
function updateTips(t) {
|
||||
tips
|
||||
.text(t)
|
||||
.addClass("ui-state-highlight");
|
||||
setTimeout(function () {
|
||||
tips.removeClass("ui-state-highlight", 1500);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function getGame(target) {
|
||||
parent.game = target.dataset.game
|
||||
}
|
||||
|
||||
function checkPID(o, n, max) {
|
||||
x = o.val().substring(0, 3)
|
||||
|
||||
if (o.val().length > max) {
|
||||
o.addClass("ui-state-error");
|
||||
updateTips("Length of " + n + "must be " +
|
||||
max + " characters long.");
|
||||
return false;
|
||||
} else if (o.val() != "") {
|
||||
switch (o.val().startsWith(x)) {
|
||||
case x == "NHA":
|
||||
return true;
|
||||
case x == "NHK":
|
||||
return true;
|
||||
case x == "CIA":
|
||||
return true;
|
||||
case x == "CIK":
|
||||
return true;
|
||||
case x == "":
|
||||
o.addClass("ui-state-error");
|
||||
updateTips("Participant ID must start either with NHA, NHK, CIA, or CIK. ");
|
||||
default:
|
||||
o.addClass("ui-state-error");
|
||||
updateTips("Participant ID must start either with NHA, NHK, CIA, or CIK. ");
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkPhase(o) {
|
||||
x = o.val().toLowerCase();
|
||||
switch (x) {
|
||||
case "training":
|
||||
return true;
|
||||
case "test":
|
||||
return true;
|
||||
default:
|
||||
o.addClass("ui-state-error");
|
||||
updateTips("Phase must be either 'training' or 'test'.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function addparticipant() {
|
||||
var valid = true;
|
||||
allFields.removeClass("ui-state-error");
|
||||
valid = valid &&
|
||||
checkPID(participant, "ID", 6);
|
||||
valid = valid && checkPhase(phase);
|
||||
|
||||
// valid = valid &&
|
||||
// checkLanguage(language);
|
||||
if (valid) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/check_participant",
|
||||
async: true,
|
||||
data: {
|
||||
game: parent.game,
|
||||
phase: phase.val(),
|
||||
participant: participant.val(),
|
||||
lang: lang.value
|
||||
},
|
||||
success: function (response) {
|
||||
// window.location.href = "/no-interaction"
|
||||
// console.log("success")
|
||||
console.log(response)
|
||||
var p_exists
|
||||
if (response.p_exists) {
|
||||
var c = confirm("This participant already exists. Use their file?")
|
||||
|
||||
if (c == true) {
|
||||
p_exists = true;
|
||||
} else {
|
||||
window.location.href = "/";
|
||||
}
|
||||
} else {
|
||||
var c = confirm("The participant doesn't exist. Create new file?");
|
||||
if (c == true) {
|
||||
p_exists = false
|
||||
} else {
|
||||
window.location.href = "/";
|
||||
}
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/run_picka",
|
||||
async: true,
|
||||
data: {
|
||||
p_exists: p_exists,
|
||||
game: response.game,
|
||||
phase: response.phase,
|
||||
participant: response.subject,
|
||||
lang: response.lang
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.game == "crm") {
|
||||
if (response.error) {
|
||||
alert(
|
||||
"There was an error connecting to Sam. Please try again."
|
||||
)
|
||||
} else {
|
||||
window.location.href = "/crm-game"
|
||||
}
|
||||
} else if (response.game == "emotion") {
|
||||
if (response.error) {
|
||||
alert(
|
||||
"There was an error connecting to Sam. Please try again."
|
||||
)
|
||||
} else {
|
||||
window.location.href = "/no-interaction-diagram"
|
||||
}
|
||||
} else {
|
||||
if (response.error) {
|
||||
alert(
|
||||
"There was an error connecting to Sam. Please try again."
|
||||
)
|
||||
} else {
|
||||
window.location.href = "/no-interaction"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
// error: function (error) {
|
||||
// console.log(error)
|
||||
// }
|
||||
});
|
||||
dialog.dialog("close");
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
dialog = $("#dialog-form").dialog({
|
||||
autoOpen: false,
|
||||
height: 400,
|
||||
width: 350,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Create participant": addparticipant,
|
||||
Cancel: function () {
|
||||
dialog.dialog("close");
|
||||
}
|
||||
},
|
||||
close: function () {
|
||||
form[0].reset();
|
||||
allFields.removeClass("ui-state-error");
|
||||
}
|
||||
});
|
||||
|
||||
form = dialog.find("form").on("submit", function (event) {
|
||||
event.preventDefault();
|
||||
addparticipant();
|
||||
|
||||
});
|
||||
|
||||
$(".create-participant").button().on("click", function (resp) {
|
||||
game = getGame(resp.target);
|
||||
dialog.data('game', game).dialog("open");
|
||||
});
|
||||
});
|
||||
|
||||
var i = 0;
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#progressBar').progressbar({
|
||||
value: (parseInt($('#current_trial').text()) / parseInt($('#total_trials').text())) * 100
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<body style="background-color: #54B77E;">
|
||||
{% block content %}
|
||||
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,88 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% if p_exists %}
|
||||
<script>
|
||||
alert("Test")
|
||||
</script>
|
||||
{% endif %}
|
||||
<div id="dialog-form" title="Create new Participant">
|
||||
<p class="validateTips">All form fields are required.</p>
|
||||
|
||||
<form>
|
||||
<fieldset>
|
||||
<label for="p_id">Participant ID</label>
|
||||
<input type="text" name="p_id" id="p_id" placeholder="NHA000"
|
||||
onkeyup="this.value = this.value.toUpperCase();" class="text ui-widget-content ui-corner-all">
|
||||
<label for="phase">Phase</label>
|
||||
<input type="text" name="phase" id="phase" placeholder="Training"
|
||||
class="text ui-widget-content ui-corner-all">
|
||||
<label for="lang">Language</label>
|
||||
<select name="lang" id="lang">
|
||||
<option value="EN">English</option>
|
||||
<option value="NL">Nederlands</option>
|
||||
</select>
|
||||
<!-- <input type="text" name="lang" id="lang" value="EN" class="text ui-widget-content ui-corner-all"> -->
|
||||
|
||||
<!-- Allow form submission with keyboard without duplicating the dialog button -->
|
||||
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="container-fluid main-logos">
|
||||
<div class="container">
|
||||
<div id="main_logos" class="row">
|
||||
<div class="col-lg">
|
||||
<img class="main_img" src="{{url_for('static', filename='images/PICKA.png')}}" alt="">
|
||||
</div>
|
||||
<div class="col-lg" style="padding-top: 2%;">
|
||||
<img class="main_img" src="{{url_for('static', filename='images/rug.png')}}" alt="" style="width: 90%;">
|
||||
</div>
|
||||
<div class="col-lg" style="padding-top: 2.5%;">
|
||||
<img class="main_img" src="{{url_for('static', filename='images/umcg.png')}}" alt="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <p>Subject: <input id="subject" type="text"></p>
|
||||
<p>Phase: <input id="phase" type="text"></p>
|
||||
<p>Language: <input id="lang" type="text"></p> -->
|
||||
<div class="container-fluid game-logos">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
<button id="game" class="game-btn create-participant">
|
||||
<img class="game_img" data-game="fishy" src="{{url_for('static', filename='images/fishy.png')}}"
|
||||
alt="">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<button class="game-btn create-participant">
|
||||
<img class="game_img" data-game="gender" src="{{url_for('static', filename='images/woman.png')}}"
|
||||
alt="" style="width:85%;">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<button class="game-btn create-participant">
|
||||
|
||||
<img data-game="emotion" class="game_img" src="{{url_for('static', filename='images/happy.png')}}"
|
||||
alt="">
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<button class="game-btn create-participant">
|
||||
|
||||
<img data-game="crm" class="game_img" src="{{url_for('static', filename='images/dog.png')}}" alt=""
|
||||
style="width:85%;">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,16 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% if p_exists %}
|
||||
<script>
|
||||
alert("Testing")
|
||||
</script>
|
||||
{% endif %}
|
||||
<div><button class="ui-button ui-corner-all ui-widget"><a href="/">Back</a></button></div>
|
||||
<div class="container-fluid no-interaction-diagram">
|
||||
<span id="no-interaction">Please watch Sam</span>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<img src="{{url_for('static', filename='images/sam_emotion_diagram.png')}}" alt="">
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,13 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% if p_exists %}
|
||||
<script>
|
||||
alert("Testing")
|
||||
</script>
|
||||
{% endif %}
|
||||
<div><button class="ui-button ui-corner-all ui-widget"><a href="/">Back</a></button></div>
|
||||
<div class="container-fluid no-interaction">
|
||||
<span id="no-interaction">Please watch Sam</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,24 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<button id="create-user">Create new user</button>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user