Commit f749fa174c87e75e4f7a392786f9504e2d3d3144

Authored by Miguel Barão
1 parent 778c815e
Exists in master and in 1 other branch dev

- fixed browser unfocus detection.

BUGS.md
... ... @@ -2,12 +2,12 @@
2 2 # BUGS
3 3  
4 4 - usar thread.Lock para aceder a variaveis de estado?
5   -- permitir adicionar imagens nas perguntas.
6   -- detect_unfocus.js so funciona se estiver inline no html. porquê???
7 5  
8 6 # TODO
9 7  
  8 +- lidar com focus. aviso em /admin
10 9 - implementar practice mode.
  10 +- permitir adicionar imagens nas perguntas.
11 11 - abrir o teste numa janela maximizada e que nao permite que o aluno a redimensione/mova.
12 12 - detectar scroll e enviar posição para servidor (analise de scroll para detectar copianço? ou simplesmente para analisar como os alunos percorrem o teste)
13 13 - detectar se janela perde focus e alertar o prof (http://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active)
... ... @@ -24,6 +24,7 @@
24 24  
25 25 # FIXED
26 26  
  27 +- detect_unfocus.js so funciona se estiver inline no html. porquê???
27 28 - inserir novo aluno /admin não fecha.
28 29 - se aluno desistir, ainda fica marcado como online
29 30 - give dá None em vez de 0.0
... ...
static/js/admin.js
... ... @@ -113,9 +113,9 @@ $(document).ready(function() {
113 113 rows += '\
114 114 <td><input type="checkbox" name="' + uid + '" value="true"' + (d['allowed'] ? 'checked' : '') + '></td>\
115 115 <td>' + uid + '</td>\
116   - <td>' + d['name'] + '</td>\
  116 + <td>' + d['name'] + (d['password_defined'] ? ' <span class="label label-default">pw</span>' : '') +'</td>\
117 117 <td>' +
118   - (d['password_defined'] ? '<span class="label label-default">pw</span>' : '') +
  118 +
119 119 // (d['online'] ? '<span class="label label-warning">online</span>' : '') +
120 120 (d['start_time']==''?'':'<span class="label label-success">teste</span>') +
121 121 '</td>\
... ...
static/js/detect_unfocus.js 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +$(document).ready(function() {
  2 + $(window).focus(function(){
  3 + $.ajax({
  4 + type: "POST",
  5 + url: "/adminwebservice",
  6 + data: {
  7 + "cmd": "focus",
  8 + "name": $("#number").text()
  9 + }
  10 + });
  11 + });
  12 +
  13 + $(window).blur(function(e){
  14 + $.ajax({
  15 + type: "POST",
  16 + url: "/adminwebservice",
  17 + data: {
  18 + "cmd": "blur",
  19 + "name": $("#number").text()
  20 + }
  21 + });
  22 + });
  23 +
  24 + $(window).resize(function(){
  25 + var n = $(window).scrollTop();
  26 + $.ajax({
  27 + type: "POST",
  28 + url: "/adminwebservice",
  29 + data: {
  30 + "cmd": "resize",
  31 + "name": $("#number").text(),
  32 + "scroll": n
  33 + }
  34 + });
  35 + });
  36 +});
0 37 \ No newline at end of file
... ...
templates/test.html
... ... @@ -74,8 +74,10 @@
74 74 <ul class="nav navbar-nav navbar-right">
75 75 <li class="dropdown">
76 76 <a class="dropdown-toggle" data-toggle="dropdown" href="#">
77   - <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
78   - ${t['student']['name']} (${t['student']['number']}) <span class="caret"></span>
  77 + <span class="glyphicon glyphicon-user" aria-hidden="true"></span>
  78 + <span id="name">${t['student']['name']}</span>
  79 + (<span id="number">${t['student']['number']}</span>)
  80 + <span class="caret"></span>
79 81 </a>
80 82 <ul class="dropdown-menu">
81 83 <li class="active"><a href="/test">Teste</a></li>
... ...