def _append_to_form(self, form, suffix='', conf=True): l = [] for i, s in enumerate(self.choices): l.append((i, '<B>%s</B>. %s' % (letters[i], s))) form.append(webui.RadioSelection('choice' + suffix, l)) if conf: forms.add_confidence_choice(form) form.append('<br>\n')
def _append_to_form(self, form, suffix='', conf=True): l = [] for i,s in enumerate(self.choices): l.append((i, '<B>%s</B>. %s' % (letters[i], s))) form.append(webui.RadioSelection('choice' + suffix, l)) if conf: forms.add_confidence_choice(form) form.append('<br>\n')
def _append_to_form(self, form, suffix='', conf=True, instructions='''(write your answer on a sheet of paper, take a picture, and upload the picture using the button below. Click here for <A HREF="/images/help.html">some helpful instructions</A>).<br>\n'''): form.append(instructions) form.append(webui.Upload('image' + suffix)) form.append('''<br>Optionally, you may enter a text answer, e.g. if you cannot submit your answer as an image:<br>''') form.append(webui.Textarea('answer2' + suffix)) if conf: forms.add_confidence_choice(form) form.append('<br>\n')
def _append_to_form( self, form, suffix='', conf=True, instructions='''(write your answer on a sheet of paper, take a picture, and upload the picture using the button below. Click here for <A HREF="/images/help.html">some helpful instructions</A>).<br>\n'''): form.append(instructions) form.append(webui.Upload('image' + suffix)) form.append('''<br>Optionally, you may enter a text answer, e.g. if you cannot submit your answer as an image:<br>''') form.append(webui.Textarea('answer2' + suffix)) if conf: forms.add_confidence_choice(form) form.append('<br>\n')
def get_choice_form(self, action='vote', confidenceChoice=True, maxreasons=2, fmt='%(answer)s', separator='<hr>\n', useSubmit=True): if useSubmit: form = webui.Form('submit') form.append(webui.Input('qid', 'hidden', str(self.id))) form.append(webui.Input('stage', 'hidden', action)) else: form = webui.Form(action) l = [] for i, category in enumerate(self.list_categories()): responses = self.categories.get(category, ()) try: if self.is_correct(category): tag = 'correct' else: tag = 'wrong' except AttributeError: # correct answer not yet categorized tag = '' d = dict(n=len(responses), tag=tag, answer=str(category)) s = fmt % d if maxreasons and responses: s += '<h3>Some arguments for this:</h3>\n' for r in responses[:maxreasons]: try: s += '<LI>%s</LI>\n' % r.reasons except AttributeError: pass separator = '<hr>\n' s += separator l.append((i, s)) form.append(webui.RadioSelection('choice', l)) if confidenceChoice: forms.add_confidence_choice(form) form.append('<br>\n') return form
def get_choice_form(self, action='vote', confidenceChoice=True, maxreasons=2, fmt='%(answer)s', separator='<hr>\n', useSubmit=True): if useSubmit: form = webui.Form('submit') form.append(webui.Input('qid', 'hidden', str(self.id))) form.append(webui.Input('stage', 'hidden', action)) else: form = webui.Form(action) l = [] for i,category in enumerate(self.list_categories()): responses = self.categories.get(category, ()) try: if self.is_correct(category): tag = 'correct' else: tag = 'wrong' except AttributeError: # correct answer not yet categorized tag = '' d = dict(n=len(responses), tag=tag, answer=str(category)) s = fmt % d if maxreasons and responses: s += '<h3>Some arguments for this:</h3>\n' for r in responses[:maxreasons]: try: s += '<LI>%s</LI>\n' % r.reasons except AttributeError: pass separator = '<hr>\n' s += separator l.append((i, s)) form.append(webui.RadioSelection('choice', l)) if confidenceChoice: forms.add_confidence_choice(form) form.append('<br>\n') return form
def _append_to_form(self, form, suffix='', conf=True): form.append(webui.Textarea('answer' + suffix)) if conf: forms.add_confidence_choice(form) form.append('<br>\n')