You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.4 KiB
86 lines
2.4 KiB
{% include 'include/header.html' %}
|
|
<title>Inbox</title>
|
|
<script type="text/javascript">
|
|
$("document").ready(function() {
|
|
var myLooper = setInterval(myLooper, 15000);
|
|
|
|
function myLooper() {
|
|
getInboxData();
|
|
}
|
|
$("#markallread").click(function() {
|
|
$.get("/markallread",function(data){
|
|
if (data == 'error') {
|
|
$('#status').text("Error updating.");
|
|
return false;
|
|
} else {
|
|
$('#status').text("All messages marked read.");
|
|
return true;
|
|
}
|
|
});
|
|
});
|
|
$("#markallunread").click(function() {
|
|
$.get("/markallunread",function(data){
|
|
if (data == 'error') {
|
|
$('#status').text("Error updating.");
|
|
return false;
|
|
} else {
|
|
$('#status').text("All messages marked unread.");
|
|
return true;
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#refreshinbox").click(function() {
|
|
getInboxData();
|
|
});
|
|
|
|
function getInboxData() {
|
|
msgResults = "";
|
|
$.getJSON("/getInbox", function(result) {
|
|
chatHtml = "";
|
|
$.each(result, function(i, field) {
|
|
chatHtml = chatHtml +
|
|
"<div class='smschatlog " + field.direction + "'><div class='ts'>" +
|
|
field.timestamp + " Status:" + field.status +
|
|
"</div> <span class='from'>" +
|
|
field.fromdid + "</span> to <span class='to'>" +
|
|
field.targetdid + "</span><div class='smsbody'>" +
|
|
field.body + "</div></div>";
|
|
});
|
|
$("#chat-body").html(chatHtml);
|
|
}).fail(function(error) {
|
|
alert("FAIL");
|
|
});
|
|
}
|
|
getInboxData();
|
|
});
|
|
</script>
|
|
</head>
|
|
{% include 'include/navblock.html' %}
|
|
<div id='inboxpage'>
|
|
<h1>Global Messages Inbox</h1>
|
|
<div id='status'></div>
|
|
<div id='chatlogcontroller'>
|
|
<input type='button' id='markallread' value='Mark all Read' /> |
|
|
<input type='button' id='markallunread' value='Mark all Unread' /> |
|
|
<input type='button' id='refreshinbox' value='Refresh Inbox' />
|
|
</div>
|
|
<div id="chat-body">
|
|
<div id="msg"><span class="chat-from">OPERATOR</span>: Welcome!</div>
|
|
</div>
|
|
{% for n in results %}
|
|
<div class='smschatlog'>
|
|
<div class='ts'>
|
|
{{n[2]}} Status: {{n[5]}} {{n[0]}}
|
|
</div>
|
|
<span class='from'>{{n[6]}}</span> to <span class='to'>{{n[7]}}</span>
|
|
{% if n[11] == 1 %}
|
|
Read
|
|
{% else %}
|
|
Unread
|
|
{% endif %}
|
|
<div class='smsbody'>{{n[9]}}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% include 'include/footer.html' %}
|
|
|