|
|
|
|
@ -1,54 +1,65 @@ |
|
|
|
|
<!doctype html>{% load staticfiles %} |
|
|
|
|
{#{% load compress %}#} |
|
|
|
|
<html> |
|
|
|
|
<html lang="ru"> |
|
|
|
|
<head> |
|
|
|
|
<meta charset='utf-8'> |
|
|
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge, chrome=1'> |
|
|
|
|
<meta name='viewport' content='width=device-width, initial-scale=1'> |
|
|
|
|
<!--<meta name='viewport' content='initial-scale=1.0, user-scalable=no, maximum-scale=1'>--> |
|
|
|
|
|
|
|
|
|
{% block head %}{% endblock %} |
|
|
|
|
|
|
|
|
|
<title>PROEKTON</title> |
|
|
|
|
|
|
|
|
|
{# {% compress css %}#} |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/jquery-ui/jquery-ui.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/bootstrap.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/font-awesome.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/reset.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/bootstrap-select/css/bootstrap-select.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/select2/select2.css" %}'> <!-- Tmp --> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/swiper.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/jquery.fileupload/css/jquery.fileupload.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "js/magnific-popup.css" %}'> |
|
|
|
|
<link rel="stylesheet" href='{% static "lib/jquery-jgrowl/jquery.jgrowl.min.css" %}'> |
|
|
|
|
|
|
|
|
|
{% block head_css %}{% endblock %} |
|
|
|
|
|
|
|
|
|
<link rel='stylesheet' href='{% static "css/main.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/extra.css" %}'> <!-- Our additional CSS --> |
|
|
|
|
{% if TEMPLATE_DEBUG %} |
|
|
|
|
<link rel='stylesheet' href='{% static "css/dev-colors.css" %}'> <!-- Dev-time only, temporary!!! --> |
|
|
|
|
{% endif %} |
|
|
|
|
{# {% endcompress %}#} |
|
|
|
|
<meta charset='utf-8'> |
|
|
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge, chrome=1'> |
|
|
|
|
<meta name='viewport' content='width=device-width, initial-scale=1'> |
|
|
|
|
<!--<meta name='viewport' content='initial-scale=1.0, user-scalable=no, maximum-scale=1'>--> |
|
|
|
|
|
|
|
|
|
{% block head %}{% endblock %} |
|
|
|
|
|
|
|
|
|
<title>PROEKTON</title> |
|
|
|
|
|
|
|
|
|
{# {% compress css %}#} |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/jquery-ui/jquery-ui.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/bootstrap.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/font-awesome.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/reset.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/bootstrap-select/css/bootstrap-select.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/select2/select2.css" %}'> <!-- Tmp --> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/swiper.min.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "lib/jquery.fileupload/css/jquery.fileupload.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "js/magnific-popup.css" %}'> |
|
|
|
|
<link rel="stylesheet" href='{% static "lib/jquery-jgrowl/jquery.jgrowl.min.css" %}'> |
|
|
|
|
|
|
|
|
|
{% block head_css %}{% endblock %} |
|
|
|
|
|
|
|
|
|
<link rel='stylesheet' href='{% static "css/main.css" %}'> |
|
|
|
|
<link rel='stylesheet' href='{% static "css/extra.css" %}'> <!-- Our additional CSS --> |
|
|
|
|
{% if TEMPLATE_DEBUG %} |
|
|
|
|
<link rel='stylesheet' href='{% static "css/dev-colors.css" %}'> <!-- Dev-time only, temporary!!! --> |
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
<link rel="icon" href="{% static 'img/favicon.jpg' %}" type="image/x-icon"> |
|
|
|
|
<link rel="shortcut icon" href="{% static 'img/favicon50.jpg' %}" type="image/x-icon"> |
|
|
|
|
<link rel="apple-touch-icon" href="{% static 'img/favicon128.jpg' %}" sizes="128x128" > |
|
|
|
|
<link rel="icon" type="image/png" href="{% static 'img/favicon50.jpg' %}" sizes="32x32"> |
|
|
|
|
<link rel="icon" type="image/png" href="{% static 'img/favicon18.jpg' %}" sizes="16x16"> |
|
|
|
|
|
|
|
|
|
{# {% endcompress %}#} |
|
|
|
|
<meta name="keywords" content=""> |
|
|
|
|
<meta name="description" content="_TEXT_"> |
|
|
|
|
<link rel="canonical" href="_URL_"> |
|
|
|
|
</head> |
|
|
|
|
|
|
|
|
|
<body> |
|
|
|
|
{% if messages %} |
|
|
|
|
{% for message in messages %} |
|
|
|
|
<div class="c" |
|
|
|
|
style="position: relative; padding: 10px; margin-bottom: 6px; z-index: 100">{{ message|safe }}</div> |
|
|
|
|
{% endfor %} |
|
|
|
|
{% for message in messages %} |
|
|
|
|
<div class="c" |
|
|
|
|
style="position: relative; padding: 10px; margin-bottom: 6px; z-index: 100">{{ message|safe }}</div> |
|
|
|
|
{% endfor %} |
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
{% if TEMPLATE_DEBUG %} |
|
|
|
|
<div ondblclick="$(this).css('display', 'none')" style="position: absolute; left: 0; bottom: 0; padding: 6px; color: black; background-color: {% if request.user.is_contractor %}#BADA55{% else %}#C0FFEE{% endif %}; z-index: 50"> |
|
|
|
|
{{ request.user }}<br> |
|
|
|
|
|
|
|
|
|
{% if request.user.is_authenticated %} |
|
|
|
|
<b>PK:</b> {{ request.user.pk }}<br> |
|
|
|
|
<b>Groups:</b> {{ request.user.groups.all }} |
|
|
|
|
{% endif %} |
|
|
|
|
<div ondblclick="$(this).css('display', 'none')" |
|
|
|
|
style="position: absolute; left: 0; bottom: 0; padding: 6px; color: black; background-color: {% if request.user.is_contractor %}#BADA55{% else %}#C0FFEE{% endif %}; z-index: 50"> |
|
|
|
|
{{ request.user }}<br> |
|
|
|
|
|
|
|
|
|
{% if request.user.is_authenticated %} |
|
|
|
|
<b>PK:</b> {{ request.user.pk }}<br> |
|
|
|
|
<b>Groups:</b> {{ request.user.groups.all }} |
|
|
|
|
{% endif %} |
|
|
|
|
</div> |
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
@ -82,42 +93,42 @@ |
|
|
|
|
<script src='{% static "index.js" %}'></script> <!-- Файл программистов --> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
var SocketHandlerMain = function (userId) { |
|
|
|
|
var domain = '{{ request.META.HTTP_HOST }}'; |
|
|
|
|
var port = '{{ request.META.SERVER_PORT }}'; |
|
|
|
|
var queryString = '{{ request.get_full_path }}'; |
|
|
|
|
|
|
|
|
|
if ((queryString.indexOf('/chat') != 0) && (queryString.indexOf('/users/contractor-office/work-projects') != 0)) { |
|
|
|
|
domain = domain.replace(':' + port, ''); |
|
|
|
|
var url = 'ws://' + domain + '/chat/' + userId + '/'; |
|
|
|
|
var sock = new WebSocket(url); |
|
|
|
|
var intervalId; |
|
|
|
|
sock.onopen = function () { |
|
|
|
|
intervalId = setInterval(function () { |
|
|
|
|
sock.send('{"dummy": 1}'); |
|
|
|
|
}, 15000); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
sock.onmessage = function (event) { |
|
|
|
|
var notificationData = JSON.parse(event.data); |
|
|
|
|
var outMessage = ""; |
|
|
|
|
if (notificationData.answer_type == 'add_message_contact'){ |
|
|
|
|
outMessage += "<a href='/chat/?user_id=" + notificationData.sender_id + "'>"+ notificationData.msg +"<a>"; |
|
|
|
|
}else if((notificationData.answer_type == 'approve_stages') || (notificationData.answer_type == 'add_message_order')){ |
|
|
|
|
outMessage += "<a href='/chat/#order" + notificationData.order_id + "'>"+ notificationData.msg +"<a>"; |
|
|
|
|
} |
|
|
|
|
$.jGrowl("Вам пришло новое сообщение!<br />" + outMessage, { life: 15000}); |
|
|
|
|
}; |
|
|
|
|
this.add_message = function (messageData) { |
|
|
|
|
sock.send(JSON.stringify(messageData)); |
|
|
|
|
}; |
|
|
|
|
var SocketHandlerMain = function (userId) { |
|
|
|
|
var domain = '{{ request.META.HTTP_HOST }}'; |
|
|
|
|
var port = '{{ request.META.SERVER_PORT }}'; |
|
|
|
|
var queryString = '{{ request.get_full_path }}'; |
|
|
|
|
|
|
|
|
|
if ((queryString.indexOf('/chat') != 0) && (queryString.indexOf('/users/contractor-office/work-projects') != 0)) { |
|
|
|
|
domain = domain.replace(':' + port, ''); |
|
|
|
|
var url = 'ws://' + domain + '/chat/' + userId + '/'; |
|
|
|
|
var sock = new WebSocket(url); |
|
|
|
|
var intervalId; |
|
|
|
|
sock.onopen = function () { |
|
|
|
|
intervalId = setInterval(function () { |
|
|
|
|
sock.send('{"dummy": 1}'); |
|
|
|
|
}, 15000); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
sock.onmessage = function (event) { |
|
|
|
|
var notificationData = JSON.parse(event.data); |
|
|
|
|
var outMessage = ""; |
|
|
|
|
if (notificationData.answer_type == 'add_message_contact') { |
|
|
|
|
outMessage += "<a href='/chat/?user_id=" + notificationData.sender_id + "'>" + notificationData.msg + "<a>"; |
|
|
|
|
} else if ((notificationData.answer_type == 'approve_stages') || (notificationData.answer_type == 'add_message_order')) { |
|
|
|
|
outMessage += "<a href='/chat/#order" + notificationData.order_id + "'>" + notificationData.msg + "<a>"; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var userId = '{{ request.user.pk }}'; |
|
|
|
|
if (userId) { |
|
|
|
|
var socketMain = new SocketHandlerMain(userId); |
|
|
|
|
$.jGrowl("Вам пришло новое сообщение!<br />" + outMessage, {life: 15000}); |
|
|
|
|
}; |
|
|
|
|
this.add_message = function (messageData) { |
|
|
|
|
sock.send(JSON.stringify(messageData)); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var userId = '{{ request.user.pk }}'; |
|
|
|
|
if (userId) { |
|
|
|
|
var socketMain = new SocketHandlerMain(userId); |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
{% block js_block %}{% endblock %} |
|
|
|
|
|