Пример #1
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = "<div class=\"iDevice\">\n"
     if not self.idevice.isAnswered:
         html += common.editModeHeading(
             _("Please select a correct answer for each question."))
     html += common.textInput("title"+self.id, self.idevice.title)
     html += u"<br/><br/>\n"
     for element in self.questionElements:
         html += element.renderEdit() 
     value = _("Add another Question")    
     html += "<br/>" 
     html += common.submitButton("addQuestion"+unicode(self.id), value)
     html += "<br/><br/>" +  _("Select pass rate: ")
     html += "<select name=\"passrate\">\n"
     template = '  <option value="%s0"%s>%s0%%</option>\n'
     for i in range(1, 11):
         if str(i)+ "0" == self.idevice.passRate:
             html += template % (str(i), ' selected="selected"', str(i))
         else:
             html += template % (str(i), '', str(i))
     html += "</select>\n"
     html += "<br /><br />" + self.renderEditButtons()
     html += "</div>\n"
     self.idevice.isAnswered = True
     return html
Пример #2
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = "<div class=\"iDevice\"><br/>\n"
        if self.idevice.message<>"":
            html += common.editModeHeading(self.idevice.message)

        # JR
	# Quitamos el prefijo "FPD -"
	if self.idevice.title.find("FPD - ") == 0:
		self.idevice.title = x_(u"Autoevaluacion")

#        html += common.textInput("title"+self.id, self.idevice.title) + '<br/>'
        html += common.textInput("title"+self.id, self.idevice.title)
            
        for element in self.questionElements:
            html += element.renderEdit() 
#            html += "<br/>"
            
        html += "<br/>"
        value = _("Add another question")    
        html += common.submitButton("addQuestion"+unicode(self.id), value)
        html += "<br /><br />" 
        html += self.renderEditButtons(undo=self.idevice.undo)
        html += "</div>\n"

        return html
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = "<div class=\"iDevice\"><br/>\n"
        if self.idevice.message<>"":
            html += common.editModeHeading(self.idevice.message)
        
        title_val = self.idevice.title
        if title_val == _("Multi-choice"):
            title_val = ""
        html += common.textInput("title"+self.id, title_val,
                             default_prompt=_("Type your title here")) + '<br/>'
            
        for element in self.questionElements:
            html += element.renderEdit() 
            html += "<br/>"
            
        html += "<br/>"
        value = _("Add another question")    
        html += common.submitButton("addQuestion"+unicode(self.id), value,
                                    extra_classes="add_item_button")
        html += "<br /><br />" 
        html += self.renderEditButtons(undo=self.idevice.undo)
        html += "</div>\n"

        return html
Пример #4
0
    def renderPreview(self, style):
        """
        Returns an XHTML string for previewing this block
        """
        lettersDict = {}
        broken = []
        count = 0
        for element in self.termElements:
            count += 1
            log.debug(len(element.termElement.field.content))
            if len(element.termElement.field.content) == 0:
                broken.append(str(count))
                log.debug("THIS IS BROKEN " + str(count))
                continue
            leadLetter = element.termElement.field.content[0].upper()
            if leadLetter in lettersDict:
                lettersDict[leadLetter] += element.renderPreview()
            else:
                lettersDict[leadLetter] = element.renderPreview()
        sortedLetters = lettersDict.keys()
        sortedLetters.sort()

        html = u'<a id="glossary_start"></a>'
        if len(broken) > 0:
            log.debug(", ".join(broken)) 
            html += common.editModeHeading(_('Terms number %s are not entered)' % ", ".join(broken)))
        html += u"<div class=\"iDevice "
        html += u"emphasis"+unicode(self.idevice.emphasis)+"\" "
        html += u"ondblclick=\"submitLink('edit',"+self.id+", 0);\">\n"
        html += u'<img alt="" class="iDevice_icon" '
        html += u"src=\"/style/"+style+"/icon_"+self.idevice.icon
        html += ".gif\" />\n"
        html += u"<span class=\"iDeviceTitle\">"       
        html += self.idevice.title+"</span>\n"
        html += u'<div class="iDevice_inner">\n'

        for letter in sortedLetters:
            html += '<a href="#anchor%s">' % letter
            html += '<span style="font-size: 26px">%s</span></a>\n' % letter
        html += '<br/>\n'
        html += '<br/>\n'

        for letter in sortedLetters:
            html += '<a name="anchor%s">' % letter
            html += '<span style="font-size: 26px">%s</span></a>\n' % letter
            html += '<br/>\n'
            html += '<br/>\n'
            html += lettersDict[letter]
            html += '<br/>\n'
            html += '<a href="#glossary_start">%s</a>\n' % _('Top')
            html += '<br/>\n'
            html += '<br/>\n'
            html += '<br/>\n'

        html += u"</div>\n"
        html += self.renderViewButtons()
        html += u"</div>\n"

        return html
Пример #5
0
    def renderView(self, style):
        """
        Returns an XHTML string for viewing this block
        """
        lettersDict = {}
        broken = []
        count = 0
        for element in self.termElements:
            count += 1
            if len(element.termElement.field.content) == 0:
                broken.append(str(count))
                continue
            leadLetter = element.termElement.field.content[0].upper()
            if leadLetter in lettersDict:
                lettersDict[leadLetter] += element.renderPreview()
            else:
                lettersDict[leadLetter] = element.renderPreview()
        sortedLetters = lettersDict.keys()
        sortedLetters.sort()

        html = u'<a id="glossary_start"></a>'
        if broken:
            html += common.editModeHeading("Terms number %s are not entered)" % ", ".join(broken))
 
        html += u'<div class="iDevice '
        html += u'emphasis'+unicode(self.idevice.emphasis)+'">\n'
        html += u'<img alt="" class="iDevice_icon" '
        html += u'src="icon_'+self.idevice.icon+'.gif" />\n'
        html += u'<span class="iDeviceTitle">'
        html += self.idevice.title+'</span>\n'
        html += u'<div class="iDevice_inner">\n'

        for letter in sortedLetters:
            html += '<a href="#anchor%s">' % letter
            html += '<span style="font-size: 26px">%s</span></a>\n' % letter
        html += '<br/>\n'
        html += '<br/>\n'

        for letter in sortedLetters:
            html += '<a id="anchor%s">' % letter
            html += '<span style="font-size: 26px">%s</span></a>\n' % letter
            html += '<br/>\n'
            html += '<br/>\n'
            html += lettersDict[letter]
            html += '<br/>\n'
            html += '<a href="#glossary_start">%s</a>\n' % _('Top')
            html += '<br/>\n'
            html += '<br/>\n'
            html += '<br/>\n'

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

        return html
Пример #6
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = "<div class=\"iDevice\"><br/>\n"
     if self.idevice.message<>"":
         html += common.editModeHeading(self.idevice.message)
     html += common.textInput("title"+self.id, self.idevice.title) + '<br/>'
     for element in self.questionElements:
         html += element.renderEdit() 
         html += "<br/>"
     html += "<br/>"
     value = _("Add another question")    
     html += common.submitButton("addQuestion"+unicode(self.id), value)
     html += "<br /><br />" + self.renderEditButtons()
     html += "</div>\n"
     return html
Пример #7
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form elements for editing this block
        """
        log.debug("renderEdit")
        

        html  = u"<div class=\"iDevice\"><br/>\n"
        print self.idevice.message
        if self.idevice.message != "":
            html += common.editModeHeading(self.idevice.message)
            html += common.elementInstruc(self.idevice.kpseInstruc_)
            html += common.textInput("kpse" + self.id, self.idevice.latexpath)
            html += u'<input type="button" onclick="addKpsepath(\'%s\')"' % self.id
            html += u"value=\"%s\"/>\n" % _(u"Search")
            html += u"<br/><br/>\n"
 

        html += common.textInput("title" + self.id, self.idevice.title) + "<br/><br/>"

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        
        html += common.textInput("path" + self.id, self.idevice.source)
        html += u'<input type="button" onclick="addTeX(\'%s\')"' % self.id
        html += u"value=\"%s\"/>\n" % _(u"Add file")
        html += common.submitButton(u"loadSource"+self.id, _(u"Load"))
        
        html += u"<br/>\n"
        html += self.articleElement.renderEdit()
        emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                          (_(u"Some emphasis"),   Idevice.SomeEmphasis)]

        html += common.formField('select', this_package, _('Emphasis'),
                                 'emphasis', self.id, 
                                 '', # TODO: Instructions
                                 emphasisValues,
                                 self.idevice.emphasis)

        html += self.renderEditButtons(undo=self.idevice.undo)
        html += u"</div>\n"
        return html