-
Notifications
You must be signed in to change notification settings - Fork 2
/
consent_form_blank.html
125 lines (112 loc) · 4.47 KB
/
consent_form_blank.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!doctype html>
<html>
<!-- 11/30/2020: Updated batch session logging to create a single array per subject with a chronological list of each time
-->
<head>
<link rel="stylesheet" href="css/consent_form.css" />
<script type="text/javascript" src="jatos.js"></script>
<script src="js/jquery-3.1.1.min.js"></script>
<meta charset="UTF-8" />
<title>Consent Form</title>
</head>
<body>
<p id="text">
<div id="consenttext">
<h1 style="text-align: center">IRB Consent Form</h1>
UNIVERSITY<br>
Study Information Sheet<br>
IRB NUMBER<br>
<br>
Lead Researcher<br>
Dr. X, Professor<br>
Department of Y<br>
PHONE / <a href="mailto:[email protected]">[email protected]</a><br>
<ul>
<li>CONSENT TEXT
</li>
<li>If you want to participate in this study, click the <b>Agree</b> button to start the survey.</li>
</ul>
</div>
<div id="buttons">
<button id="agreeButton">I agree</button>
<button id="cancelButton">Cancel</button>
</div>
</p>
<script type="text/javascript">
function getID() {
// Try to get a reasonable ID code for this person
// URL > studySession > workerID
var sid = jatos.urlQueryParameters.sid;
if (sid == undefined) {
sid = jatos.studySessionData['sid'];
}
if (typeof sid == 'undefined') {
if (typeof jatos.workerId !== 'undefined') { // At least try the workerID
sid = jatos.workerId;
}
else { sid = 1234; }
}
return sid
}
jatos.onLoad(function () {
var sid = getID();
console.log('In consent, sid= ' + sid);
let date = new Date();
let dcode = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate()) +
"-" + date.getHours() + "-" + date.getMinutes();
console.log(dcode);
if (!jatos.batchSession.defined("/" + sid)) { // Make sure to create this as an array
console.log('no record yet, adding one at ' + "/" + sid);
jatos.batchSession.add("/" + sid, ["ConsentLoad_" + dcode]);
}
else { // Append to array
console.log('have the record, appending to ' + "/" + sid)
jatos.batchSession.add("/" + sid + "/-", "ConsentLoad_" + dcode);
}
$("#buttons").show();
});
$('#agreeButton').click(function () {
var sid = getID();
let date = new Date();
let dcode = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate()) +
"-" + date.getHours() + "-" + date.getMinutes();
jatos.batchSession.add("/" + sid + "/-", "ConsentAgreed_" + dcode);
var expdata = "Consent given, ID=" + sid + " URL ID=" + jatos.urlQueryParameters.sid;
//if (typeof jatos.studySessionData["taskindex"] !== 'undefined') { jatos.studySessionData["taskindex"] += 1; }
//jatos.submitResultData(result, jatos.startNextComponent);
var order=jatos.studySessionData["order"];
jatos.studySessionData["taskindex"] += 1;
if (typeof order === 'undefined') {
// We don't have an 'order' setup, so assume it's 1-N (e.g., we didn't use the setup.html in this exp)
console.log('faking an order')
order=Array(jatos.componentList.length).fill().map((e,i)=>i+1);
jatos.studySessionData["taskindex"]=jatos.componentPos;
}
//jatos.submitResultData(result, jatos.startNextComponent);
if (typeof order === 'undefined' || order.length == jatos.studySessionData["taskindex"]) { // we're done?
// Check if this came from SONA - should have URL.sid and .sona
if (typeof jatos.urlQueryParameters.sid === 'undefined' || typeof jatos.urlQueryParameters.sona === 'undefined' ||
typeof jatos.studyJsonInput['experiment_id'] === 'undefined' || typeof jatos.studyJsonInput['credit_token'] === 'undefined') { // not SONA - just finish
jatos.submitResultData(expdata,jatos.endStudy);
}
else { // SONA - give credit
var redirect='https://uci.sona-systems.com/webstudy_credit.aspx?experiment_id='+jatos.studyJsonInput['experiment_id']+
'&credit_token='+jatos.studyJsonInput['credit_token']+'&survey_code='+jatos.urlQueryParameters.sid;
jatos.endStudyAndRedirect(redirect,expdata);
}
}
else { // submit data and start the next
jatos.submitResultData(expdata, () => { jatos.startComponentByPos(order[jatos.studySessionData["taskindex"]]) });
}
});
$('#cancelButton').click(function () {
var sid = getID();
let date = new Date();
let dcode = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate()) +
"-" + date.getHours() + "-" + date.getMinutes();
jatos.batchSession.add("/" + sid + "/-", "ConsentNOTAgreed_" + dcode);
jatos.abortStudy("Consent not given.");
});
</script>
</body>
</html>