8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-26 00:43:46 +00:00

Merge branch 'fix_65_history' into 'master'

fix #65, gestion propre de l'historique.

Closes #65

See merge request federez/re2o!186
This commit is contained in:
chirac 2018-07-22 22:22:19 +02:00
commit a84e8b5575
51 changed files with 1228 additions and 1283 deletions

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load i18n %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
@ -46,14 +47,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ article.type_user }}</td>
<td>{{ article.available_for_everyone }}</td>
<td class="text-right">
{% can_edit article %}
{% can_edit article %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-article' article.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'article' article.id %}">
<i class="fa fa-history"></i>
</a>
{% acl_end %}
{% history_button article %}
</td>
</tr>
{% endfor %}

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load i18n %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
@ -36,14 +37,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<td>{{ banque.name }}</td>
<td class="text-right">
{% can_edit banque %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-banque' banque.id %}">
{% can_edit banque %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-banque' banque.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'banque' banque.id %}">
<i class="fa fa-history"></i>
</a>
{% acl_end %}
{% history_button banque %}
</td>
</tr>
{% endfor %}

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load i18n %}
{% load logs_extra %}
<div class="table-responsive">
{% if facture_list.paginator %}
@ -86,9 +87,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</li>
{% acl_end %}
<li>
<a href="{% url 'cotisations:history' 'facture' facture.id %}">
<i class="fa fa-history"></i> {% trans "Historique" %}
</a>
{% history_button facture text=True html_class=False%}
</li>
</ul>
</div>

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load i18n %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
@ -47,9 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'paiement' paiement.id %}">
<i class="fa fa-history"></i>
</a>
{% history_button paiement %}
</td>
</tr>
{% endfor %}

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url
import re2o
from . import views
from . import payment_methods
@ -122,12 +121,6 @@ urlpatterns = [
views.index_paiement,
name='index-paiement'
),
url(
r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'cotisations'},
),
url(
r'^control/$',
views.control,

View file

@ -33,3 +33,23 @@ register = template.Library()
def classname(obj):
""" Returns the object class name """
return obj.__class__.__name__
@register.inclusion_tag('buttons/history.html')
def history_button(instance, text=False, html_class=True):
"""Creates the correct history button for an instance.
Args:
instance: The instance of which you want to get history buttons.
text: Flag stating if a 'History' text should be displayed.
html_class: Flag stating if the link should have the html classes
allowing it to be displayed as a button.
"""
return {
'application': instance._meta.app_label,
'name': instance._meta.model_name,
'id': instance.id,
'text': text,
'class': html_class,
}

View file

@ -39,4 +39,9 @@ urlpatterns = [
url(r'^stats_models/$', views.stats_models, name='stats-models'),
url(r'^stats_users/$', views.stats_users, name='stats-users'),
url(r'^stats_actions/$', views.stats_actions, name='stats-actions'),
url(
r'(?P<application>\w+)/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
views.history,
name='history',
),
]

View file

@ -2,9 +2,10 @@
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
# Copyright © 2017 Gabriel Détraz
# Copyright © 2017 Goulven Kermarec
# Copyright © 2017 Augustin Lemesle
# Copyright © 2018 Gabriel Détraz
# Copyright © 2018 Goulven Kermarec
# Copyright © 2018 Augustin Lemesle
# Copyright © 2018 Hugo Levy-Falk
#
# 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
@ -36,12 +37,16 @@ nombre d'objets par models, nombre d'actions par user, etc
"""
from __future__ import unicode_literals
from itertools import chain
from django.urls import reverse
from django.shortcuts import render, redirect
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Count, Max, F
from django.http import Http404
from django.db.models import Count
from django.apps import apps
from django.utils.translation import ugettext as _
from reversion.models import Revision
from reversion.models import Version, ContentType
@ -142,7 +147,7 @@ def index(request):
'comment': version.revision.comment,
'datetime': version.revision.date_created.strftime(
'%d/%m/%y %H:%M:%S'
),
),
'username':
version.revision.user.get_username()
if version.revision.user else '?',
@ -173,7 +178,7 @@ def stats_logs(request):
revisions = re2o_paginator(request, revisions, pagination_number)
return render(request, 'logs/stats_logs.html', {
'revisions_list': revisions
})
})
@login_required
@ -191,7 +196,7 @@ def revert_action(request, revision_id):
return form({
'objet': revision,
'objet_name': revision.__class__.__name__
}, 'logs/delete.html', request)
}, 'logs/delete.html', request)
@login_required
@ -453,3 +458,58 @@ def stats_actions(request):
},
}
return render(request, 'logs/stats_users.html', {'stats_list': stats})
def history(request, application, object_name, object_id):
"""Render history for a model.
The model is determined using the `HISTORY_BIND` dictionnary if none is
found, raises a Http404. The view checks if the user is allowed to see the
history using the `can_view` method of the model.
Args:
request: The request sent by the user.
application: Name of the application.
object_name: Name of the model.
object_id: Id of the object you want to acces history.
Returns:
The rendered page of history if access is granted, else the user is
redirected to their profile page, with an error message.
Raises:
Http404: This kind of models doesn't have history.
"""
try:
model = apps.get_model(application, object_name)
except LookupError:
raise Http404(_("No model found."))
object_name_id = object_name + 'id'
kwargs = {object_name_id: object_id}
try:
instance = model.get_instance(**kwargs)
except model.DoesNotExist:
messages.error(request, _("No entry found."))
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"))
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
pagination_number = GeneralOption.get_cached_value('pagination_number')
reversions = Version.objects.get_for_object(instance)
if hasattr(instance, 'linked_objects'):
for related_object in chain(instance.linked_objects()):
reversions = (reversions |
Version.objects.get_for_object(related_object))
reversions = re2o_paginator(request, reversions, pagination_number)
return render(
request,
're2o/history.html',
{'reversions': reversions, 'object': instance}
)

View file

@ -23,24 +23,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Alias</th>
<th></th>
</tr>
</thead>
{% for alias in alias_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ alias }}</td>
<td class="text-right">
{% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='domain' id=alias.id %}
</td>
<th>Alias</th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for alias in alias_list %}
<tr>
<td>{{ alias }}</td>
<td class="text-right">
{% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %}
{% history_button alias %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
<table class="table table-striped">
@ -30,28 +31,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<th>Extension</th>
<th>Droit infra pour utiliser ?</th>
<th>Enregistrement SOA</th>
<th>Enregistrement A origin</th>
{% if ipv6_enabled %}
<th>Enregistrement AAAA origin</th>
{% endif %}
<th></th>
<th>Enregistrement SOA</th>
<th>Enregistrement A origin</th>
{% if ipv6_enabled %}
<th>Enregistrement AAAA origin</th>
{% endif %}
<th></th>
</tr>
</thead>
{% for extension in extension_list %}
<tr>
<tr>
<td>{{ extension.name }}</td>
<td>{{ extension.need_infra }}</td>
<td>{{ extension.soa}}</td>
<td>{{ extension.origin }}</td>
<td>{{ extension.origin }}</td>
{% if ipv6_enabled %}
<td>{{ extension.origin_v6 }}</td>
{% endif %}
<td class="text-right">
{% can_edit extension %}
{% can_edit extension %}
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='extension' id=extension.id %}
{% acl_end %}
{% history_button extension %}
</td>
</tr>
{% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
@ -31,10 +32,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Extension</th>
<th>Nécessite l'autorisation infra</th>
<th>Plage ipv4</th>
<th>Préfixe v6</th>
<th>Préfixe v6</th>
<th>Sur vlan</th>
<th>Ouverture ports par défault</th>
<th></th>
<th>Ouverture ports par défault</th>
<th></th>
<th></th>
</tr>
</thead>
@ -43,15 +44,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ type.type }}</td>
<td>{{ type.extension }}</td>
<td>{{ type.need_infra }}</td>
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}</td>
<td>{{ type.prefix_v6 }}</td>
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}</td>
<td>{{ type.prefix_v6 }}</td>
<td>{{ type.vlan }}</td>
<td>{{ type.ouverture_ports }}</td>
<td>{{ type.ouverture_ports }}</td>
<td class="text-right">
{% can_edit type %}
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='iptype' id=type.id %}
{% acl_end %}
{% history_button type %}
</td>
</tr>
{% endfor %}

View file

@ -23,29 +23,30 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Ipv6</th>
<th>Slaac</th>
<th></th>
</tr>
</thead>
{% for ipv6 in ipv6_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ ipv6.ipv6 }}</td>
<td>{{ ipv6.slaac_ip }}</td>
<td class="text-right">
{% can_edit ipv6 %}
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
{% acl_end %}
{% can_delete ipv6 %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='ipv6list' id=ipv6.id %}
</td>
<th>Ipv6</th>
<th>Slaac</th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for ipv6 in ipv6_list %}
<tr>
<td>{{ ipv6.ipv6 }}</td>
<td>{{ ipv6.slaac_ip }}</td>
<td class="text-right">
{% can_edit ipv6 %}
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
{% acl_end %}
{% can_delete ipv6 %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% acl_end %}
{% history_button ipv6 %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -22,165 +22,166 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
{% if machines_list.paginator %}
{% include "pagination.html" with list=machines_list %}
{% endif %}
{% if machines_list.paginator %}
{% include "pagination.html" with list=machines_list %}
{% endif %}
<table class="table" id="machines_table">
<colgroup>
<col>
<col>
<col>
<col width="{% if ipv6_enabled %}300{% else %}150{% endif %}px">
<col width="144px">
</colgroup>
<thead>
<th>{% include "buttons/sort.html" with prefix='machine' col='name' text='Nom DNS' %}</th>
<th>Type</th>
<th>MAC</th>
<th>IP</th>
<th>Actions</th>
<tbody>
{% for machine in machines_list %}
<tr class="info">
<td colspan="4">
<b>{{ machine.name|default:'<i>Pas de nom</i>' }}</b> <i class="fa-angle-right"></i>
<a href="{% url 'users:profil' userid=machine.user.id %}" title="Voir le profil">
<i class="fa fa-user"></i> {{ machine.user }}
</a>
</td>
<td class="text-right">
{% can_create Interface machine.id %}
{% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc='Ajouter une interface' %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='machine' id=machine.id %}
{% can_delete machine %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %}
{% acl_end %}
</td>
</tr>
{% for interface in machine.interface_set.all %}
<tr>
<td>
{% if interface.domain.related_domain.all %}
{{ interface.domain }}
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseDomain_{{interface.id}}" aria-expanded="true" aria-controls="collapseDomain_{{interface.id}}">
Afficher les alias
</button>
{% else %}
{{ interface.domain }}
{% endif %}
</td>
<td>
{{ interface.type }}
</td>
<td>
{{ interface.mac_address }}
</td>
<td>
<b>IPv4</b> {{ interface.ipv4 }}
<br>
{% if ipv6_enabled and interface.ipv6 != 'None'%}
<b>IPv6</b>
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseIpv6_{{interface.id}}" aria-expanded="true" aria-controls="collapseIpv6_{{interface.id}}">
Afficher l'IPV6
</button>
{% endif %}
</td>
<td class="text-right">
<div style="width: 128px;">
<div class="btn-group" role="group">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-edit"></i> <span class="caret"></span>
<table class="table" id="machines_table">
<colgroup>
<col>
<col>
<col>
<col width="{% if ipv6_enabled %}300{% else %}150{% endif %}px">
<col width="144px">
</colgroup>
<thead>
<th>{% include "buttons/sort.html" with prefix='machine' col='name' text='Nom DNS' %}</th>
<th>Type</th>
<th>MAC</th>
<th>IP</th>
<th>Actions</th>
<tbody>
{% for machine in machines_list %}
<tr class="info">
<td colspan="4">
<b>{{ machine.name|default:'<i>Pas de nom</i>' }}</b> <i class="fa-angle-right"></i>
<a href="{% url 'users:profil' userid=machine.user.id %}" title="Voir le profil">
<i class="fa fa-user"></i> {{ machine.user }}
</a>
</td>
<td class="text-right">
{% can_create Interface machine.id %}
{% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc='Ajouter une interface' %}
{% acl_end %}
{% history_button machine %}
{% can_delete machine %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %}
{% acl_end %}
</td>
</tr>
{% for interface in machine.interface_set.all %}
<tr>
<td>
{% if interface.domain.related_domain.all %}
{{ interface.domain }}
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseDomain_{{interface.id}}" aria-expanded="true" aria-controls="collapseDomain_{{interface.id}}">
Afficher les alias
</button>
<ul class="dropdown-menu pull-right" aria-labelledby="editioninterface">
{% can_edit interface %}
<li>
<a href="{% url 'machines:edit-interface' interface.id %}">
<i class="fa fa-edit"></i> Editer
</a>
</li>
{% else %}
{{ interface.domain }}
{% endif %}
</td>
<td>
{{ interface.type }}
</td>
<td>
{{ interface.mac_address }}
</td>
<td>
<b>IPv4</b> {{ interface.ipv4 }}
<br>
{% if ipv6_enabled and interface.ipv6 != 'None'%}
<b>IPv6</b>
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseIpv6_{{interface.id}}" aria-expanded="true" aria-controls="collapseIpv6_{{interface.id}}">
Afficher l'IPV6
</button>
{% endif %}
</td>
<td class="text-right">
<div style="width: 128px;">
<div class="btn-group" role="group">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-edit"></i> <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" aria-labelledby="editioninterface">
{% can_edit interface %}
<li>
<a href="{% url 'machines:edit-interface' interface.id %}">
<i class="fa fa-edit"></i> Editer
</a>
</li>
{% acl_end %}
{% can_create Domain interface.id %}
<li>
<a href="{% url 'machines:index-alias' interface.id %}">
<i class="fa fa-edit"></i> Gerer les alias
</a>
</li>
{% acl_end %}
{% can_create Ipv6List interface.id %}
<li>
<a href="{% url 'machines:index-ipv6' interface.id %}">
<i class="fa fa-edit"></i> Gerer les ipv6
</a>
</li>
{% acl_end %}
{% can_create OuverturePortList %}
<li>
<a href="{% url 'machines:port-config' interface.id%}">
<i class="fa fa-edit"></i> Gerer la configuration des ports
</a>
</li>
{% acl_end %}
</ul>
</div>
{% history_button interface %}
{% can_delete interface %}
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
{% acl_end %}
{% can_create Domain interface.id %}
<li>
<a href="{% url 'machines:index-alias' interface.id %}">
<i class="fa fa-edit"></i> Gerer les alias
</a>
</li>
{% acl_end %}
{% can_create Ipv6List interface.id %}
<li>
<a href="{% url 'machines:index-ipv6' interface.id %}">
<i class="fa fa-edit"></i> Gerer les ipv6
</a>
</li>
{% acl_end %}
{% can_create OuverturePortList %}
<li>
<a href="{% url 'machines:port-config' interface.id%}">
<i class="fa fa-edit"></i> Gerer la configuration des ports
</a>
</li>
{% acl_end %}
</ul>
</div>
{% include 'buttons/history.html' with href='machines:history' name='interface' id=interface.id %}
{% can_delete interface %}
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
{% acl_end %}
</div>
</td>
</tr>
</div>
</td>
</tr>
{% if ipv6_enabled and interface.ipv6 != 'None'%}
<tr>
<td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseIpv6_{{interface.id}}">
<ul class="list-group" style="margin-bottom: 0px;">
{% for ipv6 in interface.ipv6.all %}
<li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;">
{{ipv6}}
</li>
{% endfor %}
</ul>
</div>
</td>
<tr>
{% endif %}
{% if ipv6_enabled and interface.ipv6 != 'None'%}
<tr>
<td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseIpv6_{{interface.id}}">
<ul class="list-group" style="margin-bottom: 0px;">
{% for ipv6 in interface.ipv6.all %}
<li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;">
{{ipv6}}
</li>
{% endfor %}
</ul>
</div>
</td>
<tr>
{% endif %}
{% if interface.domain.related_domain.all %}
<tr>
<td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseDomain_{{interface.id}}">
<ul class="list-group" style="margin-bottom: 0px;">
{% for al in interface.domain.related_domain.all %}
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;">
<a href="http://{{ al }}">
{{ al }}
<i class="fa fa-share"></i>
</a>
</li>
{% endfor %}
</ul>
</div>
</td>
<tr>
{% endif %}
{% endfor %}
<tr>
<td colspan="8"></td>
</tr>
{% endfor %}
</tbody>
</table>
{% if interface.domain.related_domain.all %}
<tr>
<td colspan=5 style="border-top: none; padding: 1px;">
<div class="collapse in" id="collapseDomain_{{interface.id}}">
<ul class="list-group" style="margin-bottom: 0px;">
{% for al in interface.domain.related_domain.all %}
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;">
<a href="http://{{ al }}">
{{ al }}
<i class="fa fa-share"></i>
</a>
</li>
{% endfor %}
</ul>
</div>
</td>
<tr>
{% endif %}
{% endfor %}
<tr>
<td colspan="8"></td>
</tr>
{% endfor %}
</tbody>
</table>
<script>
<script>
$("#machines_table").ready( function() {
var alias_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.domain.related_domain.all %}$("#collapseDomain_{{interface.id}}"), {% endif %}{% endfor %}{% endfor %}];
for (var i=0 ; i<alias_div.length ; i++) {
@ -193,9 +194,9 @@ $("#machines_table").ready( function() {
ipv6_div[i].collapse('hide');
}
} );
</script>
</script>
{% if machines_list.paginator %}
{% include "pagination.html" with list=machines_list %}
{% endif %}
{% if machines_list.paginator %}
{% include "pagination.html" with list=machines_list %}
{% endif %}
</div>

View file

@ -23,26 +23,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Type de machine</th>
<th>Type d'ip correspondant</th>
<th></th>
</tr>
</thead>
{% for type in machinetype_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ type.type }}</td>
<td>{{ type.ip_type }}</td>
<td class="text-right">
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='machinetype' id=type.id %}
</td>
<th>Type de machine</th>
<th>Type d'ip correspondant</th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for type in machinetype_list %}
<tr>
<td>{{ type.type }}</td>
<td>{{ type.ip_type }}</td>
<td class="text-right">
{% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
{% acl_end %}
{% history_button type %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,30 +23,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Zone concernée</th>
<th>Priorité</th>
<th>Enregistrement</th>
<th></th>
<th></th>
</tr>
</thead>
{% for mx in mx_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ mx.zone }}</td>
<td>{{ mx.priority }}</td>
<td>{{ mx.name }}</td>
<td class="text-right">
<th>Zone concernée</th>
<th>Priorité</th>
<th>Enregistrement</th>
<th></th>
<th></th>
</tr>
</thead>
{% for mx in mx_list %}
<tr>
<td>{{ mx.zone }}</td>
<td>{{ mx.priority }}</td>
<td>{{ mx.name }}</td>
<td class="text-right">
{% can_edit mx %}
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='mx' id=mx.id %}
</td>
</tr>
{% endfor %}
</table>
{% acl_end %}
{% history_button mx %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,32 +23,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Nom</th>
<th>Type du nas</th>
<th>Type de machine reliées au nas</th>
<th>Mode d'accès</th>
<th>Autocapture mac</th>
<th></th>
</tr>
</thead>
{% for nas in nas_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ nas.name }}</td>
<td>{{ nas.nas_type }}</td>
<td>{{ nas.machine_type }}</td>
<td>{{ nas.port_access_mode }}</td>
<td>{{ nas.autocapture_mac }}</td>
<td class="text-right">
{% can_edit nas %}
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='nas' id=nas.id %}
</td>
<th>Nom</th>
<th>Type du nas</th>
<th>Type de machine reliées au nas</th>
<th>Mode d'accès</th>
<th>Autocapture mac</th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for nas in nas_list %}
<tr>
<td>{{ nas.name }}</td>
<td>{{ nas.nas_type }}</td>
<td>{{ nas.machine_type }}</td>
<td>{{ nas.port_access_mode }}</td>
<td>{{ nas.autocapture_mac }}</td>
<td class="text-right">
{% can_edit nas %}
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% acl_end %}
{% history_button nas %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,28 +23,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Zone concernée</th>
<th>Interface autoritaire de la zone</th>
<th></th>
<th></th>
</tr>
</thead>
{% for ns in ns_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ ns.zone }}</td>
<td>{{ ns.ns }}</td>
<td class="text-right">
<th>Zone concernée</th>
<th>Interface autoritaire de la zone</th>
<th></th>
<th></th>
</tr>
</thead>
{% for ns in ns_list %}
<tr>
<td>{{ ns.zone }}</td>
<td>{{ ns.ns }}</td>
<td class="text-right">
{% can_edit ns %}
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='ns' id=ns.id %}
</td>
</tr>
{% endfor %}
</table>
{% acl_end %}
{% history_button ns %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -22,26 +22,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
<table class="table table-striped">
<thead>
<tr>
<th>Nom du service</th>
<th>Serveur</th>
<th>Dernière régénération</th>
<th>Régénération nécessaire</th>
<th>Régénération activée</th>
</tr>
</thead>
{% for server in servers_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ server.service }}</td>
<td>{{ server.server }}</td>
<td>{{ server.last_regen }}</td>
<td>{{ server.asked_regen }}</td>
<td>{{ server.need_regen }}</td>
<td class="text-right">
</td>
<th>Nom du service</th>
<th>Serveur</th>
<th>Dernière régénération</th>
<th>Régénération nécessaire</th>
<th>Régénération activée</th>
</tr>
{% endfor %}
</table>
</thead>
{% for server in servers_list %}
<tr>
<td>{{ server.service }}</td>
<td>{{ server.server }}</td>
<td>{{ server.last_regen }}</td>
<td>{{ server.asked_regen }}</td>
<td>{{ server.need_regen }}</td>
<td class="text-right">
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,31 +23,32 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Nom du service</th>
<th>Temps minimum avant nouvelle régénération</th>
<th>Temps avant nouvelle génération obligatoire (max)</th>
<th>Serveurs inclus</th>
<th></th>
<th></th>
</tr>
</thead>
{% for service in service_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ service.service_type }}</td>
<td>{{ service.min_time_regen }}</td>
<td>{{ service.regular_time_regen }}</td>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
<td class="text-right">
{% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='service' id=service.id %}
</td>
<th>Nom du service</th>
<th>Temps minimum avant nouvelle régénération</th>
<th>Temps avant nouvelle génération obligatoire (max)</th>
<th>Serveurs inclus</th>
<th></th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for service in service_list %}
<tr>
<td>{{ service.service_type }}</td>
<td>{{ service.min_time_regen }}</td>
<td>{{ service.regular_time_regen }}</td>
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
<td class="text-right">
{% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% acl_end %}
{% history_button service %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,36 +23,37 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Nom</th>
<th>Mail</th>
<th>Refresh</th>
<th>Retry</th>
<th>Expire</th>
<th>TTL</th>
<th></th>
<th></th>
</tr>
</thead>
{% for soa in soa_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ soa.name }}</td>
<td>{{ soa.mail }}</td>
<td>{{ soa.refresh }}</td>
<td>{{ soa.retry }}</td>
<td>{{ soa.expire }}</td>
<td>{{ soa.ttl }}</td>
<td class="text-right">
<th>Nom</th>
<th>Mail</th>
<th>Refresh</th>
<th>Retry</th>
<th>Expire</th>
<th>TTL</th>
<th></th>
<th></th>
</tr>
</thead>
{% for soa in soa_list %}
<tr>
<td>{{ soa.name }}</td>
<td>{{ soa.mail }}</td>
<td>{{ soa.refresh }}</td>
<td>{{ soa.retry }}</td>
<td>{{ soa.expire }}</td>
<td>{{ soa.ttl }}</td>
<td class="text-right">
{% can_edit soa %}
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='soa' id=soa.id %}
</td>
</tr>
{% endfor %}
</table>
{% acl_end %}
{% history_button soa %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,40 +23,41 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Service</th>
<th>Protocole</th>
<th>Extension</th>
<th>TTL</th>
<th>Priorité</th>
<th>Poids</th>
<th>Port</th>
<th>Cible</th>
<th></th>
<th></th>
</tr>
</thead>
{% for srv in srv_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ srv.service }}</td>
<td>{{ srv.protocole }}</td>
<td>{{ srv.extension }}</td>
<td>{{ srv.ttl }}</td>
<td>{{ srv.priority }}</td>
<td>{{ srv.weight }}</td>
<td>{{ srv.port }}</td>
<td>{{ srv.target }}</td>
<td class="text-right">
{% can_edit srv %}
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='srv' id=srv.id %}
</td>
<th>Service</th>
<th>Protocole</th>
<th>Extension</th>
<th>TTL</th>
<th>Priorité</th>
<th>Poids</th>
<th>Port</th>
<th>Cible</th>
<th></th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for srv in srv_list %}
<tr>
<td>{{ srv.service }}</td>
<td>{{ srv.protocole }}</td>
<td>{{ srv.extension }}</td>
<td>{{ srv.ttl }}</td>
<td>{{ srv.priority }}</td>
<td>{{ srv.weight }}</td>
<td>{{ srv.port }}</td>
<td>{{ srv.target }}</td>
<td class="text-right">
{% can_edit srv %}
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
{% acl_end %}
{% history_button srv %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,28 +23,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Zone concernée</th>
<th>Enregistrement</th>
<th></th>
<th></th>
</tr>
</thead>
{% for txt in txt_list %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ txt.zone }}</td>
<td>{{ txt.dns_entry }}</td>
<td class="text-right">
<th>Zone concernée</th>
<th>Enregistrement</th>
<th></th>
<th></th>
</tr>
</thead>
{% for txt in txt_list %}
<tr>
<td>{{ txt.zone }}</td>
<td>{{ txt.dns_entry }}</td>
<td class="text-right">
{% can_edit txt %}
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='txt' id=txt.id %}
</td>
</tr>
{% endfor %}
</table>
{% acl_end %}
{% history_button txt %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
<table class="table table-striped">
@ -30,22 +31,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<th>Id</th>
<th>Nom</th>
<th>Commentaire</th>
<th>Commentaire</th>
<th>Ranges ip</th>
<th></th>
<th></th>
</tr>
</thead>
{% for vlan in vlan_list %}
<tr>
<td>{{ vlan.vlan_id }}</td>
<td>{{ vlan.name }}</td>
<td>{{ vlan.comment }}</td>
<td>{{ vlan.comment }}</td>
<td>{% for range in vlan.iptype_set.all %}{{ range }}, {% endfor%}</td>
<td class="text-right">
{% can_edit vlan %}
<td class="text-right">
{% can_edit vlan %}
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='vlan' id=vlan.id %}
{% acl_end %}
{% history_button vlan %}
</td>
</tr>
{% endfor %}

View file

@ -27,7 +27,6 @@ The defined URLs for the Cotisations app
from __future__ import unicode_literals
from django.conf.urls import url
import re2o
from . import views
urlpatterns = [
@ -119,10 +118,6 @@ urlpatterns = [
url(r'^edit_nas/(?P<nasid>[0-9]+)$', views.edit_nas, name='edit-nas'),
url(r'^del_nas/$', views.del_nas, name='del-nas'),
url(r'^index_nas/$', views.index_nas, name='index-nas'),
url(r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'machines'}),
url(r'^$', views.index, name='index'),
url(r'^rest/mac-ip/$', views.mac_ip, name='mac-ip'),
url(r'^rest/regen-achieved/$',

View file

@ -22,6 +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 %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
@ -43,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit service%}
{% include 'buttons/edit.html' with href='preferences:edit-service' id=service.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='preferences:history' name='service' id=service.id %}
{% history_button service %}
</td>
</tr>
{% endfor %}

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url
import re2o
from . import views
@ -74,11 +73,5 @@ urlpatterns = [
name='edit-service'
),
url(r'^del_services/$', views.del_services, name='del-services'),
url(
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'preferences'},
),
url(r'^$', views.display_options, name='display-options'),
]

View file

@ -26,33 +26,20 @@ les views
from __future__ import unicode_literals
from itertools import chain
import git
from reversion.models import Version
from django.http import Http404
from django.urls import reverse
from django.shortcuts import render, redirect
from django.shortcuts import render
from django.template.context_processors import csrf
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.conf import settings
from django.utils.translation import ugettext as _
from django.views.decorators.cache import cache_page
import preferences
from preferences.models import (
Service,
GeneralOption,
AssoOption,
HomeOption
)
import users
import cotisations
import topologie
import machines
from .utils import re2o_paginator
from .contributors import CONTRIBUTORS
@ -73,118 +60,12 @@ def index(request):
twitter_account_name = HomeOption.get_cached_value('twitter_account_name')
asso_name = AssoOption.get_cached_value('pseudo')
return form({
'services_urls': services,
'twitter_url': twitter_url,
'twitter_account_name' : twitter_account_name,
'facebook_url': facebook_url,
'asso_name': asso_name
}, 're2o/index.html', request)
#: Binding the corresponding char sequence of history url to re2o models.
HISTORY_BIND = {
'users': {
'user': users.models.User,
'ban': users.models.Ban,
'whitelist': users.models.Whitelist,
'school': users.models.School,
'listright': users.models.ListRight,
'serviceuser': users.models.ServiceUser,
'listshell': users.models.ListShell,
},
'preferences': {
'service': preferences.models.Service,
},
'cotisations': {
'facture': cotisations.models.Facture,
'article': cotisations.models.Article,
'paiement': cotisations.models.Paiement,
'banque': cotisations.models.Banque,
},
'topologie': {
'switch': topologie.models.Switch,
'port': topologie.models.Port,
'room': topologie.models.Room,
'stack': topologie.models.Stack,
'modelswitch': topologie.models.ModelSwitch,
'constructorswitch': topologie.models.ConstructorSwitch,
'accesspoint': topologie.models.AccessPoint,
'switchbay': topologie.models.SwitchBay,
'building': topologie.models.Building,
},
'machines': {
'machine': machines.models.Machine,
'interface': machines.models.Interface,
'domain': machines.models.Domain,
'machinetype': machines.models.MachineType,
'iptype': machines.models.IpType,
'extension': machines.models.Extension,
'soa': machines.models.SOA,
'mx': machines.models.Mx,
'txt': machines.models.Txt,
'srv': machines.models.Srv,
'ns': machines.models.Ns,
'service': machines.models.Service,
'vlan': machines.models.Vlan,
'nas': machines.models.Nas,
'ipv6list': machines.models.Ipv6List,
},
}
@login_required
def history(request, application, object_name, object_id):
"""Render history for a model.
The model is determined using the `HISTORY_BIND` dictionnary if none is
found, raises a Http404. The view checks if the user is allowed to see the
history using the `can_view` method of the model.
Args:
request: The request sent by the user.
object_name: Name of the model.
object_id: Id of the object you want to acces history.
Returns:
The rendered page of history if access is granted, else the user is
redirected to their profile page, with an error message.
Raises:
Http404: This kind of models doesn't have history.
"""
try:
model = HISTORY_BIND[application][object_name]
except KeyError:
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
object_name_id = object_name + 'id'
kwargs = {object_name_id: object_id}
try:
instance = model.get_instance(**kwargs)
except model.DoesNotExist:
messages.error(request, u"Entrée inexistante")
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 "Vous ne pouvez pas accéder à ce menu")
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
pagination_number = GeneralOption.get_cached_value('pagination_number')
reversions = Version.objects.get_for_object(instance)
if hasattr(instance, 'linked_objects'):
for related_object in chain(instance.linked_objects()):
reversions = (reversions |
Version.objects.get_for_object(related_object))
reversions = re2o_paginator(request, reversions, pagination_number)
return render(
request,
're2o/history.html',
{'reversions': reversions, 'object': instance}
)
'services_urls': services,
'twitter_url': twitter_url,
'twitter_account_name': twitter_account_name,
'facebook_url': facebook_url,
'asso_name': asso_name
}, 're2o/index.html', request)
@cache_page(7 * 24 * 60 * 60)

View file

@ -21,7 +21,8 @@ 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.
{% endcomment %}
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url href name id %}">
<i class="fa fa-history"></i>
{% load i18n %}
<a {% if class%}class="btn btn-info btn-sm"{% endif %} role="button" title="{% trans 'History' %}" href="{% url 'logs:history' application name id %}">
<i class="fa fa-history"></i> {% if text %}{% trans 'History' %}{% endif %}
</a>

View file

@ -23,52 +23,51 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
{% if ap_list.paginator %}
{% include "pagination.html" with list=ap_list %}
{% endif %}
{% if ap_list.paginator %}
{% include "pagination.html" with list=ap_list %}
{% endif %}
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='ap' col='name' text='Borne' %}</th>
<th>{% include "buttons/sort.html" with prefix='ap' col='mac' text='Addresse mac' %}</th>
<th>{% include "buttons/sort.html" with prefix='ap' col='ip' text='Ipv4' %}</th>
<th>Commentaire</th>
<th>Localisation</th>
<th></th>
</tr>
</thead>
{% for ap in ap_list %}
<tr>
<td>{{ap.interface_set.first}}</td>
<td>{{ap.interface_set.first.mac_address}}</td>
<td>{{ap.interface_set.first.ipv4}}</td>
<td>{{ap.interface_set.first.details}}</td>
<td>{{ap.location}}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'accesspoint' ap.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit ap %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-ap' ap.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete ap %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'machines:del-machine' ap.id %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='ap' col='name' text='Borne' %}</th>
<th>{% include "buttons/sort.html" with prefix='ap' col='mac' text='Addresse mac' %}</th>
<th>{% include "buttons/sort.html" with prefix='ap' col='ip' text='Ipv4' %}</th>
<th>Commentaire</th>
<th>Localisation</th>
<th></th>
</tr>
</thead>
{% for ap in ap_list %}
<tr>
<td>{{ap.interface_set.first}}</td>
<td>{{ap.interface_set.first.mac_address}}</td>
<td>{{ap.interface_set.first.ipv4}}</td>
<td>{{ap.interface_set.first.details}}</td>
<td>{{ap.location}}</td>
<td class="text-right">
{% history_button ap %}
{% can_edit ap %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-ap' ap.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete ap %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'machines:del-machine' ap.id %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
{% if ap_list.paginator %}
{% include "pagination.html" with list=ap_list %}
{% endif %}
{% if ap_list.paginator %}
{% include "pagination.html" with list=ap_list %}
{% endif %}
</div>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% if building_list.paginator %}
{% include "pagination.html" with list=building_list %}
@ -34,27 +35,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% include "buttons/sort.html" with prefix='building' col='name' text='Bâtiment' %}</th>
<th></th>
</tr>
</thead>
{% for building in building_list %}
<tr>
<td>{{building.name}}</td>
</thead>
{% for building in building_list %}
<tr>
<td>{{building.name}}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'building' building.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit building %}
{% history_button building %}
{% can_edit building %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-building' building.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete building %}
{% acl_end %}
{% can_delete building %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-building' building.id %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
{% acl_end %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>
{% if building_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% if room_list.paginator %}
{% include "pagination.html" with list=room_list %}
@ -35,28 +36,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Commentaire</th>
<th></th>
</tr>
</thead>
{% for room in room_list %}
<tr>
<td>{{room.name}}</td>
<td>{{room.details}}</td>
</thead>
{% for room in room_list %}
<tr>
<td>{{room.name}}</td>
<td>{{room.details}}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'room' room.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit room %}
{% history_button room %}
{% can_edit room %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-room' room.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete room %}
{% acl_end %}
{% can_delete room %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-room' room.id %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
{% acl_end %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>
{% if room_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% if constructor_switch_list.paginator %}
{% include "pagination.html" with list=constructor_switch_list %}
@ -34,27 +35,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% include "buttons/sort.html" with prefix='constructor-switch' col='name' text='Constructeur' %}</th>
<th></th>
</tr>
</thead>
{% for constructor_switch in constructor_switch_list %}
<tr>
<td>{{constructor_switch}}</td>
</thead>
{% for constructor_switch in constructor_switch_list %}
<tr>
<td>{{constructor_switch}}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'constructorswitch' constructor_switch.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit constructor_switch %}
{% history_button constructor_switch %}
{% can_edit constructor_switch %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-constructor-switch' constructor_switch.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete constructor_switch %}
{% acl_end %}
{% can_delete constructor_switch %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-constructor-switch' constructor_switch.id %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
{% acl_end %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>
{% if constructor_switch_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% if model_switch_list.paginator %}
{% include "pagination.html" with list=model_switch_list %}
@ -33,30 +34,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<th>{% include "buttons/sort.html" with prefix='model-switch' col='reference' text='Référence' %}</th>
<th>{% include "buttons/sort.html" with prefix='model-switch' col='constructor' text='Constructeur' %}</th>
<th></th>
<th></th>
</tr>
</thead>
{% for model_switch in model_switch_list %}
<tr>
<td>{{model_switch.reference}}</td>
<td>{{model_switch.constructor}}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'modelswitch' model_switch.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit model_switch %}
</thead>
{% for model_switch in model_switch_list %}
<tr>
<td>{{model_switch.reference}}</td>
<td>{{model_switch.constructor}}</td>
<td class="text-right">
{% history_button model_switch %}
{% can_edit model_switch %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-model-switch' model_switch.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete model_switch %}
{% acl_end %}
{% can_delete model_switch %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-model-switch' model_switch.id %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
{% acl_end %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>
{% if model_switch_list.paginator %}

View file

@ -23,68 +23,67 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='radius' text='Radius' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='vlan' text='Vlan forcé' %}</th>
<th>Détails</th>
<th></th>
</tr>
</thead>
{% for port in port_list %}
<tr>
<th>{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='radius' text='Radius' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='vlan' text='Vlan forcé' %}</th>
<th>Détails</th>
<th></th>
</tr>
</thead>
{% for port in port_list %}
<tr>
<td>{{ port.port }}</td>
<td>
{% if port.room %}{{ port.room }}{% endif %}
</td>
<td>
{% if port.machine_interface %}
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
<td>{{ port.port }}</td>
<td>
{% if port.room %}{{ port.room }}{% endif %}
</td>
<td>
{% if port.machine_interface %}
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }}
{% acl_end %}
{% endif %}
</td>
<td>
{% if port.related %}
{% can_view port.related.switch %}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
{% acl_end %}
{% endif %}
</td>
<td>
{% if port.related %}
{% can_view port.related.switch %}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
{{ port.related }}
</a>
{% acl_else %}
{{ port.related }}
</a>
{% acl_else %}
{{ port.related }}
{% acl_end %}
{% endif %}
</td>
<td>{{ port.radius }}</td>
<td>{% if not port.vlan_force %}Aucun{% else %}{{ port.vlan_force }}{% endif %}</td>
<td>{{ port.details }}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'port' port.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit port %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-port' port.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete port %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-port' port.pk %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
{% acl_end %}
{% endif %}
</td>
<td>{{ port.radius }}</td>
<td>{% if not port.vlan_force %}Aucun{% else %}{{ port.vlan_force }}{% endif %}</td>
<td>{{ port.details }}</td>
<td class="text-right">
{% history_button port %}
{% can_edit port %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-port' port.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete port %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-port' port.pk %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
</div>

View file

@ -27,90 +27,90 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="table-responsive" style="font-size: 12px">
<table class="table table-bordered text-center text-nowrap">
<thead>
<tr>
<tr>
{% for port in port_list|slice:"::2" %}
<td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
{% for port in port_list|slice:"::2" %}
<td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
</tr>
<tr>
</tr>
<tr>
{% for port in port_list|slice:"::2" %}
{% if port.room %}
<td class="p-3 mb-2 bg-success text-dark">
{{ port.room }}
</td>
{% elif port.machine_interface %}
<td class="p-3 mb-2 bg-warning text-dark">
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{% for port in port_list|slice:"::2" %}
{% if port.room %}
<td class="p-3 mb-2 bg-success text-dark">
{{ port.room }}
</td>
{% elif port.machine_interface %}
<td class="p-3 mb-2 bg-warning text-dark">
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }}
{% acl_end %}
</td>
{% elif port.related%}
<td class="p-3 mb-2 bg-danger text-dark">
{% can_view port.related.switch %}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
{% acl_end %}
</td>
{% elif port.related%}
<td class="p-3 mb-2 bg-danger text-dark">
{% can_view port.related.switch %}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
{{ port.related }}
</a>
{% acl_else %}
{{ port.related }}
</a>
{% acl_else %}
{{ port.related }}
{% acl_end %}
</td>
{% else %}
<td class="p-3 mb-2 bg-info text-dark">
Vide
</td>
{% endif %}
{% endfor %}
</tr>
{% acl_end %}
</td>
{% else %}
<td class="p-3 mb-2 bg-info text-dark">
Vide
</td>
{% endif %}
{% endfor %}
<tr>
</tr>
{% for port in port_list|slice:"1::2" %}
<td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
<tr>
</tr>
<tr>
{% for port in port_list|slice:"1::2" %}
<td class="bg-primary text-white">{{ port.port }}</td>
{% endfor %}
{% for port in port_list|slice:"1::2" %}
{% if port.room %}
<td class="p-3 mb-2 bg-success text-dark">
{{ port.room }}
</td>
{% elif port.machine_interface %}
<td class="p-3 mb-2 bg-warning text-dark">
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
</tr>
<tr>
{% for port in port_list|slice:"1::2" %}
{% if port.room %}
<td class="p-3 mb-2 bg-success text-dark">
{{ port.room }}
</td>
{% elif port.machine_interface %}
<td class="p-3 mb-2 bg-warning text-dark">
{% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }}
{% acl_end %}
</td>
{% elif port.related%}
<td class="p-3 mb-2 bg-danger text-dark">
{% can_view port.related.switch %}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
{% acl_end %}
</td>
{% elif port.related%}
<td class="p-3 mb-2 bg-danger text-dark">
{% can_view port.related.switch %}
<a href="{% url 'topologie:index-port' switchid=port.related.switch.id %}">
{{ port.related }}
</a>
{% acl_else %}
{{ port.related }}
</a>
{% acl_else %}
{{ port.related }}
{% acl_end %}
</td>
{% else %}
<td class="p-3 mb-2 bg-info text-dark">
Vide
</td>
{% endif %}
{% endfor %}
</tr>
{% acl_end %}
</td>
{% else %}
<td class="p-3 mb-2 bg-info text-dark">
Vide
</td>
{% endif %}
{% endfor %}
</tr>
</table>
</div>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
@ -33,29 +34,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Membres</th>
<th></th>
</tr>
</thead>
{% for stack in stack_list %}
<tr>
<td>{{ stack.name }}</td>
<td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td>
<td>{% for switch in stack.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete stack %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</thead>
{% for stack in stack_list %}
<tr>
<td>{{ stack.name }}</td>
<td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td>
<td>{% for switch in stack.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right">
{% history_button stack %}
{% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete stack %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>

View file

@ -23,59 +23,60 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
{% if switch_list.paginator %}
{% include "pagination.html" with list=switch_list %}
{% endif %}
{% if switch_list.paginator %}
{% include "pagination.html" with list=switch_list %}
{% endif %}
<table class="table table-striped">
<thead>
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ip' text='Ipv4' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='loc' text='Emplacement' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %}</th>
<th>Id stack</th>
<th>Modèle</th>
<th>Détails</th>
<th></th>
</tr>
</thead>
{% for switch in switch_list %}
<tr>
<th>{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ip' text='Ipv4' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='loc' text='Emplacement' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %}</th>
<th>Id stack</th>
<th>Modèle</th>
<th>Détails</th>
<th></th>
<td>
<a title="Configuer" href="{% url 'topologie:index-port' switch.pk %}">
{{switch}}
</a>
</td>
<td>{{switch.interface_set.first.ipv4}}</td>
<td>{{switch.switchbay}}</td>
<td>{{switch.number}}</td>
<td>{{switch.stack.name}}</td>
<td>{{switch.stack_member_id}}</td>
<td>{{switch.model}}</td>
<td>{{switch.interface_set.first.details}}</td>
<td class="text-right">
{% history_button switch %}
{% can_edit switch %}
{% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.pk %}
{% acl_end %}
{% can_delete switch %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=switch.id %}
{% acl_end %}
{% can_create Port %}
{% include 'buttons/add.html' with href='topologie:create-ports' id=switch.pk desc='Création de ports'%}
{% acl_end %}
</td>
</tr>
</thead>
{% for switch in switch_list %}
<tr>
<td>
<a title="Configuer" href="{% url 'topologie:index-port' switch.pk %}">
{{switch}}
</a>
</td>
<td>{{switch.interface_set.first.ipv4}}</td>
<td>{{switch.switchbay}}</td>
<td>{{switch.number}}</td>
<td>{{switch.stack.name}}</td>
<td>{{switch.stack_member_id}}</td>
<td>{{switch.model}}</td>
<td>{{switch.interface_set.first.details}}</td>
<td class="text-right">
{% include 'buttons/history.html' with href='topologie:history' name='switch' id=switch.pk%}
{% can_edit switch %}
{% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.pk %}
{% acl_end %}
{% can_delete switch %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=switch.id %}
{% acl_end %}
{% can_create Port %}
{% include 'buttons/add.html' with href='topologie:create-ports' id=switch.pk desc='Création de ports'%}
{% acl_end %}
</td>
</tr>
{% endfor %}
</table>
{% endfor %}
</table>
{% if switch_list.paginator %}
{% include "pagination.html" with list=switch_list %}
{% endif %}
{% if switch_list.paginator %}
{% include "pagination.html" with list=switch_list %}
{% endif %}
</div>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% if switch_bay_list.paginator %}
{% include "pagination.html" with list=switch_bay_list %}
@ -32,35 +33,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='switch-bay' col='name' text='Baie' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch-bay' col='building' text='Bâtiment' %}</th>
<th>Info particulières</th>
<th>Switchs de la baie</th>
<th>{% include "buttons/sort.html" with prefix='switch-bay' col='building' text='Bâtiment' %}</th>
<th>Info particulières</th>
<th>Switchs de la baie</th>
<th></th>
</tr>
</thead>
{% for switch_bay in switch_bay_list %}
<tr>
<td>{{switch_bay.name}}</td>
<td>{{switch_bay.building}}</td>
<td>{{switch_bay.info}}</td>
<td>{% for switch in switch_bay.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'switchbay' switch_bay.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit switch_bay %}
</thead>
{% for switch_bay in switch_bay_list %}
<tr>
<td>{{switch_bay.name}}</td>
<td>{{switch_bay.building}}</td>
<td>{{switch_bay.info}}</td>
<td>{% for switch in switch_bay.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right">
{% history_button switch_bay %}
{% can_edit switch_bay %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-switch-bay' switch_bay.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete switch_bay %}
{% acl_end %}
{% can_delete switch_bay %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-switch-bay' switch_bay.id %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
{% acl_end %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>
{% if switch_bay_list.paginator %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
@ -31,27 +32,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>ID</th>
<th>Details</th>
</tr>
</thead>
{% for stack in stack_list %}
<tr>
<td>{{stack.name}}</td>
<td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}">
<i class="fa fa-history"></i>
</a>
{% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
</thead>
{% for stack in stack_list %}
<tr>
<td>{{stack.name}}</td>
<td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td>
<td class="text-right">
{% history_button stack %}
{% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<i class="fa fa-edit"></i>
</a>
{% acl_end %}
{% can_delete stack %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</a>
{% acl_end %}
{% can_delete stack %}
<a class="btn btn-danger btn-sm" role="button" title="Supprimer" href="{% url 'topologie:del-stack' stack.pk %}">
<i class="fa fa-trash"></i>
</a>
{% acl_end %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
</table>

View file

@ -30,7 +30,6 @@ from __future__ import unicode_literals
from django.conf.urls import url
import re2o
from . import views
urlpatterns = [
@ -51,10 +50,6 @@ urlpatterns = [
url(r'^switch/(?P<switchid>[0-9]+)$',
views.index_port,
name='index-port'),
url(r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'topologie'}),
url(r'^edit_port/(?P<portid>[0-9]+)$', views.edit_port, name='edit-port'),
url(r'^new_port/(?P<switchid>[0-9]+)$', views.new_port, name='new-port'),
url(r'^del_port/(?P<portid>[0-9]+)$', views.del_port, name='del-port'),

View file

@ -22,42 +22,43 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% if ban_list.paginator %}
{% include "pagination.html" with list=ban_list %}
{% endif %}
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='ban' col="user" text="Utilisateur" %}</th>
<th>Raison</th>
<th>{% include "buttons/sort.html" with prefix='ban' col="start" text="Date de début" %}</th>
<th>{% include "buttons/sort.html" with prefix='ban' col="end" text="Date de fin" %}</th>
<th></th>
</tr>
</thead>
{% for ban in ban_list %}
{% if ban.is_active %}
<tr class="danger">
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='ban' col="user" text="Utilisateur" %}</th>
<th>Raison</th>
<th>{% include "buttons/sort.html" with prefix='ban' col="start" text="Date de début" %}</th>
<th>{% include "buttons/sort.html" with prefix='ban' col="end" text="Date de fin" %}</th>
<th></th>
</tr>
</thead>
{% for ban in ban_list %}
{% if ban.is_active %}
<tr class="danger">
{% else %}
<tr>
{% endif %}
{% endif %}
<td>{{ ban.user }}</td>
<td>{{ ban.raison }}</td>
<td>{{ ban.date_start }}</td>
<td>{{ ban.date_end }}</td>
<td class="text-right">
{% can_delete ban %}
{% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %}
{% acl_end %}
{% can_edit ban %}
{% can_delete ban %}
{% include 'buttons/suppr.html' with href='users:del-ban' id=ban.id %}
{% acl_end %}
{% can_edit ban %}
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='ban' id=ban.id %}
{% acl_end %}
{% history_button ban %}
</td>
</tr>
{% endfor %}
</table>
</table>
{% if ban_list.paginator %}
{% include "pagination.html" with list=ban_list %}

View file

@ -28,36 +28,36 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='club' col="surname" text="Nom" %}</th>
<th>{% include "buttons/sort.html" with prefix='club' col="pseudo" text="Pseudo" %}</th>
<th>{% include "buttons/sort.html" with prefix='club' col="room" text="Chambre" %}</th>
<th>Fin de cotisation le</th>
<th>Connexion</th>
<th>Profil</th>
</tr>
</thead>
{% for club in clubs_list %}
{% can_view club %}
<tr>
<td>{{ club.surname }}</td>
<td>{{ club.pseudo }}</td>
<td>{{ club.room }}</td>
<td>{% if club.is_adherent %}{{ club.end_adhesion }}{% else %}Non adhérent{% endif %}</td>
<td>{% if club.has_access == True %}
<i class="text-success">Active</i>
{% else %}
<i class="text-danger">Désactivée</i>
{% endif %}
</td>
<td><a href="{% url "users:profil" club.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i></a>
</td>
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='club' col="surname" text="Nom" %}</th>
<th>{% include "buttons/sort.html" with prefix='club' col="pseudo" text="Pseudo" %}</th>
<th>{% include "buttons/sort.html" with prefix='club' col="room" text="Chambre" %}</th>
<th>Fin de cotisation le</th>
<th>Connexion</th>
<th>Profil</th>
</tr>
{% acl_end %}
{% endfor %}
</table>
</thead>
{% for club in clubs_list %}
{% can_view club %}
<tr>
<td>{{ club.surname }}</td>
<td>{{ club.pseudo }}</td>
<td>{{ club.room }}</td>
<td>{% if club.is_adherent %}{{ club.end_adhesion }}{% else %}Non adhérent{% endif %}</td>
<td>{% if club.has_access == True %}
<i class="text-success">Active</i>
{% else %}
<i class="text-danger">Désactivée</i>
{% endif %}
</td>
<td><a href="{% url "users:profil" club.id%}" class="btn btn-primary btn-sm" role="button"><i class="fa fa-user"></i></a>
</td>
</tr>
{% acl_end %}
{% endfor %}
</table>
{% if clubs_list.paginator %}
{% include "pagination.html" with list=clubs_list %}

View file

@ -23,20 +23,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load i18n %}
{% load logs_extra %}
{% if superusers.count %}
<div class="panel panel-default">
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_superuser">
<div class="pull-right">
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_superuser">
{{superusers.count}} <i class="fa fa-user"></i>
</a>
</div>
<h4 class="text-danger">
<i class="fa fa-address-book"></i>
{% trans "Superuser" %}
</h4>
{% trans "Django's specific pre-defined right that supersed any other rights." %}
<div class="pull-right">
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_superuser">
{{superusers.count}} <i class="fa fa-user"></i>
</a>
</div>
<h4 class="text-danger">
<i class="fa fa-address-book"></i>
{% trans "Superuser" %}
</h4>
{% trans "Django's specific pre-defined right that supersed any other rights." %}
</div>
<div class="panel-collapse collapse" id="collapse_superuser">
<div class="panel-body">
@ -106,24 +107,24 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% for right, users in rights.items %}
<div class="panel panel-default">
<div class="panel-heading clearfix" data-toggle="collapse" data-target="#collapse_{{right.id}}">
<div class="pull-right">
{% if users %}
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_{{right.id}}">
<div class="pull-right">
{% if users %}
<a type="button" class="btn btn-sm btn-default" data-toggle="modal" data-target="#modal_{{right.id}}">
{% else %}
<a type="button" class="btn btn-sm btn-default" disabled="disabled">
{% endif %}
{% endif %}
{{users.count}} <i class="fa fa-user"></i>
</a>
{% include 'buttons/edit.html' with href='users:edit-listright' id=right.id %}
{% include 'buttons/history.html' with href='users:history' name='listright' id=right.id %}
</div>
<h4 class="{% if right.critical %}text-danger{% endif %}">
<i class="fa fa-address-book"></i>
{% blocktrans trimmed with right.name as right_name and right.gid as right_gid %}
{{ right_name }} (gid: {{ right_gid }})
{% endblocktrans %}
</h4>
{{ right.details }}
{% history_button right %}
</div>
<h4 class="{% if right.critical %}text-danger{% endif %}">
<i class="fa fa-address-book"></i>
{% blocktrans trimmed with right.name as right_name and right.gid as right_gid %}
{{ right_name }} (gid: {{ right_gid }})
{% endblocktrans %}
</h4>
{{ right.details }}
</div>
<div class="panel-collapse collapse" id="collapse_{{right.id}}">
<div class="panel-body">

View file

@ -22,20 +22,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
<table class="table table-striped">
<thead>
<tr>
{% for right in right_list %}
<th>{{ right }}</th>
<th></th>
{% endfor %}
</tr>
</thead>
{% for user_right in user_right_list %}
<table class="table table-striped">
<thead>
<tr>
<td> {{ user_right }}</td>
{% for right in right_list %}
<th>{{ right }}</th>
<th></th>
{% endfor %}
</tr>
{% endfor %}
</table>
</thead>
{% for user_right in user_right_list %}
<tr>
<td> {{ user_right }}</td>
</tr>
{% endfor %}
</table>

View file

@ -22,18 +22,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
{% load logs_extra %}
<div class="table-responsive">
{% if school_list.paginator %}
{% include "pagination.html" with list=school_list %}
{% endif %}
{% if school_list.paginator %}
{% include "pagination.html" with list=school_list %}
{% endif %}
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}</th>
<th>{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}</th>
<th></th>
</tr>
</thead>
@ -44,14 +45,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit school %}
{% include 'buttons/edit.html' with href='users:edit-school' id=school.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='school' id=school.id %}
{% history_button school %}
</td>
</tr>
{% endfor %}
</table>
{% if school_list.paginator %}
{% include "pagination.html" with list=school_list %}
{% endif %}
{% if school_list.paginator %}
{% include "pagination.html" with list=school_list %}
{% endif %}
</div>

View file

@ -22,30 +22,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
{% load acl %}
<table class="table table-striped">
<thead>
<tr>
<th>Nom</th>
<th>Rôle</th>
<th>Commentaire</th>
<th></th>
</tr>
</thead>
{% for serviceuser in serviceusers_list %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ serviceuser.pseudo }}</td>
<td>{{ serviceuser.access_group }}</td>
<td>{{ serviceuser.comment }}</td>
<td class="text-right">
{% can_delete serviceuser %}
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% can_edit serviceuser %}
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %}
</td>
<th>Nom</th>
<th>Rôle</th>
<th>Commentaire</th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for serviceuser in serviceusers_list %}
<tr>
<td>{{ serviceuser.pseudo }}</td>
<td>{{ serviceuser.access_group }}</td>
<td>{{ serviceuser.comment }}</td>
<td class="text-right">
{% can_delete serviceuser %}
{% include 'buttons/suppr.html' with href='users:del-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% can_edit serviceuser %}
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
{% acl_end %}
{% history_button serviceuser %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -22,26 +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 %}
{% load acl %}
<table class="table table-striped">
<thead>
<tr>
<th>Shell</th>
<th></th>
</tr>
</thead>
{% for shell in shell_list %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<td>{{ shell.shell }}</td>
<td class="text-right">
{% can_delete shell %}
{% include 'buttons/suppr.html' with href='users:del-shell' id=shell.id %}
{% acl_end %}
{% can_edit shell %}
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='listshell' id=shell.id %}
</td>
<th>Shell</th>
<th></th>
</tr>
{% endfor %}
</table>
</thead>
{% for shell in shell_list %}
<tr>
<td>{{ shell.shell }}</td>
<td class="text-right">
{% can_delete shell %}
{% include 'buttons/suppr.html' with href='users:del-shell' id=shell.id %}
{% acl_end %}
{% can_edit shell %}
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
{% acl_end %}
{% history_button shell %}
</td>
</tr>
{% endfor %}
</table>

View file

@ -22,9 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %}
<div class="table-responsive">
{% if users_list.paginator %}
{% include "pagination.html" with list=users_list %}
{% endif %}
{% if users_list.paginator %}
{% include "pagination.html" with list=users_list %}
{% endif %}
<table class="table table-striped">
<thead>
@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %}
</table>
{% if users_list.paginator %}
{% include "pagination.html" with list=users_list %}
{% endif %}
{% if users_list.paginator %}
{% include "pagination.html" with list=users_list %}
{% endif %}
</div>

View file

@ -26,38 +26,39 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "pagination.html" with list=white_list %}
{% endif %}
{% load acl %}
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='white' col="user" text="Utilisateur" %}</th>
<th>Raison</th>
<th>{% include "buttons/sort.html" with prefix='white' col="start" text="Date de début" %}</th>
<th>{% include "buttons/sort.html" with prefix='white' col="end" text="Date de fin" %}</th>
<th></th>
</tr>
</thead>
{% for whitelist in white_list %}
{% if whitelist.is_active %}
<tr class="success">
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='white' col="user" text="Utilisateur" %}</th>
<th>Raison</th>
<th>{% include "buttons/sort.html" with prefix='white' col="start" text="Date de début" %}</th>
<th>{% include "buttons/sort.html" with prefix='white' col="end" text="Date de fin" %}</th>
<th></th>
</tr>
</thead>
{% for whitelist in white_list %}
{% if whitelist.is_active %}
<tr class="success">
{% else %}
<tr>
{% endif %}
{% endif %}
<td>{{ whitelist.user }}</td>
<td>{{ whitelist.raison }}</td>
<td>{{ whitelist.date_start }}</td>
<td>{{ whitelist.date_end }}</td>
<td class="text-right">
{% can_delete whitelist %}
{% can_delete whitelist %}
{% include 'buttons/suppr.html' with href='users:del-whitelist' id=whitelist.id %}
{% acl_end %}
{% can_edit whitelist %}
{% acl_end %}
{% can_edit whitelist %}
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
{% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='whitelist' id=whitelist.id %}
{% acl_end %}
{% history_button whitelist %}
</td>
</tr>
{% endfor %}
</table>
</table>
{% if white_list.paginator %}
{% include "pagination.html" with list=white_list %}

View file

@ -25,12 +25,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %}
{% load acl %}
{% load logs_extra %}
{% block title %}Profil{% endblock %}
{% block content %}
<h2>{{ users.surname }} {{users.name}}</h2>
<p>Vous êtes {% if users.end_adhesion != None %}<span class="label label-success">
un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger">
non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger">
non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<span class="label label-success">active</span>{% else %}<span class="label label-danger">désactivée</span>{% endif %}.</p>
{% if user_solde %}
<p>Votre solde est de <span class="badge">{{ users.solde }}€</span>.
@ -49,134 +50,131 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
</h3>
</div>
<div class="panel-collapse collapse in" id="collapse1">
<div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
<i class="fa fa-edit"></i>
Editer
</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}">
<i class="fa fa-lock"></i>
Changer le mot de passe
</a>
{% can_change User state %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
<i class="fa fa-id-badge"></i>
Changer le statut
</a>
{% acl_end %}
{% can_change User groups %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
<i class="fa fa-check"></i>
Gérer les groupes
</a>
{% acl_end %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}">
<i class="fa fa-history"></i>
Historique
</a>
<div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-info' users.id %}">
<i class="fa fa-edit"></i>
Editer
</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:password' users.id %}">
<i class="fa fa-lock"></i>
Changer le mot de passe
</a>
{% can_change User state %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:state' users.id %}">
<i class="fa fa-id-badge"></i>
Changer le statut
</a>
{% acl_end %}
{% can_change User groups %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:groups' users.id %}">
<i class="fa fa-check"></i>
Gérer les groupes
</a>
{% acl_end %}
{% history_button users text=True %}
</ul>
</div>
<div class="panel-body">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped">
<tr>
{% if users.is_class_club %}
<th>Mailing</th>
{% if users.club.mailing %}
<td>{{ users.pseudo }}(-admin)</td>
{% else %}
<td>Mailing désactivée</td>
{% endif %}
{% else %}
<th>Prénom</th>
<td>{{ users.name }}</td>
{% endif %}
<th>Nom</th>
<td>{{ users.surname }}</td>
</tr>
<tr>
<th>Pseudo</th>
<td>{{ users.pseudo }}</td>
<th>E-mail</th>
<td>{{ users.email }}</td>
</tr>
<tr>
<th>Chambre</th>
<td>{{ users.room }}</td>
<th>Téléphone</th>
<td>{{ users.telephone }}</td>
</tr>
<tr>
<th>École</th>
<td>{{ users.school }}</td>
<th>Commentaire</th>
<td>{{ users.comment }}</td>
</tr>
<tr>
<th>Date d'inscription</th>
<td>{{ users.registered }}</td>
<th>Dernière connexion</th>
<td>{{ users.last_login }}</td>
</tr>
<tr>
<th>Fin d'adhésion</th>
{% if users.end_adhesion != None %}
<td><i class="text-success">{{ users.end_adhesion }}</i></td>
{% else %}
<td><i class="text-danger">Non adhérent</i></td>
{% endif %}
<th>Accès gracieux</th>
{% if users.end_whitelist != None %}
<td><i class="text-success">{{ users.end_whitelist }}</i></td>
{% else %}
<td><i class="text-warning">Aucun</i></td>
{% endif %}
<tr>
<th>Bannissement</th>
{% if users.end_ban != None %}
<td><i class="text-danger">{{ users.end_ban }}</i></td>
{% else %}
<td><i class="text-success">Non banni</i></td>
{% endif %}
<th>Statut</th>
{% if users.state == 0 %}
<td><i class="text-success">Actif</i></td>
{% elif users.state == 1 %}
<td><i class="text-danger">Désactivé</i></td>
{% else %}
<td><i class="text-warning">Archivé</i></td>
{% endif %}
</tr>
<tr>
<th>Accès internet</th>
{% if users.has_access == True %}
<td><i class="text-success">Actif (jusqu'au {{ users.end_access }})</i></td>
{% else %}
<td><i class="text-danger">Désactivé</i></td>
{% endif %}
<th>Groupes</th>
{% if users.groups.all %}
<td>{{ users.groups.all|join:", "}}</td>
{% else %}
<td>Aucun</td>
{% endif %}
</tr>
<tr>
<th>Solde</th>
<td>{{ users.solde }} €
{% if user_solde %}
<a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
<i class="fa fa-euro-sign"></i>
Recharger
</a>
{% endif %}
</td>
{% if users.shell %}
<th>Shell</th>
<td>{{ users.shell }}</td>
{% endif %}
</tr>
</table>
<table class="table table-striped">
<tr>
{% if users.is_class_club %}
<th>Mailing</th>
{% if users.club.mailing %}
<td>{{ users.pseudo }}(-admin)</td>
{% else %}
<td>Mailing désactivée</td>
{% endif %}
{% else %}
<th>Prénom</th>
<td>{{ users.name }}</td>
{% endif %}
<th>Nom</th>
<td>{{ users.surname }}</td>
</tr>
<tr>
<th>Pseudo</th>
<td>{{ users.pseudo }}</td>
<th>E-mail</th>
<td>{{ users.email }}</td>
</tr>
<tr>
<th>Chambre</th>
<td>{{ users.room }}</td>
<th>Téléphone</th>
<td>{{ users.telephone }}</td>
</tr>
<tr>
<th>École</th>
<td>{{ users.school }}</td>
<th>Commentaire</th>
<td>{{ users.comment }}</td>
</tr>
<tr>
<th>Date d'inscription</th>
<td>{{ users.registered }}</td>
<th>Dernière connexion</th>
<td>{{ users.last_login }}</td>
</tr>
<tr>
<th>Fin d'adhésion</th>
{% if users.end_adhesion != None %}
<td><i class="text-success">{{ users.end_adhesion }}</i></td>
{% else %}
<td><i class="text-danger">Non adhérent</i></td>
{% endif %}
<th>Accès gracieux</th>
{% if users.end_whitelist != None %}
<td><i class="text-success">{{ users.end_whitelist }}</i></td>
{% else %}
<td><i class="text-warning">Aucun</i></td>
{% endif %}
<tr>
<th>Bannissement</th>
{% if users.end_ban != None %}
<td><i class="text-danger">{{ users.end_ban }}</i></td>
{% else %}
<td><i class="text-success">Non banni</i></td>
{% endif %}
<th>Statut</th>
{% if users.state == 0 %}
<td><i class="text-success">Actif</i></td>
{% elif users.state == 1 %}
<td><i class="text-danger">Désactivé</i></td>
{% else %}
<td><i class="text-warning">Archivé</i></td>
{% endif %}
</tr>
<tr>
<th>Accès internet</th>
{% if users.has_access == True %}
<td><i class="text-success">Actif (jusqu'au {{ users.end_access }})</i></td>
{% else %}
<td><i class="text-danger">Désactivé</i></td>
{% endif %}
<th>Groupes</th>
{% if users.groups.all %}
<td>{{ users.groups.all|join:", "}}</td>
{% else %}
<td>Aucun</td>
{% endif %}
</tr>
<tr>
<th>Solde</th>
<td>{{ users.solde }} €
{% if user_solde %}
<a class="btn btn-primary btn-sm" style='float:right' role="button" href="{% url 'cotisations:credit-solde' users.pk%}">
<i class="fa fa-euro-sign"></i>
Recharger
</a>
{% endif %}
</td>
{% if users.shell %}
<th>Shell</th>
<td>{{ users.shell }}</td>
{% endif %}
</tr>
</table>
</div>
</div>
</div>
@ -193,46 +191,46 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:edit-club-admin-members' users.club.id %}">
<i class="fa fa-lock"></i>
Gérer admin et membres
</a>
</a>
</div>
<div class="panel-body">
<div class="panel-body">
<h4>Administrateurs du club</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<table class="table table-striped">
<thead>
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>Pseudo</th>
</tr>
</thead>
{% for admin in users.club.administrators.all %}
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>Pseudo</th>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
</thead>
{% for admin in users.club.administrators.all %}
<tr>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
{% endfor %}
</table>
{% endfor %}
</table>
</div>
<h4>Membres</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<table class="table table-striped">
<thead>
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>Pseudo</th>
</tr>
</thead>
{% for admin in users.club.members.all %}
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>Pseudo</th>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
</thead>
{% for admin in users.club.members.all %}
<tr>
<td>{{ admin.surname }}</td>
<td>{{ admin.name }}</td>
<td>{{ admin.pseudo }}</td>
</tr>
{% endfor %}
</table>
{% endfor %}
</table>
</div>
</div>
</div>
@ -245,12 +243,12 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
Machines
<span class="badge">{{nb_machines}}</span>
</h3>
</div>
</div>
<div id="collapse3" class="panel-collapse collapse">
<div class="panel-body">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
<i class="fa fa-desktop"></i>
Ajouter une machine
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-machine' users.id %}">
<i class="fa fa-desktop"></i>
Ajouter une machine
</a>
</div>
<div class="panel-body">
@ -299,12 +297,12 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
<i class="fa fa-ban"></i>
Bannissements
</h3>
</div>
</div>
<div id="collapse5" class="panel-collapse collapse">
<div class="panel-body">
{% can_create Ban %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}">
<i class="fa fa-ban"></i>
<div class="panel-body">
{% can_create Ban %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-ban' users.id %}">
<i class="fa fa-ban"></i>
Ajouter un bannissement
</a>
{% acl_end %}
@ -326,12 +324,12 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
</h3>
</div>
<div id="collapse6" class="panel-collapse collapse">
<div class="panel-body">
<div class="panel-body">
{% can_create Whitelist %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}">
<i class="fa fa-check-circle"></i>
Accorder un accès à titre gracieux
</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:add-whitelist' users.id %}">
<i class="fa fa-check-circle"></i>
Accorder un accès à titre gracieux
</a>
{% acl_end %}
</div>
<div class="panel-body">

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url
import re2o
from . import views
urlpatterns = [
@ -95,10 +94,6 @@ urlpatterns = [
url(r'^process/(?P<token>[a-z0-9]{32})/$', views.process, name='process'),
url(r'^reset_password/$', views.reset_password, name='reset-password'),
url(r'^mass_archive/$', views.mass_archive, name='mass-archive'),
url(r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
re2o.views.history,
name='history',
kwargs={'application': 'users'}),
url(r'^$', views.index, name='index'),
url(r'^index_clubs/$', views.index_clubs, name='index-clubs'),
url(r'^rest/ml/std/$',