Blame view

src/core/pyros_django/misc/templates/base.html 27.9 KB
da13e230   Alexis Koralewski   update UI of webs...
1
2
3
4
<!DOCTYPE html>
<html lang="en">
<head>

a6603b26   Alexis Koralewski   Django and Python...
5
    {% load static %}
da13e230   Alexis Koralewski   update UI of webs...
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">
042db8a3   Alexis Koralewski   renabling sign in...
11
    <link rel="icon" type="image/png" href="{% static "media/colibrifavicon.png" %}"/>
da13e230   Alexis Koralewski   update UI of webs...
12
    
0e02606c   Etienne Pallier   Changed version n...
13
    <title>{{ request.session.obsname}} Control Center - VERSION 2021.0.2.0</title>
da13e230   Alexis Koralewski   update UI of webs...
14
15
16
17
18

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

    <link href={% static "bootstrap/css/sb-admin.css" %} rel="stylesheet">
6b3644e7   Alexis Koralewski   Upgrading fontawe...
19
20
    <link rel="stylesheet" href={% static "bootstrap/fontawesome/css/fontawesome.min.css" %}> 
    <script src="{% static "bootstrap/fontawesome/js/all.js" %}" defer></script>
1ba49504   Alexis Koralewski   fixing CSS and JS...
21
    <link rel="stylesheet" src="{% static "bootstrap/fontawesome/css/v4-shims.css" %}">
6b3644e7   Alexis Koralewski   Upgrading fontawe...
22
23
    <!-- support v4 fontawesome icon references/syntax -->
    <script defer src="{% static "bootstrap/fontawesome/js/v4-shims.js" %}"></script>
da13e230   Alexis Koralewski   update UI of webs...
24
25
    <!-- Page Specific CSS -->
    <!--    <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css"> -->
0cd0f2c2   Alexis Koralewski   add automation of...
26
27
    <link rel="stylesheet" type="text/css" href="{% static '/css/global.css' %}">
    <script src="{% static "/js/global.js" %}" defer></script>
da13e230   Alexis Koralewski   update UI of webs...
28
29
    <!-- JsTree -->
    <link rel="stylesheet" href={% static "bootstrap/dist/themes/default/style.min.css" %}>
4cc9ffea   Alexis Koralewski   adding local font...
30
    {% comment %}
da13e230   Alexis Koralewski   update UI of webs...
31
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
4cc9ffea   Alexis Koralewski   adding local font...
32
    {% endcomment %}
4cc9ffea   Alexis Koralewski   adding local font...
33
    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
da13e230   Alexis Koralewski   update UI of webs...
34
35
36
37
38
	
	{% block head %}
	<style> 
  #title {
    font-family: 'Montserra', sans-serif; 
d38312c2   Alexis Koralewski   updating UI (CSS ...
39
    font-size: 3rem;
da13e230   Alexis Koralewski   update UI of webs...
40
41
42
43
44
45
46
47
  }
  </style>
	{% endblock %}

</head>

<body>
<style>
a2dbbde1   Alexis Koralewski   Adding new config...
48
49
50
51
52
53
54
:root{
  --main-bg-color: {{ request.session.pyros_config.general.color_theme }}
}
.bg-gradient-primary{
  background-color: var(--main-bg-color);
  background-image: None;
}
46b2415a   Alexis Koralewski   Adding new prod &...
55
56
57
.bg-gradient-primary a{
  color: white;
}
02d94ed3   Alexis Koralewski   Reworking UI of w...
58
/*
da13e230   Alexis Koralewski   update UI of webs...
59
#page-wrapper {
d38312c2   Alexis Koralewski   updating UI (CSS ...
60
61
  width: 80vw;
  height: 80vh;
da13e230   Alexis Koralewski   update UI of webs...
62
63
64
}

#wrapper {
d38312c2   Alexis Koralewski   updating UI (CSS ...
65
  #padding-left: 10%;
da13e230   Alexis Koralewski   update UI of webs...
66
67
68
}

.side-nav {
afe539cb   Alexis Koralewski   Add 'Ace.js' pack...
69
  max-width: 12vw; /*200px for base_unlogged*/
da13e230   Alexis Koralewski   update UI of webs...
70
}
02d94ed3   Alexis Koralewski   Reworking UI of w...
71
*/
da13e230   Alexis Koralewski   update UI of webs...
72
73
74
75
a {
  font-family: 'Montserra', sans-serif;

}
02d94ed3   Alexis Koralewski   Reworking UI of w...
76
77
78
79
80
81
#topbar {
    -webkit-transition: background-color 800ms linear;
    -ms-transition: background-color 800ms linear;
    transition: background-color 800ms linear;
    height: 100%;
}
da13e230   Alexis Koralewski   update UI of webs...
82

02d94ed3   Alexis Koralewski   Reworking UI of w...
83
84
85
.container-fluid{
  height:90%;
}
da13e230   Alexis Koralewski   update UI of webs...
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#fas {
  size: 18px;
}

#profile
{
    font-size: 17px;
}

#hour
{
    color: black;
    font-size: 14px;
}

#plc_state
{
    color: black;
    font-size: 18px;
}

#signout {
    color: black;
}
02d94ed3   Alexis Koralewski   Reworking UI of w...
110
111
*/

da13e230   Alexis Koralewski   update UI of webs...
112
113
114
115
116
117

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

da13e230   Alexis Koralewski   update UI of webs...
118
119
120
121
122
123
124
125
126
127
128
#text_globalmode {
    font-size: 14px;
    color: black;
}

.img_icon {
  height: 18px;
  weight: 18px; 
}

.user_icon{
02d94ed3   Alexis Koralewski   Reworking UI of w...
129
  margin-left: 3.5vw;
0b2d14c7   Alexis Koralewski   removing (still a...
130
131
  margin-bottom: 0.4em;
  margin-top: 0.4em;
da13e230   Alexis Koralewski   update UI of webs...
132
  height: 1.5em;
0b2d14c7   Alexis Koralewski   removing (still a...
133
  
da13e230   Alexis Koralewski   update UI of webs...
134
135
}

d38312c2   Alexis Koralewski   updating UI (CSS ...
136
137
138
139
#home_icon{
  height: 1.4em;
  width: 1.5em;  
  float:left;
c658ec80   Alexis Koralewski   Rename command fo...
140
  //margin-right:1vw;
d38312c2   Alexis Koralewski   updating UI (CSS ...
141
}
da13e230   Alexis Koralewski   update UI of webs...
142

a2dbbde1   Alexis Koralewski   Adding new config...
143
#logo_icon{
c658ec80   Alexis Koralewski   Rename command fo...
144
145
  height: 2.5vh;
  width: 2.5vw;  
a2dbbde1   Alexis Koralewski   Adding new config...
146
147
148
  float:left;
  margin-right:1vw;
}
0b2d14c7   Alexis Koralewski   removing (still a...
149
.dropdown_user_actions {
0b2d14c7   Alexis Koralewski   removing (still a...
150
  overflow: hidden;
02d94ed3   Alexis Koralewski   Reworking UI of w...
151
152
  min-width:8.5vw;
  margin-right:2vw;
0b2d14c7   Alexis Koralewski   removing (still a...
153
154
155
}

.dropdown_user_actions_content {
da13e230   Alexis Koralewski   update UI of webs...
156
  display: none;
02d94ed3   Alexis Koralewski   Reworking UI of w...
157
  overflow: hidden;
da13e230   Alexis Koralewski   update UI of webs...
158
  position: absolute;
da13e230   Alexis Koralewski   update UI of webs...
159
  background-color: #f9f9f9;
02d94ed3   Alexis Koralewski   Reworking UI of w...
160
  min-width:8.5vw;
da13e230   Alexis Koralewski   update UI of webs...
161
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
da13e230   Alexis Koralewski   update UI of webs...
162
163
164
  z-index: 1;
}

0b2d14c7   Alexis Koralewski   removing (still a...
165
166
167
168
169
170
171
172
173
174
175
.dropdown_user_actions_content a {
  float: left;
  overflow: visible;
  color: black;
  margin: 1.2rem;
  padding-right: 1.2em;
  text-decoration: none;
  display: block;
  text-align: left;

}
02d94ed3   Alexis Koralewski   Reworking UI of w...
176
177
178
179
180
181
182
183
184
#change_role {
  color:black;
  margin-top:2vh;
  margin-right:1vw;
}
.topbar #sidebarToggleTop{
  
  margin-left: 7vw;
}
0b2d14c7   Alexis Koralewski   removing (still a...
185
.dropdown_user_actions:hover .dropdown_user_actions_content {
da13e230   Alexis Koralewski   update UI of webs...
186
187
  display: block;
}
02d94ed3   Alexis Koralewski   Reworking UI of w...
188
/*
b7becde4   Alexis Koralewski   Updating UI (foot...
189
footer{
d38312c2   Alexis Koralewski   updating UI (CSS ...
190
191
192
193
194
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  text-align: center;
02d94ed3   Alexis Koralewski   Reworking UI of w...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
}
*/
# django messages css

/* form errors and request messages and alerts */
.badge-light {
    margin-top: 2.5em;
}
.errorlist {
    list-style: none;
    padding-left: 0px;
    opacity: 0.8;
    color: #dc3545;
    font-size: 12px;
}
.msg {
    margin: 0 !important;
    margin-bottom: 4px !important;
    margin-top: 4px !important;
}
.messages {
    z-index: 100;
    position: fixed;
    right: 1vw;
    top: 6vh;
    list-style: none;
    text-align: right;
}
.alert {
    margin-top: 1rem;
}
.alert-error {
    background-color: #f2dede;
    border-color: #ebcccc;
    color: #a94442;
}
46b2415a   Alexis Koralewski   Adding new prod &...
231
232
233
234
235
/*page take full height available*/
#navbar_list, #wrapper{
  height: 100vh;
}
@media only screen and (max-width: 768px) {
d38312c2   Alexis Koralewski   updating UI (CSS ...
236

02d94ed3   Alexis Koralewski   Reworking UI of w...
237
238
239
  #navbar_list{
    display:none;
  }
46b2415a   Alexis Koralewski   Adding new prod &...
240
241
242
  .navbar-nav .open .dropdown-menu{
    background-color: white;
  }
b7becde4   Alexis Koralewski   Updating UI (foot...
243
}
02d94ed3   Alexis Koralewski   Reworking UI of w...
244
245
246



da13e230   Alexis Koralewski   update UI of webs...
247
248
249
250
</style>

{% load tags %}
{% user_level request as USER_LEVEL %}
02d94ed3   Alexis Koralewski   Reworking UI of w...
251
{% can_view_settings request as CAN_VIEW_SETTINGS %}
0cd0f2c2   Alexis Koralewski   add automation of...
252
{% get_version_number as version_number %}
da13e230   Alexis Koralewski   update UI of webs...
253
254
255
256
257
258
259
260
261
{% comment %}
  
{% get_level "TAC" as USER_LEVEL_TAC %}
{% get_level "Observer" as USER_LEVEL_OBSERVER %}
{% get_level "Operator" as USER_LEVEL_OPERATOR %}  
{% get_level "PI" as USER_LEVEL_PI %}
{% get_level "Admin" as USER_LEVEL_SYSADMIN %}
{% get_level "Visitor" as USER_LEVEL_VISITOR %}
{% endcomment %}
02d94ed3   Alexis Koralewski   Reworking UI of w...
262
<script  src="{% static "/js/jquery-1.10.2.js" %}"></script>
da13e230   Alexis Koralewski   update UI of webs...
263
264
<div id="wrapper">

02d94ed3   Alexis Koralewski   Reworking UI of w...
265
     
46b2415a   Alexis Koralewski   Adding new prod &...
266
      <ul class="navbar-nav bg-gradient-primary align-items-center" id="navbar_list">
02d94ed3   Alexis Koralewski   Reworking UI of w...
267
268
             <!-- Brand and toggle get grouped for better mobile display -->
        <div class="sidebar-brand d-flex align-items-center justify-content-center">
d38312c2   Alexis Koralewski   updating UI (CSS ...
269
            <a class="navbar-brand" href={% url "index" %} style="color: black;">
02d94ed3   Alexis Koralewski   Reworking UI of w...
270
            <img class="sidebar-brand-icon" src="{% static 'media/home.png'  %}" id="home_icon"></a>
a2dbbde1   Alexis Koralewski   Adding new config...
271
272
273
274
275
            {% if request.session.logo %}
              <img class="sidebar-brand-icon" src="{% static request.session.logo  %}" id="logo_icon"></a>
            {% else %}
              <div class="sidebar-brand-text mx-3">PyROS</div>
            {% endif %}
da13e230   Alexis Koralewski   update UI of webs...
276
            
02d94ed3   Alexis Koralewski   Reworking UI of w...
277
278
279
280
281
282
283
284
        </div>
            {% comment %} OLD SIDE MENU
              
              <li class="nav-item"><a class="nav-link" href="{% url "weather" %}">Weather</a></li>
              <li class="nav-item"><a class="nav-link" href="{% url "site" %}">Observatory</a></li>
              <li class="nav-item"><a class="nav-link" href="#">Webcams</a></li>
              <li class="nav-item"><a class="nav-link"href="{% url "alerts_list" %}">Alerts</a></li>
              <li class="nav-item"><a class="nav-link" href="{% url "current_schedule" %}">Schedule</a></li>
da13e230   Alexis Koralewski   update UI of webs...
285
286
            {# TODO: TBD #}
            {% if USER_LEVEL|ifinlist:"Admin,Operator,Unit-PI,Management board member,Observer,TAC" %}
a2dbbde1   Alexis Koralewski   Adding new config...
287
              <li class="nav-item"><a class="nav-link" href="{% url "sequences_list" %}">Request</a></li>
02d94ed3   Alexis Koralewski   Reworking UI of w...
288
              <li class="nav-item"><a class="nav-link" href="#">Images</a></li>
da13e230   Alexis Koralewski   update UI of webs...
289
            {% endif %}
02d94ed3   Alexis Koralewski   Reworking UI of w...
290
          
da13e230   Alexis Koralewski   update UI of webs...
291
            {% if USER_LEVEL == "Admin" %}
02d94ed3   Alexis Koralewski   Reworking UI of w...
292
              <li class="nav-item"><a class="nav-link" href="/admin">ADMIN</a></li>
da13e230   Alexis Koralewski   update UI of webs...
293
294
295
            {% endif %}
            {% if USER_LEVEL|ifinlist:"Admin,Operator,Unit-PI,Management board member,Observer,TAC" %}
            
02d94ed3   Alexis Koralewski   Reworking UI of w...
296
297
298
                <li class="nav-item"><a class="nav-link" href="{% url "site" %}">State</a></li>
                <li class="nav-item"><a class="nav-link" href="{% url "site" %}">Observatory</a></li>
                <li class="nav-item"><a class="nav-link" href="{% url "observation_status" %}">Tel & Inst</a></li>
da13e230   Alexis Koralewski   update UI of webs...
299
300
            {% endif %}
            {% if USER_LEVEL|ifinlist:"Admin,Observer,Unit-PI,TAC,Management board member" %}
02d94ed3   Alexis Koralewski   Reworking UI of w...
301
302
303
304
305
306
307
308
309
310
311
312
                <li class="nav-item"><a class="nav-link" href="{% url "index_scientific_program" %}">Scientific<br>programs</a></li>
            {% endif %}
            {% endcomment %}
            <li class="nav-item"><a class="nav-link" href="{% url "monitoring_index" %}">Monitoring</a></li>
            <li class="nav-item"><a class="nav-link" href="{% url "observation_index" %}">Observations</a></li>
            {% if USER_LEVEL|ifinlist:"Admin" %}
              <li class="nav-item"><a class="nav-link" href="{% url "system" %}">System</a></li>
              <li class="nav-item"><a class="nav-link" href="{% url "weather_config" %}">Weather config</a></li>
              
            {% endif %}
            {% if CAN_VIEW_SETTINGS %}
              <li class="nav-item"><a class="nav-link" href="{% url "settings" %}">Settings</a></li>
da13e230   Alexis Koralewski   update UI of webs...
313
            {% endif %}
da13e230   Alexis Koralewski   update UI of webs...
314
          </ul>
02d94ed3   Alexis Koralewski   Reworking UI of w...
315
      <div id="content-wrapper" class="d-flex flex-column">
105c4d84   Alexis Koralewski   removing TBD from...
316
        <div class="header">
02d94ed3   Alexis Koralewski   Reworking UI of w...
317
318
319
320
321
322
323
324
      
       
            {# <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> #}


            <!-- Collect the nav links, forms, and other content for toggling -->
            <!-- #f9ff93 #6b69f3-->
          
da13e230   Alexis Koralewski   update UI of webs...
325
              
02d94ed3   Alexis Koralewski   Reworking UI of w...
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
            <nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
            
                {# display home button for mobile #}       
                <a href={% url "index" %} style="color: black;">
                  <button class="btn btn-link d-md-none rounded-circle mr-3">
                    <img class="sidebar-brand-icon" src="{% static 'media/home.png'  %}" id="home_icon">
                  </button>
                </a>
              {{ request.session.obsname }} Control Center
              {% comment %}
                  <li><a id="plc_state"></a></li>
                <li><a class="nav-brand" id="hour">Sun elevation :</a></li>
                <li><a class="nav-brand" id="day_night" ><img id="day_night_img"></a></li>
                <li><a class="nav-brand" id="observatory_state" href="{% url "site" %}"><img id="obs_state_img"></a></li>
                <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>
c1a58d54   Alexis Koralewski   Adding views to v...
342
343
344
                <li><a class="nav-brand" id="globalmode" style="colr: black;"> <p id="text_globalmode"  >{% global_mode  request %} </p></a>
                  {% endcomment %}
                <ul class="navbar-nav ml-auto">
b673b6a7   Alexis Koralewski   Fixing UI of topb...
345
                  <li>Software mode : <a class="nav-brand" id="soft_mode" style="color: black;"> <p id="text_globalmode"  >{% soft_mode  request %} </p></a></li>
02d94ed3   Alexis Koralewski   Reworking UI of w...
346
347
                
                {% if request.user.is_authenticated %}
b673b6a7   Alexis Koralewski   Fixing UI of topb...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
                  <li class="nav-item dropdown no-arrow" style="border-left: 1px dotted black;margin-left: 0.5vw">
                    {# <a class="nav-brand" href="{% url "user_detail" user.id %}" style="color: black;"> #}
                    
                      <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                      {% if request.user.get_list_of_roles|length > 1 %}
                        <div id="change_role"> <span class="mr-2 d-none d-lg-inline text-gray-600 ">{{ request.user.first_name|first }} {{ request.user.last_name }} as 
                          {# user visiting his own page to change active role #}
                          <form id="change_active_role" action="{% url 'set_active_role' %}"  method="POST">
                              {% csrf_token %}
                              <select id="selected_role" class="form-select form-control " name="selected_role">
                                  {% for role in request.user.get_list_of_roles %}
                                      {% if role == request.session.role %}
                                          <option value="{{role}}" selected>{{role}}</option>
                                      {% else %}
                                          <option value="{{role}}">{{role}}</option>
                                      {% endif %}
                                  {% endfor %}
                              </select>
                          </form>
                        </div>
                      {% else %}
                          <span class="mr-2 d-none d-lg-inline text-gray-600 ">{{ request.user.first_name|first }} {{ request.user.last_name }} as <p id="active_role">{{ request.session.role}}</p></span>
02d94ed3   Alexis Koralewski   Reworking UI of w...
370
                      {% endif %}
b673b6a7   Alexis Koralewski   Fixing UI of topb...
371
                          <img class="img-profile rounded" src="{% static 'media/user.png' %}">
02d94ed3   Alexis Koralewski   Reworking UI of w...
372
                      </a>
b673b6a7   Alexis Koralewski   Fixing UI of topb...
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
                      <!-- Dropdown - User Information -->
                      <div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
                        <a class="dropdown-item" href="{% url "user_detail" request.user.id %}">
                            <i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i>
                            Profile
                        </a>
                        {% comment %}
                          
                        {% if USER_LEVEL|ifinlist:"Admin,Operator,Unit-PI,Unit-board,Observer,TAC,Management board member" %}
                          <a class="dropdown-item" href="{% url 'settings' %}">
                              <i class="fas fa-cog text-gray-400"></i>
                              Settings
                          </a>
                        {% endif %}
                        {% endcomment %}
                      
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{% url "user_logout" %}" >
                            <i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
                            Logout
                        </a>
                        </div>
02d94ed3   Alexis Koralewski   Reworking UI of w...
395
                      {% else %}
b673b6a7   Alexis Koralewski   Fixing UI of topb...
396
                        <li> <a class="dropwdown-item nav-link" id="signin" href="{% url "user_signin" %}" ><i class="fa fa-power-off"></i> Sign in</a>  </li>
02d94ed3   Alexis Koralewski   Reworking UI of w...
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
                      {% endif %}
                  {% comment %}
                    
                  <img src="{% static 'media/user.png' %}" class="user_icon" ></i>
                  <p> Welcome {{ request.user.first_name|first }} {{ request.user.last_name }} as <p id="active_role">{{ request.session.role}}</p> <i class="fa fa-caret-down"></i> </p> 
                  <ul class="dropdown_user_actions_content">
                    <li class="nav-item"><a class="nav-link" class="nav-brand" href="{% url "user_detail" request.user.id %}" style="color: black;"> Profile </a></li>
                    {% if request.user.get_list_of_roles|length > 1 %}
                      <li>
                      <div id="change_role"> Change role 
                      {# user visiting his own page to change active role #}
                      <form id="change_active_role" action="{% url 'set_active_role' %}"  method="POST">
                          {% csrf_token %}
                          <select id="selected_role" class="form-select" name="selected_role">
                              {% for role in request.user.get_list_of_roles %}
                                  {% if role == request.session.role %}
                                      <option value="{{role}}" selected>{{role}}</option>
                                  {% else %}
                                      <option value="{{role}}">{{role}}</option>
                                  {% endif %}
                              {% endfor %}
                          </select>
                      </form>
                      </div>
                    {% endif %}
                      </li>
                    {% if USER_LEVEL|ifinlist:"Admin,Operator,Unit-PI,Unit-board,Observer,TAC,Management board member" %}
                      <li>
                      <a class="nav-brand" href="{% url "settings" %}" style="color: black;"><i id="profile" class="fas fa-cog "></i>Settings</a>
                      </li>
                    {% endif %}
                    
                    <li class="nav-item"><a class="nav-link" id="signout" href="{% url "user_logout" %}" ><i class="fa fa-power-off"></i> Log Out</a></li>
                  </ul>
                  </div>
0b2d14c7   Alexis Koralewski   removing (still a...
432
                </li>
02d94ed3   Alexis Koralewski   Reworking UI of w...
433
434
435
                  {% endcomment %}
                

0b2d14c7   Alexis Koralewski   removing (still a...
436
              </ul>
02d94ed3   Alexis Koralewski   Reworking UI of w...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
            </nav>
            {% comment %}
              
              <script>
                var TOO_STRONG_WIND = 60; //Totally arbitrary values, just for demonstration
                var MAX_CLOUD_VALUE = 1;
                var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 1000;
                var MAX_RAIN_RATE = 10;

                var check_change = true;

                $( document ).ready(function() {

                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)
                {
                    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;
                    }

                    if(! mode){
                      mode = "Not connected";
                    }
                    $("#plc_state").text("PLC: " + mode + '\u00A0\u00A0\u00A0\u00A0\u00A0' + safe + '\u00A0\u00A0\u00A0\u00A0\u00A0' + ack);
                    $("#plc_state").css("color", "black");
                    if (timeout > max_plc_timeout)
                    {
                        $("#plc_state").text("Connection to PLC LOST");
                        $("#plc_state").css("color", "red");
                    }
                }



                ajax_request();
                interval = setInterval(function() {ajax_request();}, REFRESH_ICONS_FREQUENCE_MILLISECONDS);

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

                */

                function ajax_request() {
                    $.get("{% url 'retrieve_env_navbar' %}", function (weather_status) {
                      if (weather_status)
                        {
                            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)
                                _img_day_night.src ="{% static 'media/rising_sun.png' %}";
                            else
                                _img_day_night.src ="{% static 'media/moon.png' %}";
                            _img_day_night.width = 22;
                            _img_day_night.height = 22;
                            _img_day_night.id ="day_night_img";
                            _img_day_night.alt="html5";
                            $("#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);


                            var _img = document.createElement('img');
                            _img.width = 18;
                            _img.height = 18;
                            _img.id ="weather_img";

                            /*
                              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)
                                _img.src = "{% static 'media/rain.png' %}";
                            else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE)
                                _img.src = "{% static 'media/cloud.png' %}";
                            else
                                _img.src = "{% static 'media/sun.png' %}";
                                _img.width = 18;
                                _img.height = 18;
                                _img.alt = "html5";
                            $("#weather_img").replaceWith(_img);

                            var _im = document.createElement('img');
                            _im.width = 18;
                            _im.height = 18;
                            _im.id="wind_img";
                            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)
                              _im.src = "{% static 'media/wind.png' %}";
                            else
                              _im.src= "{% static 'media/windsock_nowind.png' %}";
                            $("#wind_img").replaceWith(_im);

                            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"]) );
                        }
                    }, 'json')
                        .fail(function () {
                            console.log('Ajax error: GET request failed\n');
                        })
                }});
            </script>
            {% endcomment %}

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



      
          <div class="container-fluid">
            <ul class="messages" id="messages-list">
            {% for msg in messages %}
            <li>
              <div class="alert alert-info alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                {{msg.message}}
0b2d14c7   Alexis Koralewski   removing (still a...
610
              </div>
da13e230   Alexis Koralewski   update UI of webs...
611
            </li>
02d94ed3   Alexis Koralewski   Reworking UI of w...
612
            {% endfor %}
0b2d14c7   Alexis Koralewski   removing (still a...
613
            
02d94ed3   Alexis Koralewski   Reworking UI of w...
614
615
616
617
618
            </ul>
            {% block content %}
              
              
            {% endblock %}
da13e230   Alexis Koralewski   update UI of webs...
619
        
02d94ed3   Alexis Koralewski   Reworking UI of w...
620
          </div>
da13e230   Alexis Koralewski   update UI of webs...
621

1da6c560   Etienne Pallier   fix merge conflict
622
623
624
      <footer class="sticky-footer">
          <div>
              <div class="text-right my-auto">
0cd0f2c2   Alexis Koralewski   add automation of...
625
                 <span>VERSION {{ version_number }}</span>
02d94ed3   Alexis Koralewski   Reworking UI of w...
626
              </div>
1da6c560   Etienne Pallier   fix merge conflict
627
          </div>
02d94ed3   Alexis Koralewski   Reworking UI of w...
628
      </footer>
1da6c560   Etienne Pallier   fix merge conflict
629

da13e230   Alexis Koralewski   update UI of webs...
630
631
632
      </div><!-- /#page-wrapper -->

    </div><!-- /#wrapper -->
b7becde4   Alexis Koralewski   Updating UI (foot...
633
    
da13e230   Alexis Koralewski   update UI of webs...
634
635
636
637
638
639
640
        <!-- Javascript function refreshing weather icons on the navbar -->


    
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
da13e230   Alexis Koralewski   update UI of webs...
641
642
643
    <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>
02d94ed3   Alexis Koralewski   Reworking UI of w...
644
    <script  src="{% static "/js/sb-admin-2.js" %}"></script>
da13e230   Alexis Koralewski   update UI of webs...
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659


    <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>
02d94ed3   Alexis Koralewski   Reworking UI of w...
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
    <script>

    // fade out message alerts
    function fade_alerts() {
        alerts = document.getElementsByClassName("alert msg");
        console.log(alerts);
            var i = alerts.length;
            for (let elem of alerts) {
                i--;
                time = 1000+(1000*i);
                setTimeout(function() {
                    $(elem).fadeOut("slow");
                }, time);
            }
    }

    // call fade out after DOMContentLoaded
    window.addEventListener('DOMContentLoaded', (event) => {
        fade_alerts();
    });
94e0e6e2   Alexis Koralewski   check for mobile ...
680
681
682
683
684
685
    if (document.getElementById("change_role") != null){
      document.getElementById("change_role").addEventListener("click",function(){
        $(".dropdown_user_actions_content").css("display", "block");
      });
      
    }
02d94ed3   Alexis Koralewski   Reworking UI of w...
686
687
688
689
690
691
692
693
694
695
696
697
698
699
    function changeActiveRole() {
      csrf_value = $("[name='csrfmiddlewaretoken']").val();
      $.post($("#change_active_role").attr('action'), { "role": $("#selected_role option:selected").val(), csrfmiddlewaretoken: csrf_value }, function(data) {
          $("#active_role").html($("#selected_role option:selected").val());
          $(".dropdown_user_actions_content").css("display","");
          const messages = document.getElementById("messages-list");
          messages.innerHTML += data;
      });

    }

    $("#selected_role").change(function(event) {
        changeActiveRole();
    });
6b3644e7   Alexis Koralewski   Upgrading fontawe...
700
    $( function() {
1ba49504   Alexis Koralewski   fixing CSS and JS...
701
      //$( document ).tooltip();
6b3644e7   Alexis Koralewski   Upgrading fontawe...
702
    } );
02d94ed3   Alexis Koralewski   Reworking UI of w...
703
704
    </script>
        
da13e230   Alexis Koralewski   update UI of webs...
705
</body>
f2d6c919   Alexis Koralewski   Deletion of selec...
706
</html>