Commit 0f9fca26 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos
Browse files

Major header redesign. Added detail pages where applicable

parent c01b785c
......@@ -15,7 +15,7 @@ urlpatterns = patterns('edumanage.views',
url(r'^services/points/?$', 'get_service_points', name="get-service-points"),
url(r'^services/allpoints/?$', 'get_all_services', name="get-all-services"),
url(r'^servers/?$', 'servers', name="servers"),
url(r'^servers/(?P<server_pk>\d+)?$', 'servers', name="servers"),
url(r'^servers/del/?$', 'del_server', name="del-server"),
url(r'^servers/edit/(?P<server_pk>\d+)?$', 'add_server', name="edit-servers"),
......
......@@ -74,7 +74,6 @@ def add_institution_details(request, institution_pk):
inst = profile.institution
except UserProfile.DoesNotExist:
inst = False
if (not inst) or (int(inst.pk) != int(institution_pk)):
# messages.add_message(request, messages.WARNING,
# _("Insufficient rights on Institution. Contact your administrator"))
......@@ -87,11 +86,13 @@ def add_institution_details(request, institution_pk):
inst_details = InstitutionDetails.objects.get(institution=inst)
form = InstDetailsForm(instance=inst_details)
UrlFormSet = generic_inlineformset_factory(URL_i18n, extra=2, formset=UrlFormSetFactInst, can_delete=True)
urls_form = UrlFormSet(prefix='urlsform', instance = inst_details)
except InstitutionDetails.DoesNotExist:
form = InstDetailsForm()
form.fields['institution'] = forms.ModelChoiceField(queryset=Institution.objects.filter(pk=institution_pk), empty_label=None)
UrlFormSet = generic_inlineformset_factory(URL_i18n, extra=2, can_delete=True)
urls_form = UrlFormSet(prefix='urlsform')
urls_form = UrlFormSet(prefix='urlsform')
form.fields['contact'] = forms.ModelMultipleChoiceField(queryset=Contact.objects.filter(pk__in=getInstContacts(inst)))
return render_to_response('edumanage/institution_edit.html', { 'institution': inst, 'form': form, 'urls_form':urls_form},
context_instance=RequestContext(request, base_response(request)))
......@@ -127,7 +128,6 @@ def add_institution_details(request, institution_pk):
def services(request, service_pk):
user = request.user
dict = {}
try:
profile = user.get_profile()
inst = profile.institution
......@@ -143,7 +143,7 @@ def services(request, service_pk):
return render_to_response('edumanage/service_details.html',
{
'institution': inst,
'service': services,
'service': services,
},
context_instance=RequestContext(request, base_response(request)))
......@@ -160,6 +160,7 @@ def services(request, service_pk):
def add_services(request, service_pk):
user = request.user
service = False
edit = False
try:
profile = user.get_profile()
inst = profile.institution
......@@ -172,6 +173,7 @@ def add_services(request, service_pk):
try:
service = ServiceLoc.objects.get(institutionid=inst, pk=service_pk)
form = ServiceLocForm(instance=service)
except ServiceLoc.DoesNotExist:
form = ServiceLocForm()
form.fields['institutionid'] = forms.ModelChoiceField(queryset=Institution.objects.filter(pk=inst.pk), empty_label=None)
......@@ -185,7 +187,9 @@ def add_services(request, service_pk):
UrlFormSet = generic_inlineformset_factory(URL_i18n, extra=2, formset=UrlFormSetFact, can_delete=True)
urls_form = UrlFormSet(instance=service, prefix='urlsform')
form.fields['contact'] = forms.ModelMultipleChoiceField(queryset=Contact.objects.filter(pk__in=getInstContacts(inst)))
return render_to_response('edumanage/services_edit.html', { 'form': form, 'services_form':names_form, 'urls_form': urls_form},
if service:
edit = True
return render_to_response('edumanage/services_edit.html', { 'form': form, 'services_form':names_form, 'urls_form': urls_form, "edit": edit},
context_instance=RequestContext(request, base_response(request)))
elif request.method == 'POST':
request_data = request.POST.copy()
......@@ -208,17 +212,13 @@ def add_services(request, service_pk):
urls_form.instance = service
names_inst = names_form.save()
urls_inst = urls_form.save()
# for nform in names_inst:
# nform.content_object = serviceloc
# nform.save()
# for uform in urls_inst:
# uform.content_object = serviceloc
# uform.save()
return HttpResponseRedirect(reverse("services"))
else:
form.fields['institutionid'] = forms.ModelChoiceField(queryset=Institution.objects.filter(pk=inst.pk), empty_label=None)
form.fields['contact'] = forms.ModelMultipleChoiceField(queryset=Contact.objects.filter(pk__in=getInstContacts(inst)))
return render_to_response('edumanage/services_edit.html', { 'institution': inst, 'form': form, 'services_form':names_form, 'urls_form': urls_form},
if service:
edit = True
return render_to_response('edumanage/services_edit.html', { 'institution': inst, 'form': form, 'services_form':names_form, 'urls_form': urls_form, "edit": edit},
context_instance=RequestContext(request, base_response(request)))
......@@ -279,8 +279,8 @@ def get_all_services(request):
return HttpResponse(json.dumps(locs), mimetype='application/json')
def servers(request):
@login_required
def servers(request, server_pk):
user = request.user
servers = False
try:
......@@ -290,6 +290,14 @@ def servers(request):
inst = False
if inst:
servers = InstServer.objects.filter(instid=inst)
if server_pk:
servers = servers.get(pk=server_pk)
return render_to_response('edumanage/server_details.html',
{
'institution': inst,
'server': servers,
},
context_instance=RequestContext(request, base_response(request)))
return render_to_response('edumanage/servers.html', { 'servers': servers},
context_instance=RequestContext(request, base_response(request)))
......@@ -326,6 +334,7 @@ def adduser(request):
def add_server(request, server_pk):
user = request.user
server = False
edit = False
try:
profile = user.get_profile()
inst = profile.institution
......@@ -333,7 +342,6 @@ def add_server(request, server_pk):
inst = False
if request.method == "GET":
# Determine add or edit
try:
server = InstServer.objects.get(instid=inst, pk=server_pk)
......@@ -341,8 +349,9 @@ def add_server(request, server_pk):
except InstServer.DoesNotExist:
form = InstServerForm()
form.fields['instid'] = forms.ModelChoiceField(queryset=Institution.objects.filter(pk=inst.pk), empty_label=None)
return render_to_response('edumanage/servers_edit.html', { 'form': form},
if server:
edit = True
return render_to_response('edumanage/servers_edit.html', { 'form': form, 'edit': edit },
context_instance=RequestContext(request, base_response(request)))
elif request.method == 'POST':
request_data = request.POST.copy()
......@@ -357,7 +366,9 @@ def add_server(request, server_pk):
return HttpResponseRedirect(reverse("servers"))
else:
form.fields['instid'] = forms.ModelChoiceField(queryset=Institution.objects.filter(pk=inst.pk), empty_label=None)
return render_to_response('edumanage/servers_edit.html', { 'institution': inst, 'form': form},
if server:
edit = True
return render_to_response('edumanage/servers_edit.html', { 'institution': inst, 'form': form, 'edit': edit },
context_instance=RequestContext(request, base_response(request)))
@login_required
......@@ -378,6 +389,8 @@ def realms(request):
def add_realm(request, realm_pk):
user = request.user
server = False
realm = False
edit = False
try:
profile = user.get_profile()
inst = profile.institution
......@@ -394,7 +407,9 @@ def add_realm(request, realm_pk):
form = InstRealmForm()
form.fields['instid'] = forms.ModelChoiceField(queryset=Institution.objects.filter(pk=inst.pk), empty_label=None)
form.fields['proxyto'] = forms.ModelMultipleChoiceField(queryset=InstServer.objects.filter(pk__in=getInstServers(inst)))
return render_to_response('edumanage/realms_edit.html', { 'form': form},
if realm:
edit = True
return render_to_response('edumanage/realms_edit.html', { 'form': form, 'edit': edit },
context_instance=RequestContext(request, base_response(request)))
elif request.method == 'POST':
request_data = request.POST.copy()
......@@ -410,7 +425,9 @@ def add_realm(request, realm_pk):
else:
form.fields['instid'] = forms.ModelChoiceField(queryset=Institution.objects.filter(pk=inst.pk), empty_label=None)
form.fields['proxyto'] = forms.ModelMultipleChoiceField(queryset=InstServer.objects.filter(pk__in=getInstServers(inst)))
return render_to_response('edumanage/realms_edit.html', { 'institution': inst, 'form': form},
if realm:
edit = True
return render_to_response('edumanage/realms_edit.html', { 'institution': inst, 'form': form, 'edit': edit },
context_instance=RequestContext(request, base_response(request)))
......@@ -460,6 +477,8 @@ def contacts(request):
def add_contact(request, contact_pk):
user = request.user
server = False
edit = False
contact = False
try:
profile = user.get_profile()
inst = profile.institution
......@@ -475,8 +494,9 @@ def add_contact(request, contact_pk):
form = ContactForm(instance=contact)
except InstitutionContactPool.DoesNotExist:
form = ContactForm()
return render_to_response('edumanage/contacts_edit.html', { 'form': form},
if contact:
edit = True
return render_to_response('edumanage/contacts_edit.html', { 'form': form, "edit" : edit},
context_instance=RequestContext(request, base_response(request)))
elif request.method == 'POST':
request_data = request.POST.copy()
......@@ -492,7 +512,9 @@ def add_contact(request, contact_pk):
instContPool, created = InstitutionContactPool.objects.get_or_create(contact=contact, institution=inst)
instContPool.save()
return HttpResponseRedirect(reverse("contacts"))
return render_to_response('edumanage/contacts_edit.html', { 'form': form},
if contact:
edit = True
return render_to_response('edumanage/contacts_edit.html', { 'form': form, "edit": edit},
context_instance=RequestContext(request, base_response(request)))
......
......@@ -5,58 +5,86 @@
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 100px;
padding-bottom: 60px;
}
.sidebar-nav {
padding: 9px 0;
}
.headtitle {font-family: "Franklin Gothic Demi", "Franklin Gothic", "ITC Franklin Gothic", Arial, sans-serif; letter-spacing: -1px; }
#logotitle, #logotitle.a{
color: #656565;
font-size: 18px;
font-weight: bold;
left: 105px;
position: relative;
top: 60px;
font-family: "Franklin Gothic Demi", "Franklin Gothic", "ITC Franklin Gothic", Arial, sans-serif; letter-spacing: -1px;
width: 300px;"
}
</style>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
body {
padding-top: 100px;
padding-bottom: 60px;
}
.sidebar-nav {
padding: 9px 0;
}
.headtitle {
font-family: "Franklin Gothic Demi", "Franklin Gothic",
"ITC Franklin Gothic", Arial, sans-serif;
letter-spacing: -1px;
}
#logotitle,#logotitle.a {
color: #656565;
font-size: 18px;
font-weight: bold;
left: 105px;
position: relative;
top: 60px;
font-family: "Franklin Gothic Demi", "Franklin Gothic",
"ITC Franklin Gothic", Arial, sans-serif;
letter-spacing: -1px;
width: 300px;
"
}
.navbar .brand { max-height: 40px; overflow: visible;padding-top: 0;padding-bottom: 0; }
</style>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
{% block extrahead %}{% endblock %}
</head>
<body>
<div class="navbar navbar-fixed-top">
<p class="navbar-text pull-left">
<a class="brand2" href="#" style="position: absolute; top: 0px; left: 15px;">
<img src="/static/img/grnet_logo3.png" style="position: absolute; top: 10px; left: 10px; max-width: none;">
</a>
</p>
<a class="brand2" href="#" style="position: absolute; top: 0px; left: 15px;">
<img src="/static/img/grnet_logo3.png" style="position: absolute; top: 10px; left: 10px; max-width: none;">
</a>
<div class="navbar-inner">
<div class="container-fluid">
<div class="nav-collapse collapse">
<p class="navbar-text pull-left">
<a class="brand" href="#">
<img src="/static/img/pixelrow.png">
</a>
</p>
<div style="text-align:center; margin: auto; top: 3px; float: none;" class="nav"><a href="{% url index %}" style="height: 200px;"><img src="/static/img/eduroam_trans_248pix.png"></a></div>
</div>
{% comment %}
<div class="navbar navbar-fixed-top">
<p class="navbar-text pull-left">
<a class="brand2" href="#"
style="position: absolute; top: 0px; left: 15px;"> <img
src="/static/img/grnet_logo3.png"
style="position: absolute; top: 10px; left: 10px; max-width: none;">
</a>
</p>
<div class="navbar-inner">
<div class="container-fluid">
<div class="nav-collapse collapse">
<p class="navbar-text pull-left">
<a class="brand" href="#"> <img src="/static/img/pixelrow.png">
</a>
</p>
<div
style="text-align: center; margin: auto; top: 3px; float: none;"
class="nav">
<a href="{% url index %}" style="height: 200px;"><img
src="/static/img/eduroam_trans_248pix.png"></a>
</div>
</div>
</div>
</div>
</div>
{% endcomment %}
<div class="navbar navbar-fixed-top">
</div>
</div>
</div>
{% block content %}
<div class="navbar-inner">
<div class="container" style="padding-left: 0px; width: auto;">
<a class="brand" href="#"><img src="/static/img/logo_holder.png" /></a>
<ul class="nav">
<li class="active">
<a href="#">Home</a>
</li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div>
</div>
</div>
{% block content %}
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
......
......@@ -95,7 +95,7 @@ $("#delcontactSubmit").click(function(){
{% block subcontent %}
<h4>contacts</h4>
<h4>Contacts</h4>
<hr>
<div><a href="{% url edit-contacts %}" class="btn btn-primary">Add new contact</a></div>
<div class="span10"></div>
......
{% extends "edumanage/welcome.html"%}
{% block crumbs %}
<li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
<li><a href="{% url realms %}">Realms</a><span class="divider">/</span></li>
<li class="active">Add-Edit</li>
<li><a href="{% url contacts %}">Contacts</a><span class="divider">/</span></li>
<li class="active">{% if edit %}{{form.instance.firstname}} {{form.instance.lastname}} (edit){% else %}Add Contact{% endif %}</li>
{% endblock %}
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
......@@ -16,7 +16,7 @@
{% block homeactive %}{% endblock %}
{% block contactsactive %}class="active"{% endblock %}
{% block subcontent %} <h4>Contacts Add/Edit</h4>
{% block subcontent %} <h4>{% if edit %}{{form.instance.firstname}} {{form.instance.lastname}} (edit){% else %}Add Contact{% endif %}</h4>
<hr>
<form method="POST" class="form-horizontal">
{% csrf_token %}
......
{% extends "edumanage/welcome.html"%}
{% block extrahead %}
<style type="text/css">
.control-label{
padding-top: 0px !important;
width: auto !important;
}
</style>
{% endblock %}
{% block crumbs %}
<li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
<li class="active">Institution</li>
{% endblock %}
{% block homeactive %}{% endblock %}
{% block instactive %}class="active"{% endblock %}
{% block subcontent %}
<h4>Institution</h4>
<hr>
......@@ -13,49 +20,74 @@
{% if institution %}
{% if institution.institutiondetails %}
<div class="row-fluid">
<div class="span12"></div>
</div>
<table class="table table-striped" width="100%" id="table"><thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>Type</th>
<th>Contact</th>
<th>Url</th>
<th>Oper Name</th>
<th># Users</th>
<th># Id</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr class="info">
<td><b>{% tolocale institution LANGUAGE_CODE%}</b></td>
<td>{{institution.institutiondetails.address_street}}@{{institution.institutiondetails.address_city}}</td>
<td>{{institution.institutiondetails.get_ertype_display}}</td>
<td>{% if institution.institutiondetails.contact.all %}{% for con in institution.institutiondetails.contact.all %}{{con}}<br>{% endfor %}{% else %}(no contacts){% endif %}</td>
<td>{% if institution.institutiondetails.url.all %}{% for url in institution.institutiondetails.url.all %}{{url}}<br>{% endfor %}{% else %}(no urls){% endif %}</td>
<td>{{institution.institutiondetails.oper_name}}</td>
<td>{{institution.institutiondetails.number_user}}</td>
<td>{{institution.institutiondetails.number_id}}</td>
<td style="text-align: center;"><a href="{% url edit-institution institution.pk %}" class="btn btn-small btn-primary">edit</a></td>
</tr>
</tbody>
</table>
<div class="form-horizontal">
<div class="control-group">
<label class="control-label" for="id_ertype">Name</label>
<div class="controls">
{% tolocale institution LANGUAGE_CODE %}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_ertype">ErType</label>
<div class="controls">
{{ institution.institutiondetails.get_ertype_display }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_address_street">Address Street</label>
<div class="controls">
{{ institution.institutiondetails.address_street }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_address_city">Address City</label>
<div class="controls">
{{ institution.institutiondetails.address_city }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_contact">Contact(s)</label>
<div class="controls">
{% for contact in institution.institutiondetails.contact.all %}
{{contact.firstname}} {{contact.lastname}} (<a href="mailto:{{contact.email}}">{{contact.email}}</a> - tel:{{contact.phone}}){% if not forloop.last %}<br>{% endif %}
{% endfor %}
</div>
</div>
<div class="control-group ">
<label class="control-label" for="id_urls">Urls</label>
<div class="controls">
{% for url in institution.institutiondetails.url.all %}
<a href="{{url.url}}" target="_blank">{{url.url}}</a> - {{url.get_urltype_display}} ({{url.get_lang_display}}){% if not forloop.last %}<br>{% endif %}
{% endfor %}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_oper_name">Oper Name</label>
<div class="controls">
{{ institution.institutiondetails.oper_name }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_number_user">Number User</label>
<div class="controls">
{{ institution.institutiondetails.number_user }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_number_id">Number Id</label>
<div class="controls">
{{ institution.institutiondetails.number_id }}
</div>
</div>
<div class="control-group">
<div class="controls">
<a class="btn btn-large btn-primary" href="{% url edit-institution institution.pk %}">Edit</a>
</div>
</div>
</div>
{% else %}
<div>No institution details defined yet for {% tolocale institution LANGUAGE_CODE%} <a href="{% url edit-institution institution.pk %}" class="btn btn-small btn-primary">edit</a></div>
{% endif %}
......
{% extends "edumanage/welcome.html"%}
{% load tolocale %}
{% block crumbs %}
<li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
<li><a href="{% url institutions %}">Institutions</a><span class="divider">/</span></li>
<li class="active">Add-Edit</li>
<li><a href="{% url institutions %}">Institution</a><span class="divider">/</span></li>
<li class="active">{% tolocale institution LANGUAGE_CODE%} (Edit)</li>
{% endblock %}
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.formset.js"></script>
......@@ -69,9 +70,8 @@ function addButton(row){
{% block homeactive %}{% endblock %}
{% block instactive %}class="active"{% endblock %}
{% block subcontent %}
<h4>Institution Edit</h4>
<h4>{% tolocale institution LANGUAGE_CODE%} Edit</h4>
<hr>
{% load tolocale %}
<form method="POST" class="form-horizontal">
{% csrf_token %}
{% if form.non_field_errors %}
......
......@@ -2,7 +2,7 @@
{% block crumbs %}
<li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
<li><a href="{% url realms %}">Realms</a><span class="divider">/</span></li>
<li class="active">Add-Edit</li>
<li class="active">{% if edit %}{{form.instance.realm}} (edit){% else %}Add Realm{% endif %}</li>
{% endblock %}
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
......@@ -16,7 +16,7 @@
{% block homeactive %}{% endblock %}
{% block realmsactive %}class="active"{% endblock %}
{% block subcontent %} <h4>Realms Add/Edit</h4>
{% block subcontent %} <h4>{% if edit %}{{form.instance.realm}} (edit){% else %}Add Realm{% endif %}</h4>
<hr>
<form method="POST" class="form-horizontal">
{% csrf_token %}
......
{% extends "edumanage/welcome.html"%}
{% block crumbs %}
<li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
<li><a href="{% url servers %}">Servers</a><span class="divider">/</span></li>
<li class="active">{{server.name}}</li>
{% endblock %}
{% block extrahead %}
<style type="text/css">
.control-label{
padding-top: 0px !important;
width: auto !important;
}
</style>
{% endblock %}
{% block homeactive %}{% endblock %}
{% block serversactive %}class="active"{% endblock %}
{% block subcontent %} <h4>{{server.name}}</h4>
<hr>
<div class="form-horizontal">
{% csrf_token %}
{% if form.non_field_errors %}
<p class="error">
{{ form.non_field_errors}}
</p>
{% endif %}
<div style="display: none">
{{form.instid}}
</div>
<div class="control-group">
<label class="control-label" for="id_ertype">ErType</label>
<div class="controls">
{{ server.ertype }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_name">name</label>
<div class="controls">
{{ server.name }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_host">host</label>
<div class="controls">
{{ server.host }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_port">port</label>
<div class="controls">
{{ server.port }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_acct_port">acct_port</label>
<div class="controls">
{{ server.acct_port }}
</div>