10 changed files with 278 additions and 534 deletions
-
33abonapp/tests.py
-
8agent/mod_mikrotik.py
-
16agent/settings.py
-
25clientsideapp/views.py
-
69djing/utils/load_from_nodeny.py
-
182djing/utils/save_from_nodeny.py
-
15taskapp/handle.py
-
362taskapp/locale/ru/LC_MESSAGES/django.po
-
15taskapp/models.py
-
13taskapp/views.py
@ -1,16 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
|
|
||||
|
|
||||
# Для установки модуля NAS смотрите в __init__ |
|
||||
|
|
||||
# Certificates |
|
||||
CERTFILE = "/etc/ssl/server.crt" |
|
||||
KEYFILE = "/etc/ssl/server.key" |
|
||||
|
|
||||
# Использовать-ли при передаче инфы между NAS и основным сервером SSL |
|
||||
IS_USE_SSL = False |
|
||||
|
|
||||
NAS_IP = '10.12.1.11' |
|
||||
NAS_LOGIN = 'admin' |
|
||||
NAS_PASSW = '2ekc3' |
|
||||
NAS_PORT = 8728 |
|
||||
@ -1,48 +1,55 @@ |
|||||
#!/bin/env python2 |
|
||||
|
#!/bin/env python3 |
||||
# coding=utf-8 |
# coding=utf-8 |
||||
|
|
||||
import os |
|
||||
import MySQLdb |
import MySQLdb |
||||
from json import dumps |
from json import dumps |
||||
|
|
||||
|
|
||||
if __name__ == "__main__": |
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djing.settings") |
|
||||
|
|
||||
db = MySQLdb.connect(host="localhost", user="root", passwd="PASSWORD", db="nodeny", charset='utf8') |
|
||||
cursor = db.cursor() |
|
||||
|
|
||||
result = dict() |
|
||||
|
|
||||
|
def load_users(cursor, grp_id): |
||||
# выбираем абонентов |
# выбираем абонентов |
||||
sql = r"SELECT users.name, users.fio, data0._adr_telefon, dictionary.v, data0._adr_house, data0._birthday, users.grp FROM users LEFT JOIN data0 ON (data0.uid=users.id) LEFT JOIN dictionary ON (dictionary.k=data0._adr_street AND dictionary.type='street') WHERE users.grp=23" |
|
||||
|
sql = r"SELECT users.name, users.fio, data0._adr_telefon, dictionary.v AS street, data0._adr_house, data0._birthday, users.grp, INET_NTOA(ip_pool.ip) AS ip, users.balance, AES_DECRYPT(users.passwd, 'Vu6saiZa') as decr_passwd FROM users LEFT JOIN data0 ON (data0.uid = users.id) LEFT JOIN dictionary ON (dictionary.k = data0._adr_street AND dictionary.type = 'street') LEFT JOIN ip_pool ON (ip_pool.uid = users.id) WHERE users.grp = %d" % grp_id |
||||
cursor.execute(sql) |
cursor.execute(sql) |
||||
result['users'] = list() |
|
||||
res = cursor.fetchone() |
|
||||
while res: |
|
||||
result['users'].append({ |
|
||||
'name': res[0], |
|
||||
'fio': res[1], |
|
||||
'tel': res[2], |
|
||||
'addr': u"ул. %s д. %s" % (res[3], res[4]), |
|
||||
'birth': int(res[5]), |
|
||||
'grp': int(res[6]) |
|
||||
}) |
|
||||
res = cursor.fetchone() |
|
||||
|
|
||||
|
users = [{ |
||||
|
'name': str(res[0]), |
||||
|
'fio': str(res[1]), |
||||
|
'tel': str(res[2]), |
||||
|
'street': str(res[3] or ''), |
||||
|
'house': str(res[4]), |
||||
|
'birth': res[5], |
||||
|
'grp': int(res[6]), |
||||
|
'ip': str(res[7] or ''), |
||||
|
'balance': float(res[8]), |
||||
|
'passw': res[9].decode("utf-8") if res[9] is not None else '' |
||||
|
} for res in cursor.fetchall()] |
||||
|
return users |
||||
|
|
||||
|
|
||||
|
|
||||
|
def load_groups(cursor): |
||||
# выбираем группы |
# выбираем группы |
||||
sql = r'SELECT grp_id, grp_name FROM user_grp' |
sql = r'SELECT grp_id, grp_name FROM user_grp' |
||||
cursor.execute(sql) |
cursor.execute(sql) |
||||
result['groups'] = list() |
|
||||
res = cursor.fetchone() |
|
||||
while res: |
|
||||
result['groups'].append({ |
|
||||
|
groups = list() |
||||
|
for res in cursor.fetchall(): |
||||
|
users = load_users(cursor=cursor, grp_id=int(res[0])) |
||||
|
groups.append({ |
||||
'gid': int(res[0]), |
'gid': int(res[0]), |
||||
'gname': res[1] |
|
||||
|
'gname': res[1], |
||||
|
'users': users |
||||
}) |
}) |
||||
res = cursor.fetchone() |
|
||||
|
return groups |
||||
|
|
||||
|
|
||||
|
|
||||
|
if __name__ == "__main__": |
||||
|
db = MySQLdb.connect(host="127.0.0.1", user="<username>", passwd="<password>", db="db", charset='utf8') |
||||
|
cursor = db.cursor() |
||||
|
|
||||
|
result = dict() |
||||
|
|
||||
|
result['groups'] = load_groups(cursor=cursor) |
||||
db.close() |
db.close() |
||||
f = open('dump_chkal.json', 'w') |
|
||||
f.write(dumps(result, ensure_ascii=False).encode('utf8')) |
|
||||
|
f = open('dump.json', 'w') |
||||
|
f.write(dumps(result, ensure_ascii=False)) |
||||
f.close() |
f.close() |
||||
@ -1,362 +0,0 @@ |
|||||
# SOME DESCRIPTIVE TITLE. |
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
|
||||
# This file is distributed under the same license as the PACKAGE package. |
|
||||
# Dmitry Novikov nerosketch@gmail.com, 2017. |
|
||||
# |
|
||||
#, fuzzy |
|
||||
msgid "" |
|
||||
msgstr "" |
|
||||
"Project-Id-Version: PACKAGE VERSION\n" |
|
||||
"Report-Msgid-Bugs-To: \n" |
|
||||
"POT-Creation-Date: 2017-02-27 12:27+0300\n" |
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
||||
"Last-Translator: Dmitry Novikov nerosketch@gmail.com\n" |
|
||||
"Language: ru\n" |
|
||||
"MIME-Version: 1.0\n" |
|
||||
"Content-Type: text/plain; charset=UTF-8\n" |
|
||||
"Content-Transfer-Encoding: 8bit\n" |
|
||||
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" |
|
||||
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" |
|
||||
"%100>=11 && n%100<=14)? 2 : 3);\n" |
|
||||
|
|
||||
#: taskapp/forms.py:16 |
|
||||
msgid "Short description" |
|
||||
msgstr "Краткое описание" |
|
||||
|
|
||||
#: taskapp/handle.py:14 |
|
||||
msgid "Task" |
|
||||
msgstr "Задача" |
|
||||
|
|
||||
#: taskapp/handle.py:23 |
|
||||
msgid "Task completed" |
|
||||
msgstr "Задача завершена" |
|
||||
|
|
||||
#: taskapp/handle.py:29 |
|
||||
#, python-format |
|
||||
msgid "address %s. telephone %s. " |
|
||||
msgstr "по адресу %s тел. %s. " |
|
||||
|
|
||||
#: taskapp/handle.py:32 |
|
||||
#, python-format |
|
||||
msgid "locality %s. Task type - %s. " |
|
||||
msgstr "с. %s. Тип задачи - %s. " |
|
||||
|
|
||||
#: taskapp/handle.py:33 taskapp/templates/taskapp/view.html.py:34 |
|
||||
msgid "Not assigned" |
|
||||
msgstr "<Не назначено>" |
|
||||
|
|
||||
#: taskapp/models.py:13 |
|
||||
msgid "Higher" |
|
||||
msgstr "Высший" |
|
||||
|
|
||||
#: taskapp/models.py:14 |
|
||||
msgid "Average" |
|
||||
msgstr "Средний" |
|
||||
|
|
||||
#: taskapp/models.py:15 |
|
||||
msgid "Low" |
|
||||
msgstr "Низкий" |
|
||||
|
|
||||
#: taskapp/models.py:19 |
|
||||
msgid "New" |
|
||||
msgstr "Новая" |
|
||||
|
|
||||
#: taskapp/models.py:20 |
|
||||
msgid "In fulfilling" |
|
||||
msgstr "На выполнении" |
|
||||
|
|
||||
#: taskapp/models.py:21 |
|
||||
msgid "Completed" |
|
||||
msgstr "Выполнена" |
|
||||
|
|
||||
#: taskapp/models.py:25 |
|
||||
msgid "not chosen" |
|
||||
msgstr "не выбрано" |
|
||||
|
|
||||
#: taskapp/models.py:26 |
|
||||
msgid "yellow triangle" |
|
||||
msgstr "жёлтый треугольник" |
|
||||
|
|
||||
#: taskapp/models.py:27 |
|
||||
msgid "red cross" |
|
||||
msgstr "красный крестик" |
|
||||
|
|
||||
#: taskapp/models.py:28 |
|
||||
msgid "weak speed" |
|
||||
msgstr "слабая скорость" |
|
||||
|
|
||||
#: taskapp/models.py:29 |
|
||||
msgid "cable break" |
|
||||
msgstr "обрыв кабеля" |
|
||||
|
|
||||
#: taskapp/models.py:30 |
|
||||
msgid "connection" |
|
||||
msgstr "подключение" |
|
||||
|
|
||||
#: taskapp/models.py:31 |
|
||||
msgid "periodic disappearance" |
|
||||
msgstr "переодическое пропадание" |
|
||||
|
|
||||
#: taskapp/models.py:32 |
|
||||
msgid "router setup" |
|
||||
msgstr "настройка роутера" |
|
||||
|
|
||||
#: taskapp/models.py:33 |
|
||||
msgid "configure onu" |
|
||||
msgstr "настроить onu" |
|
||||
|
|
||||
#: taskapp/models.py:34 |
|
||||
msgid "crimp cable" |
|
||||
msgstr "обжать кабель" |
|
||||
|
|
||||
#: taskapp/models.py:35 |
|
||||
msgid "other" |
|
||||
msgstr "другое" |
|
||||
|
|
||||
#: taskapp/models.py:42 |
|
||||
msgid "Change task" |
|
||||
msgstr "Изменение задачи" |
|
||||
|
|
||||
#: taskapp/models.py:43 |
|
||||
msgid "Create task" |
|
||||
msgstr "Создание задачи" |
|
||||
|
|
||||
#: taskapp/models.py:44 |
|
||||
msgid "Delete task" |
|
||||
msgstr "Удаление задачи" |
|
||||
|
|
||||
#: taskapp/models.py:45 |
|
||||
msgid "Completing tasks" |
|
||||
msgstr "Завершение задачи" |
|
||||
|
|
||||
#: taskapp/models.py:46 |
|
||||
msgid "The task started" |
|
||||
msgstr "Задача начата" |
|
||||
|
|
||||
#: taskapp/models.py:77 |
|
||||
msgid "Access to all tasks" |
|
||||
msgstr "Доступ ко всем задачам" |
|
||||
|
|
||||
#: taskapp/models.py:78 |
|
||||
msgid "Reminders of tasks" |
|
||||
msgstr "Напоминания о задачах" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:7 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:7 |
|
||||
#: taskapp/templates/taskapp/view.html:7 |
|
||||
msgid "Tasks" |
|
||||
msgstr "Задачи" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:8 |
|
||||
#: taskapp/templates/taskapp/tasklist.html:48 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:46 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:54 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:43 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:40 |
|
||||
msgid "Edit" |
|
||||
msgstr "Редактировать" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:8 |
|
||||
msgid "Create" |
|
||||
msgstr "Создать" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:15 |
|
||||
#: taskapp/templates/taskapp/footer_btns.html:3 |
|
||||
#: taskapp/templates/taskapp/footer_btns.html:4 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:75 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:76 |
|
||||
msgid "Add new task" |
|
||||
msgstr "Добавьте новую задачу" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:27 |
|
||||
#: taskapp/templates/taskapp/tasklist.html:10 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:10 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:22 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:10 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:10 |
|
||||
#: taskapp/templates/taskapp/view.html:19 |
|
||||
msgid "Description" |
|
||||
msgstr "Описание" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:35 |
|
||||
#: taskapp/templates/taskapp/tasklist.html:12 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:12 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:24 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:12 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:11 |
|
||||
msgid "The nature of the damage" |
|
||||
msgstr "Характер поломки" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:43 |
|
||||
#: taskapp/templates/taskapp/tasklist.html:14 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:14 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:26 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:14 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:13 |
|
||||
msgid "A priority" |
|
||||
msgstr "Приоритет" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:51 |
|
||||
#: taskapp/templates/taskapp/tasklist.html:13 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:13 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:25 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:13 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:12 |
|
||||
msgid "Condition" |
|
||||
msgstr "Состояние" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:59 |
|
||||
#: taskapp/templates/taskapp/view.html:30 |
|
||||
msgid "Subscriber" |
|
||||
msgstr "Абонент" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:75 |
|
||||
msgid "Reality (the date by which you must complete the task)" |
|
||||
msgstr "Актуальность (дата, до которой нужно завершить задачу)" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:91 |
|
||||
msgid "Attached image" |
|
||||
msgstr "Прикреплённое изображение" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:99 |
|
||||
msgid "Save" |
|
||||
msgstr "Сохранить" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/add_edit_task.html:102 |
|
||||
msgid "Reset" |
|
||||
msgstr "Сбросить" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/footer_btns.html:9 |
|
||||
msgid "View all tasks" |
|
||||
msgstr "Просмотреть все задачи" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist.html:11 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:11 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:23 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:11 |
|
||||
msgid "Task author" |
|
||||
msgstr "Кто назначил" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist.html:15 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:15 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:27 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:15 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:14 |
|
||||
#: taskapp/templates/taskapp/view.html:27 |
|
||||
msgid "Date of create" |
|
||||
msgstr "Дата создания" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist.html:16 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:16 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:28 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:16 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:15 |
|
||||
#: taskapp/templates/taskapp/view.html:37 |
|
||||
msgid "Attachment" |
|
||||
msgstr "Приложение" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist.html:17 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:17 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:29 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:17 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:16 |
|
||||
msgid "Actions" |
|
||||
msgstr "Действия" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist.html:41 |
|
||||
msgid "Begin" |
|
||||
msgstr "Начать" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist.html:44 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:42 |
|
||||
msgid "Complete" |
|
||||
msgstr "Завершить" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist.html:56 |
|
||||
#: taskapp/templates/taskapp/tasklist_active.html:54 |
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:67 |
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:56 |
|
||||
msgid "The list is empty" |
|
||||
msgstr "Список пуст" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:8 |
|
||||
msgid "All tasks" |
|
||||
msgstr "Все задачи" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:14 |
|
||||
msgid "Records of all the tasks in the system" |
|
||||
msgstr "Лог всех задач в системе" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist_all.html:59 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:45 |
|
||||
msgid "Remind" |
|
||||
msgstr "Напомнить" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist_finish.html:48 |
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:50 |
|
||||
msgid "Delete" |
|
||||
msgstr "Удалить" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/tasklist_own.html:58 |
|
||||
msgid "All your tasks has been performed" |
|
||||
msgstr "Все ваши задачи выполнены" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/view.html:15 |
|
||||
msgid "Task description" |
|
||||
msgstr "Описание задачи" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/view.html:20 |
|
||||
msgid "Implementers" |
|
||||
msgstr "Исполнители" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/view.html:26 |
|
||||
msgid "The task is valid until" |
|
||||
msgstr "Задача действительна до" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/view.html:28 |
|
||||
#, fuzzy |
|
||||
#| msgid "Time left" |
|
||||
msgid "time left" |
|
||||
msgstr "Времени осталось" |
|
||||
|
|
||||
#: taskapp/templates/taskapp/view.html:29 |
|
||||
msgid "Task type" |
|
||||
msgstr "Тип задачи" |
|
||||
|
|
||||
#: taskapp/views.py:84 |
|
||||
msgid "You cannot delete task that assigned to you" |
|
||||
msgstr "Вы не можете удалять назначенные на вас задачи" |
|
||||
|
|
||||
#: taskapp/views.py:148 |
|
||||
msgid "No responsible employee for the users group" |
|
||||
msgstr "Нет ответственных за группу, в которой находится выбранный абонент" |
|
||||
|
|
||||
#: taskapp/views.py:150 |
|
||||
msgid "You must select the subscriber" |
|
||||
msgstr "Нужно выбрать абонента" |
|
||||
|
|
||||
#: taskapp/views.py:152 |
|
||||
msgid "Error in the form fields" |
|
||||
msgstr "Ошибка в полях формы" |
|
||||
|
|
||||
#: taskapp/views.py:154 |
|
||||
msgid "Employee has not yet signed up for notifications" |
|
||||
msgstr "Исполнитель ещё не подписался на оповещения" |
|
||||
|
|
||||
msgid "Tasks to be performed" |
|
||||
msgstr "Задачи, которые необходимо выполнить" |
|
||||
|
|
||||
msgid "New tasks" |
|
||||
msgstr "Новые задачи" |
|
||||
|
|
||||
msgid "Active tasks" |
|
||||
msgstr "Активные задачи" |
|
||||
|
|
||||
msgid "Completed tasks" |
|
||||
msgstr "Выполненные задачи" |
|
||||
|
|
||||
msgid "Scheduled tasks me" |
|
||||
msgstr "Назначенные мной задачи" |
|
||||
|
|
||||
msgid "All my tasks" |
|
||||
msgstr "Все мои задачи" |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue