Commit 34bf50e7 authored by Fernet Laouen's avatar Fernet Laouen

Translation of machines/ (front)

parent af40e3ea
......@@ -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('machines')
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.")
......@@ -37,7 +37,7 @@ from __future__ import unicode_literals
from django.forms import ModelForm, Form
from django import forms
from django.utils.translation import ugettext_lazy as _l
from django.utils.translation import ugettext_lazy as _
from re2o.field_permissions import FieldPermissionFormMixin
from re2o.mixins import FormRevMixin
......@@ -75,7 +75,7 @@ class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(EditMachineForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['name'].label = 'Nom de la machine'
self.fields['name'].label = _("Machine name")
class NewMachineForm(EditMachineForm):
......@@ -94,12 +94,11 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
user = kwargs.get('user')
super(EditInterfaceForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['mac_address'].label = 'Adresse mac'
self.fields['type'].label = 'Type de machine'
self.fields['type'].empty_label = "Séléctionner un type de machine"
self.fields['mac_address'].label = _("MAC address")
self.fields['type'].label = _("Machine type")
self.fields['type'].empty_label = _("Select a machine type")
if "ipv4" in self.fields:
self.fields['ipv4'].empty_label = ("Assignation automatique de "
"l'ipv4")
self.fields['ipv4'].empty_label = _("Automatic IPv4 assignment")
self.fields['ipv4'].queryset = IpList.objects.filter(
interface__isnull=True
)
......@@ -170,7 +169,7 @@ class DelAliasForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs objets alias"""
alias = forms.ModelMultipleChoiceField(
queryset=Domain.objects.all(),
label="Alias actuels",
label=_("Current aliases"),
widget=forms.CheckboxSelectMultiple
)
......@@ -191,15 +190,15 @@ class MachineTypeForm(FormRevMixin, ModelForm):
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(MachineTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['type'].label = 'Type de machine à ajouter'
self.fields['ip_type'].label = "Type d'ip relié"
self.fields['type'].label = _("Machine type to add")
self.fields['ip_type'].label = _("Related IP type")
class DelMachineTypeForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs machinetype"""
machinetypes = forms.ModelMultipleChoiceField(
queryset=MachineType.objects.none(),
label="Types de machines actuelles",
label=_("Current machine types"),
widget=forms.CheckboxSelectMultiple
)
......@@ -222,7 +221,7 @@ class IpTypeForm(FormRevMixin, ModelForm):
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(IpTypeForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['type'].label = 'Type ip à ajouter'
self.fields['type'].label = _("IP type to add")
class EditIpTypeForm(IpTypeForm):
......@@ -239,7 +238,7 @@ class DelIpTypeForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs iptype"""
iptypes = forms.ModelMultipleChoiceField(
queryset=IpType.objects.none(),
label="Types d'ip actuelles",
label=_("Current IP types"),
widget=forms.CheckboxSelectMultiple
)
......@@ -261,17 +260,17 @@ class ExtensionForm(FormRevMixin, ModelForm):
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(ExtensionForm, self).__init__(*args, prefix=prefix, **kwargs)
self.fields['name'].label = 'Extension à ajouter'
self.fields['origin'].label = 'Enregistrement A origin'
self.fields['origin_v6'].label = 'Enregistrement AAAA origin'
self.fields['soa'].label = 'En-tête SOA à utiliser'
self.fields['name'].label = _("Extension to add")
self.fields['origin'].label = _("A record origin")
self.fields['origin_v6'].label = _("AAAA record origin")
self.fields['soa'].label = _("SOA record to use")
class DelExtensionForm(FormRevMixin, Form):
"""Suppression d'une ou plusieurs extensions"""
extensions = forms.ModelMultipleChoiceField(
queryset=Extension.objects.none(),
label="Extensions actuelles",
label=_("Current extensions"),
widget=forms.CheckboxSelectMultiple
)
......@@ -310,7 +309,7 @@ class DelSOAForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs SOA"""
soa = forms.ModelMultipleChoiceField(
queryset=SOA.objects.none(),
label="SOA actuels",
label=_("Current SOA records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -341,7 +340,7 @@ class DelMxForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs MX"""
mx = forms.ModelMultipleChoiceField(
queryset=Mx.objects.none(),
label="MX actuels",
label=_("Current MX records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -374,7 +373,7 @@ class DelNsForm(FormRevMixin, Form):
"""Suppresion d'un ou plusieurs NS"""
ns = forms.ModelMultipleChoiceField(
queryset=Ns.objects.none(),
label="Enregistrements NS actuels",
label=_("Current NS records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -402,7 +401,7 @@ class DelTxtForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs TXT"""
txt = forms.ModelMultipleChoiceField(
queryset=Txt.objects.none(),
label="Enregistrements Txt actuels",
label=_("Current TXT records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -430,7 +429,7 @@ class DelDNameForm(FormRevMixin, Form):
"""Delete a set of DNAME entries"""
dnames = forms.ModelMultipleChoiceField(
queryset=Txt.objects.none(),
label="Existing DNAME entries",
label=_("Current DNAME records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -458,7 +457,7 @@ class DelSrvForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs Srv"""
srv = forms.ModelMultipleChoiceField(
queryset=Srv.objects.none(),
label="Enregistrements Srv actuels",
label=_("Current SRV records"),
widget=forms.CheckboxSelectMultiple
)
......@@ -487,7 +486,7 @@ class DelNasForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs nas"""
nas = forms.ModelMultipleChoiceField(
queryset=Nas.objects.none(),
label="Enregistrements Nas actuels",
label=_("Current NAS devices"),
widget=forms.CheckboxSelectMultiple
)
......@@ -519,7 +518,7 @@ class DelRoleForm(FormRevMixin, Form):
"""Deletion of one or several roles."""
role = forms.ModelMultipleChoiceField(
queryset=Role.objects.none(),
label=_l("Current roles"),
label=_("Current roles"),
widget=forms.CheckboxSelectMultiple
)
......@@ -560,7 +559,7 @@ class DelServiceForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs service"""
service = forms.ModelMultipleChoiceField(
queryset=Service.objects.none(),
label="Services actuels",
label=_("Current services"),
widget=forms.CheckboxSelectMultiple
)
......@@ -588,7 +587,7 @@ class DelVlanForm(FormRevMixin, Form):
"""Suppression d'un ou plusieurs vlans"""
vlan = forms.ModelMultipleChoiceField(
queryset=Vlan.objects.none(),
label="Vlan actuels",
label=_("Current VLANs"),
widget=forms.CheckboxSelectMultiple
)
......@@ -646,3 +645,4 @@ class SshFpForm(FormRevMixin, ModelForm):
prefix=prefix,
**kwargs
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -23,25 +23,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load acl %}
{% load i18n %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
<th>Alias</th>
<th>{% trans "Aliases" %}</th>
<th></th>
</tr>
</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>
<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>
......@@ -22,16 +22,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Target zone</th>
<th>Record</th>
<th></th>
</tr>
</thead>
{% for dname in dname_list %}
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "Target zone" %}</th>
<th>{% trans "Record" %}</th>
<th></th>
</tr>
</thead>
{% for dname in dname_list %}
<tr>
<td>{{ dname.zone }}</td>
<td>{{ dname.dns_entry }}</td>
......@@ -39,10 +40,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit dname %}
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
{% acl_end %}
{% history_button dname %}
{% history_button dname %}
</td>
</tr>
{% endfor %}
</table>
{% endfor %}
</table>
......@@ -25,17 +25,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load design %}
{% load i18n %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Extension</th>
<th>Droit infra pour utiliser ?</th>
<th>Enregistrement SOA</th>
<th>Enregistrement A origin</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "SOA record" %}</th>
<th>{% trans "A record origin" %}</th>
{% if ipv6_enabled %}
<th>Enregistrement AAAA origin</th>
<th>{% trans "AAAA record origin" %}</th>
{% endif %}
<th></th>
</tr>
......@@ -44,7 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<td>{{ extension.name }}</td>
<td>{{ extension.need_infra|tick }}</td>
<td>{{ extension.soa}}</td>
<td>{{ extension.soa }}</td>
<td>{{ extension.origin }}</td>
{% if ipv6_enabled %}
<td>{{ extension.origin_v6 }}</td>
......@@ -59,3 +60,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %}
</table>
</div>
......@@ -26,18 +26,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Type d'ip</th>
<th>Extension</th>
<th>Nécessite l'autorisation infra</th>
<th>Plage ipv4</th>
<th>Préfixe v6</th>
<th>DNSSEC reverse v4/v6</th>
<th>Sur vlan</th>
<th>Ouverture ports par défault</th>
<th>{% trans "IP type" %}</th>
<th>{% trans "Extension" %}</th>
<th>{% trans "'infra' right required" %}</th>
<th>{% trans "IPv4 range" %}</th>
<th>{% trans "v6 prefix" %}</th>
<th>{% trans "DNSSEC reverse v4/v6" %}</th>
<th>{% trans "On VLAN(s)" %}</th>
<th>{% trans "Default ports opening" %}</th>
<th></th>
</tr>
</thead>
......@@ -61,3 +63,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endfor %}
</table>
</div>
......@@ -24,29 +24,30 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Ipv6</th>
<th>Slaac</th>
<th>{% trans "IPv6 addresses" %}</th>
<th>{% trans "SLAAC" %}</th>
<th></th>
</tr>
</thead>
</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>
<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>
......@@ -24,26 +24,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Type de machine</th>
<th>Type d'ip correspondant</th>
<th>{% trans "Machine type" %}</th>
<th>{% trans "Matching IP type" %}</th>
<th></th>
</tr>
</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>
<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>
......@@ -24,30 +24,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Zone concernée</th>
<th>Priorité</th>
<th>Enregistrement</th>
<th></th>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Priority" %}</th>
<th>{% trans "Record" %}</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 %}
{% history_button mx %}
</td>
</tr>
<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 %}
{% history_button mx %}
</td>
</tr>
{% endfor %}
</table>
......@@ -25,32 +25,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load design %}
{% load i18n %}
<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>{% trans "Name" %}</th>
<th>{% trans "NAS device type" %}</th>
<th>{% trans "Machine type linked to the NAS device" %}</th>
<th>{% trans "Access mode" %}</th>
<th>{% trans "MAC address auto capture" %}</th>
<th></th>
</tr>
</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|tick }}</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>
<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|tick }}</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>
......@@ -24,28 +24,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Zone concernée</th>
<th>Interface autoritaire de la zone</th>
<th></th>
<th>{% trans "Concerned zone" %}</th>
<th>{% trans "Authoritarian interface for the concerned zone" %}</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 %}
{% history_button ns %}
</td>
</tr>
<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 %}
{% history_button ns %}
</td>
</tr>
{% endfor %}
</table>
......@@ -38,14 +38,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr>
</thead>
{% for role in role_list %}
<tr>
<td>{{ role.role_type }}</td>
<td>{{ role.specific_role }}</td>
<td>{% for serv in role.servers.all %}{{ serv }}, {% endfor %}</td>
<td class="text-right">
{% can_edit role %}
<tr>
<td>{{ role.role_type }}</td>
<td>{{ role.specific_role }}</td>
<td>{% for serv in role.servers.all %}{{ serv }}, {% endfor %}</td>
<td class="text-right">
{% can_edit role %}
{% include 'buttons/edit.html' with href='machines:edit-role' id=role.id %}
{% acl_end %}
{% acl_end %}
{% history_button role %}
</td>
</tr>
......
......@@ -23,27 +23,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %}
{% load design %}
{% load i18n %}
<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>
<th>{% trans "Service name" %}</th>
<th>{% trans "Server" %}</th>
<th>{% trans "Last regeneration" %}</th>
<th>{% trans "Regeneration required" %}</th>
<th>{% trans "Regeneration activated" %}</th>
</tr>
</thead>
{% for server in servers_list %}
<tr>
<td>{{ server.service }}</td>
<td>{{ server.server }}</td>
<td>{{ server.last_regen }}</td>
<td>{{ server.asked_regen| tick }}</td>
<td>{{ server.need_regen | tick }}</td>
<td class="text-right">
</td>
</tr>
<tr>
<td>{{ server.service }}</td>
<td>{{ server.server }}</td>
<td>{{ server.last_regen }}</td>
<td>{{ server.asked_regen|tick }}</td>
<td>{{ server.need_regen|tick }}</td>
<td class="text-right">
</td>
</tr>
{% endfor %}
</table>
......@@ -24,32 +24,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<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>Demander la regeneration</th>
<th>{% trans "Service name" %}</th>
<th>{% trans "Minimal time before regeneration" %}</th>
<th>{% trans "Maximal time before regeneration" %}</th>
<th>{% trans "Included servers" %}</th>
<th>{% trans "Ask for regeneration" %}</th>
<th></th>
</tr>
</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><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i class="fas fa-sync"></i></a></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>
<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><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i class="fa fa-sync"></i></a></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>
......@@ -24,36 +24,35 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<table class="table table-striped">
<thead>
<tr>
<th>Nom</th>
<th>Mail</th>
<th>Refresh</th>
<th>Retry</th>