Commit 265c3da0e7c0d00068219ef4138ce3e386198cdb
1 parent
2fa19bd5
Exists in
master
and in
1 other branch
Added identification form submission.
Showing
2 changed files
with
14 additions
and
5 deletions
Show diff stats
src/web/survey.py
@@ -27,7 +27,13 @@ class About: | @@ -27,7 +27,13 @@ class About: | ||
27 | 27 | ||
28 | class Thanks: | 28 | class Thanks: |
29 | def POST(self): | 29 | def POST(self): |
30 | - return render.thanks() | 30 | + web_input = web.input() |
31 | + user_id = web_input['user_id'].encode('utf8') | ||
32 | + with open("./submissions/%s/ident" % user_id,'w') as ident: | ||
33 | + for key in ["name","email","country","public","comments"]: | ||
34 | + if web_input.has_key(key): | ||
35 | + ident.write("%s: %s\n" % (key,web_input[key])) | ||
36 | + return render.thanks_id() | ||
31 | 37 | ||
32 | class Package: | 38 | class Package: |
33 | def GET(self, pkg): | 39 | def GET(self, pkg): |
@@ -143,7 +149,7 @@ class Save: | @@ -143,7 +149,7 @@ class Save: | ||
143 | if web_input.has_key('strategy_button'): | 149 | if web_input.has_key('strategy_button'): |
144 | return Survey().POST() | 150 | return Survey().POST() |
145 | elif web_input.has_key('finish_button'): | 151 | elif web_input.has_key('finish_button'): |
146 | - return render.thanks() | 152 | + return render.thanks(user_id) |
147 | else: | 153 | else: |
148 | return render.survey_index() | 154 | return render.survey_index() |
149 | 155 | ||
@@ -210,6 +216,7 @@ urls = ('/', 'Index', | @@ -210,6 +216,7 @@ urls = ('/', 'Index', | ||
210 | '/apprec', 'Survey', | 216 | '/apprec', 'Survey', |
211 | '/thanks', 'Thanks', | 217 | '/thanks', 'Thanks', |
212 | '/save', 'Save', | 218 | '/save', 'Save', |
219 | + '/thanks', 'Thanks', | ||
213 | '/about', 'About', | 220 | '/about', 'About', |
214 | '/package/(.*)', 'Package' | 221 | '/package/(.*)', 'Package' |
215 | ) | 222 | ) |
src/web/templates/thanks.html
1 | -$var title: Feedback | 1 | +$def with (user_id) |
2 | +$var title: Thanks | ||
2 | $var mod = 'thanks'; | 3 | $var mod = 'thanks'; |
3 | $var cssfiles: static/css/survey.css | 4 | $var cssfiles: static/css/survey.css |
4 | 5 | ||
@@ -7,9 +8,10 @@ $var cssfiles: static/css/survey.css | @@ -7,9 +8,10 @@ $var cssfiles: static/css/survey.css | ||
7 | <div class="innertube"> | 8 | <div class="innertube"> |
8 | 9 | ||
9 | <h2>Identification</h2> | 10 | <h2>Identification</h2> |
10 | - <form> | 11 | + <form action="/thanks" method="post" enctype="multipart/form-data" name="identification_form"> |
11 | <p> | 12 | <p> |
12 | <label> | 13 | <label> |
14 | + <input type="hidden" name="user_id" value=$user_id> | ||
13 | Name: <input type="text" name="name" value="" size="30"> | 15 | Name: <input type="text" name="name" value="" size="30"> |
14 | </label></p> | 16 | </label></p> |
15 | <p> | 17 | <p> |
@@ -311,7 +313,7 @@ $var cssfiles: static/css/survey.css | @@ -311,7 +313,7 @@ $var cssfiles: static/css/survey.css | ||
311 | address you'll be sent the survey results report as soon as it is released. If | 313 | address you'll be sent the survey results report as soon as it is released. If |
312 | you have any further comments, please send it through the form below.</p><br /> | 314 | you have any further comments, please send it through the form below.</p><br /> |
313 | 315 | ||
314 | - | 316 | +<br style="clear: both" /> |
315 | </div><!-- class="innertube" --> | 317 | </div><!-- class="innertube" --> |
316 | </div><!-- id="maincontent" --> | 318 | </div><!-- id="maincontent" --> |
317 | 319 |