Ejemplo n.º 1
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this option element
     """
     html  = u"<tr><td align=\"center\"><b>%s</b>" % _("Option")
     html += common.elementInstruc(self.field.idevice.answerInstruc)
     header = ""
     if self.index == 0:
         header = _("Correct") + "<br/>" + _("Option")
     html += u"</td><td align=\"center\"><b>%s</b>\n" % header
     html += common.elementInstruc(self.field.idevice.keyInstruc)
     html += "</td><td></td></tr><tr><td>\n" 
     html += common.textArea("ans"+self.id, self.field.answer, rows="4")
     html += "</td><td align=\"center\">\n"
     html += common.option("c"+self.field.question.id, 
                           self.field.isCorrect, self.index)   
     html += "</td><td>\n"
     html += common.submitImage("del"+self.id, self.field.idevice.id, 
                                "/images/stock-cancel.png",
                                _(u"Delete option"))
     html += "</td></tr><tr><td align=\"center\"><b>%s</b>" % _("Feedback")
     html += common.elementInstruc(self.field.idevice.feedbackInstruc)
     html += "</td><td></td><td></td></tr><tr><td>\n" 
     html += common.textArea('f'+self.id, self.field.feedback, rows="4")
     html += "</td><td></td><td></td></tr>\n"
     return html
Ejemplo n.º 2
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this option element
     """
     html  = u"<tr><td align=\"left\"><b>%s</b>" % _("Option")
     html += common.elementInstruc(self.question.optionInstruc)
     header = ""
     if self.index == 0: 
         header = _("Correct Option")
     html += u"</td><td align=\"right\"><b>%s</b>\n" % header
     html += u"</td><td>\n"
     if self.index == 0: 
          html += common.elementInstruc(self.question.correctAnswerInstruc)
     html += "</td></tr><tr><td colspan=2>\n"
     this_package = None 
     if self.answerElement.field_idevice is not None \
     and self.answerElement.field_idevice.parentNode is not None: 
         this_package = self.answerElement.field_idevice.parentNode.package
     html += common.richTextArea(self.answerId,
             self.answerElement.field.content_w_resourcePaths,
             package=this_package)
     html += "</td><td align=\"center\">\n"
     html += common.option("c"+self.keyId, 
             self.option.isCorrect, self.id)
     html += "<br><br><br><br>\n"
     html += common.submitImage(self.id, self.idevice.id, 
                                "/images/stock-cancel.png",
                                _(u"Delete option"))
     html += "</td></tr>\n"
     return html
Ejemplo n.º 3
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this option element
     """
     html = self.question_question.renderEdit()
     html += _("True") + " " 
     html += common.option(self.keyId, self.question.isCorrect, "true") 
     html += _("False") + " " 
     html += common.option(self.keyId, not self.question.isCorrect, "false") 
     html += "<br/><br/>\n"
     html += common.elementInstruc(self.idevice.keyInstruc)
     html += self.question_feedback.renderEdit()
     html += self.question_hint.renderEdit()
     html += common.submitImage(self.id, self.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete question"))
     html += "<br/><br/>\n"
     return html
Ejemplo n.º 4
0
 def renderView(self):
     """
     Returns an XHTML string for viewing this option element
     """
     log.debug("renderView called")
     html  = '<tr><td>'
     html += common.option(self.keyId, 0, unicode(self.index))
     html += '</td><td>\n'
     html += self.option.answer + "</td></tr>\n"
     return html
Ejemplo n.º 5
0
 def renderView(self, preview=False):
     """
     Returns an XHTML string for viewing this option element
     """
     log.debug("renderView called")
     html  = '<tr><td>'
     html += common.option(self.keyId, 0, unicode(self.index))
     html += '</td><td>\n'
     if preview: 
         html += self.answerElement.renderPreview()
     else:            
         html += self.answerElement.renderView()
     html += "</td></tr>\n"
     return html
Ejemplo n.º 6
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this option element
     """
     html = u"<tr><td>"
     html += common.richTextArea(self.answerId, self.option.answer)
     html += "</td><td align=\"center\">\n"
     html += common.option("c"+self.keyId, self.option.isCorrect, self.id)
     html += "</td><td>\n"
     html += common.submitImage(self.id, self.idevice.id, 
                                "/images/stock-cancel.png",
                                _(u"Delete option"))
     html += "</td></tr>\n"
     return html
Ejemplo n.º 7
0
    def renderEdit(self):
        """
        Returns an XHTML string for editing this option element
        """

        html = self.question_question.renderEdit()

        html += _("True") + " "
        html += common.option(self.keyId, self.question.isCorrect, "true")
        html += _("False") + " "
        html += common.option(self.keyId, not self.question.isCorrect, "false")

        html += "<br/><br/>\n"

        html += common.elementInstruc(self.idevice.keyInstruc)

        html += self.question_feedback.renderEdit()
        html += self.question_hint.renderEdit()

        html += common.submitImage(self.id, self.idevice.id,
                                   "/images/stock-cancel.png",
                                   _("Delete question"))
        html += "<br/><br/>\n"
        return html
Ejemplo n.º 8
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this option element
     """
     html  = common.formField('richTextArea',_(u'Question:'),'',
                             self.questionId, self.idevice.questionInstruc,
                             self.question_question.field.content)
     html += _("True") + " " 
     html += common.option(self.keyId, self.question_isCorrect, "true") 
     html += _("False") + " " 
     html += common.option(self.keyId, not self.question_isCorrect, "false") 
     html += "<br/><br/>\n"
     html += common.elementInstruc(self.idevice.keyInstruc)
     html += common.formField('richTextArea',_(u'Feedback'),'',
                             self.feedbackId, self.idevice.feedbackInstruc,
                             self.question_feedback.field.content)
     html += common.formField('richTextArea',_(u'Hint'),'',
                             self.hintId, self.idevice.hintInstruc,
                             self.question_hint.field.content)
     html += common.submitImage(self.id, self.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete question"))
     html += "<br/><br/>\n"
     return html
Ejemplo n.º 9
0
    def renderView(self, preview=False):
        """
        Returns an XHTML string for viewing this option element
        """
        log.debug("renderView called")

        html = '<tr><td>'
        html += common.option(self.keyId, 0, unicode(self.index))
        html += '</td><td>\n'

        if preview:
            html += self.answerElement.renderPreview()
        else:
            html += self.answerElement.renderView()
        html += "</td></tr>\n"

        return html
Ejemplo n.º 10
0
    def renderEdit(self):
        """
        Returns an XHTML string for editing this option element
        """
        html = u"<tr><td align=\"left\"><b>%s</b>" % _("Option")
        html += common.elementInstruc(self.question.optionInstruc)

        header = ""
        if self.index == 0:
            header = _("Correct Option")

        html += u"</td><td align=\"right\"><b>%s</b>\n" % header
        html += u"</td><td>\n"
        if self.index == 0:
            html += common.elementInstruc(self.question.correctAnswerInstruc)
        html += "</td></tr><tr><td colspan=2>\n"

        # rather than using answerElement.renderEdit(),
        # access the appropriate content_w_resourcePaths attribute directly,
        # since this is in a customised output format
        # (in a table, with an extra delete-option X to the right)

        this_package = None
        if self.answerElement.field_idevice is not None \
        and self.answerElement.field_idevice.parentNode is not None:
            this_package = self.answerElement.field_idevice.parentNode.package

        html += common.richTextArea(
            self.answerId,
            self.answerElement.field.content_w_resourcePaths,
            package=this_package)

        html += "</td><td align=\"center\">\n"
        html += common.option("c" + self.keyId, self.option.isCorrect, self.id)
        html += "<br><br><br><br>\n"
        html += common.submitImage(self.id, self.idevice.id,
                                   "/images/stock-cancel.png",
                                   _(u"Delete option"))
        html += "</td></tr>\n"

        return html
Ejemplo n.º 11
0
    def renderEdit(self):
        """
        Returns an XHTML string for editing this option element
        """
        html  = u"<tr><td align=\"left\"><b>%s</b>" % _("Option")
        html += common.elementInstruc(self.question.optionInstruc)

        header = ""
        if self.index == 0: 
            header = _("Correct Option")

        html += u"</td><td align=\"right\"><b>%s</b>\n" % header
        html += u"</td><td>\n"
        if self.index == 0: 
             html += common.elementInstruc(self.question.correctAnswerInstruc)
        html += "</td></tr><tr><td colspan=2>\n"

        # rather than using answerElement.renderEdit(),
        # access the appropriate content_w_resourcePaths attribute directly,
        # since this is in a customised output format 
        # (in a table, with an extra delete-option X to the right)

        this_package = None 
        if self.answerElement.field_idevice is not None \
        and self.answerElement.field_idevice.parentNode is not None: 
            this_package = self.answerElement.field_idevice.parentNode.package

        html += common.richTextArea(self.answerId,
                self.answerElement.field.content_w_resourcePaths,
                package=this_package)

        html += "</td><td align=\"center\">\n"
        html += common.option("c"+self.keyId, 
                self.option.isCorrect, self.id)
        html += "<br><br><br><br>\n"
        html += common.submitImage(self.id, self.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _(u"Delete option"))
        html += "</td></tr>\n"

        return html
Ejemplo n.º 12
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     floatArr        = [[_(u'Left'), 'left'],
                       [_(u'Right'), 'right'],
                       [_(u'None'),  'none']]
     glassSizeArr    = [[_(u'Small'), '1'],
                       [_(u'Medium'),'2'],
                       [_(u'Large'),'3'],
                       [_(u'Extra large'),'4'],]
     html  = u"<div class=\"iDevice\">\n"
     html += self.imageMagnifierElement.renderEdit()       
     html += common.formField('select', _("Align:"),
                              "float" + self.id, '',
                              self.idevice.dimensionInstruc,
                              floatArr, self.idevice.float)
     html += '<div class="block">'
     html += u"<b>%s </b>" % _(u"Caption:")
     html += common.textInput("caption" + self.id, self.idevice.caption)
     html += common.elementInstruc(self.idevice.captionInstruc)
     html += '</div>'
     html += '<div class="block">'
     html += self.textElement.renderEdit()
     html += '</div>'
     html += common.formField('select', _(u"Size of magnifying glass: "),
                              "glass" + self.id,
                              options = glassSizeArr, 
                              selection = \
                              self.idevice.imageMagnifier.glassSize)
     zoomOpts = []
     selected = ''
     for i in range(10, 21):
         if str(i)+ "0" == self.idevice.imageMagnifier.maxZSize:
             selected = str(i)
         zoomOpts.append((str(i), str(i)))
     html += common.formField('select', _(u"Maximum zoom"),
                              "maxZoom" + self.id,
                              options = zoomOpts, 
                              selection = selected)
     html += '<div class="block">'
     html += "<b>" +_(u"Magnify initial zoom? ")  + "</b>"
     html += _(u"Yes")
     if self.idevice.imageMagnifier.initialZSize == "100":
         html += common.option("initial"+self.id, 0, "yes")
         html += _(u"No")
         html += common.option("initial"+self.id, 1, "no")
     else:
         html += common.option("initial"+self.id, 1, "yes")
         html += _(u"No")
         html += common.option("initial"+self.id, 0, "no")
     html += common.formField('select', _(u"Maximum zoom"),
                              "maxZoom", self.id,
                              '',
                              glassSizeArr, 
                              self.idevice.imageMagnifier.glassSize)
     html += "<b>" +_(u"Magnify initial zoom? ")  + "</b>"
     html += _(u"Yes")
     if self.idevice.imageMagnifier.initialZSize == "100":
         html += common.option("initial"+self.id, 0, "yes")
         html += _(u"No")
         html += common.option("initial"+self.id, 1, "no")
     else:
         html += common.option("initial"+self.id, 1, "yes")
         html += _(u"No")
         html += common.option("initial"+self.id, 0, "no")
     html += '</div>'
     html += self.renderEditButtons()
     html += u"</div>\n"
     return html