Commit eb944249 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Added translations and help_texts

parent 53979954
......@@ -13,7 +13,8 @@ import pprint
import re
FQDN_RE = r'(^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$)'
#FQDN_RE = r'(^[a-z0-9.-]{1,255}$)'
DN_RE = r'(^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$)'
class UserProfileForm(forms.ModelForm):
......@@ -30,18 +31,12 @@ class InstDetailsForm(forms.ModelForm):
institution = self.cleaned_data['institution']
if institution.ertype in [2,3]:
if oper_name:
match = re.match(DN_RE, oper_name)
if not match:
raise forms.ValidationError('Invalid domain name format.')
return self.cleaned_data["oper_name"]
else:
raise forms.ValidationError('This field is required.')
def clean_number_user(self):
number_user = self.cleaned_data['number_user']
institution = self.cleaned_data['institution']
if institution.ertype in [1,3]:
if number_user:
return self.cleaned_data["number_user"]
else:
raise forms.ValidationError('This field is required.')
class InstServerForm(forms.ModelForm):
......
......@@ -6,7 +6,7 @@ TODO main description
'''
from django.db import models
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
......@@ -114,9 +114,9 @@ ERTYPES = (
RADPROTOS = (
('radius', 'traditional RADIUS over UDP' ),
('radius-tcp', 'RADIUS over TCP (RFC6613)'),
('radius-tls', 'RADIUS over TLS (RFC6614)'),
('radius-dtls', 'RADIUS over datagram TLS (RESERVED)'),
# ('radius-tcp', 'RADIUS over TCP (RFC6613)'),
# ('radius-tls', 'RADIUS over TLS (RFC6614)'),
# ('radius-dtls', 'RADIUS over datagram TLS (RESERVED)'),
)
......@@ -203,17 +203,17 @@ class InstServer(models.Model):
# 3: accept if instid.ertype: 3 (idpsp)
# hostname/ipaddr or descriptive label of server
name = models.CharField(max_length=80, help_text="Descriptive label", null=True, blank=True) # ** (acts like a label)
name = models.CharField(max_length=80, help_text=_("Descriptive label"), null=True, blank=True) # ** (acts like a label)
# hostname/ipaddr of server, overrides name
host = models.CharField(max_length=80, help_text="IP address of FQDN hostname") # Handling with FQDN parser or ipaddr (google lib) * !!! Add help text to render it in template (mandatory, unique)
host = models.CharField(max_length=80, help_text=_("IP address | FQDN hostname")) # Handling with FQDN parser or ipaddr (google lib) * !!! Add help text to render it in template (mandatory, unique)
#TODO: Add description field or label field
# accept if type: 1 (idp) or 3 (idpsp) (for the folowing 4 fields)
port = models.PositiveIntegerField(max_length=5, null=True, blank=True) # TODO: Also ignore while exporting XML
acct_port = models.PositiveIntegerField(max_length=5, null=True, blank=True)
timeout = models.PositiveIntegerField(max_length=2, null=True, blank=True)
port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1812, help_text=_("Defaul for Radius: 1812")) # TODO: Also ignore while exporting XML
acct_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1813, help_text=_("Defaul for Radius: 1813"))
timeout = models.PositiveIntegerField(max_length=2, null=True, blank=True, help_text=_("Timeout in seconds"))
retry = models.PositiveIntegerField(max_length=2, null=True, blank=True)
status_server = models.BooleanField()
status_server = models.BooleanField(help_text=_("Do you accept Status-Server requests?"))
secret = models.CharField(max_length=16)
proto = models.CharField(max_length=12, choices=RADPROTOS)
ts = models.DateTimeField(auto_now=True)
......@@ -407,10 +407,10 @@ class InstitutionDetails(models.Model):
contact = models.ManyToManyField(Contact)
url = generic.GenericRelation(URL_i18n)
# accept if ertype: 2 (sp) or 3 (idpsp) (Applies to the following field)
oper_name = models.CharField(max_length=24, null=True, blank=True)
oper_name = models.CharField(max_length=24, null=True, blank=True, help_text=_('The primary, registered domain name for your institution, eg. example.com.<br>This is used to derive the Operator-Name attribute according to RFC5580, par.4.1, using the REALM namespace.'))
# accept if ertype: 1 (idp) or 3 (idpsp) (Applies to the following field)
number_user = models.PositiveIntegerField(max_length=6, null=True, blank=True)
number_id = models.PositiveIntegerField(max_length=6)
number_user = models.PositiveIntegerField(max_length=6, null=True, blank=True, help_text=_("Number of users (individuals) that are eligible to participate in eduroam service"))
number_id = models.PositiveIntegerField(max_length=6, null=True, blank=True, help_text=_("Number of issued e-identities (credentials) that may be used for authentication in eduroam service"))
ts = models.DateTimeField(auto_now=True)
def __unicode__(self):
......
This diff is collapsed.
......@@ -32,6 +32,14 @@ select, textarea, input[type="text"], input[type="password"], input[type="dateti
.btn{
font-size: 13px;
}
.form-horizontal .help-block {
font-size: 10px;
font-style: italic;
margin-bottom: 0;
margin-top: 5px;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Everything below this line is the same as demo_table.css. This file is
......
......@@ -67,7 +67,7 @@
</div>
{% if institution.ertype == 2 or institution.ertype == 3 %}
<div class="control-group">
<label class="control-label" for="id_oper_name">{% trans "Oper Name" %}</label>
<label class="control-label" for="id_oper_name">{% trans "Domain Name" %}</label>
<div class="controls">
{{ institution.institutiondetails.oper_name }}
</div>
......@@ -82,7 +82,7 @@
</div>
{% endif %}
<div class="control-group">
<label class="control-label" for="id_number_id">{% trans "Number Id" %}</label>
<label class="control-label" for="id_number_id">{% trans "Number of IDs" %}</label>
<div class="controls">
{{ institution.institutiondetails.number_id }}
</div>
......
......@@ -141,17 +141,17 @@ function addButton(row){
</div>
{% if institution.ertype == 2 or institution.ertype == 3 %}
<div class="control-group {% if form.oper_name.errors %} error {% endif %}">
<label class="control-label" for="id_oper_name"><b>{% trans "Oper Name" %}</b></label>
<label class="control-label" for="id_oper_name"><b>{% trans "Domain Name" %}</b></label>
<div class="controls">
{{ form.oper_name }}
{% if form.oper_name.errors %} <span class="help-inline"> {{ form.oper_name.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.oper_name.help_text }}</span>
{% endif %} <span class="help-block">{% autoescape off %}{{ form.oper_name.help_text }}{% endautoescape %}</span>
</div>
</div>
{% endif %}
{% if institution.ertype == 1 or institution.ertype == 3 %}
<div class="control-group {% if form.number_user.errors %} error {% endif %}">
<label class="control-label" for="id_number_user"><b>{% trans "Number of Users" %}</b></label>
<label class="control-label" for="id_number_user">{% trans "Number of Users" %}</label>
<div class="controls">
{{ form.number_user }}
{% if form.number_user.errors %} <span class="help-inline"> {{ form.number_user.errors|join:", " }} </span>
......@@ -160,7 +160,7 @@ function addButton(row){
</div>
{% endif %}
<div class="control-group {% if form.number_id.errors %} error {% endif %}">
<label class="control-label" for="id_number_id"><b>{% trans "Number Id" %}</b></label>
<label class="control-label" for="id_number_id">{% trans "Number of IDs" %}</label>
<div class="controls">
{{ form.number_id }}
{% if form.number_id.errors %} <span class="help-inline"> {{ form.number_id.errors|join:", " }} </span>
......
......@@ -53,7 +53,7 @@
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_acct_port">{% trans "acct_port" %}</label>
<label class="control-label" for="id_acct_port">{% trans "Accounting Port" %}</label>
<div class="controls">
{{ server.acct_port }}
</div>
......
......@@ -23,10 +23,7 @@ var oTable = $('#table').dataTable({
}, {
"bSearchable": true,
"bSortable": true
}, {
"bSearchable": true,
"bSortable": true
}, {
}, {
"bSearchable": true,
"bSortable": true
}, {
......@@ -114,8 +111,7 @@ $("#delserverSubmit").click(function(){
<th>{% trans "Name" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Port" %}</th>
<th>{% trans "acct_port" %}</th>
<th>{% trans "proto" %}</th>
<th>{% trans "Protocol" %}</th>
<th style="text-align: center;">{% trans "Action" %}</th>
</tr>
</thead>
......@@ -126,7 +122,6 @@ $("#delserverSubmit").click(function(){
<td><a href = "{% url servers server.pk %}">{{server.get_name}}</a></td>
<td>{{server.get_ertype_display}}</td>
<td>{{server.port}}</td>
<td>{{server.acct_port}}</td>
<td>{{server.proto}}</td>
<td style="text-align: center;"><a href="{% url edit-servers server.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_server_{{server.pk}}" data-servername="{{server.name}}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
</tr>
......
......@@ -8,7 +8,12 @@
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript"></script>
<script type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#id_script").attr('type', 'password');
});
</script>
{% endblock %}
{% block homeactive %}{% endblock %}
{% block serversactive %}class="active"{% endblock %}
......@@ -29,15 +34,7 @@
<div class="controls">
{{ form.ertype }}
{% if form.ertype.errors %} <span class="help-inline"> {{ form.ertype.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.ertype.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.name.errors %} error {% endif %}">
<label class="control-label" for="id_name">{% trans "Label" %}</label>
<div class="controls">
{{ form.name }}
{% if form.name.errors %} <span class="help-inline"> {{ form.name.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.name.help_text }}</span>
{% endif %} <span class="help-block">{{ form.ertype.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.host.errors %} error {% endif %}">
......@@ -45,7 +42,15 @@
<div class="controls">
{{ form.host }}
{% if form.host.errors %} <span class="help-inline"> {{ form.host.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.host.help_text }}</span>
{% endif %} <span class="help-block">{{ form.host.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.name.errors %} error {% endif %}">
<label class="control-label" for="id_name">{% trans "Label" %}</label>
<div class="controls">
{{ form.name }}
{% if form.name.errors %} <span class="help-inline"> {{ form.name.errors|join:", " }} </span>
{% endif %} <span class="help-block">{{ form.name.help_text }}</span>
</div>
</div>
{% if institution.ertype == 1 or institution.ertype == 3 %}
......@@ -54,15 +59,15 @@
<div class="controls">
{{ form.port }}
{% if form.port.errors %} <span class="help-inline"> {{ form.port.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.port.help_text }}</span>
{% endif %} <span class="help-block">{{ form.port.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.acct_port.errors %} error {% endif %}">
<label class="control-label" for="id_acct_port"><b>{% trans "acct_port" %}</b></label>
<label class="control-label" for="id_acct_port"><b>{% trans "Accounting Port" %}</b></label>
<div class="controls">
{{ form.acct_port }}
{% if form.acct_port.errors %} <span class="help-inline"> {{ form.acct_port.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.acct_port.help_text }}</span>
{% endif %} <span class="help-block">{{ form.acct_port.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.timeout.errors %} error {% endif %}">
......@@ -70,7 +75,7 @@
<div class="controls">
{{ form.timeout }}
{% if form.timeout.errors %} <span class="help-inline"> {{ form.timeout.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.ertype.help_text }}</span>
{% endif %} <span class="help-block">{{ form.timeout.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.retry.errors %} error {% endif %}">
......@@ -78,16 +83,16 @@
<div class="controls">
{{ form.retry }}
{% if form.retry.errors %} <span class="help-inline"> {{ form.retry.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.retry.help_text }}</span>
{% endif %} <span class="help-block">{{ form.retry.help_text }}</span>
</div>
</div>
{% endif %}
<div class="control-group {% if form.status_server.errors %} error {% endif %}">
<label class="control-label" for="id_status_server">{% trans "Status Server" %}</label>
<label class="control-label" for="id_status_server">{% trans "Status-Server" %}</label>
<div class="controls">
{{ form.status_server }}
{% if form.status_server.errors %} <span class="help-inline"> {{ form.status_server.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.status_server.help_text }}</span>
{% endif %} <span class="help-block">{{ form.status_server.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.secret.errors %} error {% endif %}">
......@@ -95,7 +100,7 @@
<div class="controls">
{{ form.secret }}
{% if form.secret.errors %} <span class="help-inline"> {{ form.secret.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.status_server.help_text }}</span>
{% endif %} <span class="help-block">{{ form.secret.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.proto.errors %} error {% endif %}">
......@@ -103,7 +108,7 @@
<div class="controls">
{{ form.proto }}
{% if form.proto.errors %} <span class="help-inline"> {{ form.proto.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.proto.help_text }}</span>
{% endif %} <span class="help-block">{{ form.proto.help_text }}</span>
</div>
</div>
<div class="control-group">
......
......@@ -3,7 +3,7 @@
{% load tolocale %}
{% block crumbs %}
<li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
<li><a href="{% url services %}">{% trans "Services" %}</a><span class="divider">/</span></li>
<li><a href="{% url services %}">{% trans "Locations" %}</a><span class="divider">/</span></li>
<li class="active">{% tolocale service LANGUAGE_CODE %}</li>
{% endblock %}
{% block extrahead %}
......
......@@ -2,7 +2,7 @@
{% load i18n %}
{% block crumbs %}
<li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
<li class="active">{% trans "Services" %}</li>
<li class="active">{% trans "Locations" %}</li>
{% endblock %}
{% load i18n %}
{% block extrahead %}
......@@ -38,7 +38,7 @@ var oTable = $('#table').dataTable({
"iDisplayLength": 25,
"oSearch": {"bSmart": false, "bRegex":true},
"oLanguage": {
"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "services" %}',
"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "locations" %}',
"sProcessing": "Processing...",
"sZeroRecords": '{% trans "No records to display" %}',
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
......@@ -60,8 +60,8 @@ oTable.fnDraw();
$('[id^=del_service_]').click(function(){
server_id = (this.id).replace("del_service_", '');
name = this.getAttribute("data-servicename");
$("#mymodalbody").html("{% trans 'You are about to delete service' %}: <b>"+name+"</b><br>{% trans 'Press Delete to proceed or Cancel to cancel deletion' %}");
$("#myModalLabel").html("{% trans 'Delete Service' %} "+name);
$("#mymodalbody").html("{% trans 'You are about to delete location' %}: <b>"+name+"</b><br>{% trans 'Press Delete to proceed or Cancel to cancel deletion' %}");
$("#myModalLabel").html("{% trans 'Delete Location' %} "+name);
$('#myModal').modal('show');
$(".modal-footer").show();
$("#service_name_del").html(name)
......@@ -93,7 +93,7 @@ $("#delserviceSubmit").click(function(){
{% block homeactive %}{% endblock %}
{% block servicesactive %}class="active"{% endblock %}
{% block subcontent %}
<h4>{% trans "Services" %}</h4>
<h4>{% trans "Locations" %}</h4>
<hr>
{% if messages %}
<table class="table table-condensed">
......@@ -103,7 +103,7 @@ $("#delserviceSubmit").click(function(){
{% endfor %}
</table>
{% endif %}
<div>{% if institution.ertype == 2 or institution.ertype == 3 %}<a href="{% url edit-services %}" class="btn btn-primary">{% trans "Add new service" %}</a>{% endif %}</div>
<div>{% if institution.ertype == 2 or institution.ertype == 3 %}<a href="{% url edit-services %}" class="btn btn-primary">{% trans "Add location" %}</a>{% endif %}</div>
<div class="span10"></div>
{% load tolocale %}
{% if institution.ertype == 2 or institution.ertype == 3 %}
......@@ -137,7 +137,7 @@ $("#delserviceSubmit").click(function(){
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Delete Service</h3>
<h3 id="myModalLabel">{% trans "Delete Location" %}</h3>
</div>
<div class="modal-body" id="mymodalbody">
......@@ -151,7 +151,7 @@ $("#delserviceSubmit").click(function(){
<div class="modal hide fade" id="servDets" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabelservdets">{% trans "Service Details" %}</h3>
<h3 id="myModalLabelservdets">{% trans "Location Details" %}</h3>
</div>
<div class="modal-body" id="servDetsbody">
......
......@@ -3,8 +3,8 @@
{% load tolocale %}
{% block crumbs %}
<li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
<li><a href="{% url services %}">{% trans "Services" %}</a><span class="divider">/</span></li>
<li class="active">{% if edit %}{% tolocale form.instance LANGUAGE_CODE %} ({% trans "edit" %}){% else %}{% trans "Add Service" %}{% endif %}</li>
<li><a href="{% url services %}">{% trans "Locations" %}</a><span class="divider">/</span></li>
<li class="active">{% if edit %}{% tolocale form.instance LANGUAGE_CODE %} ({% trans "edit" %}){% else %}{% trans "Add Location" %}{% endif %}</li>
{% endblock %}
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.formset.js"></script>
......@@ -307,7 +307,7 @@
{% block servicesactive %}class="active"{% endblock %}
{% block subcontent %}
<h4>{% if edit %}{% tolocale form.instance LANGUAGE_CODE %} ({% trans "edit" %}){% else %}{% trans "Add Service" %}{% endif %}</h4>
<h4>{% if edit %}{% tolocale form.instance LANGUAGE_CODE %} ({% trans "edit" %}){% else %}{% trans "Add Location" %}{% endif %}</h4>
<hr>
<form method="POST" class="form-horizontal">
{% csrf_token %}
......
......@@ -202,7 +202,7 @@ $.get("{% url get-service-points %}", function(data){
{% endif %}
{% if institutiondetails %}
<li {% block servicesactive %}{% endblock %}>
<a href="{% url services %}">{% trans "Services" %} ({{services_num}})</a>
<a href="{% url services %}">{% trans "Locations" %} ({{services_num}})</a>
</li>
<li {% block serversactive %}{% endblock %}>
<a href="{% url servers %}">{% trans "Servers" %} ({{servers_num}})</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment