summaryrefslogtreecommitdiffstats
path: root/html_server/templates/property_info.html
blob: ce974acad2d7dd03a015c1cda314882752dc81c7 (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
91
92
93
{% block content %}

{% if standalone %}
<script src="{{ url_for('static', filename='codebase/dhtmlx.js') }}"></script>
<script src="{{ url_for('static', filename='check_err.js') }}"></script>
{% endif %}

<script>
   function updateProperty(prop) {
      var pathToGetProperty = "{{ url_for('get_property_json') }}"
      var completePath = pathToGetProperty + '?prop=' + prop
      
      $.getJSON(completePath, function(json){
                  checkError(json)
                  var valFieldId = "#actVal"+prop.split('/').join("_")
                  $(valFieldId).text(json.value)
               })
   }
   
   function setProperty(prop)
   {
      var value = document.getElementById("set_val_" + prop).value;
      if(value == "")
         return
      
      var pathToGetProperty = "{{ url_for('set_property_json') }}"
      var completePath = pathToGetProperty + '?prop=' + prop +
                     '&val=' + value;
                        
      $.getJSON(completePath, 
                function(json) {
                   checkError(json)
                   updateProperty(prop)
                })
   };
</script>
   
<table class="infoTable">
   <tr class="infoTable">
      <td class="infoTable">Name</td>
      <td class="infoTable">Description</td>
      <td class="infoTable">Value</td>
      <td class="infoTable">Mode</td>
      <td class="infoTable">Type</td>
      <td class="infoTable">Unit</td>
      <td class="infoTable">Path</td>
   </tr>
   {% for property in properties %}
      <tr class="infoTable">
         <td class="infoTable">{{ property.name }}</td>
         <td class="infoTable">
         {% if 'description' in property %}
             {{ property.description }}
         {% endif %}
         </td>
         <td class="infoTable">
            <table>
               <tr>
                  <td id = "actVal{{ property.path.replace('/', '_') }}" class="infoTable"> 
                     {{ value }}
                  </td>
                  {% if 'R' in property.mode %}
                  <td> 
                     <input type="button" value="update" style="width:100%;height:100%" onclick="updateProperty('{{ property.path }}')">
                  </td>
                  {% endif %}
               </tr>
               {% if 'W' in property.mode %}
                  <tr>
                     <td> 
                           <input type="text" name="set_val_{{ property.path }}" id="set_val_{{ property.path }}" value="" />
                     </td>
                     <td> 
                           <input type="button" value="set" style="width:100%;height:100%" onclick="setProperty('{{ property.path }}')">
                     </td>
                  </tr>
               {% endif %}
            </table>
         </td>
         <td class="infoTable">
            <ul>
            {% for m in property.mode %}
               {{ m + ';  '}}
            {% endfor %}
            </ul>
         </td>
         <td class="infoTable"> {{ property.type }} </td>
         <td class="infoTable"> {{ property.unit }} </td>
         <td class="infoTable"> {{ property.path }} </td>
      </tr>
   {% endfor %}
</table>
{% endblock %}