From 5a78ce20c0ef802b8867285204f6a1ea3fc63997 Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@BigDaddy.local>
Date: Sat, 9 Jan 2010 19:17:45 -0800
Subject: [PATCH] fixed for generic server, updated helios for large num voters

---
 helios                         | 2 +-
 initialization.py.sample       | 1 -
 server_ui/templates/base.html  | 2 ++
 server_ui/templates/index.html | 7 +++++++
 server_ui/views.py             | 5 ++++-
 settings.py.sample             | 1 +
 6 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/helios b/helios
index 95eb274..9785977 160000
--- a/helios
+++ b/helios
@@ -1 +1 @@
-Subproject commit 95eb27464e8850963f65177c8426ace0920f6430
+Subproject commit 9785977b0c97397e91622b9b1fa58561c4ed4e9f
diff --git a/initialization.py.sample b/initialization.py.sample
index 0ad5c87..cf6c6ad 100644
--- a/initialization.py.sample
+++ b/initialization.py.sample
@@ -11,7 +11,6 @@ import auth.models
 
 helios.TEMPLATE_BASE = "server_ui/templates/base.html"
 helios.ADMIN_ONLY = True
-helios.ADMIN = auth.models.User.update_or_create(user_type = 'cas', user_id = 'yaro', info={})
 
 # authentication limited to passwords
 auth.ENABLED_AUTH_SYSTEMS = ['cas', 'password']
diff --git a/server_ui/templates/base.html b/server_ui/templates/base.html
index 796070b..0580264 100644
--- a/server_ui/templates/base.html
+++ b/server_ui/templates/base.html
@@ -45,7 +45,9 @@
         </div>
       <div id="footer">
 <span style="float:right;">
+{% if settings.FOOTER_LOGO %}
 <img src="/static/footer-logo.gif" />
+{% endif %}
 </span>
 {% if user %}
 logged in as {{user.user_id}}  [<a href="{% url auth.views.logout %}">logout</a>]<br />
diff --git a/server_ui/templates/index.html b/server_ui/templates/index.html
index 5c0913d..70aaf5b 100644
--- a/server_ui/templates/index.html
+++ b/server_ui/templates/index.html
@@ -18,6 +18,12 @@
 </p>
 -->
 
+{% if create_p %}
+<a href="{% url helios.views.election_new %}">create election</a>
+|
+<a href="{% url helios.views.elections_administered %}">elections you administer</a>
+{% endif %}
+
 <p style="font-size: 1.4em;">
 Current Elections:
 <ul>
@@ -27,4 +33,5 @@ Current Elections:
 </ul>
 </p>
 
+
 {% endblock %}
diff --git a/server_ui/views.py b/server_ui/views.py
index 1c7f33d..9e5c610 100644
--- a/server_ui/views.py
+++ b/server_ui/views.py
@@ -10,6 +10,7 @@ import helios.views
 import helios
 from helios.crypto import utils as cryptoutils
 from auth.security import *
+from helios.security import can_create_election
 
 from django.core.urlresolvers import reverse
 from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseNotAllowed
@@ -24,7 +25,9 @@ def home(request):
   # load the featured elections
   featured_elections = Election.get_featured()
   
-  return render_template(request, "index", {'elections': featured_elections})
+  create_p = can_create_election(request)
+  
+  return render_template(request, "index", {'elections': featured_elections, 'create_p':create_p})
   
 def about(request):
   return HttpResponse(request, "about")
diff --git a/settings.py.sample b/settings.py.sample
index 844c411..dc3cd33 100644
--- a/settings.py.sample
+++ b/settings.py.sample
@@ -147,4 +147,5 @@ SINGLE_ELECTION_PARAMS = {
 
 # FOOTER links
 FOOTER_LINKS = [{'url':'http://usg.princeton.edu/elections', 'text':'USG Elections Center'}]
+FOOTER_LOGO = False
 
-- 
GitLab