2020-08-12 00:36:09 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<!-- Required meta tags -->
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
2020-08-27 22:35:08 +00:00
|
|
|
{% block meta %}{% end %}
|
2020-08-12 00:36:09 +00:00
|
|
|
<title>{% block title %}{{ _('Default') }}{% end %}</title>
|
|
|
|
|
|
|
|
<!-- plugins:css -->
|
|
|
|
<link rel="stylesheet" href="/static/assets/vendors/mdi/css/materialdesignicons.min.css">
|
|
|
|
<link rel="stylesheet" href="/static/assets/vendors/flag-icon-css/css/flag-icon.min.css">
|
|
|
|
<link rel="stylesheet" href="/static/assets/vendors/ti-icons/css/themify-icons.css">
|
|
|
|
<link rel="stylesheet" href="/static/assets/vendors/typicons/typicons.css">
|
2020-08-24 23:11:17 +00:00
|
|
|
<link rel="stylesheet" href="/static/assets/vendors/fontawesome5/css/all.css">
|
2020-12-13 18:40:55 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.22/fh-3.1.7/r-2.2.6/sc-2.0.3/sp-1.2.2/datatables.min.css"/>
|
2020-08-12 00:36:09 +00:00
|
|
|
<link rel="stylesheet" href="/static/assets/vendors/css/vendor.bundle.base.css">
|
2020-08-26 14:25:20 +00:00
|
|
|
<link rel="stylesheet" href="/static/assets/css/crafty.css">
|
2020-08-23 22:43:28 +00:00
|
|
|
|
2020-08-12 00:36:09 +00:00
|
|
|
<!-- endinject -->
|
|
|
|
|
|
|
|
<!-- Plugin css for this page -->
|
|
|
|
<link rel="stylesheet" href="/static/assets/vendors/jvectormap/jquery-jvectormap.css">
|
|
|
|
<!-- End Plugin css for this page -->
|
|
|
|
|
|
|
|
<!-- Layout styles -->
|
|
|
|
<link rel="stylesheet" href="/static/assets/css/dark/style.css">
|
|
|
|
<!-- End Layout styles -->
|
|
|
|
|
|
|
|
<link rel="shortcut icon" href="/static/assets/images/favicon.png" />
|
2020-08-23 22:43:28 +00:00
|
|
|
<link rel="stylesheet" href="/static/assets/css/crafty.css">
|
2020-08-12 00:36:09 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body class="dark-theme">
|
|
|
|
<div class="container-scroller">
|
|
|
|
<!-- partial:partials/_navbar.html -->
|
|
|
|
<nav class="navbar default-layout col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
|
|
|
|
<div class="text-center navbar-brand-wrapper d-flex align-items-top justify-content-center">
|
2020-08-19 01:04:43 +00:00
|
|
|
<a class="navbar-brand brand-logo" href="/panel/dashboard">
|
2020-08-12 00:36:09 +00:00
|
|
|
<img src="/static/assets/images/logo_long.jpg" alt="logo" /> </a>
|
2020-08-19 01:04:43 +00:00
|
|
|
<a class="navbar-brand brand-logo-mini" href="/panel/dashboard">
|
2020-08-12 00:36:09 +00:00
|
|
|
<img src="/static/assets/images/logo_square.jpg" alt="logo" /> </a>
|
|
|
|
</div>
|
|
|
|
<div class="navbar-menu-wrapper d-flex align-items-center">
|
|
|
|
<button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
|
|
|
|
<span class="mdi mdi-menu"></span>
|
|
|
|
</button>
|
2020-09-22 22:23:14 +00:00
|
|
|
|
2020-08-12 00:36:09 +00:00
|
|
|
{% include notify.html %}
|
|
|
|
|
|
|
|
<button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
|
|
|
|
<span class="mdi mdi-menu"></span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
{% include main_menu.html %}
|
|
|
|
|
|
|
|
<div class="main-panel">
|
|
|
|
|
2021-01-11 19:51:38 +00:00
|
|
|
<div class="warnings">
|
2021-03-26 13:57:50 +00:00
|
|
|
<noscript class="noscript-warning" style="padding: 20px; background-color: rgb(247, 151, 15);">
|
2021-09-29 02:25:47 +00:00
|
|
|
<div>{% raw translate('base', 'doesNotWorkWithoutJavascript', data['lang']) %}</div>
|
2021-03-26 13:57:50 +00:00
|
|
|
</noscript>
|
2021-01-11 19:51:38 +00:00
|
|
|
</div>
|
2020-12-17 13:39:29 +00:00
|
|
|
|
2020-08-12 00:36:09 +00:00
|
|
|
{% block content %}
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% include footer.html %}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- main-panel ends -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- page-body-wrapper ends -->
|
|
|
|
</div>
|
2020-08-23 22:43:28 +00:00
|
|
|
|
|
|
|
|
2021-02-27 12:05:04 +00:00
|
|
|
<style>
|
|
|
|
.notifications {
|
|
|
|
position: fixed;
|
|
|
|
width: 200px;
|
|
|
|
top: 70px;
|
|
|
|
right: 0px;
|
|
|
|
}
|
|
|
|
.notification {
|
|
|
|
position: relative;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: 0.5rem;
|
|
|
|
padding-left: 0.7rem;
|
|
|
|
width: 180px;
|
|
|
|
margin-left: 10px;
|
|
|
|
margin-right: 10px;
|
|
|
|
background: #282a40;
|
|
|
|
transition: right 0.75s, opacity 0.75s, top 0.75s;
|
|
|
|
right: -6rem;
|
|
|
|
opacity: 0.1;
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
z-index: 999;
|
|
|
|
top: 0px;
|
|
|
|
}
|
|
|
|
.notification.active {
|
|
|
|
right: 0rem;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
.notification.remove {
|
|
|
|
right: 0rem;
|
|
|
|
opacity: 0.1;
|
|
|
|
top: -2rem;
|
|
|
|
}
|
|
|
|
.notification p {
|
|
|
|
margin: 0px;
|
|
|
|
width: calc(160.8px - 16px);
|
|
|
|
z-index: inherit;
|
|
|
|
}
|
|
|
|
.notification span {
|
|
|
|
position: absolute;
|
|
|
|
right: 0.5rem;
|
|
|
|
top: 0.46rem;
|
|
|
|
cursor: pointer;
|
|
|
|
font-weight: bold;
|
|
|
|
line-height: 20px;
|
|
|
|
font-size: 22px;
|
|
|
|
user-select: none;
|
|
|
|
z-index: inherit;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<div class="notifications"></div>
|
|
|
|
|
|
|
|
|
2020-08-12 00:36:09 +00:00
|
|
|
<script src="/static/assets/vendors/js/vendor.bundle.base.js"></script>
|
2020-08-19 01:04:43 +00:00
|
|
|
<script src="/static/assets/js/shared/off-canvas.js"></script>
|
|
|
|
<script src="/static/assets/js/shared/hoverable-collapse.js"></script>
|
2020-08-23 22:43:28 +00:00
|
|
|
<script src="/static/assets/js/shared/misc.js"></script>
|
2020-12-13 18:40:55 +00:00
|
|
|
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.10.22/fh-3.1.7/r-2.2.6/sc-2.0.3/sp-1.2.2/datatables.min.js"></script>
|
2020-08-23 22:43:28 +00:00
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js"></script>
|
2020-08-12 00:36:09 +00:00
|
|
|
|
2020-08-24 23:11:17 +00:00
|
|
|
<script>
|
2021-01-11 19:51:38 +00:00
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
$.extend($.fn.dataTable.defaults, {
|
2021-09-29 02:25:47 +00:00
|
|
|
language: {% raw translate('datatables', 'i18n', data['lang']) %}
|
2021-03-26 13:57:50 +00:00
|
|
|
})
|
2021-01-11 19:51:38 +00:00
|
|
|
|
2020-08-24 23:11:17 +00:00
|
|
|
//used to get cookies from browser - this is part of tornados xsrf protection - it's for extra security
|
|
|
|
function getCookie(name) {
|
|
|
|
var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
|
|
|
|
return r ? r[1] : undefined;
|
|
|
|
}
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
// tool tips
|
2020-08-24 23:11:17 +00:00
|
|
|
$(function () {
|
|
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
|
|
})
|
2020-09-23 01:42:41 +00:00
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
// Notify
|
2020-09-23 01:42:41 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
$("#notificationDropdown").click(function(){
|
|
|
|
$.get("/ajax/announcements", function(data){
|
|
|
|
console.log(data);
|
|
|
|
bootbox.alert({
|
|
|
|
title: "Notifications",
|
|
|
|
message: data,
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2020-12-17 13:39:29 +00:00
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
// {% if request.protocol == 'https' %}
|
2020-12-17 13:39:29 +00:00
|
|
|
let usingWebSockets = true;
|
|
|
|
|
2021-02-27 12:05:04 +00:00
|
|
|
let listenEvents = [];
|
2020-12-17 13:39:29 +00:00
|
|
|
|
|
|
|
try {
|
2021-08-10 20:17:56 +00:00
|
|
|
pageQueryParams = 'page_query_params=' + encodeURIComponent(location.search)
|
|
|
|
page = 'page=' + encodeURIComponent(location.pathname)
|
|
|
|
var wsInternal = new WebSocket('wss://' + location.host + '/ws?' + page + '&' + pageQueryParams);
|
2020-12-17 13:39:29 +00:00
|
|
|
wsInternal.onopen = function() {
|
|
|
|
console.log('opened WebSocket connection:', wsInternal)
|
|
|
|
};
|
2021-02-27 12:05:04 +00:00
|
|
|
wsInternal.onmessage = function (rawMessage) {
|
|
|
|
var message = JSON.parse(rawMessage.data);
|
2020-12-17 13:39:29 +00:00
|
|
|
|
|
|
|
console.log('got message: ', message)
|
|
|
|
|
2021-02-27 12:05:04 +00:00
|
|
|
listenEvents
|
|
|
|
.filter(listenedEvent => listenedEvent.event == message.event)
|
|
|
|
.forEach(listenedEvent => listenedEvent.callback(message.data))
|
2021-03-01 00:54:20 +00:00
|
|
|
};
|
|
|
|
wsInternal.onerror = function (errorEvent) {
|
|
|
|
console.error('WebSocket Error', errorEvent);
|
|
|
|
};
|
|
|
|
wsInternal.onclose = function (closeEvent) {
|
|
|
|
console.log('Closed WebSocket', closeEvent);
|
|
|
|
};
|
2020-12-17 13:39:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
webSocket = {
|
2021-02-27 12:05:04 +00:00
|
|
|
on: function (event, callback) {
|
|
|
|
console.log('registered ' + event + ' event');
|
|
|
|
listenEvents.push({ event: event, callback: callback })
|
2020-12-17 13:39:29 +00:00
|
|
|
},
|
2021-02-27 12:05:04 +00:00
|
|
|
emit: function (event, data) {
|
2020-12-17 13:39:29 +00:00
|
|
|
var message = {
|
2021-02-27 12:05:04 +00:00
|
|
|
event: event,
|
2020-12-17 13:39:29 +00:00
|
|
|
data: data
|
|
|
|
}
|
|
|
|
|
|
|
|
wsInternal.send(JSON.stringify(message));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.error('Error while making websocket helpers', error);
|
|
|
|
usingWebSockets = false;
|
|
|
|
}
|
2021-03-26 13:57:50 +00:00
|
|
|
// {% else %}
|
2020-12-17 13:39:29 +00:00
|
|
|
let usingWebSockets = false;
|
|
|
|
warn('WebSockets are not supported in Crafty if not using the https protocol')
|
2021-02-27 12:05:04 +00:00
|
|
|
var webSocket;
|
2021-03-26 13:57:50 +00:00
|
|
|
// {% end%}
|
2020-12-17 13:39:29 +00:00
|
|
|
|
2021-08-07 18:25:47 +00:00
|
|
|
if (webSocket) {
|
|
|
|
webSocket.on('send_start_error', function (start_error) {
|
2021-08-10 20:37:47 +00:00
|
|
|
var x = document.querySelector('.bootbox');
|
|
|
|
if(x){
|
|
|
|
x.remove()}
|
|
|
|
var x = document.querySelector('.modal-backdrop');
|
|
|
|
if(x){
|
|
|
|
x.remove()}
|
2021-09-13 17:10:34 +00:00
|
|
|
bootbox.alert({
|
|
|
|
message: start_error.error,
|
|
|
|
callback: function () {
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
})
|
2021-08-07 19:23:22 +00:00
|
|
|
});
|
|
|
|
}
|
2021-08-07 18:25:47 +00:00
|
|
|
|
|
|
|
|
2020-12-17 13:39:29 +00:00
|
|
|
function warn(message) {
|
|
|
|
var closeEl = document.createElement('span');
|
|
|
|
var strongEL = document.createElement('strong');
|
|
|
|
var msgEl = document.createElement('div');
|
|
|
|
|
|
|
|
closeEl.innerHTML = '×';
|
|
|
|
strongEL.textContent = 'Warning: ';
|
|
|
|
msgEl.append(strongEL, message);
|
|
|
|
|
|
|
|
|
|
|
|
closeEl.style.marginLeft = '15px';
|
|
|
|
closeEl.style.fontWeight = 'bold';
|
2021-02-27 12:07:16 +00:00
|
|
|
closeEl.style.float = 'right';
|
2021-02-27 12:05:04 +00:00
|
|
|
closeEl.style.fontSize = '22px';
|
2021-02-27 12:07:16 +00:00
|
|
|
closeEl.style.lineHeight = '20px';
|
2020-12-17 13:39:29 +00:00
|
|
|
closeEl.style.cursor = 'pointer';
|
|
|
|
|
|
|
|
closeEl.addEventListener('click', function () {this.parentElement.style.display='none';});
|
|
|
|
|
|
|
|
var parentEl = document.createElement('div');
|
|
|
|
|
|
|
|
parentEl.style.padding = '20px';
|
|
|
|
parentEl.style.backgroundColor = '#f7970f';
|
|
|
|
|
|
|
|
parentEl.appendChild(closeEl);
|
|
|
|
parentEl.appendChild(msgEl);
|
|
|
|
|
|
|
|
document.querySelector('.warnings').appendChild(parentEl);
|
|
|
|
}
|
|
|
|
|
2021-02-27 12:05:04 +00:00
|
|
|
function closeNotification(element) {
|
|
|
|
element.parentElement.classList.add('remove');
|
|
|
|
setTimeout(function () {
|
|
|
|
element.parentElement.remove();
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
|
|
|
|
function notify(message) {
|
|
|
|
console.log(`notify(${message}})`);
|
|
|
|
var paragraphEl = document.createElement('p');
|
|
|
|
var closeEl = document.createElement('span');
|
|
|
|
|
|
|
|
paragraphEl.textContent = message;
|
|
|
|
|
|
|
|
closeEl.innerHTML = '×';
|
|
|
|
closeEl.addEventListener('click', function () {closeNotification(this)});
|
|
|
|
|
|
|
|
var parentEl = document.createElement('div');
|
|
|
|
parentEl.appendChild(paragraphEl);
|
|
|
|
parentEl.appendChild(closeEl);
|
|
|
|
|
|
|
|
parentEl.classList.add('notification');
|
|
|
|
|
|
|
|
document.querySelector('.notifications').appendChild(parentEl);
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
parentEl.classList.add('active');
|
|
|
|
}, 200);
|
|
|
|
|
|
|
|
setTimeout(function (element) {
|
|
|
|
closeNotification(element);
|
|
|
|
}, 7500, closeEl);
|
|
|
|
|
|
|
|
`
|
|
|
|
<div class="notification">
|
|
|
|
<p>Hello, World! This text should overflow</p>
|
|
|
|
<span>×</span>
|
|
|
|
</div>
|
|
|
|
`
|
|
|
|
}
|
|
|
|
webSocket.on('notification', notify);
|
|
|
|
|
2020-08-24 23:11:17 +00:00
|
|
|
</script>
|
2020-08-12 00:36:09 +00:00
|
|
|
|
2020-08-23 22:43:28 +00:00
|
|
|
{% block js %}
|
2020-08-12 00:36:09 +00:00
|
|
|
<!-- Custom js for this page -->
|
|
|
|
<!-- End custom js for this page -->
|
2020-08-23 22:43:28 +00:00
|
|
|
{% end %}
|
|
|
|
|
2020-08-12 00:36:09 +00:00
|
|
|
</body>
|
|
|
|
</html>
|