コード例 #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
コード例 #2
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form elements for editing this block
     """
     log.debug("renderEdit")
     html  = "<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title"+self.id, self.idevice.title)
     html += u"<br/><br/>\n"
     html += common.textInput("path"+self.id, "", 50)
     html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
     html += u'value="%s" />\n' % _(u"Add files")
     html += u'<input type="submit" name="%s" value="%s"' % ("upload"+self.id,
                                                             _(u"Upload"))
     html += common.elementInstruc(self.idevice.fileInstruc)
     html += u'<br/>\n'
     html += u'<b>%s</b>\n' % _(u'Applet Code:')
     html += common.elementInstruc(self.idevice.codeInstruc)
     html += u'<br/>\n'
     html += common.textArea('code'+self.id,
                                 self.idevice.appletCode)
     if self.idevice.userResources:
         html += '<table>'
         for resource in self.idevice.userResources:
             html += '<tr><td>%s</td><td>' % resource.storageName
             html += common.submitImage(self.id, resource.storageName,
                                        "/images/stock-cancel.png",
                                        _("Delete File"))
             html += '</td></tr>\n'
         html += '</table>'
     html += u'<br/>\n'
     html += self.renderEditButtons()
     html += u'\n</div>\n'
     return html
コード例 #3
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")

        html  = "<div class=\"iDevice\"><br/>\n"
        html += common.textInput("title"+self.id, self.idevice.title)
        html += u"<br/><br/>\n"
       
        types = [(_(u"Geogebra"), "geogebra"),
                 (_(u"Other"), "other")]
        html += u"<b>%s</b>" % _("Applet Type")
        
        html += '<select onchange="submitChange(\'changeType%s\', \'type%s\')";' % (self.id, self.id)
        html += 'name="type%s" id="type%s">\n' % (self.id, self.id)
        
        for type, value in types:
            html += "<option value=\""+value+"\" "
            if self.idevice.type == value:
                html += "selected "
            html += ">" + type + "</option>\n"
        html += "</select> \n"
        html += common.elementInstruc(self.idevice.typeInstruc) + "<br/><br/>"
        
        if self.idevice.message <> "":
            html += '<p style="color:red"><b>' + self.idevice.message + '</b></p>'
        
        html += common.textInput("path"+self.id, "", 50)
        html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
        html += u'value="%s" />\n' % _(u"Add files")
        html += u'<input type="submit" name="%s" value="%s"' % ("upload"+self.id,
                                                                _(u"Upload"))
        html += common.elementInstruc(self.idevice.fileInstruc)
        html += u'<br/>\n'

        html += u'<b>%s</b>\n' % _(u'Applet Code:')
        html += common.elementInstruc(self.idevice.codeInstruc)
        html += u'<br/>\n'

        html += common.textArea('code'+self.id,
                                    self.idevice.appletCode,rows="12")

        if self.idevice.userResources:
            html += '<table>'
            for resource in self.idevice.userResources:
                html += '<tr><td>%s</td><td>' % resource.storageName
                html += common.submitImage(self.id, resource.storageName,
                                           "/images/stock-cancel.png",
                                           _("Delete File"))
                html += '</td></tr>\n'
            html += '</table>'
           
        html += u'<br/>\n'
        html += self.renderEditButtons(undo=self.idevice.undo)
        html += u'\n</div>\n'

        return html
コード例 #4
0
 def renderPreview(self):
     """
     Returns an XHTML string with the form element for previewing this field
     """
     html  = "<b>" + self.field.name + "</b> "
     if self.field.instruc != "":
         html += common.elementInstruc(self.field.instruc)
     html += "<br/>\n" 
     html += common.textArea(self.id, self.field.content)
     html += "<br/>\n"
     return html
コード例 #5
0
 def renderPreview(self):
     """
     Returns an XHTML string with the form element for previewing this field
     """
     html  = "<b>" + self.field.name + "</b> "
     if self.field.instruc != "":
         html += common.elementInstruc(self.field.instruc)
     html += "<br/>\n" 
     html += common.textArea(self.id, self.field.content)
     html += "<br/>\n"
     return html
コード例 #6
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this option element
     """
     html = u"<tr><td>"
     html += common.textArea("ans"+self.id, self.field.answer,rows="4")
     html += "</td><td align=\"center\">\n"
     html += common.checkbox("c"+self.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>\n"
     return html
コード例 #7
0
 def render(self):
     """Returns an XHTML string for viewing this pane"""
     log.debug("render")
     html  = u''
     html += u'<a name="currentBlock"/>'
     html += u"<form method=\"post\" action=\"%s\" " % self.url
     html += u"id=\"contentForm\" " 
     html += u'onSubmit="return handleSubmit()">\n' 
     html += common.hiddenField("action")
     html += common.hiddenField("isChanged", self.package.isChanged)
     html += common.hiddenField("posting", self.package.isChanged)
     html += u"<table border=\"0\" cellspacing=\"6\">\n"
     html += u"<tr><td><b>%s</b></td><td>\n" % _(u"Project title:")
     html += common.textInput("title", self.package.root.title, 53) 
     html += u"</td>"
     html += u"</tr><tr><td><b>"
     html += _(u"Author")
     html += u":</b></td><td>\n"
     html += common.textInput("author", self.package.author, 53) 
     html += u"</td></tr>\n"
     html += u"<tr><td valign=\"top\"><b>"
     html += _(u"Description")
     html += u":</b></td><td>\n"
     html += common.textArea("description", self.package.description)
     html += u"</td></tr>\n"
     html += u"<tr><td valign=\"top\"><b>"
     html += _(u"Taxonomy")
     html += u":</b></td>\n"
     html += u"<td valign=\"top\">"
     html += _(u"Level 1: ")
     html += common.textInput("level1", self.package.levelName(0), 20)
     html += u'<div class="block">'
     html += _(u"Level 2: ")
     html += common.textInput("level2", self.package.levelName(1), 20)
     html += u"</div>\n"
     html += u'<div class="block">'
     html += _(u"Level 3: ")
     html += common.textInput("level3", self.package.levelName(2), 20)
     html += u"</div></td></tr><tr><td align=\"right\">\n"       
     html += common.submitButton('done', _(u'Done'))
     html += u"</td><td>&nbsp;</td></tr></table></form>\n"
     return html
コード例 #8
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this element
     """
     html  = u"<b>" + _("Question:") + " </b>" 
     html += common.elementInstruc(self.field.idevice.questionInstruc)
     html += u" " + common.submitImage("del" + self.id, self.field.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete question"))
     html += common.textArea("question"+self.id, 
                                 self.field.question, rows="6")
     html += common.formField('textArea',_(u'Hint:'),'hint',
                             self.id, self.field.idevice.hintInstruc,
                             self.field.hint, rows="4")
     html += "<table width =\"100%%\">"
     html += "<tbody>"
     for element in self.options:
         html += element.renderEdit() 
     html += "</tbody>"
     html += "</table>\n"
     value = _("Add another option")    
     html += common.submitButton("addOption"+unicode(self.id), value)
     return html
コード例 #9
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this element
     """
     html  = u"<div class=\"iDevice\">\n"
     html += u"<b>" + _("Question:") + " </b>" 
     html += common.elementInstruc(self.field.questionInstruc)
     html += u" " + common.submitImage("del" + self.id, self.field.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete question"))
     html += common.textArea("question"+self.id, 
                                 self.field.question, rows="4")
     html += u"<table width =\"100%%\">"
     html += u"<thead>"
     html += u"<tr>"
     html += u"<th>%s " % _("Options")
     html += common.elementInstruc(self.field.optionInstruc)
     html += u"</th><th align=\"left\">%s "  % _("Correct")
     html += common.elementInstruc(self.field.correctAnswerInstruc)
     html += u"<br/>" + _("Option")
     html += u"</th>"
     html += u"</tr>"
     html += u"</thead>"
     html += u"<tbody>"
     for element in self.options:
         html += element.renderEdit() 
     html += u"</tbody>"
     html += u"</table>\n"
     value = _(u"Add another Option")    
     html += common.submitButton("addOption"+self.id, value)
     html += u"<br />"
     html += common.formField('richTextArea', _(u'Feedback:'),
                              'feedback', self.id,
                              self.field.feedbackInstruc,
                              self.field.feedback)
     html += u"</div>\n"
     return html
コード例 #10
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     from exe.application import application
     webDir = application.config.webDir
     greekDir = Path(webDir+'/images/maths/greek letters')
     oprationDir = Path(webDir+'/images/maths/binary oprations')
     relationDir = Path(webDir+'/images/maths/relations')
     html = u'<div class="block">'
     html += u"<b>"+self.field.name+":</b>\n"
     html += common.elementInstruc(self.field.instruc)
     html += u"<br/></div>\n"
     html += '<div class="maths">\n'
     for file in greekDir.files():
         if file.ext == ".gif" or file.ext == ".png":
             symbol = file.namebase
             html += common.insertSymbol("input"+self.id, 
                     u"/images/maths/greek letters/%s", 
                                         "%s", r"\\%s") % (symbol, symbol,
                                                             file.basename())
     html += u"<br/>"        
     for file in oprationDir.files():
         if file.ext == ".gif" or file.ext == ".png":
             symbol = file.namebase
             html += common.insertSymbol("input"+self.id, 
                     u"/images/maths/binary oprations/%s", 
                                         "%s", r"\\%s") % (symbol, symbol,
                                                             file.basename())
     html += u"<br/>"        
     for file in relationDir.files():
         if file.ext == ".gif" or file.ext == ".png":
             symbol = file.namebase
             html += common.insertSymbol("input"+self.id, 
                     u"/images/maths/relations/%s", 
                                         "%s", r"\\%s") % (symbol, symbol,
                                                             file.basename())
     html += "<br />" 
     html += common.insertSymbol("input"+self.id, "", "",
                         r"\\begin{verbatim}\\end{verbatim}", _("text"), 14)
     html += common.insertSymbol("input"+self.id, "", "", r"\\\\\n", _("newline"))
     html += '<br/>'
     html +=  _("Select a font size: ")
     html += "<select name=\"fontsize%s\">\n" % self.id
     template = '  <option value="%s"%s>%s</option>\n' 
     for i in range(1, 11):
         if i == self.field.fontsize:
             html += template % (str(i), ' selected="selected"', str(i))
         else:
             html += template % (str(i), '', str(i))
     html += "</select>\n"
     html += "</div>\n"
     html += common.textArea('input'+self.id, self.field.latex)
     html += '<div class="block">\n'
     html += common.submitButton('preview'+self.id, _('Preview'))
     html += common.elementInstruc(self.field.previewInstruc) + '<br/>'
     if self.field.gifResource:
         html += '<p>'
         html += '<img src="resources/%s" /></p>' % (self.field.gifResource.storageName) 
         html += "</div>\n"
     else:
         html += '<br/>'
     return html