8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-09-12 01:03:09 +00:00

Translation of logs/ (front)

This commit is contained in:
Laouen Fernet 2018-08-05 18:57:36 +02:00
parent 2ecf6b86f1
commit f6130c2335
16 changed files with 619 additions and 238 deletions

View file

@ -25,6 +25,7 @@
Here are defined some functions to check acl on the application.
"""
from django.utils.translation import ugettext as _
def can_view(user):
@ -38,4 +39,6 @@ def can_view(user):
viewing is granted and msg is a message (can be None).
"""
can = user.has_module_perms('admin')
return can, None if can else "Vous ne pouvez pas voir cette application."
return can, None if can else _("You don't have the right to view this"
" application.")

Binary file not shown.

View file

@ -0,0 +1,338 @@
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
# Copyright © 2018 Maël Kervella
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
msgid ""
msgstr ""
"Project-Id-Version: 2.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-15 20:12+0200\n"
"PO-Revision-Date: 2018-06-23 16:01+0200\n"
"Last-Translator: Laouen Fernet <laouen.fernet@supelec.fr>\n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: acl.py:42
msgid "You don't have the right to view this application."
msgstr "Vous n'avez pas le droit de voir cette application."
#: templates/logs/aff_stats_logs.html:36
msgid "Edited object"
msgstr "Objet modifié"
#: templates/logs/aff_stats_logs.html:37
#: templates/logs/aff_stats_models.html:32
msgid "Object type"
msgstr "Type d'objet"
#: templates/logs/aff_stats_logs.html:38
msgid "Edited by"
msgstr "Modifié par"
#: templates/logs/aff_stats_logs.html:40
msgid "Date of editing"
msgstr "Date de modification"
#: templates/logs/aff_stats_logs.html:42
msgid "Comment"
msgstr "Commentaire"
#: templates/logs/aff_stats_logs.html:58 templates/logs/aff_summary.html:62
#: templates/logs/aff_summary.html:85 templates/logs/aff_summary.html:104
#: templates/logs/aff_summary.html:123 templates/logs/aff_summary.html:142
msgid "Cancel"
msgstr "Annuler"
#: templates/logs/aff_stats_models.html:29
#, python-format
msgid "Statistics of the set %(key)s"
msgstr "Statistiques de l'ensemble %(key)s"
#: templates/logs/aff_stats_models.html:33
msgid "Number of stored entries"
msgstr "Nombre d'entrées enregistrées"
#: templates/logs/aff_stats_users.html:31
#, python-format
msgid "Statistics per %(key_dict)s of %(key)s"
msgstr "Statistiques par %(key_dict)s de %(key)s"
#: templates/logs/aff_stats_users.html:34
#, python-format
msgid "Number of %(key)s per %(key_dict)s"
msgstr "Nombre de %(key)s par %(key_dict)s"
#: templates/logs/aff_stats_users.html:35
msgid "Rank"
msgstr "Rang"
#: templates/logs/aff_summary.html:37
msgid "Date"
msgstr "Date"
#: templates/logs/aff_summary.html:39
msgid "Editing"
msgstr "Modification"
#: templates/logs/aff_summary.html:48
#, python-format
msgid "%(username)s has banned"
msgstr "%(username)s a banni"
#: templates/logs/aff_summary.html:52 templates/logs/aff_summary.html:75
msgid "No reason"
msgstr "Aucun motif"
#: templates/logs/aff_summary.html:71
#, python-format
msgid "%(username)s has graciously authorised"
msgstr "%(username)s a autorisé gracieusement"
#: templates/logs/aff_summary.html:94
#, python-format
msgid "%(username)s has updated"
msgstr "%(username)s a mis à jour"
#: templates/logs/aff_summary.html:113
#, python-format
msgid "%(username)s has sold %(number)sx %(name)s to"
msgstr "%(username)s a vendu %(number)sx %(name)s à"
#: templates/logs/aff_summary.html:116
#, python-format
msgid "+%(duration)s months"
msgstr "+%(duration)s mois"
#: templates/logs/aff_summary.html:132
#, python-format
msgid "%(username)s has edited an interface of"
msgstr "%(username)s a modifié une interface de"
#: templates/logs/delete.html:29
msgid "Deletion of actions"
msgstr "Suppression d'actions"
#: templates/logs/delete.html:35
#, python-format
msgid ""
"Warning: are you sure you want to delete this action %(objet_name)s "
"( %(objet)s )?"
msgstr ""
"Attention: voulez-vous vraiment supprimer cette action %(objet_name)s "
"( %(objet)s ) ?"
#: templates/logs/delete.html:36
msgid "Confirm"
msgstr "Confirmer"
#: templates/logs/index.html:29 templates/logs/stats_general.html:29
#: templates/logs/stats_logs.html:29 templates/logs/stats_models.html:29
#: templates/logs/stats_users.html:29
msgid "Statistics"
msgstr "Statistiques"
#: templates/logs/index.html:32 templates/logs/stats_logs.html:32 views.py:403
msgid "Actions performed"
msgstr "Actions effectuées"
#: templates/logs/sidebar.html:33
msgid "Summary"
msgstr "Résumé"
#: templates/logs/sidebar.html:37
msgid "Events"
msgstr "Évènements"
#: templates/logs/sidebar.html:41
msgid "General"
msgstr "Général"
#: templates/logs/sidebar.html:45
msgid "Database"
msgstr "Base de données"
#: templates/logs/sidebar.html:49
msgid "Wiring actions"
msgstr "Actions de câblage"
#: templates/logs/sidebar.html:53 views.py:325
msgid "Users"
msgstr "Utilisateurs"
#: templates/logs/stats_general.html:32
msgid "General statistics"
msgstr "Statistiques générales"
#: templates/logs/stats_models.html:32
msgid "Database statistics"
msgstr "Statistiques sur la base de données"
#: templates/logs/stats_users.html:32
msgid "Statistics about users"
msgstr "Statistiques sur les utilisateurs"
#: views.py:191
msgid "Nonexistent revision."
msgstr "Révision inexistante."
#: views.py:194
msgid "The action was deleted."
msgstr "L'action a été supprimée."
#: views.py:227
msgid "Category"
msgstr "Catégorie"
#: views.py:228
msgid "Number of users (members and clubs)"
msgstr "Nombre d'utilisateurs (adhérents et clubs)"
#: views.py:229
msgid "Number of members"
msgstr "Nombre d'adhérents"
#: views.py:230
msgid "Number of clubs"
msgstr "Nombre de clubs"
#: views.py:234
msgid "Activated users"
msgstr "Utilisateurs activés"
#: views.py:242
msgid "Disabled users"
msgstr "Utilisateurs désactivés"
#: views.py:250
msgid "Archived users"
msgstr "Utilisateurs archivés"
#: views.py:258
msgid "Contributing members"
msgstr "Adhérents cotisants"
#: views.py:264
msgid "Users benefiting from a connection"
msgstr "Utilisateurs bénéficiant d'une connexion"
#: views.py:270
msgid "Banned users"
msgstr "Utilisateurs bannis"
#: views.py:276
msgid "Users benefiting from a free connection"
msgstr "Utilisateurs bénéficiant d'une connexion gratuite"
#: views.py:282
msgid "Active interfaces (with access to the network)"
msgstr "Interfaces actives (ayant accès au réseau)"
#: views.py:292
msgid "Active interfaces assigned IPv4"
msgstr "Interfaces actives assignées IPv4"
#: views.py:305
msgid "IP range"
msgstr "Plage d'IP"
#: views.py:306
msgid "VLAN"
msgstr "VLAN"
#: views.py:307
msgid "Total number of IP addresses"
msgstr "Nombre total d'adresses IP"
#: views.py:308
msgid "Number of assigned IP addresses"
msgstr "Nombre d'adresses IP non assignées"
#: views.py:309
msgid "Number of IP address assigned to an activated machine"
msgstr "Nombre d'adresses IP assignées à une machine activée"
#: views.py:310
msgid "Number of nonassigned IP addresses"
msgstr "Nombre d'adresses IP non assignées"
#: views.py:337
msgid "Subscriptions"
msgstr "Cotisations"
#: views.py:359 views.py:420
msgid "Machines"
msgstr "Machines"
#: views.py:386
msgid "Topology"
msgstr "Topologie"
#: views.py:405
msgid "Number of actions"
msgstr "Nombre d'actions"
#: views.py:419 views.py:437 views.py:442 views.py:447 views.py:462
msgid "User"
msgstr "Utilisateur"
#: views.py:423
msgid "Invoice"
msgstr "Facture"
#: views.py:426
msgid "Ban"
msgstr "Bannissement"
#: views.py:429
msgid "Whitelist"
msgstr "Accès gracieux"
#: views.py:432
msgid "Rights"
msgstr "Droits"
#: views.py:436
msgid "School"
msgstr "Établissement"
#: views.py:441
msgid "Payment method"
msgstr "Moyen de paiement"
#: views.py:446
msgid "Bank"
msgstr "Banque"
#: views.py:463
msgid "Action"
msgstr "Action"
#: views.py:494
msgid "No model found."
msgstr "Aucun modèle trouvé."
#: views.py:500
msgid "Nonexistent entry."
msgstr "Entrée inexistante."
#: views.py:507
msgid "You don't have the right to access this menu."
msgstr "Vous n'avez pas le droit d'accéder à ce menu."

View file

@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% for stats in stats_list %}
{% for stats in stats_list %}
<table class="table table-striped">
<thead>
<tr>
@ -32,11 +32,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr>
</thead>
{% for key, stat in stats.1.items %}
<tr>
{% for item in stat %}
<td>{{ item }}</td>
{% endfor %}
</tr>
{% endfor %}
<tr>
{% for item in stat %}
<td>{{ item }}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
{% endfor %}
{% endfor %}

View file

@ -28,39 +28,43 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load logs_extra %}
{% load acl %}
{% load i18n %}
<table class="table table-striped">
<thead>
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Edited object" %}</th>
<th>{% trans "Object type" %}</th>
{% trans "Edited by" as tr_edited_by %}
<th>{% include "buttons/sort.html" with prefix='logs' col='author' text=tr_edited_by %}</th>
{% trans "Date of editing" as tr_date_of_editing %}
<th>{% include "buttons/sort.html" with prefix='logs' col='date' text=tr_date_of_editing %}</th>
<th>{% trans "Comment" %}</th>
<th></th>
</tr>
</thead>
{% for revision in revisions_list %}
{% for reversion in revision.version_set.all %}
<tr>
<th>Objet modifié</th>
<th>Type de l'objet</th>
<th>{% include "buttons/sort.html" with prefix='logs' col='author' text='Modification par' %}</th>
<th>{% include "buttons/sort.html" with prefix='logs' col='date' text='Date de modification' %}</th>
<th>Commentaire</th>
<th></th>
<td>{{ reversion.object|truncatechars:20 }}</td>
<td>{{ reversion.object|classname }}</td>
<td>{{ revision.user }}</td>
<td>{{ revision.date_created }}</td>
<td>{{ revision.comment }}</td>
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' revision.id %}">
<i class="fa fa-times"></i>
{% trans "Cancel" %}
</a>
</td>
{% acl_end %}
</tr>
</thead>
{% for revision in revisions_list %}
{% for reversion in revision.version_set.all %}
<tr>
<td>{{ reversion.object|truncatechars:20 }}</td>
<td>{{ reversion.object|classname }}</td>
<td>{{ revision.user }}</td>
<td>{{ revision.date_created }}</td>
<td>{{ revision.comment }}</td>
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' revision.id %}">
<i class="fa fa-times"></i>
Annuler
</a>
</td>
{% acl_end %}
</tr>
{% endfor %}
{% endfor %}
</table>
{% endfor %}
</table>
{% if revisions_list.paginator %}
{% include "pagination.html" with list=revisions_list %}
{% endif %}

View file

@ -22,20 +22,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% for key, stats in stats_list.items %}
{% load i18n %}
{% for key, stats in stats_list.items %}
<table class="table table-striped">
<h4>Statistiques de l'ensemble {{ key }}</h4>
<thead>
<tr>
<th>Type d'objet</th>
<th>Nombre d'entrée stockées</th>
</tr>
</thead>
{% for key, stat in stats.items %}
<tr>
<td>{{ stat.0 }}</td>
<td>{{ stat.1 }}</td>
</tr>
{% endfor %}
<h4>{% blocktrans %}Statistics of the set {{ key }}{% endblocktrans %}</h4>
<thead>
<tr>
<th>{% trans "Object type" %}</th>
<th>{% trans "Number of stored entries" %}</th>
</tr>
</thead>
{% for key, stat in stats.items %}
<tr>
<td>{{ stat.0 }}</td>
<td>{{ stat.1 }}</td>
</tr>
{% endfor %}
</table>
{% endfor %}
{% endfor %}

View file

@ -22,24 +22,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% for key_dict, stats_dict in stats_list.items %}
{% load i18n %}
{% for key_dict, stats_dict in stats_list.items %}
{% for key, stats in stats_dict.items %}
<table class="table table-striped">
<thead>
<h4>Statistiques par {{ key_dict }} de {{ key }}</h4>
<tr>
<th>{{ key_dict }}</th>
<th>Nombre de {{ key }} par {{ key_dict }}</th>
<th>Rang</th>
</tr>
</thead>
{% for stat in stats %}
<tr>
<td>{{ stat|truncatechars:25 }}</td>
<td>{{ stat.num }}</td>
<td>{{ forloop.counter }}</td>
</tr>
{% endfor %}
</table>
{% endfor %}
{% endfor %}
<table class="table table-striped">
<thead>
<h4>{% blocktrans %}Statistics per {{ key_dict }} of {{ key }}{% endblocktrans %}</h4>
<tr>
<th>{{ key_dict }}</th>
<th>{% blocktrans %}Number of {{ key }} per {{ key_dict }}{% endblocktrans %}</th>
<th>{% trans "Rank" %}</th>
</tr>
</thead>
{% for stat in stats %}
<tr>
<td>{{ stat|truncatechars:25 }}</td>
<td>{{ stat.num }}</td>
<td>{{ forloop.counter }}</td>
</tr>
{% endfor %}
</table>
{% endfor %}
{% endfor %}

View file

@ -28,122 +28,127 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load logs_extra %}
{% load acl %}
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='sum' col='date' text='Date' %}</th>
<th>Modification</th>
<th></th>
</tr>
</thead>
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
{% trans "Date" as tr_date %}
<th>{% include "buttons/sort.html" with prefix='sum' col='date' text=tr_date %}</th>
<th>{% trans "Editing" %}</th>
<th></th>
</tr>
</thead>
{% for v in versions_list %}
{% if v.version.content_type.model == 'ban' %}
<tr class="danger">
<td>{{ v.datetime }}</td>
<td>
{{ v.username }} a banni
{% blocktrans with username=v.username %}{{ username }} has banned{% endblocktrans %}
<a href="{% url 'users:profil' v.version.object.user_id %}">{{ v.version.object.user.get_username }}</a>
(<i>
(<i>
{% if v.version.object.raison == '' %}
Aucune raison
{% trans "No reason" %}
{% else %}
{{ v.version.object.raison }}
{% endif %}
</i>)
</td>
{% can_edit_history %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="fa fa-times"></i>
Annuler
{% trans "Cancel" %}
</a>
</td>
{% acl_end %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'whitelist' %}
<tr class="success">
<td>{{ v.datetime }}</td>
<td>
{{ v.username }} a autorisé gracieusement
{% blocktrans with username=v.username %}{{ username }} has graciously authorised{% endblocktrans %}
<a href="{% url 'users:profil' v.version.object.user_id %}">{{ v.version.object.user.get_username }}</a>
(<i>
{% if v.version.object.raison == '' %}
Aucune raison
{% trans "No reason" %}
{% else %}
{{ v.version.object.raison }}
{% endif %}
</i>)
</td>
{% can_edit_history%}
{% can_edit_history%}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="fa fa-times"></i>
Annuler
{% trans "Cancel" %}
</a>
</td>
{% acl_end %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'user' %}
<tr>
<td>{{ v.datetime }}</td>
<td>
{{ v.username }} a mis à jour
{% blocktrans with username=v.username %}{{ username }} has updated{% endblocktrans %}
<a href="{% url 'users:profil' v.version.object.id %}">{{ v.version.object.get_username }}</a>
{% if v.comment != '' %}
(<i>{{ v.comment }}</i>)
{% endif %}
{% if v.comment != '' %}
(<i>{{ v.comment }}</i>)
{% endif %}
</td>
{% can_edit_history %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="fa fa-times"></i>
Annuler
{% trans "Cancel" %}
</a>
</td>
{% acl_end %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'vente' %}
<tr>
<td>{{ v.datetime }}</td>
<td>
{{ v.username }} a vendu {{ v.version.object.number }}x {{ v.version.object.name }} à
{% blocktrans with username=v.username number=v.version.object.number name=v.version.object.name %}{{ username }} has sold {{ number }}x {{ name }} to{% endblocktrans %}
<a href="{% url 'users:profil' v.version.object.facture.user_id %}">{{ v.version.object.facture.user.get_username }}</a>
{% if v.version.object.iscotisation %}
(<i>+{{ v.version.object.duration }} mois</i>)
{% endif %}
{% if v.version.object.iscotisation %}
(<i>{% blocktrans with duration=v.version.object.duration %}+{{ duration }} months{% endblocktrans %}</i>)
{% endif %}
</td>
{% can_edit_history %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="fa fa-times"></i>
Annuler
{% trans "Cancel" %}
</a>
</td>
{% acl_end %}
{% acl_end %}
</tr>
{% elif v.version.content_type.model == 'interface' %}
<tr>
<td>{{ v.datetime }}</td>
<td>
{{ v.username }} a modifié une interface de
{% blocktrans with username=v.username %}{{ username }} has edited an interface of{% endblocktrans %}
<a href="{% url 'users:profil' v.version.object.machine.user_id %}">{{ v.version.object.machine.user.get_username }}</a>
{% if v.comment != '' %}
(<i>{{ v.comment }}</i>)
{% endif %}
{% if v.comment != '' %}
(<i>{{ v.comment }}</i>)
{% endif %}
</td>
{% can_edit_history %}
{% can_edit_history %}
<td>
<a class="btn btn-danger btn-sm" role="button" href="{% url 'logs:revert-action' v.rev_id %}">
<i class="fa fa-times"></i>
Annuler
{% trans "Cancel" %}
</a>
</td>
{% acl_end %}
{% acl_end %}
</tr>
{% endif %}
{% endfor %}
</table>
</table>
{% if versions_list.paginator %}
{% include "pagination.html" with list=versions_list %}
{% endif %}

View file

@ -24,17 +24,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}Supression d'action{% endblock %}
{% block title %}{% trans "Deletion of actions" %}{% endblock %}
{% block content %}
<form class="form" method="post">
{% csrf_token %}
<h4>Attention, voulez-vous vraiment annuler cette action {{ objet_name }} ( {{ objet }} ) ?</h4>
{% bootstrap_button "Confirmer" button_type="submit" icon="trash" %}
<h4>{% blocktrans %}Warning: are you sure you want to delete this action {{ objet_name }} ( {{ objet }} )?{% endblocktrans %}</h4>
{% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type="submit" icon="trash" %}
</form>
<br />
<br />
<br />
<br />
<br />
<br />
{% endblock %}

View file

@ -24,13 +24,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}Statistiques{% endblock %}
{% block title %}{%trans "Statistics" %}{% endblock %}
{% block content %}
<h2>Actions effectuées</h2>
{% include "logs/aff_summary.html" with versions_list=versions_list %}
<br />
<br />
<br />
{% endblock %}
<h2>{% trans "Actions performed" %}</h2>
{% include "logs/aff_summary.html" with versions_list=versions_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -24,32 +24,34 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load i18n %}
{% block sidebar %}
{% can_view_app logs %}
<a class="list-group-item list-group-item-info" href="{% url "logs:index" %}">
<i class="fa fa-clipboard-list"></i>
Résumé
{% trans "Summary" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url "logs:stats-logs" %}">
<i class="fa fa-calendar-alt"></i>
Évènements
{% trans "Events" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url "logs:stats-general" %}">
<i class="fa fa-chart-area"></i>
Général
{% trans "General" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url "logs:stats-models" %}">
<i class="fa fa-database"></i>
Base de données
{% trans "Database" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url "logs:stats-actions" %}">
<i class="fa fa-plug"></i>
Actions de cablage
{% trans "Wiring actions" %}
</a>
<a class="list-group-item list-group-item-info" href="{% url "logs:stats-users" %}">
<i class="fa fa-users"></i>
Utilisateurs
{% trans "Users" %}
</a>
{% acl_end %}
{% endblock %}

View file

@ -24,13 +24,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}Statistiques générales{% endblock %}
{% block title %}{% trans "Statistics" %}{% endblock %}
{% block content %}
<h2>Statistiques générales</h2>
{% include "logs/aff_stats_general.html" with stats_list=stats_list %}
<br />
<br />
<br />
{% endblock %}
<h2>{% trans "General statistics" %}</h2>
{% include "logs/aff_stats_general.html" with stats_list=stats_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -24,13 +24,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}Statistiques{% endblock %}
{% block title %}{% trans "Statistics" %}{% endblock %}
{% block content %}
<h2>Actions effectuées</h2>
{% include "logs/aff_stats_logs.html" with revisions_list=revisions_list %}
<br />
<br />
<br />
{% endblock %}
<h2>{% trans "Actions performed" %}</h2>
{% include "logs/aff_stats_logs.html" with revisions_list=revisions_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -24,13 +24,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}Statistiques des objets base de données{% endblock %}
{% block title %}{% trans "Statistics" %}{% endblock %}
{% block content %}
<h2>Statistiques bdd</h2>
{% include "logs/aff_stats_models.html" with stats_list=stats_list %}
<br />
<br />
<br />
{% endblock %}
<h2>{% trans "Database statistics" %}</h2>
{% include "logs/aff_stats_models.html" with stats_list=stats_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -24,13 +24,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load bootstrap3 %}
{% load i18n %}
{% block title %}Statistiques par utilisateur{% endblock %}
{% block title %}{% trans "Statistics" %}{% endblock %}
{% block content %}
<h2>Statistiques par utilisateur</h2>
{% include "logs/aff_stats_users.html" with stats_list=stats_list %}
<br />
<br />
<br />
{% endblock %}
<h2>{% trans "Statistics about users" %}</h2>
{% include "logs/aff_stats_users.html" with stats_list=stats_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -188,10 +188,10 @@ def revert_action(request, revision_id):
try:
revision = Revision.objects.get(id=revision_id)
except Revision.DoesNotExist:
messages.error(request, u"Revision inexistante")
messages.error(request, _("Nonexistent revision."))
if request.method == "POST":
revision.revert()
messages.success(request, "L'action a été supprimée")
messages.success(request, _("The action was deleted."))
return redirect(reverse('logs:index'))
return form({
'objet': revision,
@ -224,14 +224,14 @@ def stats_general(request):
stats = [
[ # First set of data (about users)
[ # Headers
"Categorie",
"Nombre d'utilisateurs (total club et adhérents)",
"Nombre d'adhérents",
"Nombre de clubs"
_("Category"),
_("Number of users (members and clubs)"),
_("Number of members"),
_("Number of clubs")
],
{ # Data
'active_users': [
"Users actifs",
_("Activated users"),
User.objects.filter(state=User.STATE_ACTIVE).count(),
(Adherent.objects
.filter(state=Adherent.STATE_ACTIVE)
@ -239,7 +239,7 @@ def stats_general(request):
Club.objects.filter(state=Club.STATE_ACTIVE).count()
],
'inactive_users': [
"Users désactivés",
_("Disabled users"),
User.objects.filter(state=User.STATE_DISABLED).count(),
(Adherent.objects
.filter(state=Adherent.STATE_DISABLED)
@ -247,7 +247,7 @@ def stats_general(request):
Club.objects.filter(state=Club.STATE_DISABLED).count()
],
'archive_users': [
"Users archivés",
_("Archived users"),
User.objects.filter(state=User.STATE_ARCHIVE).count(),
(Adherent.objects
.filter(state=Adherent.STATE_ARCHIVE)
@ -255,31 +255,31 @@ def stats_general(request):
Club.objects.filter(state=Club.STATE_ARCHIVE).count()
],
'adherent_users': [
"Cotisant à l'association",
_("Contributing members"),
_all_adherent.count(),
_all_adherent.exclude(adherent__isnull=True).count(),
_all_adherent.exclude(club__isnull=True).count()
],
'connexion_users': [
"Utilisateurs bénéficiant d'une connexion",
_("Users benefiting from a connection"),
_all_has_access.count(),
_all_has_access.exclude(adherent__isnull=True).count(),
_all_has_access.exclude(club__isnull=True).count()
],
'ban_users': [
"Utilisateurs bannis",
_("Banned users"),
_all_baned.count(),
_all_baned.exclude(adherent__isnull=True).count(),
_all_baned.exclude(club__isnull=True).count()
],
'whitelisted_user': [
"Utilisateurs bénéficiant d'une connexion gracieuse",
_("Users benefiting from a free connection"),
_all_whitelisted.count(),
_all_whitelisted.exclude(adherent__isnull=True).count(),
_all_whitelisted.exclude(club__isnull=True).count()
],
'actives_interfaces': [
"Interfaces actives (ayant accès au reseau)",
_("Active interfaces (with access to the network)"),
_all_active_interfaces_count.count(),
(_all_active_interfaces_count
.exclude(machine__user__adherent__isnull=True)
@ -289,7 +289,7 @@ def stats_general(request):
.count())
],
'actives_assigned_interfaces': [
"Interfaces actives et assignées ipv4",
_("Active interfaces assigned IPv4"),
_all_active_assigned_interfaces_count.count(),
(_all_active_assigned_interfaces_count
.exclude(machine__user__adherent__isnull=True)
@ -302,12 +302,12 @@ def stats_general(request):
],
[ # Second set of data (about ip adresses)
[ # Headers
"Range d'ip",
"Vlan",
"Nombre d'ip totales",
"Ip assignées",
"Ip assignées à une machine active",
"Ip non assignées"
_("IP range"),
_("VLAN"),
_("Total number of IP addresses"),
_("Number of assigned IP addresses"),
_("Number of IP address assigned to an activated machine"),
_("Number of nonassigned IP addresses")
],
ip_dict # Data already prepared
]
@ -322,79 +322,87 @@ def stats_models(request):
nombre d'users, d'écoles, de droits, de bannissements,
de factures, de ventes, de banque, de machines, etc"""
stats = {
'Users': {
'users': [User.PRETTY_NAME, User.objects.count()],
'adherents': [Adherent.PRETTY_NAME, Adherent.objects.count()],
'clubs': [Club.PRETTY_NAME, Club.objects.count()],
'serviceuser': [ServiceUser.PRETTY_NAME,
_("Users"): {
'users': [User._meta.verbose_name, User.objects.count()],
'adherents': [Adherent._meta.verbose_name, Adherent.objects.count()],
'clubs': [Club._meta.verbose_name, Club.objects.count()],
'serviceuser': [ServiceUser._meta.verbose_name,
ServiceUser.objects.count()],
'school': [School.PRETTY_NAME, School.objects.count()],
'listright': [ListRight.PRETTY_NAME, ListRight.objects.count()],
'listshell': [ListShell.PRETTY_NAME, ListShell.objects.count()],
'ban': [Ban.PRETTY_NAME, Ban.objects.count()],
'whitelist': [Whitelist.PRETTY_NAME, Whitelist.objects.count()]
'school': [School._meta.verbose_name, School.objects.count()],
'listright': [ListRight._meta.verbose_name, ListRight.objects.count()],
'listshell': [ListShell._meta.verbose_name, ListShell.objects.count()],
'ban': [Ban._meta.verbose_name, Ban.objects.count()],
'whitelist': [Whitelist._meta.verbose_name, Whitelist.objects.count()]
},
'Cotisations': {
_("Subscriptions"): {
'factures': [
Facture._meta.verbose_name.title(),
Facture._meta.verbose_name,
Facture.objects.count()
],
'vente': [
Vente._meta.verbose_name.title(),
Vente._meta.verbose_name,
Vente.objects.count()
],
'cotisation': [
Cotisation._meta.verbose_name.title(),
Cotisation._meta.verbose_name,
Cotisation.objects.count()
],
'article': [
Article._meta.verbose_name.title(),
Article._meta.verbose_name,
Article.objects.count()
],
'banque': [
Banque._meta.verbose_name.title(),
Banque._meta.verbose_name,
Banque.objects.count()
],
},
'Machines': {
'machine': [Machine.PRETTY_NAME, Machine.objects.count()],
'typemachine': [MachineType.PRETTY_NAME,
_("Machines"): {
'machine': [Machine._meta.verbose_name,
Machine.objects.count()],
'typemachine': [MachineType._meta.verbose_name,
MachineType.objects.count()],
'typeip': [IpType.PRETTY_NAME, IpType.objects.count()],
'extension': [Extension.PRETTY_NAME, Extension.objects.count()],
'interface': [Interface.PRETTY_NAME, Interface.objects.count()],
'alias': [Domain.PRETTY_NAME,
'typeip': [IpType._meta.verbose_name,
IpType.objects.count()],
'extension': [Extension._meta.verbose_name,
Extension.objects.count()],
'interface': [Interface._meta.verbose_name,
Interface.objects.count()],
'alias': [Domain._meta.verbose_name,
Domain.objects.exclude(cname=None).count()],
'iplist': [IpList.PRETTY_NAME, IpList.objects.count()],
'service': [Service.PRETTY_NAME, Service.objects.count()],
'iplist': [IpList._meta.verbose_name,
IpList.objects.count()],
'service': [Service._meta.verbose_name,
Service.objects.count()],
'ouvertureportlist': [
OuverturePortList.PRETTY_NAME,
OuverturePortList._meta.verbose_name,
OuverturePortList.objects.count()
],
'vlan': [Vlan.PRETTY_NAME, Vlan.objects.count()],
'SOA': [SOA.PRETTY_NAME, SOA.objects.count()],
'Mx': [Mx.PRETTY_NAME, Mx.objects.count()],
'Ns': [Ns.PRETTY_NAME, Ns.objects.count()],
'nas': [Nas.PRETTY_NAME, Nas.objects.count()],
'vlan': [Vlan._meta.verbose_name, Vlan.objects.count()],
'SOA': [SOA._meta.verbose_name, SOA.objects.count()],
'Mx': [Mx._meta.verbose_name, Mx.objects.count()],
'Ns': [Ns._meta.verbose_name, Ns.objects.count()],
'nas': [Nas._meta.verbose_name, Nas.objects.count()],
},
'Topologie': {
'switch': [Switch.PRETTY_NAME, Switch.objects.count()],
'bornes': [AccessPoint.PRETTY_NAME, AccessPoint.objects.count()],
'port': [Port.PRETTY_NAME, Port.objects.count()],
'chambre': [Room.PRETTY_NAME, Room.objects.count()],
'stack': [Stack.PRETTY_NAME, Stack.objects.count()],
_("Topology"): {
'switch': [Switch._meta.verbose_name,
Switch.objects.count()],
'bornes': [AccessPoint._meta.verbose_name,
AccessPoint.objects.count()],
'port': [Port._meta.verbose_name, Port.objects.count()],
'chambre': [Room._meta.verbose_name, Room.objects.count()],
'stack': [Stack._meta.verbose_name, Stack.objects.count()],
'modelswitch': [
ModelSwitch.PRETTY_NAME,
ModelSwitch._meta.verbose_name,
ModelSwitch.objects.count()
],
'constructorswitch': [
ConstructorSwitch.PRETTY_NAME,
ConstructorSwitch._meta.verbose_name,
ConstructorSwitch.objects.count()
],
},
'Actions effectuées sur la base':
_("Actions performed"):
{
'revision': ["Nombre d'actions", Revision.objects.count()],
'revision': [_("Number of actions"), Revision.objects.count()],
},
}
return render(request, 'logs/stats_models.html', {'stats_list': stats})
@ -408,35 +416,35 @@ def stats_users(request):
de moyens de paiements par user, de banque par user,
de bannissement par user, etc"""
stats = {
'Utilisateur': {
'Machines': User.objects.annotate(
_("User"): {
_("Machines"): User.objects.annotate(
num=Count('machine')
).order_by('-num')[:10],
'Facture': User.objects.annotate(
_("Invoice"): User.objects.annotate(
num=Count('facture')
).order_by('-num')[:10],
'Bannissement': User.objects.annotate(
_("Ban"): User.objects.annotate(
num=Count('ban')
).order_by('-num')[:10],
'Accès gracieux': User.objects.annotate(
_("Whitelist"): User.objects.annotate(
num=Count('whitelist')
).order_by('-num')[:10],
'Droits': User.objects.annotate(
_("Rights"): User.objects.annotate(
num=Count('groups')
).order_by('-num')[:10],
},
'Etablissement': {
'Utilisateur': School.objects.annotate(
_("School"): {
_("User"): School.objects.annotate(
num=Count('user')
).order_by('-num')[:10],
},
'Moyen de paiement': {
'Utilisateur': Paiement.objects.annotate(
_("Payment method"): {
_("User"): Paiement.objects.annotate(
num=Count('facture')
).order_by('-num')[:10],
},
'Banque': {
'Utilisateur': Banque.objects.annotate(
_("Bank"): {
_("User"): Banque.objects.annotate(
num=Count('facture')
).order_by('-num')[:10],
},
@ -451,8 +459,8 @@ def stats_actions(request):
utilisateurs.
Affiche le nombre de modifications aggrégées par utilisateurs"""
stats = {
'Utilisateur': {
'Action': User.objects.annotate(
_("User"): {
_("Action"): User.objects.annotate(
num=Count('revision')
).order_by('-num')[:40],
},
@ -489,14 +497,14 @@ def history(request, application, object_name, object_id):
try:
instance = model.get_instance(**kwargs)
except model.DoesNotExist:
messages.error(request, _("No entry found."))
messages.error(request, _("Nonexistent entry."))
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
can, msg = instance.can_view(request.user)
if not can:
messages.error(request, msg or _("You cannot acces to this menu"))
messages.error(request, msg or _("You don't have the right to access this menu."))
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
@ -513,3 +521,4 @@ def history(request, application, object_name, object_id):
're2o/history.html',
{'reversions': reversions, 'object': instance}
)