/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to html_server/templates/property_info.html

  • Committer: Vasilii Chernov
  • Date: 2016-02-25 16:02:35 UTC
  • mto: This revision was merged to the branch mainline in revision 367.
  • Revision ID: vchernov@inr.ru-20160225160235-g9zkhg8ngg2o12zj
Move html_server to separate folder. Update html server templates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{% extends "base.html" %}
2
 
{% block title %}Property list{% endblock %}
3
 
{% block info %}
4
 
<h1>List of properties in branch {{ branch }}</h1>
5
 
{% endblock %}
6
 
 
7
1
{% block content %}
8
2
 
9
 
   <script>
10
 
      function set_property()
11
 
      {
12
 
         var value = document.getElementById("set_val_box").value;
13
 
         window.location.href = "{{ url_for('set_property') }}?prop={{ branch }}&"+
14
 
                                'val='+value;
15
 
      };
16
 
   </script>
 
3
{% if standalone %}
 
4
<script src="{{ url_for('static', filename='codebase/dhtmlx.js') }}"></script>
 
5
<script src="{{ url_for('static', filename='check_err.js') }}"></script>
 
6
{% endif %}
17
7
 
18
 
<table border="1" style="width:100%">
19
 
   <tr>
20
 
    <th>Name</th>
21
 
    <th>Description</th> 
 
8
<script>
 
9
   function updateProperty(prop) {
 
10
      var pathToGetProperty = "{{ url_for('get_property_json') }}"
 
11
      var completePath = pathToGetProperty + '?prop=' + prop
 
12
      
 
13
      $.getJSON(completePath, function(json){
 
14
                  checkError(json)
 
15
                  var valFieldId = "#actVal"+prop.split('/').join("_")
 
16
                  $(valFieldId).text(json.value)
 
17
               })
 
18
   }
 
19
   
 
20
   function setProperty(prop)
 
21
   {
 
22
      var value = document.getElementById("set_val_" + prop).value;
 
23
      if(value == "")
 
24
         return
 
25
      
 
26
      var pathToGetProperty = "{{ url_for('set_property_json') }}"
 
27
      var completePath = pathToGetProperty + '?prop=' + prop +
 
28
                     '&val=' + value;
 
29
                        
 
30
      $.getJSON(completePath, 
 
31
                function(json) {
 
32
                   checkError(json)
 
33
                   updateProperty(prop)
 
34
                })
 
35
   };
 
36
</script>
 
37
   
 
38
<table class="infoTable">
 
39
   <tr class="infoTable">
 
40
      <td class="infoTable">Name</td>
 
41
      <td class="infoTable">Description</td>
 
42
      <td class="infoTable">Value</td>
 
43
      <td class="infoTable">Mode</td>
 
44
      <td class="infoTable">Type</td>
 
45
      <td class="infoTable">Unit</td>
 
46
      <td class="infoTable">Path</td>
22
47
   </tr>
23
48
   {% for property in properties %}
24
 
   <tr>
25
 
      {% if ('childs' in property.flags) or (properties|length != 1) %}
26
 
         <td><a href="{{ url_for('get_property_list', branch = property.path) }}">"{{ property.name }}"</td>
 
49
      <tr class="infoTable">
 
50
         <td class="infoTable">{{ property.name }}</td>
 
51
         <td class="infoTable">
27
52
         {% if 'description' in property %}
28
 
      <script>
29
 
      function set_property()
30
 
      {
31
 
         var value = document.getElementById("set_val_box").value;
32
 
         window.location.href = "{{ url_for('set_property') }}?prop={{ branch }}&"+
33
 
                                'val='+value;
34
 
      };
35
 
   </script>
36
 
         <td>{{ property.description }}</td>
37
 
            {% else %}
38
 
            <td></td>
39
 
            {% endif %}
40
 
         {% else %}
41
 
            <td>{{ property.name }}"</td>
42
 
            <td>
43
 
               <table border="1" style="width:100%">
44
 
                  {% if 'description' in property %}
45
 
                  <tr>
46
 
                     <th> Description </th>
47
 
                     <td> {{ property.description }} </td>
48
 
                  </tr>
49
 
                  {% endif %}
50
 
                  <tr>
51
 
                     <th> Current value </th>
52
 
                     <td> {{ value }} </td>
53
 
                  </tr>
54
 
                  {% if 'W' in property.mode %}
55
 
                     <tr>
56
 
                        <th> Set value</th>
57
 
                        <td> 
58
 
                           <input type="text" name="set_val_box" id="set_val_box" value="" />
59
 
                           <input type="button" value="set" onclick="set_property()">
60
 
                        </td>
61
 
                     </tr>
62
 
                  {% endif %}
63
 
                  <tr>
64
 
                     <th>Mode</th>
65
 
                     <td>
66
 
                        <ul>
67
 
                           {% for m in property.mode %}
68
 
                              <li>{{ m }}</li>
69
 
                           {% endfor %}
70
 
                        </ul>
71
 
                     </td>
72
 
                  </tr>
73
 
                  <tr>
74
 
                     <th>Type</th>
75
 
                     <td> {{ property.type }} </td>
76
 
                  </tr>
77
 
                  <tr>
78
 
                     <th>Unit</th>
79
 
                     <td> {{ property.unit }} </td>
80
 
                  </tr>
81
 
                  <tr>
82
 
                     <th>Path</th>
83
 
                     <td> {{ property.path }} </td>
84
 
                  </tr>
85
 
               </table>
86
 
            </td>
 
53
             {{ property.description }}
87
54
         {% endif %}
 
55
         </td>
 
56
         <td class="infoTable">
 
57
            <table>
 
58
               <tr>
 
59
                  <td id = "actVal{{ property.path.replace('/', '_') }}" class="infoTable"> 
 
60
                     {{ value }}
 
61
                  </td>
 
62
                  {% if 'R' in property.mode %}
 
63
                  <td> 
 
64
                     <input type="button" value="update" style="width:100%;height:100%" onclick="updateProperty('{{ property.path }}')">
 
65
                  </td>
 
66
                  {% endif %}
 
67
               </tr>
 
68
               {% if 'W' in property.mode %}
 
69
                  <tr>
 
70
                     <td> 
 
71
                           <input type="text" name="set_val_{{ property.path }}" id="set_val_{{ property.path }}" value="" />
 
72
                     </td>
 
73
                     <td> 
 
74
                           <input type="button" value="set" style="width:100%;height:100%" onclick="setProperty('{{ property.path }}')">
 
75
                     </td>
 
76
                  </tr>
 
77
               {% endif %}
 
78
            </table>
 
79
         </td>
 
80
         <td class="infoTable">
 
81
            <ul>
 
82
            {% for m in property.mode %}
 
83
               {{ m + ';  '}}
 
84
            {% endfor %}
 
85
            </ul>
 
86
         </td>
 
87
         <td class="infoTable"> {{ property.type }} </td>
 
88
         <td class="infoTable"> {{ property.unit }} </td>
 
89
         <td class="infoTable"> {{ property.path }} </td>
88
90
      </tr>
89
 
      {% endfor %}
90
 
   </table>
 
91
   {% endfor %}
 
92
</table>
91
93
{% endblock %}