Blame view

src/misc/templates/base.html 11 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
55
56
57
58
59
}

.side-nav {
  margin-left: -200px;
  left: 200px;
  width: 200px;
}

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;
fca58359   Unknown   Updating site tim...
97
}
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
98
</style>
fca58359   Unknown   Updating site tim...
99

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
100
{% load tags %}
94082e77   haribo   Date: 03/06/2016
101
102
103
104
105
106
<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">
d5fce214   theopuhl   Dashboard color c...
107
            <a class="navbar-brand" href={% url "index" %} style="color: black;">Colibri Control Center</a>
94082e77   haribo   Date: 03/06/2016
108
        </div>
76dfa189   Unknown   Adding devices lo...
109
110
111
112
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>



94082e77   haribo   Date: 03/06/2016
113
        <!-- Collect the nav links, forms, and other content for toggling -->
d5fce214   theopuhl   Dashboard color c...
114
        <!-- #f9ff93 #6b69f3-->
d10a07d4   theopuhl   Update Images
115
        <div id="topbar" class="collapse navbar-collapse navbar-ex1-collapse navbar-dark bg-primary">
d5fce214   theopuhl   Dashboard color c...
116
        <ul class="nav navbar-nav side-nav navbar-dark bg-primary" id="navbar_list">
2c61f856   theopuhl   Url change to pat...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
            <li><a href="{% url "weather" %}">Weather</a></li>
            {% if request.user.user_level.priority >= 3 %}
                <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 %}
            {% if request.user.user_level.priority >= 3 %}
                <li><a href="{% url "observation_status" %}">Tel & Inst</a></li>
            {% endif %}
            <li><a href="#">Webcams</a></li>
            {% if request.user.user_level.priority >= 2 %}
                <li><a href="{% url "proposal" %}">Proposal</a></li>
            {% endif %}
            <li><a href="{% url "requests_list" %}">Request</a></li>
3dbda6a0   haribo   Date: 17/06/2016
132
            <li><a href="{% url "alerts_list" %}">Alerts</a></li>
2c61f856   theopuhl   Url change to pat...
133
134
            <li><a href="{% url "current_schedule" %}">Schedule</a></li>
            <li><a href="#">Images</a></li>
94082e77   haribo   Date: 03/06/2016
135
          </ul>
94082e77   haribo   Date: 03/06/2016
136
          <ul class="nav navbar-nav navbar-right navbar-user">
6973f7df   Quentin Durand   PLC STATE + MODE
137
              <li><a id="plc_state"></a></li>
d10a07d4   theopuhl   Update Images
138
            <li><a class="nav-brand" id="hour">Sun elevation :</a></li>
d5fce214   theopuhl   Dashboard color c...
139
140
            <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
141
            <li><a class="nav-brand" id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li>
c830a3bc   Quentin Durand   PLC ACK + plc tim...
142
143
            <li><a class="nav-brand" id="globalmode" style="color: black;"> {% global_mode  request %} </a>              

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
144
            <li>
d5fce214   theopuhl   Dashboard color c...
145
                <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
146
            </li>
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
147
            <li>
d5fce214   theopuhl   Dashboard color c...
148
              <a id="signout" href="{% url "user_logout" %}" ><i class="fa fa-power-off"></i> Log Out</a>             
94082e77   haribo   Date: 03/06/2016
149
            </li>
76dfa189   Unknown   Adding devices lo...
150

94082e77   haribo   Date: 03/06/2016
151
          </ul>
757a9ae5   Unknown   fixing js in base...
152
            <script>
76dfa189   Unknown   Adding devices lo...
153
154
              var TOO_STRONG_WIND = 60; //Totally arbitrary values, just for demonstration
              var MAX_CLOUD_VALUE = 1;
40ee3b96   Quentin Durand   adding sunelevati...
155
              var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 1000;
76dfa189   Unknown   Adding devices lo...
156
157
              var MAX_RAIN_RATE = 10;

c830a3bc   Quentin Durand   PLC ACK + plc tim...
158
159
              var check_change = true;

fca58359   Unknown   Updating site tim...
160
              $( document ).ready(function() {
40ee3b96   Quentin Durand   adding sunelevati...
161
162
              //get_hour();
              //setInterval(function() {get_hour();}, 900);
fca58359   Unknown   Updating site tim...
163

40ee3b96   Quentin Durand   adding sunelevati...
164
              function set_elev(sun_elev)
fca58359   Unknown   Updating site tim...
165
              {
40ee3b96   Quentin Durand   adding sunelevati...
166
                  $("#hour").text("Sun elevation : " + sun_elev);
fca58359   Unknown   Updating site tim...
167
              }
fca58359   Unknown   Updating site tim...
168

d10a07d4   theopuhl   Update Images
169
              function change_color(elevation)
fca58359   Unknown   Updating site tim...
170
              {
d10a07d4   theopuhl   Update Images
171
172
173
174
175
176
                  var color = "";
                  if (elevation > -10)
                    color = "#f9ff93";
                  else
                    color = "#6b69f3";
                $("#topbar").css("background-color", color);
fca58359   Unknown   Updating site tim...
177
              }
c830a3bc   Quentin Durand   PLC ACK + plc tim...
178
              function info_plc(is_safe, mode, ack)
6973f7df   Quentin Durand   PLC STATE + MODE
179
              {
c830a3bc   Quentin Durand   PLC ACK + plc tim...
180
181


6973f7df   Quentin Durand   PLC STATE + MODE
182
183
184
185
                  var safe = "UNSAFE";
                  if (is_safe)
                      safe = "SAFE";

c830a3bc   Quentin Durand   PLC ACK + plc tim...
186
187
188
189
190
191
192
193
194
195
196
197
198
199
                  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);
6973f7df   Quentin Durand   PLC STATE + MODE
200
201
              }

76dfa189   Unknown   Adding devices lo...
202
203
204
205
206
              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...
207
                    if (weather_status)
76dfa189   Unknown   Adding devices lo...
208
209
210
211
212
213
214
215
                      {
                          /*
                          *** totally arbitrary method for day/night cycle, just for demonstration
                           */
                          var hour = new Date().getTime();
                          var site_time = new Date(hour - 9 * 3600 * 1000).getHours();
                          var _img_day_night =document.createElement('img');
                          if (site_time > 5 && site_time < 20)
d5fce214   theopuhl   Dashboard color c...
216
                              _img_day_night.src ="{% static 'media/rising_sun.png' %}";
76dfa189   Unknown   Adding devices lo...
217
                          else
d5fce214   theopuhl   Dashboard color c...
218
219
220
                              _img_day_night.src ="{% static 'media/moon.png' %}";
                          _img_day_night.width = 18;
                          _img_day_night.height = 18;
76dfa189   Unknown   Adding devices lo...
221
222
223
224
225
                          _img_day_night.id ="day_night_img";
                          _img_day_night.alt="html5";
                          $("#day_night_img").replaceWith(_img_day_night);

                          var _img = document.createElement('img');
d5fce214   theopuhl   Dashboard color c...
226
227
                          _img.width = 18;
                          _img.height = 18;
76dfa189   Unknown   Adding devices lo...
228
                          _img.id ="weather_img";
76dfa189   Unknown   Adding devices lo...
229
                          if(parseInt(weather_status[0]['fields']['rain']) > MAX_RAIN_RATE)
d5fce214   theopuhl   Dashboard color c...
230
                              _img.src = "{% static 'media/rain.png' %}";
76dfa189   Unknown   Adding devices lo...
231
                          else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE)
d5fce214   theopuhl   Dashboard color c...
232
                              _img.src = "{% static 'media/cloud.png' %}";
76dfa189   Unknown   Adding devices lo...
233
                          else
d5fce214   theopuhl   Dashboard color c...
234
235
236
                              _img.src = "{% static 'media/sun.png' %}";
                              _img.width = 18;
                              _img.height = 18;
76dfa189   Unknown   Adding devices lo...
237
238
239
240
                              _img.alt = "html5";
                          $("#weather_img").replaceWith(_img);

                          var _im = document.createElement('img');
d5fce214   theopuhl   Dashboard color c...
241
242
                          _im.width = 18;
                          _im.height = 18;
76dfa189   Unknown   Adding devices lo...
243
244
                          _im.id="wind_img";
                          if (parseInt(weather_status[0]['fields']['wind']) >= TOO_STRONG_WIND)
d5fce214   theopuhl   Dashboard color c...
245
                            _im.src = "{% static 'media/wind.png' %}";
76dfa189   Unknown   Adding devices lo...
246
                          else
d5fce214   theopuhl   Dashboard color c...
247
                            _im.src= "{% static 'media/windsock_nowind.png' %}";
76dfa189   Unknown   Adding devices lo...
248
                          $("#wind_img").replaceWith(_im);
40ee3b96   Quentin Durand   adding sunelevati...
249
250

                          set_elev(weather_status[0]['sunelev']);
d10a07d4   theopuhl   Update Images
251
                          change_color(parseInt(weather_status[0]['sunelev']));
c830a3bc   Quentin Durand   PLC ACK + plc tim...
252
                          info_plc(weather_status[0]["is_safe"], weather_status[0]["plc_mode"], weather_status[0]["ACK"] );
76dfa189   Unknown   Adding devices lo...
253
254
255
256
257
                      }
                  }, 'json')
                      .fail(function () {
                          console.log('Ajax error: GET request failed\n');
                      })
fca58359   Unknown   Updating site tim...
258
              }});
76dfa189   Unknown   Adding devices lo...
259
          </script>
757a9ae5   Unknown   fixing js in base...
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284

        </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
285
286
287
288
289
    
    <!-- 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...
290
291
292
293
    <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
294
295
296
297

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

    <!-- JavaScript -->
e6dd9964   haribo   Date: 19/07/2016
298
299
{#    <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
300
301
302
303
        <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...
304
    <!--    <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script>    -->
94082e77   haribo   Date: 03/06/2016
305
306
307
308
    <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...
309
    
94082e77   haribo   Date: 03/06/2016
310
311
</body>
</html>