public
Description: RiP: Annotations Remix
Homepage:
Clone URL: git://github.com/mikeal/ripannotations.git
ripannotations / admin.mko
100644 96 lines (84 sloc) 2.312 kb
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
<head><title>RiP: Annotations Remix -- Admin</title></head>
 
 
<body>
  
  <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>
  
<style type="text/css">
 
 
table {
  color:#555555;
  font-family:"Sabon LT Std","Hoefler Text","Palatino Linotype","Book Antiqua",serif;
  font-size:20px;
}
tr {
  width: 100%;
  text-align:center;
}
td.starttime {
  width:10%;
}
td.time {
  width: 5%;
}
td.duration {
  width:5%;
}
td.rendered {
  width:75%;
}
td.delete {
  width:5%;
}
div.login {
  color:#555555;
  font-family:"Sabon LT Std","Hoefler Text","Palatino Linotype","Book Antiqua",serif;
  font-size:20px;
  padding-bottom:20px;
}
input {
  width:100px;
}
div.success{
  color:#0000ff;
  font-family:"Sabon LT Std","Hoefler Text","Palatino Linotype","Book Antiqua",serif;
  font-size:20px;
  padding-bottom:20px;
}
div.failure{
  color:#ff0000;
  font-family:"Sabon LT Std","Hoefler Text","Palatino Linotype","Book Antiqua",serif;
  font-size:20px;
  padding-bottom:20px;
}
 
 
</style>
 
<div class="login">
<span class="username">username:</span><input id="username" type="text" class="username" />
<span class="password">password:</span><input id="password" type="password" class="password" />
</div>
<div class="success" id="success"></div>
<div class="failure" id="failure"></div>
<table>
% for a in annotations:
<tr id="${a["_id"]}">
  <td class="time">${a["time"]}</td>
  <td class="duration">${a["duration"]}</td>
  <td class="starttime">${a["starttime"]}</td>
  <td class="rendered">${a["rendered"]}</td>
  <td class="delete"><a href="javascript:deleteAnnotation('${a["_id"]}')">delete</a></td>
</tr>
% endfor
</table>
  
<script>
var deleteAnnotation = function (_id) {
  var req = new XMLHttpRequest();
  var username = document.getElementById("username").value;
  var password = document.getElementById("password").value;
  req.open("DELETE", "/remove/"+_id+'?username='+username+"&password="+password, false);
  req.send(null);
  if (req.status == 200) {
    // document.getElementById("success").textContent = "Removed!";
    $('tr#'+_id).remove();
  } else {
    document.getElementById("failure").textContent = req.responseText;
    setTimeout(function(){document.getElementById("failure").textContent = '';}, 2000)
  }
}
</script>
  
  
</body>