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 | 27 | |
| 28 | 28 | class Thanks: |
| 29 | 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 | 38 | class Package: |
| 33 | 39 | def GET(self, pkg): |
| ... | ... | @@ -143,7 +149,7 @@ class Save: |
| 143 | 149 | if web_input.has_key('strategy_button'): |
| 144 | 150 | return Survey().POST() |
| 145 | 151 | elif web_input.has_key('finish_button'): |
| 146 | - return render.thanks() | |
| 152 | + return render.thanks(user_id) | |
| 147 | 153 | else: |
| 148 | 154 | return render.survey_index() |
| 149 | 155 | |
| ... | ... | @@ -210,6 +216,7 @@ urls = ('/', 'Index', |
| 210 | 216 | '/apprec', 'Survey', |
| 211 | 217 | '/thanks', 'Thanks', |
| 212 | 218 | '/save', 'Save', |
| 219 | + '/thanks', 'Thanks', | |
| 213 | 220 | '/about', 'About', |
| 214 | 221 | '/package/(.*)', 'Package' |
| 215 | 222 | ) | ... | ... |
src/web/templates/thanks.html
| 1 | -$var title: Feedback | |
| 1 | +$def with (user_id) | |
| 2 | +$var title: Thanks | |
| 2 | 3 | $var mod = 'thanks'; |
| 3 | 4 | $var cssfiles: static/css/survey.css |
| 4 | 5 | |
| ... | ... | @@ -7,9 +8,10 @@ $var cssfiles: static/css/survey.css |
| 7 | 8 | <div class="innertube"> |
| 8 | 9 | |
| 9 | 10 | <h2>Identification</h2> |
| 10 | - <form> | |
| 11 | + <form action="/thanks" method="post" enctype="multipart/form-data" name="identification_form"> | |
| 11 | 12 | <p> |
| 12 | 13 | <label> |
| 14 | + <input type="hidden" name="user_id" value=$user_id> | |
| 13 | 15 | Name: <input type="text" name="name" value="" size="30"> |
| 14 | 16 | </label></p> |
| 15 | 17 | <p> |
| ... | ... | @@ -311,7 +313,7 @@ $var cssfiles: static/css/survey.css |
| 311 | 313 | address you'll be sent the survey results report as soon as it is released. If |
| 312 | 314 | you have any further comments, please send it through the form below.</p><br /> |
| 313 | 315 | |
| 314 | - | |
| 316 | +<br style="clear: both" /> | |
| 315 | 317 | </div><!-- class="innertube" --> |
| 316 | 318 | </div><!-- id="maincontent" --> |
| 317 | 319 | ... | ... |