Blame view

src/misc/templates/base_unlogged.html 13.3 KB
2c61f856   theopuhl   Url change to pat...
1
2
3
4
5
<!DOCTYPE html>
<html lang="en">
<head>

    {% load staticfiles %}
2c61f856   theopuhl   Url change to pat...
6
7
8
9
10
    <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">
e7876d61   Patrick Maeght   colibrifavicon
11
    <link rel="icon" type="image/png" href="../public/static/media/colibrifavicon.png" />
2c61f856   theopuhl   Url change to pat...
12
    
f7138561   Etienne Pallier   version on index ...
13
    <title>Colibri Control Center - VERSION 2018.0.011</title>
2c61f856   theopuhl   Url change to pat...
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

    <!-- 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 -->
    <!--    <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css"> -->
    
    <!-- JsTree -->
    <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">
	
	{% block head %}
	<style> 
  #title {
    font-family: 'Montserra', sans-serif; 
    font-size: 50px;
  }
  </style>
	{% endblock %}

</head>

<body>
<style>

#page-wrapper {
  padding: 15px 60px;
}
d10a07d4   theopuhl   Update Images
46

2c61f856   theopuhl   Url change to pat...
47
#wrapper {
d10a07d4   theopuhl   Update Images
48
  padding-left: 10%; 
2c61f856   theopuhl   Url change to pat...
49
50
51
52
53
}

.side-nav {
  margin-left: -200px;
  left: 200px;
b70385ab   Etienne Pallier   bugfixing pyros s...
54
  width: 200px; /*125px for base*/
2c61f856   theopuhl   Url change to pat...
55
56
57
58
59
60
61
62
}

a {
  font-family: 'Montserra', sans-serif;

}

#fas {
d10a07d4   theopuhl   Update Images
63
  size: 18px;
2c61f856   theopuhl   Url change to pat...
64
}
d10a07d4   theopuhl   Update Images
65
66

#hour
2c61f856   theopuhl   Url change to pat...
67
{
d10a07d4   theopuhl   Update Images
68
69
    color: black;
    font-size: 14px;
2c61f856   theopuhl   Url change to pat...
70
71
}

0d353024   Quentin Durand   Fixing navbar whe...
72
73
74
75
76
77
#plc_state
{
    color: black;
    font-size: 18px;
}

d10a07d4   theopuhl   Update Images
78
79
80
#signin {
    color: black;
}
2c61f856   theopuhl   Url change to pat...
81

d10a07d4   theopuhl   Update Images
82
.nav>li>a:focus, .nav>li>a:hover {
0d353024   Quentin Durand   Fixing navbar whe...
83
84
85
86
87
88
89
90
91
92
93
94
95
        text-decoration: none;
        background-color: transparent !important;
}

#topbar {
    -webkit-transition: background-color 800ms linear;
    -ms-transition: background-color 800ms linear;
    transition: background-color 800ms linear;
    height: 100%;
}
#text_globalmode {
    font-size: 14px;
    color: black;
2c61f856   theopuhl   Url change to pat...
96
}
d10a07d4   theopuhl   Update Images
97

2c61f856   theopuhl   Url change to pat...
98
99
100
101
102
103
104
105
106
</style>

{% load tags %}
<div id="wrapper">

      <!-- Sidebar -->
      <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
e7876d61   Patrick Maeght   colibrifavicon
107
          <img alt="" src="../public/static/media/colibrifavicon.png">
d10a07d4   theopuhl   Update Images
108
          <a class="navbar-brand" href={% url "index" %} style="color: black;">Colibri Control Center</a>
f7138561   Etienne Pallier   version on index ...
109
          <i>VERSION 2018.0.011</i>
2c61f856   theopuhl   Url change to pat...
110
        </div>
efdd4cd8   Etienne Pallier   added version
111
            <!--
2c61f856   theopuhl   Url change to pat...
112
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
efdd4cd8   Etienne Pallier   added version
113
114
            -->
            <script  src="{% static "/js/jquery.min.js" %}"></script>
2c61f856   theopuhl   Url change to pat...
115
116
117
118



        <!-- Collect the nav links, forms, and other content for toggling -->
d10a07d4   theopuhl   Update Images
119
120
121
        <!-- #f9ff93 #6b69f3-->
        <div id="topbar" class="collapse navbar-collapse navbar-ex1-collapse navbar-dark bg-primary" style="background-color: #6b69f3;">
        <ul class="nav navbar-nav side-nav navbar-dark bg-primary" id="navbar_list">
2c61f856   theopuhl   Url change to pat...
122
123
124
125
126
127
128
            <li><a href="{% url "weather" %}">Weather</a></li>
            <li><a href="{% url "site" %}">Observatory</a></li>
            <li><a href="#">Webcams</a></li>
            <li><a href="{% url "alerts_list" %}">Alerts</a></li>
            <li><a href="{% url "current_schedule" %}">Schedule</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right navbar-user">
0d353024   Quentin Durand   Fixing navbar whe...
129
130
           <li><a id="plc_state"></a></li>
            <li><a class="nav-brand" id="hour">Sun elevation :</a></li>
5f7e4955   Quentin Durand   Add some commands...
131
            <li><a class="nav-brand" id="day_night" ><img id="day_night_img"></a></li>
0d353024   Quentin Durand   Fixing navbar whe...
132
             <li><a class="nav-brand" id="observatory_state" href="{% url "site" %}"><img id="obs_state_img"></a></li>
d10a07d4   theopuhl   Update Images
133
134
            <li><a class="nav-brand" id="wind" href="{% url "weather" %}"><img id="wind_img"></a></li>
            <li><a class="nav-brand" id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li>
0d353024   Quentin Durand   Fixing navbar whe...
135
136
            <li><a class="nav-brand" id="globalmode" style="color: black;"> <p id="text_globalmode"  >{% global_mode  request %} </p></a>

2c61f856   theopuhl   Url change to pat...
137
            <li>
d10a07d4   theopuhl   Update Images
138
              <a class="nav-link" id="signin" href="{% url "user_signin" %}" ><i class="fa fa-power-off"></i> Sign in</a>             
2c61f856   theopuhl   Url change to pat...
139
140
141
            </li>
          </ul>
            <script>
0d353024   Quentin Durand   Fixing navbar whe...
142
             var TOO_STRONG_WIND = 60; //Totally arbitrary values, just for demonstration
2c61f856   theopuhl   Url change to pat...
143
              var MAX_CLOUD_VALUE = 1;
9f3db1a3   Quentin Durand   plc_mode in progr...
144
              var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 1000;
2c61f856   theopuhl   Url change to pat...
145
146
              var MAX_RAIN_RATE = 10;

0d353024   Quentin Durand   Fixing navbar whe...
147
148
              var check_change = true;

2c61f856   theopuhl   Url change to pat...
149
              $( document ).ready(function() {
2c61f856   theopuhl   Url change to pat...
150

0d353024   Quentin Durand   Fixing navbar whe...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
              function set_elev(sun_elev)
              {
                  $("#hour").text("Sun elevation : " + sun_elev);
              }

              function change_color_navbar(elevation, elev_threshold)
              {
                  var color = "";
                  if (elevation >= elev_threshold)
                    color = "#f9ff93";
                  else
                    color = "#6b69f3";
                $("#topbar").css("background-color", color);
              }

              /*
                function displaying the state of the PLC, called in the main function every REFRESH_ICONS_FREQUENCE_MILLISECONDS
              */

              function info_plc(is_safe, mode, ack, timeout, max_plc_timeout)
2c61f856   theopuhl   Url change to pat...
171
              {
0d353024   Quentin Durand   Fixing navbar whe...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
                  var safe = "UNSAFE";
                  if (is_safe)
                      safe = "SAFE";

                  if (ack) {
                      ack = "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 + '\u00A0\u00A0\u00A0\u00A0\u00A0' + safe + '\u00A0\u00A0\u00A0\u00A0\u00A0' + ack);
e1b1c92c   Etienne Pallier   added version
190
                  $("#plc_state").css("color", "red");
b70385ab   Etienne Pallier   bugfixing pyros s...
191
                  if (timeout > max_plc_timeout)
0d353024   Quentin Durand   Fixing navbar whe...
192
193
194
195
                  {
                      $("#plc_state").text("Connection to PLC LOST");
                      $("#plc_state").css("color", "red");
                  }
2c61f856   theopuhl   Url change to pat...
196
197
              }

0d353024   Quentin Durand   Fixing navbar whe...
198
199


2c61f856   theopuhl   Url change to pat...
200
201
202
              ajax_request();
              interval = setInterval(function() {ajax_request();}, REFRESH_ICONS_FREQUENCE_MILLISECONDS);

0d353024   Quentin Durand   Fixing navbar whe...
203
204
205
206
207
208
209
210
211
               /*
                   Main method called every REFRESH_ICONS_FREQUENCE_MILLISECONDS,  it is responsible of the element
                   in the navbar, it changes the information and the pictures displayed in function of the elemets send
                   by the "retrieve_env_navbar" view : PLC info, sunelev etc

                   This information is retrieved by a HTTP GET on the retrieve_env_navbar url

               */

2c61f856   theopuhl   Url change to pat...
212
213
              function ajax_request() {
                  $.get("{% url 'retrieve_env_navbar' %}", function (weather_status) {
0d353024   Quentin Durand   Fixing navbar whe...
214
                    if (weather_status)
2c61f856   theopuhl   Url change to pat...
215
                      {
0d353024   Quentin Durand   Fixing navbar whe...
216
217
218
219
220
221
222
223
224
225
                          var sunelev = parseFloat(weather_status[0]['sunelev']);
                          var max_sunelev = parseInt(weather_status[0]['max_sunelev']);

                          set_elev(sunelev);

                          change_color_navbar(sunelev, max_sunelev);

                          $("#text_globalmode").text(weather_status[0]["pyros_mode"]);
                          var _img_day_night = document.createElement('img');
                          if (sunelev >= max_sunelev)
d10a07d4   theopuhl   Update Images
226
                              _img_day_night.src ="{% static 'media/rising_sun.png' %}";
2c61f856   theopuhl   Url change to pat...
227
                          else
d10a07d4   theopuhl   Update Images
228
                              _img_day_night.src ="{% static 'media/moon.png' %}";
5f7e4955   Quentin Durand   Add some commands...
229
230
                          _img_day_night.width = 22;
                          _img_day_night.height = 22;
2c61f856   theopuhl   Url change to pat...
231
232
                          _img_day_night.id ="day_night_img";
                          _img_day_night.alt="html5";
0d353024   Quentin Durand   Fixing navbar whe...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
                           $("#day_night_img").replaceWith(_img_day_night);


                           var _img = document.createElement('img');
                          _img.width = 18;
                          _img.height = 18;
                          _img.id ="obs_state_img";
                          if (parseInt(weather_status[0]["plc_timeout"]) > parseInt(weather_status[0]["max_plc_timeout"]))
                              _img.src = "{% static 'media/observatory_off.png' %}";
                          else if (weather_status[0]["sitewatch_global_status"] === "OK")
                               _img.src = "{% static 'media/observatory.png' %}";
                          else
                              _img.src = "{% static 'media/observatory_red.png' %}";
                          _img.alt = "html5";
                          $("#obs_state_img").replaceWith(_img);

2c61f856   theopuhl   Url change to pat...
249
250

                          var _img = document.createElement('img');
d10a07d4   theopuhl   Update Images
251
252
                          _img.width = 18;
                          _img.height = 18;
2c61f856   theopuhl   Url change to pat...
253
                          _img.id ="weather_img";
0d353024   Quentin Durand   Fixing navbar whe...
254
255
256
257
258
259
260
261

                          /*
                            The plc_timeout variable is badly named: actually it is "seconds_since_plc_gave_its_last_status"
                            max_plc_timeout is the maximum time that we can wait to the plc to create a status before considering it offline
                          */
                          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)
d10a07d4   theopuhl   Update Images
262
                              _img.src = "{% static 'media/rain.png' %}";
2c61f856   theopuhl   Url change to pat...
263
                          else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE)
d10a07d4   theopuhl   Update Images
264
                              _img.src = "{% static 'media/cloud.png' %}";
2c61f856   theopuhl   Url change to pat...
265
                          else
d10a07d4   theopuhl   Update Images
266
267
268
                              _img.src = "{% static 'media/sun.png' %}";
                              _img.width = 18;
                              _img.height = 18;
2c61f856   theopuhl   Url change to pat...
269
270
271
272
                              _img.alt = "html5";
                          $("#weather_img").replaceWith(_img);

                          var _im = document.createElement('img');
d10a07d4   theopuhl   Update Images
273
274
                          _im.width = 18;
                          _im.height = 18;
2c61f856   theopuhl   Url change to pat...
275
                          _im.id="wind_img";
0d353024   Quentin Durand   Fixing navbar whe...
276
277
278
                          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)
d10a07d4   theopuhl   Update Images
279
                            _im.src = "{% static 'media/wind.png' %}";
2c61f856   theopuhl   Url change to pat...
280
                          else
d10a07d4   theopuhl   Update Images
281
                            _im.src= "{% static 'media/windsock_nowind.png' %}";
2c61f856   theopuhl   Url change to pat...
282
                          $("#wind_img").replaceWith(_im);
0d353024   Quentin Durand   Fixing navbar whe...
283
284
285
286

                          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"]) );
2c61f856   theopuhl   Url change to pat...
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
                      }
                  }, 'json')
                      .fail(function () {
                          console.log('Ajax error: GET request failed\n');
                      })
              }});
          </script>

        </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 -->


    
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
efdd4cd8   Etienne Pallier   added version
323
    <!--
2c61f856   theopuhl   Url change to pat...
324
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
efdd4cd8   Etienne Pallier   added version
325
326
    -->
    <script  src="{% static "/js/jquery.min.js" %}"></script>
2c61f856   theopuhl   Url change to pat...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
    <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>


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

    <!-- JavaScript -->
{#    <script src={% static "bootstrap/js/jquery-1.10.2.js" %}></script>#}
{#    <script src={% static "bootstrap/js/bootstrap.js" %}></script>#}
        <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>
    <!--    <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script>    -->
    <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>
    
    
</body>
efdd4cd8   Etienne Pallier   added version
348
</html>