{% load static %}
<head>
<!-- <script src="{% static 'jquery-3.2.1.min.js' %}"></script> -->
<!-- <script src="static/jquery-3.2.1.min.js"></script> -->
</head>
<script>
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
var csrftoken = getCookie('csrftoken');
$.ajaxSetup({
beforeSend: function(xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
});
</script>
<body>
<div>
<h1 id='hdr_1'>{{ hdr1 }}</h1>
</div>
<table>
<tr>
{% if my_apps_list %}
{% for my_apps in my_apps_list %}
<td>
<button type="button" id="app{{ forloop.counter }}">
<img src="{% static my_apps.app_icon %}" alt="{{ my_apps.app_name }}" height="132" width="192">
</button><br><br>
<script>
$("#app{{ forloop.counter }}").click( function() {
$.post("{% url 'launch' %}",
{'appname': '{{ my_apps.app_name }}',
'apppath': '{{ my_apps.app_path }}',
'appexe': '{{ my_apps.app_exe }}',
'appargs': '{{ my_apps.app_args }}',
'appusr': '{{ my_apps.app_user }}',
'apppwd': '{{ my_apps.app_pwd }}',
'applook4': '{{ my_apps.app_wait4 }}',
'appdelay': '{{ my_apps.app_delay }}',
'appkeys': '{{ my_apps.app_keys }}'
}, function (msg) {
document.getElementById('appstatus').innerHTML = msg;
});
});
</script>
</td>
{% endfor %}
</tr>
</table>
<br>
<p id='appstatus'></p>
{% else %}
<p>No applications are available.</p>
{% endif %}
</body>