summaryrefslogtreecommitdiff
path: root/templates/admin/testexp.html
blob: 5b9c1d5901683c9caf85bea5150baae2f04d3292 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{% extends "layout.html" %}
{% load staticfiles %}

{% block content %}
<div class="container">
    <div class="row">
        {% include "account/sub_nav.html" %}
        <div style="margin-left: 30px">
            {% include "admin/sub_nav.html" %}
            <h1>Board status</h1>
        </div>
        <div class="span7">
            <table class="table table-bordered" id="tableId">
                <thead>
                    <tr>
                        <th>Board MID</th>
                        <th>Status</th>
                    </tr>
                </thead>
                <tbody>
                    {% for b in boards %}
                    <tr>
                        <td>{{ b.mid }}</td>
                        <td><span class="label label-{% if b.online %}success{% else %}important{% endif %}">{% if b.online %}Online{% else %}Offline{% endif %}</span></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        <div class="span5">    
            <div>
                <input type="text" id="temp" readonly="true"><br/>
                <button class="btn btn-primary" onclick="getTemp()">Get Temperature</button>
            </div>
            <br><br>

            <form name="set" action="" method="POST">
                <div>
                    Heater Input: <input type="number" size="3" min="0" max="250" name="Heater_Input"><br/>
                    Fan Input:<input type="number" size="3" min="0" max="250" name="Fan_Input" style="margin-left: 20px"><br/>
                    <input type="submit" class="btn btn-primary" value="Set Parameters">
                    <br><br>
                </div>
            </form>
            <br><br>

            <form name="reset" action="" method="POST">
                <div>
                    <input type="submit" class="btn btn-primary" value="Reset Parameters">
                </div>
            </form>

        </div>

    </div>
</div>
<style type="text/css">
    .highlight {
        background-color: lightblue;
    }
</style>
<script>
    var selected_mid = -1;
    function addRowHandlers() {
        var table = document.getElementById("tableId");
        var rows = table.getElementsByTagName("tr");
        for (i = 0; i < rows.length; i++) {
            var currentRow = table.rows[i];
            var createClickHandler = 
            function(row) 
            {
                return function() { 
                    var cell = row.getElementsByTagName("td")[0];
                    selected_mid = cell.innerHTML;
                };
            };
            currentRow.onclick = createClickHandler(currentRow);
        }
    }
    function getTemp() {
        document.getElementById("field2").value = 0;
    }
    $("#tableId").on("click", "tr", function(e) {
        $("#tableId").find("tr.highlight").removeClass("highlight");
        $(this).addClass("highlight");
    });
    addRowHandlers();
</script>

{% endblock %}