Commit bc7cca49 authored by Jonathon Duerig's avatar Jonathon Duerig

Incrementally show the activity log via the magic of AJAX.

parent 15dce279
<html>
<head>
<script src="apt/js/lib/jquery-2.0.3.min.js"></script>
<script src="apt/js/lib/underscore-min.js"></script>
<script>
$(document).ready(function () {
var lastIndex = 0;
var url = window.location.protocol + '//' +
window.location.host +
'/spewlogfile.php3' +
window.location.search;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function ()
{
if (xhr.responseText)
{
var newText = xhr.responseText.substr(lastIndex);
lastIndex = xhr.responseText.length;
var shouldScroll = (document.body.scrollHeight - document.body.clientHeight == document.body.scrollTop);
$('pre').append(_.escape(newText));
if (shouldScroll)
{
document.body.scrollTop = document.body.scrollHeight - document.body.clientHeight;
}
}
};
xhr.open('get', url, true);
xhr.send();
});
</script>
</head>
<body>
<pre></pre>
</body>
</html>
......@@ -127,7 +127,7 @@ function STARTLOG($object)
if (!is_a($object, 'Logfile')) {
$object = $object->GetLogfile();
}
$url = CreateURL("spewlogfile", $object);
$url = CreateURL("fetchlogfile", $object);
echo "<center>\n";
echo "<img id='load_busy' src='busy.gif'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment