Commit 27d6f3e2 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos
Browse files

Fixed issue with <dd> with empty encryption

A location with an empty encryption would not render properly in
Google maps infowindow. An empty dd would be ommited causing data
to shift thus breaking category values inside infowindow
parent 00956564
......@@ -390,7 +390,7 @@ class ServiceLoc(models.Model):
address_city = models.CharField(max_length=64)
contact = models.ManyToManyField(Contact, blank=True, null=True)
SSID = models.CharField(max_length=16)
enc_level = MultiSelectField(max_length=64, choices=ENCTYPES)
enc_level = MultiSelectField(max_length=64, choices=ENCTYPES, blank=True, null=True)
port_restrict = models.BooleanField()
transp_proxy = models.BooleanField()
IPv6 = models.BooleanField()
......@@ -477,7 +477,7 @@ class InstitutionDetails(models.Model):
return _('Institution: %(inst)s, Type: %(ertype)s') % {
# but name is many-to-many from institution
'inst': ', '.join([i.name for i in self.institution.org_name.all()]),
'ertype': self.institution.ertype,
'ertype': self.institution.get_ertype_display(),
}
def get_inst_name(self):
return join([i.name for i in self.institution.org_name.all()])
......
......@@ -897,7 +897,10 @@ def get_service_points(request):
response_location['lat'] = u"%s"%sl.latitude
response_location['lng'] = u"%s"%sl.longitude
response_location['address'] = u"%s<br>%s"%(sl.address_street, sl.address_city)
response_location['enc'] = u"%s"%(','.join(sl.enc_level))
if len(sl.enc_level[0]) != 0:
response_location['enc'] = u"%s"%(','.join(sl.enc_level))
else:
response_location['enc'] = u"-"
response_location['AP_no'] = u"%s"%(sl.AP_no)
response_location['name'] = sl.loc_name.get(lang='en').name
response_location['port_restrict'] = u"%s"%(sl.port_restrict)
......@@ -922,7 +925,10 @@ def get_all_services(request):
response_location['lat'] = u"%s"%sl.latitude
response_location['lng'] = u"%s"%sl.longitude
response_location['address'] = u"%s<br>%s"%(sl.address_street, sl.address_city)
response_location['enc'] = u"%s"%(','.join(sl.enc_level))
if len(sl.enc_level[0]) != 0:
response_location['enc'] = u"%s"%(','.join(sl.enc_level))
else:
response_location['enc'] = u"-"
response_location['AP_no'] = u"%s"%(sl.AP_no)
try:
response_location['inst'] = sl.institutionid.org_name.get(lang=lang).name
......
......@@ -144,7 +144,7 @@
<div class="control-group {% if form.enc_level.errors %} error {% endif %}">
<label class="control-label" for="id_oper_name">{% trans "Encryption Level" %}</label>
<div class="controls">
{% for enc in service.enc_level %}{{enc}}{% if not forloop.last%}, {% endif %}{% endfor %}
{% for enc in service.enc_level %}{% if enc == '' %}-{% else %}{{enc}}{% if not forloop.last%},{% endif %}{% endif %}{% endfor %}
</div>
</div>
<div class="control-group {% if form.port_restrict.errors %} error {% endif %}">
......
......@@ -125,7 +125,7 @@ $("#delserviceSubmit").click(function(){
<td><a href="{% url services service.pk %}">{% tolocale service LANGUAGE_CODE %}</a></td>
<td>{{service.address_street}}<br>{{service.address_city}}</td>
<td>{{service.SSID}}</td>
<td>{% for enc in service.enc_level %}{{enc}}{% if not forloop.last%},{% endif %}{% endfor %}</td>
<td>{% for enc in service.enc_level %}{% if enc == '' %}-{% else %}{{enc}}{% if not forloop.last%},{% endif %}{% endif %}{% endfor %}</td>
<td>{{service.AP_no}}</td>
<td style="text-align: center;"><a href="{% url edit-services service.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_service_{{service.pk}}" data-servicename="{% tolocale service LANGUAGE_CODE%}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
</tr>
......
......@@ -393,7 +393,7 @@
</div>
</div>
<div class="control-group {% if form.enc_level.errors %} error {% endif %}">
<label class="control-label" for="id_oper_name"><b>{% trans "Encryption Level" %}</b></label>
<label class="control-label" for="id_oper_name">{% trans "Encryption Level" %}</label>
<div class="controls">
{{ form.enc_level }}
{% if form.enc_level.errors %} <span class="help-inline"> {{ form.enc_level.errors|join:", " }} </span>
......
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