Blame view

src/misc/templates/base.html 10.2 KB
94082e77   haribo   Date: 03/06/2016
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html lang="en">
<head>

    {% load staticfiles %}
  
    <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 ...
14
    <title >Colibri Control Center</title>
94082e77   haribo   Date: 03/06/2016
15
16
17
18
19
20
21
22

    <!-- 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...
23
    <!--    <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css"> -->
94082e77   haribo   Date: 03/06/2016
24
25
    
    <!-- JsTree -->
6dc0b213   theophile.puhl@epitech.eu   Création du dashb...
26
27
28
    <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
29
30
	
	{% block head %}
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
31
32
33
34
35
36
	<style> 
  #title {
    font-family: 'Montserra', sans-serif; 
    font-size: 50px;
  }
  </style>
94082e77   haribo   Date: 03/06/2016
37
38
39
40
41
	{% endblock %}

</head>

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

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

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

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

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

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

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

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

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

#signout {
    color: black;
fca58359   Unknown   Updating site tim...
81
}
d5fce214   theopuhl   Dashboard color c...
82
83
84
85
86
87

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

d10a07d4   theopuhl   Update Images
88
89
90
91
#topbar {
    -webkit-transition: background-color 800ms linear;
    -ms-transition: background-color 800ms linear;
    transition: background-color 800ms linear;
fca58359   Unknown   Updating site tim...
92
}
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
93
</style>
fca58359   Unknown   Updating site tim...
94

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



94082e77   haribo   Date: 03/06/2016
108
        <!-- Collect the nav links, forms, and other content for toggling -->
d5fce214   theopuhl   Dashboard color c...
109
        <!-- #f9ff93 #6b69f3-->
d10a07d4   theopuhl   Update Images
110
        <div id="topbar" class="collapse navbar-collapse navbar-ex1-collapse navbar-dark bg-primary">
d5fce214   theopuhl   Dashboard color c...
111
        <ul class="nav navbar-nav side-nav navbar-dark bg-primary" id="navbar_list">
2c61f856   theopuhl   Url change to pat...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
            <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
127
            <li><a href="{% url "alerts_list" %}">Alerts</a></li>
2c61f856   theopuhl   Url change to pat...
128
129
            <li><a href="{% url "current_schedule" %}">Schedule</a></li>
            <li><a href="#">Images</a></li>
94082e77   haribo   Date: 03/06/2016
130
          </ul>
94082e77   haribo   Date: 03/06/2016
131
          <ul class="nav navbar-nav navbar-right navbar-user">
334105c7   theopuhl   Update base.html
132
            <li id="plc_state"></li>
d10a07d4   theopuhl   Update Images
133
            <li><a class="nav-brand" id="hour">Sun elevation :</a></li>
d5fce214   theopuhl   Dashboard color c...
134
135
136
            <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>
            <li><a class="nav-brand" id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li>
d10a07d4   theopuhl   Update Images
137
            <li><a class="nav-brand" id="globalmode" style="color: black;"> {% global_mode  request %} </a>              
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
138
            <li>
d5fce214   theopuhl   Dashboard color c...
139
                <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
140
            </li>
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
141
            <li>
d5fce214   theopuhl   Dashboard color c...
142
              <a id="signout" href="{% url "user_logout" %}" ><i class="fa fa-power-off"></i> Log Out</a>             
94082e77   haribo   Date: 03/06/2016
143
            </li>
76dfa189   Unknown   Adding devices lo...
144

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

fca58359   Unknown   Updating site tim...
152
              $( document ).ready(function() {
40ee3b96   Quentin Durand   adding sunelevati...
153
154
              //get_hour();
              //setInterval(function() {get_hour();}, 900);
fca58359   Unknown   Updating site tim...
155

40ee3b96   Quentin Durand   adding sunelevati...
156
              function set_elev(sun_elev)
fca58359   Unknown   Updating site tim...
157
              {
40ee3b96   Quentin Durand   adding sunelevati...
158
                  $("#hour").text("Sun elevation : " + sun_elev);
fca58359   Unknown   Updating site tim...
159
              }
fca58359   Unknown   Updating site tim...
160

d10a07d4   theopuhl   Update Images
161
              function change_color(elevation)
fca58359   Unknown   Updating site tim...
162
              {
d10a07d4   theopuhl   Update Images
163
164
165
166
167
168
                  var color = "";
                  if (elevation > -10)
                    color = "#f9ff93";
                  else
                    color = "#6b69f3";
                $("#topbar").css("background-color", color);
fca58359   Unknown   Updating site tim...
169
              }
76dfa189   Unknown   Adding devices lo...
170
171
172
173
174
              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...
175
                    if (weather_status)
76dfa189   Unknown   Adding devices lo...
176
177
178
179
180
181
182
183
                      {
                          /*
                          *** 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...
184
                              _img_day_night.src ="{% static 'media/rising_sun.png' %}";
76dfa189   Unknown   Adding devices lo...
185
                          else
d5fce214   theopuhl   Dashboard color c...
186
187
188
                              _img_day_night.src ="{% static 'media/moon.png' %}";
                          _img_day_night.width = 18;
                          _img_day_night.height = 18;
76dfa189   Unknown   Adding devices lo...
189
190
191
192
193
                          _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...
194
195
                          _img.width = 18;
                          _img.height = 18;
76dfa189   Unknown   Adding devices lo...
196
                          _img.id ="weather_img";
76dfa189   Unknown   Adding devices lo...
197
                          if(parseInt(weather_status[0]['fields']['rain']) > MAX_RAIN_RATE)
d5fce214   theopuhl   Dashboard color c...
198
                              _img.src = "{% static 'media/rain.png' %}";
76dfa189   Unknown   Adding devices lo...
199
                          else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE)
d5fce214   theopuhl   Dashboard color c...
200
                              _img.src = "{% static 'media/cloud.png' %}";
76dfa189   Unknown   Adding devices lo...
201
                          else
d5fce214   theopuhl   Dashboard color c...
202
203
204
                              _img.src = "{% static 'media/sun.png' %}";
                              _img.width = 18;
                              _img.height = 18;
76dfa189   Unknown   Adding devices lo...
205
206
207
208
                              _img.alt = "html5";
                          $("#weather_img").replaceWith(_img);

                          var _im = document.createElement('img');
d5fce214   theopuhl   Dashboard color c...
209
210
                          _im.width = 18;
                          _im.height = 18;
76dfa189   Unknown   Adding devices lo...
211
212
                          _im.id="wind_img";
                          if (parseInt(weather_status[0]['fields']['wind']) >= TOO_STRONG_WIND)
d5fce214   theopuhl   Dashboard color c...
213
                            _im.src = "{% static 'media/wind.png' %}";
76dfa189   Unknown   Adding devices lo...
214
                          else
d5fce214   theopuhl   Dashboard color c...
215
                            _im.src= "{% static 'media/windsock_nowind.png' %}";
76dfa189   Unknown   Adding devices lo...
216
                          $("#wind_img").replaceWith(_im);
40ee3b96   Quentin Durand   adding sunelevati...
217
218

                          set_elev(weather_status[0]['sunelev']);
d10a07d4   theopuhl   Update Images
219
                          change_color(parseInt(weather_status[0]['sunelev']));
40ee3b96   Quentin Durand   adding sunelevati...
220
                          console.log(weather_status);
76dfa189   Unknown   Adding devices lo...
221
222
223
224
225
                      }
                  }, 'json')
                      .fail(function () {
                          console.log('Ajax error: GET request failed\n');
                      })
fca58359   Unknown   Updating site tim...
226
              }});
76dfa189   Unknown   Adding devices lo...
227
          </script>
757a9ae5   Unknown   fixing js in base...
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

        </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
253
254
255
256
257
    
    <!-- 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...
258
259
260
261
    <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
262
263
264
265

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

    <!-- JavaScript -->
e6dd9964   haribo   Date: 19/07/2016
266
267
{#    <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
268
269
270
271
        <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...
272
    <!--    <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script>    -->
94082e77   haribo   Date: 03/06/2016
273
274
275
276
    <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...
277
    
94082e77   haribo   Date: 03/06/2016
278
279
</body>
</html>