Commit 326279fe authored by Zenon Mousmoulas's avatar Zenon Mousmoulas

Conditionally show Service Locations in edumanage menu and home page, if the

institution type permits
parent 89cdc495
...@@ -22,9 +22,11 @@ ...@@ -22,9 +22,11 @@
</li> </li>
{% endif %} {% endif %}
{% if institutiondetails %} {% if institutiondetails %}
{% if institution_canhaveservicelocs %}
<li {% block servicesactive %}{% endblock %}> <li {% block servicesactive %}{% endblock %}>
<a href="{% url services %}">{% trans "Locations" %} ({{services_num}})</a> <a href="{% url services %}">{% trans "Locations" %} ({{services_num}})</a>
</li> </li>
{% endif %}
<li {% block serversactive %}{% endblock %}> <li {% block serversactive %}{% endblock %}>
<a href="{% url servers %}">{% trans "Servers" %} ({{servers_num}})</a> <a href="{% url servers %}">{% trans "Servers" %} ({{servers_num}})</a>
</li> </li>
...@@ -56,17 +58,19 @@ ...@@ -56,17 +58,19 @@
<tr class="error"><td>You are not associated with any institution. Please contact your administrator<td></tr> <tr class="error"><td>You are not associated with any institution. Please contact your administrator<td></tr>
</table> </table>
{% else %} {% else %}
<h4>{% trans "Home" %} - {% trans "Service Locations" %} </h4> <h4>{% trans "Home" %}{% if institution_canhaveservicelocs %} - {% trans "Service Locations" %}{% endif %} </h4>
<hr> <hr>
{% if services %} {% if services %}
<div id="map_canvas" data-group="{% static 'img/edugroup.png' %}" data-pin="{% static 'img/edupin.png' %}" data-center-lat="{{MAP_CENTER.0}}" data-center-lng="{{MAP_CENTER.1}}" data-service="{% url get-service-points %}" data-service-edit="{% url edit-services %}" style="width:100%; height:450px;"></div> <div id="map_canvas" data-group="{% static 'img/edugroup.png' %}" data-pin="{% static 'img/edupin.png' %}" data-center-lat="{{MAP_CENTER.0}}" data-center-lng="{{MAP_CENTER.1}}" data-service="{% url get-service-points %}" data-service-edit="{% url edit-services %}" style="width:100%; height:450px;"></div>
{% else %} {% else %}
<div> <div>
{% if institutiondetails %} {% if institutiondetails %}
{% if institution_canhaveservicelocs %}
{% trans "No services defined yet"%}! {% trans "No services defined yet"%}!
<a href="{% url edit-services %}" class="btn btn-primary"> <a href="{% url edit-services %}" class="btn btn-primary">
{% trans "Add new service" %} {% trans "Add new service" %}
</a> </a>
{% endif %}
{% else %} {% else %}
Specify your institution details to proceed <a class="btn btn-small btn-primary" href="{% url edit-institution institution.pk %}">{% trans "Edit" %}</a> Specify your institution details to proceed <a class="btn btn-small btn-primary" href="{% url edit-institution institution.pk %}">{% trans "Edit" %}</a>
{% endif %} {% endif %}
......
...@@ -1398,6 +1398,7 @@ def base_response(request): ...@@ -1398,6 +1398,7 @@ def base_response(request):
contacts = [] contacts = []
institution = False institution = False
institution_exists = False institution_exists = False
institution_canhaveservicelocs = False
try: try:
profile = user.get_profile() profile = user.get_profile()
institution = profile.institution institution = profile.institution
...@@ -1422,6 +1423,10 @@ def base_response(request): ...@@ -1422,6 +1423,10 @@ def base_response(request):
instututiondetails = institution.institutiondetails instututiondetails = institution.institutiondetails
except: except:
instututiondetails = False instututiondetails = False
try:
institution_canhaveservicelocs = institution.ertype in [2, 3]
except:
pass
return { return {
'inst_num': len(inst), 'inst_num': len(inst),
'servers_num': len(server), 'servers_num': len(server),
...@@ -1432,6 +1437,7 @@ def base_response(request): ...@@ -1432,6 +1437,7 @@ def base_response(request):
'institution': institution, 'institution': institution,
'institutiondetails': instututiondetails, 'institutiondetails': instututiondetails,
'institution_exists': institution_exists, 'institution_exists': institution_exists,
'institution_canhaveservicelocs': institution_canhaveservicelocs,
} }
......
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