mirror of https://github.com/dirtbags/moth.git
Make survey record answers
This commit is contained in:
parent
742d1a0c35
commit
31e2d517c3
3
Makefile
3
Makefile
|
@ -17,6 +17,9 @@ all: ctf.tce
|
|||
|
||||
target: $(PYC)
|
||||
$(INSTALL) -d --mode=0755 --owner=100 $(DESTDIR)/var/lib/ctf
|
||||
|
||||
$(INSTALL) -d --mode=0755 --owner=100 $(DESTDIR)/var/lib/ctf/survey
|
||||
|
||||
$(INSTALL) -d $(DESTDIR)/var/lib/ctf/disabled
|
||||
touch $(DESTDIR)/var/lib/ctf/disabled/survey
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import cgi
|
||||
import time
|
||||
import os
|
||||
|
||||
f = cgi.FieldStorage()
|
||||
if f.getfirst('submit'):
|
||||
|
@ -8,7 +10,13 @@ if f.getfirst('submit'):
|
|||
print()
|
||||
print('Thanks for filling in the survey.')
|
||||
print()
|
||||
print(dir(f))
|
||||
try:
|
||||
fn = '/var/lib/ctf/survey/%s.%d.%d.txt' % (time.strftime('%Y-%m-%d'), time.time(), os.getpid())
|
||||
o = open(fn, 'w')
|
||||
for k in f.keys():
|
||||
o.write('%s: %r\n' % (k, f.getlist(k)))
|
||||
except IOError:
|
||||
pass
|
||||
print('The key is:')
|
||||
print(' quux blorb frotz')
|
||||
else:
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC
|
||||
"-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Survey</title>
|
||||
<link rel="stylesheet" href="%s" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action=",submit.cgi">
|
||||
<ul>
|
||||
<li>
|
||||
Did you have any trouble figuring out how to play?
|
||||
<select name="getting-started">
|
||||
<option>A lot of trouble</option>
|
||||
<option selected="selected">Not much trouble</option>
|
||||
<option>No trouble</option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
How difficult were the puzzles?
|
||||
<select name="puzzle-strength">
|
||||
<option>Too hard</option>
|
||||
<option selected="selected">About right</option>
|
||||
<option>Too easy</option>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Please use the provided space for any additional comments.
|
||||
</p>
|
||||
<textarea name="comments" style="height: 5em; width: 40em;"></textarea>
|
||||
<p>
|
||||
Thanks for your feedback! We hope you had fun and learned
|
||||
something!
|
||||
</p>
|
||||
<input type="submit" name="submit" value="Submit survey" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -4,38 +4,7 @@
|
|||
recieve a key redeemable for <b>ONE MILLION POINTS</b>.
|
||||
</p>
|
||||
|
||||
<fieldset>
|
||||
<legend>Survey</legend>
|
||||
|
||||
<form method="post" action="submit.cgi">
|
||||
<ul>
|
||||
<li>
|
||||
Did you have any trouble figuring out how to play?
|
||||
<select name="getting-started">
|
||||
<option>A lot of trouble</option>
|
||||
<option selected="selected">Not much trouble</option>
|
||||
<option>No trouble</option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
How difficult were the puzzles?
|
||||
<select name="puzzle-strength">
|
||||
<option>Too hard</option>
|
||||
<option selected="selected">About right</option>
|
||||
<option>Too easy</option>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Please use the provided space for any additional comments.
|
||||
</p>
|
||||
<textarea name="comments" style="height: 5em; width: 40em;"></textarea>
|
||||
<p>
|
||||
Thanks for your feedback! We hope you had fun and learned
|
||||
something!
|
||||
</p>
|
||||
<input type="submit" name="submit" value="Submit survey" />
|
||||
</form>
|
||||
</fieldset>
|
||||
<object data=",survey.html" type="text/html"
|
||||
style="width: 100%; height: 40em;">
|
||||
<a href=",survey.html">Survey</a>
|
||||
</object>
|
||||
|
|
Loading…
Reference in New Issue