summaryrefslogtreecommitdiff
path: root/sbhs/templates
diff options
context:
space:
mode:
Diffstat (limited to 'sbhs/templates')
-rw-r--r--sbhs/templates/base.html27
-rw-r--r--sbhs/templates/dashboard/all_images.html18
-rw-r--r--sbhs/templates/dashboard/show_all_boards.html2
-rw-r--r--sbhs/templates/webcam/show_video.html54
4 files changed, 94 insertions, 7 deletions
diff --git a/sbhs/templates/base.html b/sbhs/templates/base.html
index 099488b..65f05b9 100644
--- a/sbhs/templates/base.html
+++ b/sbhs/templates/base.html
@@ -20,6 +20,7 @@
{% endblock %}
</head>
<body>
+
<div id = "header">
{% block nav %}
@@ -35,7 +36,7 @@
{% if user.is_authenticated %}
<li id="book-slot-nav"><a href="{% url 'slot_new' %}">Book slot</a></li>
<li id="download-log-nav"><a href="{% url 'experiment_logs' %}">Download log files</a></li>
- <li id="video-nav"><a href="">Show video</a></li>
+ <li id="video-nav"><a href="{% url 'show_video' %}">Show video</a></li>
{% if user.profile.is_moderator %}
<li id="admin-nav"><a href="{% url 'moderator_dashboard' %}">Moderator Dashboard</a></li>
{% endif %}
@@ -58,7 +59,7 @@
<div class="dropdown-menu">
<ul class="nav">
<li><a class="dropdown-item" href="{% url 'password_change'%}">Change Password</a></li>
- <li><a>Request machine change</a></li>
+ <li><a data-toggle="modal" data-target="#myModal">Request Machine Change</a></li>
<li><a href="{% url 'account_logout' %}">Logout</a></li>
</ul>
</div>
@@ -91,7 +92,6 @@
</div>
</div>
-
<div class="footer" id = "footer">
{% block footer %}
@@ -138,6 +138,25 @@
</div>
</div>
-
+{% if user.is_authenticated %}
+ <!-- Modal -->
+ <div class="modal fade" id="myModal" role="dialog">
+ <div class="modal-dialog">
+ <!-- Modal content-->
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal">&times;</button>
+ <h3>Machine change</h3>
+ </div>
+ <div class="modal-body">
+ <p>Please send an email to <strong>rupakrokade@iitb.ac.in</strong> stating the reasons why machine change is required.</p>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+ </div>
+{% endif %}
</body>
</html>
diff --git a/sbhs/templates/dashboard/all_images.html b/sbhs/templates/dashboard/all_images.html
index 102a93b..5a7b74e 100644
--- a/sbhs/templates/dashboard/all_images.html
+++ b/sbhs/templates/dashboard/all_images.html
@@ -1,9 +1,23 @@
{% extends 'dashboard/dashboard_index.html' %}
+{% load staticfiles %}
{% block title %}
All Images
{% endblock %}
{% block main %}
- <div>
- <h4>All Images</h4>
+ <div class = "container">
+ <div class = "row">
+ {% for b in boards %}
+ <div class="span4" style="text-align: center; outline: 1px solid black">
+ <img src="{% static b.image_link %}" alt="{{ b.mid }}" style="width:90%;">
+ <br>
+ Board MID: {{ b.mid }}
+ </div>
+ {% endfor %}
</div>
+ </div>
+<script type="text/javascript">
+ var timer = setInterval(function(){
+ location.reload();
+ }, 25000);
+</script>
{% endblock %} \ No newline at end of file
diff --git a/sbhs/templates/dashboard/show_all_boards.html b/sbhs/templates/dashboard/show_all_boards.html
index e247ffe..6ede6d8 100644
--- a/sbhs/templates/dashboard/show_all_boards.html
+++ b/sbhs/templates/dashboard/show_all_boards.html
@@ -27,7 +27,7 @@
<td>{{board.mid}}</td>
<td><span style="cursor: pointer;" class = "label label-{% if board.online %}success{% else %}danger{% endif %}">{% if board.online %}Online{% else %}Offline{% endif %}</span></td>
<td><span style="cursor: pointer;" class = "label label-{% if board.online %}success{% else %}danger{% endif %}">{% if board.online %}On{% else %}Off{% endif %}</span></td>
- <td><a href = "">View Image</a></td>
+ <td><a href = "{% url 'show_video_to_moderator' board.mid %}">View Image</a></td>
<td><a href = "{% url 'profile' board.mid %}">View Profile</a></td>
<td><a href = "{% url 'download_log' board.mid %}" target="_blank">Download</a></td>
</tr>
diff --git a/sbhs/templates/webcam/show_video.html b/sbhs/templates/webcam/show_video.html
new file mode 100644
index 0000000..1f372d7
--- /dev/null
+++ b/sbhs/templates/webcam/show_video.html
@@ -0,0 +1,54 @@
+{% extends "account/home.html" %}
+{% load staticfiles %}
+{% block title %}
+ Show video
+{% endblock %}
+{% block content %}
+ {% block headerfiles %}
+ <script type="{% static 'js/jquery-ui.js' %}"></script>
+ <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
+ {% endblock %}
+ <br>
+ <div>
+ <div>
+ <script type="text/javascript">
+ document.getElementById("video-nav").classList.add("active");
+ </script>
+ <div class = "">
+ <h3>SBHS live feed: Machine ID {{mid}}</h3>
+ <div class = "offeset4" style="text-align:center;">
+ </div>
+ <img src="{% static image_link %}" id="videoImage" alt="SBHS live feed" class = "offeset4">
+ <div class = "offeset4" style="text-align:center">
+ <a href="#" onclick = "image_reloader()" id = "image_reloader" class = "btn btn-primary btn-large">Refresh Image.</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ <script type="text/javascript">
+ {% if request.user.profile.is_moderator %}
+ setInterval(function(){
+ var refresh = new Image();
+ refresh.src = "{% url 'reload_image' mid %}";
+ document.getElementById("videoImage").src = "{% static image_link %}" + new Date().getTime();
+ }, 2000);
+ {% else %}
+ window.image_reloader = function(){
+ var button = document.getElementById("image_reloader");
+
+ if (!button.disabled){
+ button.setAttribute("disabled", true);
+ var refresh = new Image();
+ refresh.src = "{% url 'reload_image' mid %}";
+ document.getElementById("videoImage").src = "{% static image_link %}" + new Date.getTime();
+ setTimeout(function(){
+ button.removeAttribute("disabled");
+ }, 3000);
+ }
+ }
+ (function(){
+ image_reloader();
+ })();
+ {% endif %}
+ </script>
+{% endblock %} \ No newline at end of file