예제 #1
0
def build_assess_form(q,
                      errorModels=(),
                      bottom='',
                      title='Assessing your answer'):
    'return HTML for standard form for round 2'
    doc = webui.Document(title)
    if getattr(q, 'showAnswer', False) and getattr(q, 'explanation', False):
        doc.add_text('Answer: ' + q.explanation, 'B')
        doc.add_text('<HR>\n')
    doc.add_text(
        '''How does your answer compare with the right answer?
    If your answer was different, please briefly explain below how your
    reasoning differed.''', 'B')
    form = webui.Form('submit')
    form.append(webui.Input('qid', 'hidden', str(q.id)))
    form.append(webui.Input('stage', 'hidden', 'assess'))
    options = (('correct', 'Essentially the same.'), ('close', 'Close.'),
               ('different', 'Different.'))
    form.append(webui.RadioSelection('assessment', options))
    if errorModels:
        form.append(
            "<br>\n<b>Did you make any of the following common errors?</b><br>\n"
        )
        form.append(
            webui.CheckboxSelection('errors', list(enumerate(errorModels))))
    form.append('''<br>\nIf you made an error not listed above, please
indicate how your reasoning differed from the right idea.  
Otherwise, you may leave this blank, or ask any question about
this problem that still puzzles you:<br>\n''')
    form.append(webui.Textarea('differences'))
    form.append('<br>\n')
    doc.append(form)
    doc.add_text(bottom)
    return str(doc)
예제 #2
0
def build_quizmode_form(formtitle='Switch to Quiz Mode?',
                        explanation='''Quiz Mode presents all questions
                        on a single form, so students answer them all
                        and then submit the form once.  This is
                        designed for giving the students a test
                        rather than the usual mode of walking
                        them through one exercise at a time.''',
                        title='Quiz',
                        instructions='''Please answer all of the following
                        questions. You must answer all questions.
                        When you have answered all questions, click Go
                        to submit your answers.  Note that your submitted
                        answers are final; you cannot resubmit answers again.'''
                        ):
    doc = webui.Document(formtitle)
    doc.add_text(explanation)
    form = webui.Form('quizmode')
    form.append('<br>\nQuiz Title:\n')
    form.append(webui.Input('title', value='Quiz', size=50))
    form.append('<br>\nInstructions for the students:<br>\n')
    form.append(webui.Textarea('instructions', value=instructions))
    form.append('<br>\nWill this quiz be graded?<br>\n')
    options = (('yes', 'Graded'), ('', 'Ungraded'))
    form.append(webui.RadioSelection('graded', options))
    form.append('<br>\n')
    doc.append(form)
    return str(doc)
예제 #3
0
 def build_critique_form(self):
     form = self.get_choice_form('critique', False)
     form.append(
         '<br>\nBriefly state what you think is wrong with this answer:<br>\n'
     )
     form.append(webui.Textarea('criticisms'))
     form.append('<br>\n')
     return self.build_vote_form(
         form, 'Choose an answer to critique', '''<h1>Critique</h1>
                                 Choose one of the following answers to critique:
                                 <br>''')
예제 #4
0
 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')
예제 #5
0
 def build_self_critique_form(self,
                              title='Critique your original answer',
                              text='''<h1>Critique</h1>
                              Briefly state what you think was wrong with your original answer:
                              <br>''',
                              action='self_critique'):
     doc = webui.Document(title)
     doc.add_text(text)
     form = webui.Form('submit')
     form.append(webui.Input('qid', 'hidden', str(self.id)))
     form.append(webui.Input('stage', 'hidden', action))
     form.append(webui.Textarea('criticisms'))
     form.append('<br>\n')
     doc.append(form)
     doc.add_text(self._navHTML)
     return str(doc)
예제 #6
0
 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')