diff options
-rw-r--r-- | index.php | 8 | ||||
-rw-r--r-- | js/interface.js | 2 | ||||
-rw-r--r-- | pool.php | 62 | ||||
-rw-r--r-- | pool_save.php | 25 | ||||
-rwxr-xr-x | server.rb | 2 |
5 files changed, 8 insertions, 91 deletions
@@ -5,7 +5,9 @@ <script src="js/jquery.min.js" charset="utf-8"></script> <script type="text/javascript"> var check_submit = function () { - if ($("#name").val()=="" || $("#key").val()=="") { + var name = $("#name").val().trim(); + $("#name").val(name); + if (name=="" || $("#key").val()=="" || !$("#key").val().match(/^[a-f0-9]{1,4}$/)) { alert("Please enter a session key and a name.") return; } @@ -22,12 +24,12 @@ <form method="get" name="sess" action="interface.php"> <strong>Session key:</strong> <input type="text" id="key" name="key" style="width:8em" /> - <strong>Name:</strong> + <strong>E-Mail:</strong> <input type="txt" id="name" name="name" style="width:12em" /> <strong>Session type:</strong> <select name="ui_type"> <option value="t">text</option> - <option value="g">graphical</option> + <!--<option value="g">graphical</option>--> </select> <input type="button" value="Submit" onclick="check_submit()" /> diff --git a/js/interface.js b/js/interface.js index b86bf50..089f417 100644 --- a/js/interface.js +++ b/js/interface.js @@ -286,7 +286,7 @@ var next = function () } send_data["key"] = key; - send_data["name"] = $("#name").val(); + send_data["name"] = encodeURIComponent($("#name").val().replace(/"/g, ' ').trim()); // send data if (oov_correct.value=="false" && post_edit != "") { diff --git a/pool.php b/pool.php deleted file mode 100644 index bce819c..0000000 --- a/pool.php +++ /dev/null @@ -1,62 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> - - <title>Pool</title> - - <link rel='stylesheet' type='text/css' href='static/pool.css' /> - <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script> - <script src="js/pool.js" type="text/javascript" charset="utf-8"></script> -</head> - -<body> - <p style='margin:2em;color:#000'><strong>Click on a table cell, enter your name, and click 'Begin' to begin your session. Reload the page if you clicked on the wrong cell or if the session is already used by someone else.</strong></p> - <table border=1 style="margin-left:10%"> - <tr><td>#0</td></tr> - </table> - <br /> - <br /> - <br /> - <br /> - <center> - <table border=1> - <tr> - -<!--<tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td><td>#5</td></tr> - <tr><td>#6</td><td>#7</td><td>#8</td><td>#9</td><td>#10</td></tr> - <tr><td>#11</td><td>#12</td><td>#13</td><td>#14</td><td>#15</td></tr> - <tr><td>#16</td><td>#17</td><td>#18</td><td>#19</td><td>#20</td></tr> - <tr><td>#21</td><td>#22</td><td>#23</td><td>#24</td><td>#25</td></tr>--> - - <?php - $f = fopen("../sessions/sessions", "r"); - $b = array(); - $max = -1; - while (($line = fgets($f)) !== false) { - $x = explode("\t", $line, 2); - $j = intval($x[0]); - $b[$j] = trim($x[1]); - if ($j>$max) { - $max = $j; - } - } - fclose($f); - - for ($i=1; $i<=$max; $i++) { - echo "<td class='item' session='".$b[$i]."' id='item".$i."'>#".$i."<br /><span style='font-size:.5em'>".$b[$i]."</span></td>\n"; - if ($i%5 == 0) { - echo "</tr><tr>\n"; - } - } - ?> - - </tr> - </table> - - <button style="font-size:2em;margin:2em" id="button">Begin</button> - - </center> -</body> -</html> - diff --git a/pool_save.php b/pool_save.php deleted file mode 100644 index 5d67a25..0000000 --- a/pool_save.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -if (!$_GET['session'] || !$_GET['name']) { - echo "empty"; - return; -} - -$f = fopen(tempnam("../tmp", "assignment-"), "wa"); - -fwrite($f,urldecode($_GET["name"])."\n"); -fwrite($f,urldecode($_GET["session"])."\n"); -fwrite($f,getdate()[0]."\n"); -fclose($f); - -$checkf = "../tmp/".urldecode($_GET["session"]); -if (file_exists($checkf)) { - echo "notok"; -} else { - $g = fopen($checkf, "wa"); - fwrite($g, "x\n"); - fclose($g); - echo "ok"; -} - -?> @@ -671,6 +671,8 @@ get '/reset_progress' do # reset current session $db['original_svg'].clear $db['feedback'].clear $db['progress'] = -1 + $db['count_kbd'].clear + $db['count_click'].clear update_database true $confirmed = true $last_reply = nil |