summaryrefslogtreecommitdiff
path: root/js/status_load.js
blob: b02d74411a0e591499e799e37fa9d97e20392162 (plain)
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
function load()
{
    var xmlhttp = false;

    if (typeof XMLHttpRequest!='undefined') {
        xmlhttp = new XMLHttpRequest();
    } else {
        xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
    }

    if (!xmlhttp) {
        alert('Sorry, cannot use XMLHttpRequest');
        return;
    }

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            var content = document.getElementById('status');
            var ret = xmlhttp.responseText;

            content.innerHTML  = ret;
            if(view != "innerLog.php")
                timer(2000);
        }
    }
    xmlhttp.open('GET', view, true);
    xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT");
    xmlhttp.send("");
}

function reload()
{
    var xmlhttp = false;
    if (typeof XMLHttpRequest!='undefined') {
        xmlhttp = new XMLHttpRequest();
    } else {
        xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
    }

    if (!xmlhttp) {
        alert('Sorry, cannot use XMLHttpRequest');
        return;
    }

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            var content = document.getElementById('status');
            var ret = xmlhttp.responseText;

            content.innerHTML  = ret;
            if(refreshTime > 0)
                timer(refreshTime);
        }
    }
    xmlhttp.open('GET', view, true);
    xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT");
    xmlhttp.send("");
}

function timer(interval)
{
    setTimeout("reload()",interval);
}

function sendCommand(command, nodeNumber, message)
{
    if (window.confirm(message)) {
        document.Command.action.value= command;
        document.Command.nodeNumber.value= nodeNumber;
        document.Command.submit();
    }
}