Skip to content

Commit

Permalink
added emails page
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Oct 16, 2015
1 parent 04af516 commit 266da57
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
28 changes: 24 additions & 4 deletions huntserver/templates/hunt2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
{% block title %}Puzzles!{% endblock title %}

{% block includes %}
<link rel="stylesheet" type="text/css" media='screen and (max-width: 1200px)' href="/static/huntserver/low-width.css">
<link rel="stylesheet" type="text/css" media='screen and (max-width: 1200px)' href="/protected/huntserver/low-width.css">
<style>
body {
padding-bottom: 0px;
}
</style>
{% endblock %}

{% block content %}
<div id='container'>
<div id='content-left'>
<h1 class="title">Unlocked Puzzles</h1>
<a href='/objects/' >
<p style="margin-top: -10px;"> Click here for unlocked objects </p>
</a>
<div id="puzzles">
<table>
<thead>
Expand Down Expand Up @@ -43,13 +51,25 @@ <h1 class="title">Unlocked Puzzles</h1>
</tbody>
</table>
</div>
<p>For assistance, email <a href="mailto:dlareau@cmu.edu">dlareau@cmu.edu</a>.</p>
<p>For assistance, email <a href="mailto:dlareau@cmu.edu">dlareau@cmu.edu</a> or try our new <a href="/chat/"> Chat Feature</a>.</p>
</div>
<div id='content-right'>
<div id='plot'>
Plot goes here!
Hello Space Cadet(s)!
</br>
{% lorem 3 p %}
<p>
You are part of the emergency response team that has been woken out of cryostasis to help
get the ship back on course.
</p>
<p>
It would seem an engineer had woken up unexpectedly from cryostasis causing him to go crazy. Before he was subdued he had managed to deactivate the engines and change all of the door passwords. He did leave some clues behind in the form of puzzles.
</p>
<p>
Please look over the puzzles he left, use the answers to unlock futher rooms (which we suspect will contain further puzzles), make your way to the engine room and reactivate the engine.
</p>
</br>
Thanks,</br>
Command
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions huntserver/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
url(r'^staff/control/$', views.control, name='control'),
url(r'^staff/teams/$', RedirectView.as_view(url='/admin/huntserver/team/', permanent=False)),
url(r'^staff/puzzles/$', RedirectView.as_view(url='/admin/huntserver/puzzle/', permanent=False)),
url(r'^staff/emails/$', views.emails, name='emails'),
]
13 changes: 12 additions & 1 deletion huntserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,10 @@ def puzzle(request, puzzle_id):
form = AnswerForm()
# Directory for puzzle PNGs
# TODO: what do we do if this doesn't exist
directory = "/home/hunt/puzzlehunt_server/huntserver/static/huntserver/puzzles"
directory = "/home/hunt/puzzlehunt_server/static/huntserver/puzzles"
file_str = directory + "/" + puzzle.puzzle_id + ".pdf"
# Ideally this should be done some other way to reduce command calls
print("pdfinfo " + file_str + " | grep Pages | awk '{print $2}'")
pages = int(check_output("pdfinfo " + file_str + " | grep Pages | awk '{print $2}'", shell=True))
context = {'form': form, 'pages': range(pages), 'puzzle': puzzle,
'submission_list': submissions}
Expand Down Expand Up @@ -355,3 +356,13 @@ def control(request):
def public_stats(request):
newest_hunt = 1
return hunt(request, newest_hunt)

def emails(request):
if(not is_admin(request)):
return render(request, 'access_error.html')

people = Person.objects.filter(team__hunt__hunt_number=settings.CURRENT_HUNT_NUM)
emails = []
for person in people:
emails.append(person.email)
return HttpResponse(", ".join(emails))

0 comments on commit 266da57

Please sign in to comment.