summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-24 23:24:59 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-24 23:24:59 +0100
commit4735edb9d08d8bb17ae00018d3bb087206afc09f (patch)
treeab258cb84b3f3ceb3fd619db850272a7f160a6c4
parent18e080418f3b2f29c431d081d43bc5f5bc2846c4 (diff)
downloadtroggle-4735edb9d08d8bb17ae00018d3bb087206afc09f.tar.gz
troggle-4735edb9d08d8bb17ae00018d3bb087206afc09f.tar.bz2
troggle-4735edb9d08d8bb17ae00018d3bb087206afc09f.zip
[svn] Have control panel display an error for logged in, non-superuser users.
-rw-r--r--expo/views_other.py7
-rw-r--r--media/css/main3.css4
-rw-r--r--templates/controlPanel.html10
3 files changed, 17 insertions, 4 deletions
diff --git a/expo/views_other.py b/expo/views_other.py
index 504d1f6..f5944a6 100644
--- a/expo/views_other.py
+++ b/expo/views_other.py
@@ -65,7 +65,7 @@ def controlPanel(request):
if request.user.is_superuser:
#importlist is mostly here so that things happen in the correct order.
- #http post data seems to come in an unpredictable order, we do it this way.
+ #http post data seems to come in an unpredictable order, so we do it this way.
importlist=['reload_db', 'import_people', 'import_cavetab', 'import_logbooks', 'import_surveys', 'import_QMs']
databaseReset.make_dirs()
for item in importlist:
@@ -74,7 +74,10 @@ def controlPanel(request):
exec "databaseReset."+item+"()"
jobs_completed.append(item)
else:
- return HttpResponseRedirect(reverse('auth_login'))
+ if request.user.is_authenticated(): #The user is logged in, but is not a superuser.
+ return render_response(request,'controlPanel.html', {'caves':Cave.objects.all(),'error':'You must be a superuser to use that feature.'})
+ else:
+ return HttpResponseRedirect(reverse('auth_login'))
return render_response(request,'controlPanel.html', {'caves':Cave.objects.all(),'jobs_completed':jobs_completed})
diff --git a/media/css/main3.css b/media/css/main3.css
index 0d67fea..24544a9 100644
--- a/media/css/main3.css
+++ b/media/css/main3.css
@@ -340,4 +340,8 @@ h1 {
#quicksearch {
margin-left:40px;
+}
+
+.noticeBox {
+ border:thin black solid; width: 40%; color:#F00; margin-left:auto; margin-right:auto
} \ No newline at end of file
diff --git a/templates/controlPanel.html b/templates/controlPanel.html
index 209fa20..49725e1 100644
--- a/templates/controlPanel.html
+++ b/templates/controlPanel.html
@@ -1,9 +1,8 @@
{% extends "base.html" %}
{% block content %}
-
{% if jobs_completed %}
- <div style="border:thin black solid; width: 40%; color:#F00; margin-left:auto; margin-right:auto">
+ <div class="noticeBox">
Just finished running:
<ul>
{% for job in jobs_completed %}
@@ -15,6 +14,13 @@
</div>
{% endif %}
+{% if error %}
+ <div class="noticeBox">
+ {{ error }}
+ <a href="#" class="closeDiv">dismiss this message</a>
+ </div>
+{% endif %}
+
<form name="reset" method="post" action="">
<h3>Wipe:</h3>