<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>