diff options
Diffstat (limited to 'rpkid/rpki/gui')
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/asn_view.html (renamed from rpkid/rpki/gui/app/templates/asn_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/child_view.html (renamed from rpkid/rpki/gui/app/templates/child_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/conf_empty.html (renamed from rpkid/rpki/gui/app/templates/conf_empty.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/conf_list.html (renamed from rpkid/rpki/gui/app/templates/conf_list.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/dashboard.html (renamed from rpkid/rpki/gui/app/templates/dashboard.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/parent_view.html (renamed from rpkid/rpki/gui/app/templates/parent_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/rpkigui/prefix_view.html (renamed from rpkid/rpki/gui/app/templates/prefix_view.html) | 0 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/views.py | 19 | ||||
-rw-r--r-- | rpkid/rpki/gui/templates/base.html | 24 | ||||
-rw-r--r-- | rpkid/rpki/gui/templates/registration/login.html | 26 |
10 files changed, 59 insertions, 10 deletions
diff --git a/rpkid/rpki/gui/app/templates/asn_view.html b/rpkid/rpki/gui/app/templates/rpkigui/asn_view.html index 4417c576..4417c576 100644 --- a/rpkid/rpki/gui/app/templates/asn_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/asn_view.html diff --git a/rpkid/rpki/gui/app/templates/child_view.html b/rpkid/rpki/gui/app/templates/rpkigui/child_view.html index 9bcdf948..9bcdf948 100644 --- a/rpkid/rpki/gui/app/templates/child_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/child_view.html diff --git a/rpkid/rpki/gui/app/templates/conf_empty.html b/rpkid/rpki/gui/app/templates/rpkigui/conf_empty.html index 0ef9366c..0ef9366c 100644 --- a/rpkid/rpki/gui/app/templates/conf_empty.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/conf_empty.html diff --git a/rpkid/rpki/gui/app/templates/conf_list.html b/rpkid/rpki/gui/app/templates/rpkigui/conf_list.html index 4bb18114..4bb18114 100644 --- a/rpkid/rpki/gui/app/templates/conf_list.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/conf_list.html diff --git a/rpkid/rpki/gui/app/templates/dashboard.html b/rpkid/rpki/gui/app/templates/rpkigui/dashboard.html index dea03c31..dea03c31 100644 --- a/rpkid/rpki/gui/app/templates/dashboard.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/dashboard.html diff --git a/rpkid/rpki/gui/app/templates/parent_view.html b/rpkid/rpki/gui/app/templates/rpkigui/parent_view.html index 13a9d848..13a9d848 100644 --- a/rpkid/rpki/gui/app/templates/parent_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/parent_view.html diff --git a/rpkid/rpki/gui/app/templates/prefix_view.html b/rpkid/rpki/gui/app/templates/rpkigui/prefix_view.html index 78e9958a..78e9958a 100644 --- a/rpkid/rpki/gui/app/templates/prefix_view.html +++ b/rpkid/rpki/gui/app/templates/rpkigui/prefix_view.html diff --git a/rpkid/rpki/gui/app/views.py b/rpkid/rpki/gui/app/views.py index e1048e2a..ad5f87a6 100644 --- a/rpkid/rpki/gui/app/views.py +++ b/rpkid/rpki/gui/app/views.py @@ -65,7 +65,7 @@ def handle_required(f): if conf.count() == 1: handle = conf[0] elif conf.count() == 0: - return render('myrpki/conf_empty.html', {}, request) + return render('rpkigui/conf_empty.html', {}, request) #return http.HttpResponseRedirect('/myrpki/conf/add') else: # Should reverse the view for this instead of hardcoding @@ -81,7 +81,7 @@ def render(template, context, request): context_instance=RequestContext(request)) @handle_required -def dashboard(request): +def dashboard(request, template_name='rpkigui/dashboard.html'): '''The user's dashboard.''' handle = request.session[ 'handle' ] # ... pick out data for the dashboard and return it @@ -109,8 +109,7 @@ def dashboard(request): asns.sort(key=lambda x: x.range.min) prefixes.sort(key=lambda x: x.range.min) - return render('myrpki/dashboard.html', { 'conf': handle, 'asns': asns, - 'ars': prefixes }, request) + return render(template_name, { 'conf': handle, 'asns': asns, 'ars': prefixes }, request) @login_required def conf_list(request): @@ -120,7 +119,7 @@ def conf_list(request): else: queryset = models.Conf.objects.filter(owner=request.user) return object_list(request, queryset, - template_name='myrpki/conf_list.html', template_object_name='conf', extra_context={ 'select_url' : reverse(conf_select) }) + template_name='rpkigui/conf_list.html', template_object_name='conf', extra_context={ 'select_url' : reverse(conf_select) }) @login_required def conf_select(request): @@ -161,7 +160,7 @@ def parent_view(request, parent_handle): """Detail view for a particular parent.""" handle = request.session['handle'] parent = get_object_or_404(handle.parents, handle__exact=parent_handle) - return render('myrpki/parent_view.html', { 'parent': parent }, request) + return render('rpkigui/parent_view.html', { 'parent': parent }, request) def get_parents_or_404(handle, obj): '''Return the Parent object(s) that the given address range derives @@ -181,7 +180,7 @@ def asn_view(request, pk): roas = handle.roas.filter(asn=obj.lo) # roas which contain this asn unallocated = AllocationTree.AllocationTreeAS(obj).unallocated() - return render('myrpki/asn_view.html', + return render('rpkigui/asn_view.html', { 'asn': obj, 'parent': parent_set, 'roas': roas, 'unallocated' : unallocated }, request) @@ -191,7 +190,7 @@ def child_view(request, child_handle): handle = request.session['handle'] child = get_object_or_404(handle.children, handle__exact=child_handle) - return render('myrpki/child_view.html', { 'child': child }, request) + return render('rpkigui/child_view.html', { 'child': child }, request) class PrefixView(object): '''Extensible view for address ranges/prefixes. This view can be @@ -218,7 +217,7 @@ class PrefixView(object): u = AllocationTree.AllocationTreeIP.from_prefix(self.obj).unallocated() - return render('myrpki/prefix_view.html', + return render('rpkigui/prefix_view.html', { 'addr': self.obj, 'parent': self.parent_set, 'unallocated': u, 'form': self.form }, self.request) @@ -369,7 +368,7 @@ def asn_allocate_view(request, pk): form = forms.PrefixAllocateForm(obj.allocated.pk if obj.allocated else None, handle.children.all()) - return render('myrpki/asn_view.html', { 'form': form, + return render('rpkigui/asn_view.html', { 'form': form, 'asn': obj, 'form': form, 'parent': parent_set }, request) # this is similar to handle_required, except that the handle is given in URL diff --git a/rpkid/rpki/gui/templates/base.html b/rpkid/rpki/gui/templates/base.html new file mode 100644 index 00000000..a096cdca --- /dev/null +++ b/rpkid/rpki/gui/templates/base.html @@ -0,0 +1,24 @@ +<html> +<head> + <title>{% block title %}MyRPKI{% endblock %}</title> + {% block head %}{% endblock %} + <style type="text/css"> + {% block css %}{% endblock %} + </style> +</head> +<body> + <div id="header"> + <h1>RPKI Portal GUI</h1> + </div> + <div id="content"> + {% if user.is_authenticated %} + <span style="float: right; font-size: 80%;">Logged in as {{ user }} | + {% if user.is_staff %}<a href="/admin/">admin</a> |{% endif %} + <a href="{% url django.contrib.auth.views.logout %}">Log Out</a></span> + {% else %} + <span style="float: right; font-size: 80%;"><a href="{% url django.contrib.auth.views.login %}">Log In</a></span> + {% endif %} + {% block content %}{% endblock %} + </div> +</body> +</html> diff --git a/rpkid/rpki/gui/templates/registration/login.html b/rpkid/rpki/gui/templates/registration/login.html new file mode 100644 index 00000000..f99e9a25 --- /dev/null +++ b/rpkid/rpki/gui/templates/registration/login.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} + +{% block content %} + +{% if form.errors %} +<p>Your username and password didn't match. Please try again.</p> +{% endif %} + +<form method="post" action="{% url django.contrib.auth.views.login %}">{% csrf_token %} +<table> +<tr> + <td>{{ form.username.label_tag }}</td> + <td>{{ form.username }}</td> +</tr> +<tr> + <td>{{ form.password.label_tag }}</td> + <td>{{ form.password }}</td> +</tr> +</table> + +<input type="submit" value="login" /> +<input type="hidden" name="next" value="{{ next }}" /> +</form> + +{% endblock %} + |