Blame view

src/misc/templates/base.html 12.3 KB
94082e77   haribo   Date: 03/06/2016
1
2
3
4
5
<!DOCTYPE html>
<html lang="en">
<head>

    {% load staticfiles %}
94082e77   haribo   Date: 03/06/2016
6
7
8
9
10
11
12
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Control center for the SVOM French GFT">
    <meta name="author" content="CNRS-IRAP">
    
    
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
13
    <title >Colibri Control Center</title>
94082e77   haribo   Date: 03/06/2016
14
15
16
17
18
19
20
21

    <!-- Bootstrap core CSS -->
    <link href={% static "bootstrap/css/bootstrap.css" %} rel="stylesheet">

    <link href={% static "bootstrap/css/sb-admin.css" %} rel="stylesheet">
    <link rel="stylesheet" href={% static "bootstrap/font-awesome/css/font-awesome.min.css" %}>

    <!-- Page Specific CSS -->
ba1d1f2b   Quentin Durand   implémentation Fr...
22
    <!--    <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css"> -->
94082e77   haribo   Date: 03/06/2016
23
24
    
    <!-- JsTree -->
6dc0b213   theophile.puhl@epitech.eu   Création du dashb...
25
26
27
    <link rel="stylesheet" href={% static "bootstrap/dist/themes/default/style.min.css" %}>
    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
94082e77   haribo   Date: 03/06/2016
28
29
	
	{% block head %}
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
30
31
32
33
34
35
	<style> 
  #title {
    font-family: 'Montserra', sans-serif; 
    font-size: 50px;
  }
  </style>
94082e77   haribo   Date: 03/06/2016
36
37
38
39
40
	{% endblock %}

</head>

<body>
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
41
<style>
17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
42

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
43
44
45
#page-wrapper {
  padding: 15px 60px;
}
d5fce214   theopuhl   Dashboard color c...
46

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
47
48
#wrapper {
  padding-left: 10%;
17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
49
  
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
50
51
52
53
54
}

.side-nav {
  margin-left: -200px;
  left: 200px;
9f5133c2   Unknown   Implmentation of ...
55
  width: 125px;
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
56
57
58
59
}

a {
  font-family: 'Montserra', sans-serif;
94082e77   haribo   Date: 03/06/2016
60

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
61
62
63
}

#fas {
d5fce214   theopuhl   Dashboard color c...
64
  size: 18px;
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
65
}
d5fce214   theopuhl   Dashboard color c...
66

17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
67
68
#profile
{
d5fce214   theopuhl   Dashboard color c...
69
    font-size: 17px;
17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
70
}
fca58359   Unknown   Updating site tim...
71

fca58359   Unknown   Updating site tim...
72
73
#hour
{
d5fce214   theopuhl   Dashboard color c...
74
75
76
77
    color: black;
    font-size: 14px;
}

6973f7df   Quentin Durand   PLC STATE + MODE
78
79
#plc_state
{
c830a3bc   Quentin Durand   PLC ACK + plc tim...
80
    color: black;
6973f7df   Quentin Durand   PLC STATE + MODE
81
82
83
    font-size: 18px;
}

d5fce214   theopuhl   Dashboard color c...
84
85
#signout {
    color: black;
fca58359   Unknown   Updating site tim...
86
}
d5fce214   theopuhl   Dashboard color c...
87
88
89
90
91
92

.nav>li>a:focus, .nav>li>a:hover {
        text-decoration: none;
        background-color: transparent !important;
}

d10a07d4   theopuhl   Update Images
93
94
95
96
#topbar {
    -webkit-transition: background-color 800ms linear;
    -ms-transition: background-color 800ms linear;
    transition: background-color 800ms linear;
6aec6155   theopuhl   Majordome algorit...
97
98
99
100
    height: 100%;
}
#text_globalmode {
    font-size: 14px;
fca58359   Unknown   Updating site tim...
101
}
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
102
</style>
fca58359   Unknown   Updating site tim...
103

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
104
{% load tags %}
d3a69adc   theopuhl   Change name to ch...
105
106
107
108
109
110
{% get_level "USER_LEVEL_TAS" as USER_LEVEL_TAC %}
{% get_level "USER_LEVEL_OBSERVER" as USER_LEVEL_OBSERVER %}
{% get_level "USER_LEVEL_IE" as USER_LEVEL_IE %}
{% get_level "USER_LEVEL_OPERATOR" as USER_LEVEL_OPERATOR %}
{% get_level "USER_LEVEL_SUPEROPERATOR" as USER_LEVEL_SUPEROPERATOR %}
{% get_level "USER_LEVEL_PI" as USER_LEVEL_PI %}
a58163bb   theopuhl   New page Simulator
111
{% get_level "USER_LEVEL_PI" as USER_LEVEL_SYSADMIN %}
94082e77   haribo   Date: 03/06/2016
112
113
114
<div id="wrapper">

      <!-- Sidebar -->
6aec6155   theopuhl   Majordome algorit...
115
      <nav class="navbar navbar-inverse navbar-fixed-top navbar-expand-lg" role="navigation">
94082e77   haribo   Date: 03/06/2016
116
117
      <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
d5fce214   theopuhl   Dashboard color c...
118
            <a class="navbar-brand" href={% url "index" %} style="color: black;">Colibri Control Center</a>
94082e77   haribo   Date: 03/06/2016
119
        </div>
76dfa189   Unknown   Adding devices lo...
120
121
122
123
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>



94082e77   haribo   Date: 03/06/2016
124
        <!-- Collect the nav links, forms, and other content for toggling -->
d5fce214   theopuhl   Dashboard color c...
125
        <!-- #f9ff93 #6b69f3-->
d10a07d4   theopuhl   Update Images
126
        <div id="topbar" class="collapse navbar-collapse navbar-ex1-collapse navbar-dark bg-primary">
d5fce214   theopuhl   Dashboard color c...
127
        <ul class="nav navbar-nav side-nav navbar-dark bg-primary" id="navbar_list">
2c61f856   theopuhl   Url change to pat...
128
            <li><a href="{% url "weather" %}">Weather</a></li>
d3a69adc   theopuhl   Change name to ch...
129
            {% if USER_LEVEL >= USER_LEVEL_IE %}
2c61f856   theopuhl   Url change to pat...
130
131
132
133
134
                <li><a href="{% url "site" %}">State</a></li>
                <li><a href="{% url "site" %}">Observatory</a></li>
            {% else %}
                <li><a href="{% url "site" %}">Observatory</a></li>
            {% endif %}
d3a69adc   theopuhl   Change name to ch...
135
            {% if USER_LEVEL >= USER_LEVEL_IE %}
2c61f856   theopuhl   Url change to pat...
136
137
138
                <li><a href="{% url "observation_status" %}">Tel & Inst</a></li>
            {% endif %}
            <li><a href="#">Webcams</a></li>
d3a69adc   theopuhl   Change name to ch...
139
            {% if USER_LEVEL >= USER_LEVEL_OBSERVER %}
2c61f856   theopuhl   Url change to pat...
140
141
142
                <li><a href="{% url "proposal" %}">Proposal</a></li>
            {% endif %}
            <li><a href="{% url "requests_list" %}">Request</a></li>
3dbda6a0   haribo   Date: 17/06/2016
143
            <li><a href="{% url "alerts_list" %}">Alerts</a></li>
2c61f856   theopuhl   Url change to pat...
144
145
            <li><a href="{% url "current_schedule" %}">Schedule</a></li>
            <li><a href="#">Images</a></li>
94082e77   haribo   Date: 03/06/2016
146
          </ul>
6aec6155   theopuhl   Majordome algorit...
147
          <ul class="nav navbar-nav navbar-right navbar-user navbar-expand-lg">
6973f7df   Quentin Durand   PLC STATE + MODE
148
              <li><a id="plc_state"></a></li>
d10a07d4   theopuhl   Update Images
149
            <li><a class="nav-brand" id="hour">Sun elevation :</a></li>
d5fce214   theopuhl   Dashboard color c...
150
151
            <li><a class="nav-brand" id="day_night" href="{% url "weather" %}"><img id="day_night_img"></a></li>
            <li><a class="nav-brand" id="wind" href="{% url "weather" %}"><img id="wind_img"></a></li>
6973f7df   Quentin Durand   PLC STATE + MODE
152
            <li><a class="nav-brand" id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li>
6aec6155   theopuhl   Majordome algorit...
153
            <li><a class="nav-brand" id="globalmode" style="color: black;"> <p id="text_globalmode" >{% global_mode  request %} </p></a>              
c830a3bc   Quentin Durand   PLC ACK + plc tim...
154

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
155
            <li>
d5fce214   theopuhl   Dashboard color c...
156
                <a class="nav-brand" href="{% url "profile" %}" style="color: black;"><i id="profile" class="fas fa-cog "></i></a>              
94082e77   haribo   Date: 03/06/2016
157
            </li>
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
158
            <li>
d5fce214   theopuhl   Dashboard color c...
159
              <a id="signout" href="{% url "user_logout" %}" ><i class="fa fa-power-off"></i> Log Out</a>             
94082e77   haribo   Date: 03/06/2016
160
            </li>
76dfa189   Unknown   Adding devices lo...
161

94082e77   haribo   Date: 03/06/2016
162
          </ul>
757a9ae5   Unknown   fixing js in base...
163
            <script>
76dfa189   Unknown   Adding devices lo...
164
165
              var TOO_STRONG_WIND = 60; //Totally arbitrary values, just for demonstration
              var MAX_CLOUD_VALUE = 1;
40ee3b96   Quentin Durand   adding sunelevati...
166
              var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 1000;
76dfa189   Unknown   Adding devices lo...
167
168
              var MAX_RAIN_RATE = 10;

c830a3bc   Quentin Durand   PLC ACK + plc tim...
169
170
              var check_change = true;

fca58359   Unknown   Updating site tim...
171
              $( document ).ready(function() {
40ee3b96   Quentin Durand   adding sunelevati...
172
173
              //get_hour();
              //setInterval(function() {get_hour();}, 900);
40ee3b96   Quentin Durand   adding sunelevati...
174
              function set_elev(sun_elev)
fca58359   Unknown   Updating site tim...
175
              {
40ee3b96   Quentin Durand   adding sunelevati...
176
                  $("#hour").text("Sun elevation : " + sun_elev);
fca58359   Unknown   Updating site tim...
177
              }
fca58359   Unknown   Updating site tim...
178

9f5133c2   Unknown   Implmentation of ...
179
              function change_color(elevation, elev_threshold)
fca58359   Unknown   Updating site tim...
180
              {
d10a07d4   theopuhl   Update Images
181
                  var color = "";
9f5133c2   Unknown   Implmentation of ...
182
                  if (elevation >= elev_threshold)
d10a07d4   theopuhl   Update Images
183
184
185
186
                    color = "#f9ff93";
                  else
                    color = "#6b69f3";
                $("#topbar").css("background-color", color);
fca58359   Unknown   Updating site tim...
187
              }
9f5133c2   Unknown   Implmentation of ...
188
              function info_plc(is_safe, mode, ack, timeout, max_plc_timeout)
6973f7df   Quentin Durand   PLC STATE + MODE
189
              {
6973f7df   Quentin Durand   PLC STATE + MODE
190
191
192
193
                  var safe = "UNSAFE";
                  if (is_safe)
                      safe = "SAFE";

c830a3bc   Quentin Durand   PLC ACK + plc tim...
194
195
196
197
198
199
200
201
202
203
204
205
206
207
                  if (ack) {
                      ack = "STAFF ACK: OK";
                      if (!check_change)
                          window.location.reload(true);
                      check_change = true;
                  }
                  else
                  {
                      ack = "STAFF ACK: KO";
                      $("#plc_state").css("background-color", "red");
                      check_change = false;
                  }

                  $("#plc_state").text("PLC: " + mode + " " + safe + " " + ack);
9f5133c2   Unknown   Implmentation of ...
208
209
210
211
212
213
                   $("#plc_state").css("color", "black");
                   if (timeout > max_plc_timeout)
                  {
                      $("#plc_state").text("Connection to PLC LOST");
                      $("#plc_state").css("color", "red");
                  }
6973f7df   Quentin Durand   PLC STATE + MODE
214
215
              }

76dfa189   Unknown   Adding devices lo...
216
217
218
219
220
              ajax_request();
              interval = setInterval(function() {ajax_request();}, REFRESH_ICONS_FREQUENCE_MILLISECONDS);

              function ajax_request() {
                  $.get("{% url 'retrieve_env_navbar' %}", function (weather_status) {
d5fce214   theopuhl   Dashboard color c...
221
                    if (weather_status)
76dfa189   Unknown   Adding devices lo...
222
                      {
bb697c31   Unknown   Auto stash before...
223
                          var sunelev = parseFloat(weather_status[0]['sunelev']);
9f5133c2   Unknown   Implmentation of ...
224
225
226
227
                          var max_sunelev = parseInt(weather_status[0]['max_sunelev']);

                          set_elev(sunelev);
                          change_color(sunelev, max_sunelev);
6aec6155   theopuhl   Majordome algorit...
228
                          $("#text_globalmode").text(weather_status[0]["pyros_mode"]);
bb697c31   Unknown   Auto stash before...
229
                          var _img_day_night = document.createElement('img');
9f5133c2   Unknown   Implmentation of ...
230
                          if (sunelev >= max_sunelev)
d5fce214   theopuhl   Dashboard color c...
231
                              _img_day_night.src ="{% static 'media/rising_sun.png' %}";
76dfa189   Unknown   Adding devices lo...
232
                          else
d5fce214   theopuhl   Dashboard color c...
233
234
235
                              _img_day_night.src ="{% static 'media/moon.png' %}";
                          _img_day_night.width = 18;
                          _img_day_night.height = 18;
76dfa189   Unknown   Adding devices lo...
236
237
                          _img_day_night.id ="day_night_img";
                          _img_day_night.alt="html5";
6aec6155   theopuhl   Majordome algorit...
238
                          
76dfa189   Unknown   Adding devices lo...
239
240

                          var _img = document.createElement('img');
d5fce214   theopuhl   Dashboard color c...
241
242
                          _img.width = 18;
                          _img.height = 18;
76dfa189   Unknown   Adding devices lo...
243
                          _img.id ="weather_img";
9f5133c2   Unknown   Implmentation of ...
244
245
246
                          if (parseInt(weather_status[0]["plc_timeout"]) > parseInt(weather_status[0]["max_plc_timeout"]))
                               _img.src = "{% static 'media/rain_no_plc.png' %}";
                          else if(parseInt(weather_status[0]['fields']['rain']) > MAX_RAIN_RATE)
d5fce214   theopuhl   Dashboard color c...
247
                              _img.src = "{% static 'media/rain.png' %}";
76dfa189   Unknown   Adding devices lo...
248
                          else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE)
d5fce214   theopuhl   Dashboard color c...
249
                              _img.src = "{% static 'media/cloud.png' %}";
76dfa189   Unknown   Adding devices lo...
250
                          else
d5fce214   theopuhl   Dashboard color c...
251
252
253
                              _img.src = "{% static 'media/sun.png' %}";
                              _img.width = 18;
                              _img.height = 18;
76dfa189   Unknown   Adding devices lo...
254
255
256
257
                              _img.alt = "html5";
                          $("#weather_img").replaceWith(_img);

                          var _im = document.createElement('img');
d5fce214   theopuhl   Dashboard color c...
258
259
                          _im.width = 18;
                          _im.height = 18;
76dfa189   Unknown   Adding devices lo...
260
                          _im.id="wind_img";
9f5133c2   Unknown   Implmentation of ...
261
262
263
                          if (parseInt(weather_status[0]["plc_timeout"]) > parseInt(weather_status[0]["max_plc_timeout"]))
                              _im.src = "{% static 'media/wind_no_plc.png' %}";
                          else if (parseInt(weather_status[0]['fields']['wind']) >= TOO_STRONG_WIND)
d5fce214   theopuhl   Dashboard color c...
264
                            _im.src = "{% static 'media/wind.png' %}";
76dfa189   Unknown   Adding devices lo...
265
                          else
d5fce214   theopuhl   Dashboard color c...
266
                            _im.src= "{% static 'media/windsock_nowind.png' %}";
76dfa189   Unknown   Adding devices lo...
267
                          $("#wind_img").replaceWith(_im);
40ee3b96   Quentin Durand   adding sunelevati...
268

9f5133c2   Unknown   Implmentation of ...
269
270
271
                          info_plc(weather_status[0]["is_safe"], weather_status[0]["plc_mode"],
                              weather_status[0]["ACK"], parseInt(weather_status[0]["plc_timeout"]),
                              parseInt(weather_status[0]["max_plc_timeout"]) );
76dfa189   Unknown   Adding devices lo...
272
273
274
275
276
                      }
                  }, 'json')
                      .fail(function () {
                          console.log('Ajax error: GET request failed\n');
                      })
fca58359   Unknown   Updating site tim...
277
              }});
76dfa189   Unknown   Adding devices lo...
278
          </script>
757a9ae5   Unknown   fixing js in base...
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

        </div><!-- /.navbar-collapse -->

      </nav>

      <div id="page-wrapper">
      
      
      	<div class="row">      	
			<center><h2 id="title">{% block title %}  {% endblock %}</h2></center>
		</div>
	
		{% block content %}
		   
		   
		{% endblock %}
        

      </div><!-- /#page-wrapper -->

    </div><!-- /#wrapper -->

        <!-- Javascript function refreshing weather icons on the navbar -->


94082e77   haribo   Date: 03/06/2016
304
305
306
307
308
    
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
fca58359   Unknown   Updating site tim...
309
310
311
312
    <script  src="{% static "/js/moment.min.js" %}"></script>
    <script  src="{% static "/js/moment-timezone.min.js" %}"></script>
    <script  src="{% static "/js/moment-timezone-with-data.min.js" %}"></script>

94082e77   haribo   Date: 03/06/2016
313
314
315
316

    <script src={% static "bootstrap/js/bootstrap.min.js" %}></script>

    <!-- JavaScript -->
e6dd9964   haribo   Date: 19/07/2016
317
318
{#    <script src={% static "bootstrap/js/jquery-1.10.2.js" %}></script>#}
{#    <script src={% static "bootstrap/js/bootstrap.js" %}></script>#}
94082e77   haribo   Date: 03/06/2016
319
320
321
322
        <script src={% static "bootstrap/js/jquery.formset.js" %}></script>

    <!-- Page Specific Plugins -->
    <script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
ba1d1f2b   Quentin Durand   implémentation Fr...
323
    <!--    <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script>    -->
94082e77   haribo   Date: 03/06/2016
324
325
326
327
    <script src={% static "bootstrap/js/morris/chart-data-morris.js" %}></script>
    <script src={% static "bootstrap/js/tablesorter/jquery.tablesorter.js" %}></script>
    <script src={% static "bootstrap/js/tablesorter/tables.js" %}></script>
    
6dc0b213   theophile.puhl@epitech.eu   Création du dashb...
328
    
94082e77   haribo   Date: 03/06/2016
329
330
</body>
</html>