Example #1
0
 def renderEditButtons(self):
     """
     Returns an XHTML string for the edit buttons
     """
     html  = common.submitImage(u"done", self.id, 
                                u"/images/stock-apply.png", 
                                _(u"Done"),1)
     html += common.confirmThenSubmitImage(
         _(u"This will delete this iDevice."
           u"\\n"
           u"Do you really want to do this?"),
         u"delete",
         self.id, u"/images/stock-cancel.png", 
         _(u"Delete"), 1)
     if self.idevice.isFirst():
         html += common.image(u"movePrev", u"/images/stock-go-up-off.png")
     else:
         html += common.submitImage(u"movePrev", self.id, 
                                    u"/images/stock-go-up.png", 
                                    _(u"Move Up"),1)
     if self.idevice.isLast():
         html += common.image(u"moveNext", u"/images/stock-go-down-off.png")
     else:
         html += common.submitImage(u"moveNext", self.id, 
                                    u"/images/stock-go-down.png", 
                                    _(u"Move Down"),1)
     options  = [(_(u"---Move To---"), "")]
     options += self.__getNodeOptions(self.package.root, 0)
     html += common.select(u"move", self.id, options)
     if self.purpose.strip() or self.tip.strip():
         html += u'<a title="%s" ' % _(u'Pedagogical Help')
         html += u'onmousedown="Javascript:updateCoords(event);" '
         html += u"onclick=\"Javascript:showMe('p"+self.id+"', 420, 240);\" "
         html += u'href="Javascript:void(0)" style="cursor:help;"> ' 
         html += u'<img alt="%s" class="info" src="/images/info.png" ' \
                 % _('Information')
         html += u'style="align:middle;" /></a>\n'
         html += u'<div id="p%s" style="display:none;">' % self.id
         html += u'<div style="float:right;">'
         html += u'<img alt="%s" src="/images/stock-stop.png" ' % _('Close')
         html += u' title="%s" ' % _(u"Close")
         html += u'onmousedown="Javascript:hideMe();"/></div>'
         if self.purpose != "":
             html += u'<div class="popupDivLabel">'
             html += u' ' + _(u"Purpose") + u'</div>'
             html += self.purpose 
         if self.tip != "":
             html += u'<div class="block"><b>' + _(u"Tip:") + u'</b></div>'
             html += self.tip 
             html += u'\n'
         html += u'</div><br/><br/>\n'    
     return html
Example #2
0
    def renderEdit(self):
        """
        Returns an XHTML string for editing this option element
        """

        html = self.question_question.renderEdit()

        #removed unnecessary elements kthamm 111028
        #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_hint.renderEdit()
        #end removed

        html += self.question_feedback.renderEdit()
        html += common.submitImage(self.id, self.idevice.id,
                                   "/images/stock-cancel.png",
                                   _("Delete question"))
        html += "<br/><br/>\n"
        return html
    def renderEdit(self):
        """
        Returns an XHTML string for editing this option element
        """
        
        html = self.question_question.renderEdit()

#removed unnecessary elements kthamm 111028
        #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_hint.renderEdit()
#end removed

        html += self.question_feedback.renderEdit()
        html += common.submitImage(self.id, self.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Delete question"))
        html += "<br/><br/>\n"
        return html
Example #4
0
def field_engine_make_delete_button(element,
                                    imgAltText="Delete Item",
                                    prefix="delfile"):
    html = ""
    html += common.submitImage(prefix + element.id, element.field.idevice.id,
                               "/images/stock-cancel.png", _(imgAltText))
    return html
Example #5
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
Example #6
0
 def renderEdit(self):
     html  = u"<div>\n"
     
     
     html += common.textInput("path"+self.id, "", 50, \
                 onclick="addFile('%s')" % self.id, readonly="readonly" )
     html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
     html += u'value="%s" />\n' % _(u"Browse")
     
     buttonName = _(u"Replace")
     if self.field.fileResource is None:
         buttonName = _(u"Upload") 
     
     html += u'<input type="submit" name="%s" value="%s" />' % ("upload"+self.id,
                                                             buttonName)
     html += common.elementInstruc(self.field.fileInstruc)
     
     html += self.fileDescriptionElement.renderEdit()
     
     if self.field.fileResource is not None:
         html += "<div class='block'><strong>"
         html += _("File") + ": %s " % self.field.fileResource.storageName
         
         if self.showDelFile:
             html += common.submitImage("delfile" + self.id, self.field.fileResource.storageName,
                                         "/images/stock-cancel.png",
                                         _("Delete File"))
         html += "</strong></div>"
     else:
         html += "<i>"+_("No File Uploaded Currently") + "</i>"
     html += "<br/></div>"
     
     html += field_engine_make_delete_button(self)
     
     return html
Example #7
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
Example #8
0
    def renderEdit(self):
        """
        Returns an XHTML string with the form element for editing this element
        """
        html  = u"<div class=\"iDevice\">\n"
        html += common.submitImage(self.id, self.idevice.id,  
                "/images/stock-cancel.png", 
                _("Delete question")) 
        html += self.questionElement.renderEdit()

        html += u"<table width =\"100%%\">"
        html += u"<thead>"
        html += u"<tr>"
        html += u"<th>%s " % _("Options")
        html += common.elementInstruc(self.question.optionInstruc)
        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"+unicode(self.id), value)
        html += u"<br />"
        html += u"</div>\n"

        return html
Example #9
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
Example #10
0
 def renderViewButtons(self):
     """
     Returns an XHTML string for the view buttons
     """
     html = common.submitImage(u"edit", self.id, u"/images/stock-edit.png",
                               _(u"Edit"), self.package.isChanged, True)
     return html
Example #11
0
 def renderViewButtons(self):
     """
     Returns an XHTML string for the view buttons
     """
     html  = common.submitImage(u"edit", self.id, 
                                u"/images/stock-edit.png", 
                                _(u"Edit"), self.package.isChanged)
     return html
    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
Example #13
0
    def renderEdit(self):
        """
        Returns an XHTML string with the form element for editing this field
        """
        html = common.textInput("name" + self.id, self.field.name, 25)
        html += common.submitImage("deleteField", self.id, "/images/stock-cancel.png", _("Delete"), 1)
        html += "<br/>\n"

        this_package = None
        html += common.formField("richTextArea", this_package, "", "instruc", self.id, "", self.field.instruc)
        return html
Example #14
0
    def renderEdit(self):
        """
        Returns an XHTML string with the form element for editing this field
        """
        html = "<b>%s</b><br/>" % _("Text Line")
        html += common.textInput("name" + self.id, self.field.name, 25)
        html += common.submitImage("deleteField", self.id, "/images/stock-cancel.png", _("Delete"), 1)
        html += "<br/>\n"

        this_package = None
        html += common.richTextArea("instruc" + self.id, self.field.instruc, package=this_package)
        html += "<br/>"
        return html
Example #15
0
 def renderViewButtons(self):
     """
     Returns an XHTML string for the view buttons
     """
     html = '<p class="exe-controls idevice-edition-buttons">'
     html += common.submitImage(u"edit", self.id, u"/images/stock-edit.png",
                                _(u"Edit"), self.package.isChanged, True)
     html += common.confirmThenSubmitImage(
         _(u"This will delete this iDevice. Do you really want to do this?"
           ), u"delete", self.id, u"/images/stock-cancel.png", _(u"Delete"),
         1)
     html += '</p>'
     return html
Example #16
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
Example #17
0
    def renderEdit(self):
        """
        Returns an XHTML string with the form element for editing this field
        """
        html  = common.textInput("name"+self.id, self.field.name, 25)
        html += common.submitImage("deleteField", self.id, 
                                   "/images/stock-cancel.png", 
                                   _("Delete"), 1)
        html += "<br/>\n"

        this_package = None
        html += common.formField('richTextArea', this_package, '','instruc',
                                 self.id, '',
                                 self.field.instruc)
        return html
Example #18
0
 def renderViewButtons(self):
     """
     Returns an XHTML string for the view buttons
     """
     html = '<p class="exe-controls idevice-edition-buttons">'
     html  += common.submitImage(u"edit", self.id, 
                                u"/images/stock-edit.png", 
                                _(u"Edit"), self.package.isChanged, True)
     html += common.confirmThenSubmitImage(
         _(u"This will delete this iDevice. Do you really want to do this?"),
         u"delete",
         self.id, u"/images/stock-cancel.png", 
         _(u"Delete"), 1)
     html += '</p>'
     return html
Example #19
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
Example #20
0
    def renderEdit(self):
        """
        Returns an XHTML string with the form element for editing this field
        """
        html  = "<b>%s</b><br/>" % _("Text Line")
        html += common.textInput("name"+self.id, self.field.name, 25)
        html += common.submitImage("deleteField", self.id, 
                                   "/images/stock-cancel.png", 
                                   _("Delete"), 1)
        html += "<br/>\n"

        this_package = None
        html += common.richTextArea("instruc"+self.id, self.field.instruc, 
                package=this_package)
        html += "<br/>"
        return html
Example #21
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this question element
     """
     html  = "<tr><td><b>%s</b>\n" % _("Activity")
     html += common.elementInstruc(self.idevice.questionInstruc)
     html += self.question_question.renderEdit()
     html += "<b>%s</b>\n" % _("Feedback")
     html += common.elementInstruc(self.idevice.feedbackInstruc)
     html += self.question_feedback.renderEdit()
     html += "</td><td>\n"
     html += common.submitImage(self.id, self.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete question"))
     html += "</td></tr>\n"
     return html
Example #22
0
    def renderEdit(self):
        html = "<div stlye='border: 1px solid green; padding-top: 20px;'>"
        html += common.fieldShowEditMessageEle(self)
        textElementItems = ["left", "top", "width", "height", "hideDelay"]
        textAreaItems = ["Hint", "ShowMe"]

        for textElementName in textElementItems:
            html += self.textElements[textElementName].renderEdit()

        #for textAreaElementName, textAreaElement in self.textAreaElements.iteritems():
        for textAreaElementName in textAreaItems:
            html += self.textAreaElements[textAreaElementName].renderEdit()

        html += common.submitImage(self.id, self.field.idevice.id,
                                   "/images/stock-cancel.png",
                                   _("Delete Clickable Area"))
        html += "</div>"
        return html
Example #23
0
 def renderEdit(self):
     html = "<div stlye='border: 1px solid green; padding-top: 20px;'>"
     html += common.fieldShowEditMessageEle(self)
     textElementItems = ["left", "top", "width", "height", "hideDelay"]
     textAreaItems = ["Hint", "ShowMe"]
     
     for textElementName in textElementItems:
         html += self.textElements[textElementName].renderEdit()
     
     #for textAreaElementName, textAreaElement in self.textAreaElements.iteritems():
     for textAreaElementName in textAreaItems: 
         html +=self.textAreaElements[textAreaElementName].renderEdit()
         
     html += common.submitImage(self.id, self.field.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete Clickable Area"))
     html += "</div>"
     return html
Example #24
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     html = "<b>%s </b>" % _("Button Caption")
     html += common.textInput("btnCaption"+self.id, 
                              self.field.buttonCaption, 25)
     html += "<br/><br/>"
     html += common.textInput("name"+self.id, self.field.name, 25)
     html += common.submitImage("deleteField", self.id, 
                                "/images/stock-cancel.png", 
                                _("Delete"), 1)
     html += "<br/>\n"
     html += common.formField('richTextArea', '','instruc',
                              self.id, '',
                              self.field.instruc)
     html += "<br/>"
     return html
Example #25
0
 def renderEdit(self):
     """
     Returns an XHTML string with the form element for editing this field
     """
     html  = common.textInput("name"+self.id, self.field.name, 25)
     html += common.submitImage("deleteField", self.id, 
                                "/images/stock-cancel.png", 
                                _("Delete"), 1)
     html += "<br/>\n"
     html += common.image("img"+self.id, 
                          "/images/"+ImageEditorElement.DefaultImage,
                          self.field.width,
                          self.field.height)
     html += "<br/>\n"
     html += common.formField('richTextArea', '','instruc',
                              self.id, '',
                              self.field.instruc)
     return html
Example #26
0
 def renderEdit(self):
     """
     Returns an XHTML string for editing this question element
     """
     html  = "<tr><td><b>%s</b>\n" % _("Activity")
     html += common.elementInstruc(self.idevice.questionInstruc)
     html += common.richTextArea(self.quesId, self.question.question)
     html += self.imageElement.renderEdit()
     html += "<b>%s</b>\n" % _("Feedback")
     html += common.elementInstruc(self.idevice.feedbackInstruc)
     html += common.richTextArea(self.feedbackId, self.question.feedback)
     if self.imageElement.field.imageResource is None:
         self.imageElement.field.setDefaultImage()
     html += "</td><td>\n"
     html += common.submitImage(self.id, self.idevice.id, 
                                "/images/stock-cancel.png",
                                _("Delete question"))
     html += "</td></tr>\n"
     return html
    def renderEdit(self):
        """
        Returns an XHTML string for editing this question element
        """

        html  = "<tr><td><b>%s</b>\n" % _("Activity")
        html += common.elementInstruc(self.idevice.questionInstruc)
        html += self.question_question.renderEdit()

        html += "<b>%s</b>\n" % _("Feedback")
        html += common.elementInstruc(self.idevice.feedbackInstruc)
        html += self.question_feedback.renderEdit()

        html += "</td><td>\n"
        html += common.submitImage(self.id, self.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Delete question"))
        html += "</td></tr>\n"
        return html
Example #28
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
Example #29
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
Example #30
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
Example #31
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
Example #32
0
    def renderEdit(self):
        html = u"<div>\n"


        html += common.textInput("path"+self.id, "", 50, \
                    onclick="addFile('%s')" % self.id, readonly="readonly" )
        html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id
        html += u'value="%s" />\n' % _(u"Browse")

        buttonName = _(u"Replace")
        if self.field.fileResource is None:
            buttonName = _(u"Upload")

        html += u'<input type="submit" name="%s" value="%s" />' % (
            "upload" + self.id, buttonName)
        html += common.elementInstruc(self.field.fileInstruc)

        html += self.fileDescriptionElement.renderEdit()

        if self.field.fileResource is not None:
            html += "<div class='block'><strong>"
            html += _("File") + ": %s " % self.field.fileResource.storageName

            if self.showDelFile:
                html += common.submitImage("delfile" + self.id,
                                           self.field.fileResource.storageName,
                                           "/images/stock-cancel.png",
                                           _("Delete File"))
            html += "</strong></div>"
        else:
            html += "<i>" + _("No File Uploaded Currently") + "</i>"
        html += "<br/></div>"

        html += field_engine_make_delete_button(self)

        return html
Example #33
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
Example #34
0
    def renderEditButtons(self, undo=True):
        """
        Returns an XHTML string for the edit buttons
        """
        
        html  = common.submitImage(u"done", self.id, 
                                   u"/images/stock-apply.png", 
                                   _(u"Done"),1)

        if undo:
            html += common.confirmThenSubmitImage(
                _(u"Exit without saving?"),
                u"cancel",
                self.id, u"/images/stock-undo.png", 
                _(u"Undo Edits"), 1)
        else:
            html  += common.submitImage(u"no_cancel", self.id, 
                                   u"/images/stock-undoNOT.png", 
                                   _(u"Can NOT Undo Edits"),1)

        html += common.confirmThenSubmitImage(
            _(u"This will delete this iDevice. Do you really want to do this?"),
            u"delete",
            self.id, u"/images/stock-cancel.png", 
            _(u"Delete"), 1)

        if self.idevice.isFirst():
            html += common.image(u"movePrev", u"/images/stock-go-up-off.png", 16, 16, None, u"submit")
        else:
            html += common.submitImage(u"movePrev", self.id, 
                                       u"/images/stock-go-up.png", 
                                       _(u"Move Up"),1)

        if self.idevice.isLast():
            html += common.image(u"moveNext", u"/images/stock-go-down-off.png", 16, 16, None, u"submit")
        else:
            html += common.submitImage(u"moveNext", self.id, 
                                       u"/images/stock-go-down.png", 
                                       _(u"Move Down"),1)

        options  = [(_(u"---Move To---"), "")]
        options += self.__getNodeOptions(self.package.root, 0)
        html += common.select(u"move", self.id, options)

        if self.purpose.strip() or self.tip.strip():
            html += u'<a title="%s" ' % _(u'Pedagogical Help')
            html += u"onclick=\"showMessageBox('"+self.id+"');\" "
            html += u'href="javascript:void(0)" style="cursor:help;margin-left:.2em;">' 
            html += u'<img alt="%s" class="info" src="/images/info.png" ' \
                    % _('Information')
            html += u'style="align:middle;" /></a>\n'
            html += u'<div style="display:none;">'

            if self.purpose != "":
                html += u'<div id="'+self.id+'title">'+_(u"Purpose")+'</div>'
                html += u'<div id="'+self.id+'content">'+self.purpose+'</div>'
                
            if self.tip != "":
                html += u'<div id="'+self.id+'title">'+_(u"Tip:")+'</div>'
                html += u'<div id="'+self.id+'content">'+self.tip+'</div>'
                
            html += u'</div>\n'    
        
        return html
Example #35
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = u"<div>\n"
        html += common.ideviceShowEditMessage(self)
        
        
        html += self.titleElement.renderEdit()
        html += self.contentElement.renderEdit()
        html += self.alphabetElement.renderEdit()

        #messages to show the user for different events
        html += self.wrongGuessTextElement.renderEdit()
        html += self.lostLevelTextElement.renderEdit()
        html += self.levelPassedTextElement.renderEdit()
        html += self.gameWonTextElement.renderEdit()
        html += self.resetButtonTextElement.renderEdit()

        divId = "fieldtype_advanced"  + self.id
        html += "<input name='showbox" + divId + "' type='checkbox' onchange='$(\"#" + divId + "\").toggle()'/>"
        
        html += _("Show Advanced Options") + "<br/>"
        html += "<div id='" + divId + "' style='display: none' "
        html += ">"
        
        #styles for buttons
        html += self.letterButtonStyleElement.renderEdit()
        html += self.wrongLetterButtonStyleElement.renderEdit()
        html += self.rightLetterButtonStyleElement.renderEdit()

        #style of the text fields
        html += self.hintFieldStyleElement.renderEdit()
        html += self.wordAreaStyleElement.renderEdit()

        html += self.resetButtonStyleElement.renderEdit()
        html += "</div>"
        
        #render edit of these images
        for imgElement in self.chanceImageElements:
            html += imgElement.renderEdit()
            html += common.submitImage(imgElement.id, imgElement.field.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Remove This Life")) + "<br/>"

        addChanceButtonLabel = _("Add Chance")
        html += common.submitButton("addChance"+unicode(self.id), addChanceButtonLabel)
        html += "<br/>"

        #show words to be guessed
        html += _("<h2>Words to Guess</h2>")
        for wordIndex in range(0, len(self.wordElements)):
            word = self.wordElements[wordIndex]
            html += word.renderEdit()
            html += self.hintElements[wordIndex].renderEdit()
            html += "<br/>"
            if wordIndex > 0:
                html += common.submitImage(word.id, word.field.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Remove This Word")) + "<br/>"
        
        html += common.submitButton("addWord"+unicode(self.id), _("Add Word"))        
        html += "<br/>"
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = u"<div>\n"
        html += common.ideviceShowEditMessage(self)
        
        html += """<div class='edit_inline_hint'>The Hangman activity 
        creates a game where the learner has to guess the letters in a
        word from a hint.  Everytime a letter is guessed incorrectly they
        lose a life, represented by an image (e.g. a series of pictures
        with less and less apples on a tree)
        </div>
        """
        
        html += self.titleElement.renderEdit()
        
        #show words to be guessed
        html += _("<h2>Words to Guess</h2>")
        for wordIndex in range(0, len(self.wordElements)):
            html += "<div class='idevice_item_container' style='width: 500px;'>"
            word = self.wordElements[wordIndex]
            
            html += "<table width='99%'><tr><td valign='top'>"
            html += "<strong>"
            html += _("Word %s" % str(wordIndex+1))
            html += "</strong>"
            html += self.hintElements[wordIndex].renderEdit()
            html += word.renderEdit()
            html += "</td><td valign='top' style='text-align: right'>"
            if wordIndex > 0:
                html += common.submitImage(word.id, word.field.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Remove This Word")) + "<br/>"
            html += "</td></tr></table>"
            html += "</div>"
        html += common.submitButton("addWord"+unicode(self.id),\
                         _("Add Word"), extra_classes="add_item_button")
        
        #render edit of these images
        for img_count in range(0, len(self.chanceImageElements)):
            imgElement = self.chanceImageElements[img_count]
            html += "<div class='idevice_item_container' style='width: 700px;'>"
            html += "<table><tr><td valign='top'>"
            html += "<strong>"
            html += "Chance %s" % str(img_count+1)
            html += "</strong>"
            html += imgElement.renderEdit()
            html += "</td><td valign='top' style='text-align: right'>"
            html += common.submitImage(imgElement.id, imgElement.field.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Remove This Chance"))
            html += "</td></tr></table>"
            html += "</div>"
            
        addChanceButtonLabel = _("Add Chance")
        html += common.submitButton("addChance"+unicode(self.id), \
                            addChanceButtonLabel, extra_classes="add_item_button")     
        
        html += self.contentElement.renderEdit()
        html += self.alphabetElement.renderEdit()

        #messages to show the user for different events
        html += self.wrongGuessTextElement.renderEdit()
        html += self.lostLevelTextElement.renderEdit()
        html += self.levelPassedTextElement.renderEdit()
        html += self.gameWonTextElement.renderEdit()
        html += self.resetButtonTextElement.renderEdit()

        divId = "fieldtype_advanced"  + self.id
        html += "<input name='showbox" + divId + "' type='checkbox' onchange='$(\"#" + divId + "\").toggle()'/>"
        
        html += _("Show Advanced Options") + "<br/>"
        html += "<div id='" + divId + "' style='display: none' "
        html += ">"
        
        #styles for buttons
        html += self.letterButtonStyleElement.renderEdit()
        html += self.wrongLetterButtonStyleElement.renderEdit()
        html += self.rightLetterButtonStyleElement.renderEdit()

        #style of the text fields
        html += self.hintFieldStyleElement.renderEdit()
        html += self.wordAreaStyleElement.renderEdit()

        html += self.resetButtonStyleElement.renderEdit()
        html += "</div>"
        
        

        
        html += "<br/>"

           
        html += "<br/>"
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
Example #37
0
def field_engine_make_delete_button(element, imgAltText = "Delete Item", prefix = ""):
    html = ""
    html += common.submitImage(prefix + element.id, element.field.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _(imgAltText))
    return html
    def renderEditButtons(self, undo=True):
        """
        Returns an XHTML string for the edit buttons
        """
        html = "<br></br>"  #Added this so there is space between end of Idevice page and the icons at the botton when authoring
        html  += common.submitImage(u"done", self.id, 
                                   #u"/images/stock-apply.png", 
                                   u"/images/dialog-ok-apply-2.png",
                                   _(u"Done"),1)
        html +="&nbsp;" #Added

        if undo:
            html  += common.submitImage(u"cancel", self.id, 
                                   #u"/images/stock-undo.png", 
                                   u"/images/edit-undo-5.png",
                                   _(u"Undo Edits"),1)
            html +="&nbsp;" #Added
        else:
            html  += common.submitImage(u"no_cancel", self.id, 
                                   u"/images/stock-undoNOT.png",
                                   _(u"Can NOT Undo Edits"),1)
            html +="&nbsp;" #Added

        html += common.confirmThenSubmitImage(
            _(u"This will delete this iDevice. Do you really want to do this?"),
            u"delete",
            #self.id, u"/images/stock-cancel.png", 
            self.id, u"/images/dialog-cancel-3.png",
            _(u"Delete"), 1)
        html +="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" #Added

        if self.idevice.isFirst():
            html += common.image(u"movePrev", u"/images/draw-arrow-up-off.png", alt=None, cssClass=u"submit")
            html +="&nbsp;"
        else:
            html += common.submitImage(u"movePrev", self.id, 
                                       u"/images/draw-arrow-up.png",
                                       _(u"Move Up"),1)
            html +="&nbsp;" 

        if self.idevice.isLast():
            html += common.image(u"moveNext", u"/images/draw-arrow-down-off.png", alt=None, 
                                 cssClass=u"submit")
            html +="&nbsp;" 
        else:
            html += common.submitImage(u"moveNext", self.id, 
                                       u"/images/draw-arrow-down.png",
                                       _(u"Move Down"),1)
            html +="&nbsp;" 
            
        html += "<br></br>" #There is no space, line between the finish icons in page and Move To option.    
        options  = [(_(u"---Move To---"), "")]
        options += self.__getNodeOptions(self.package.root, 0)
        html += common.select(u"move", self.id, options)

        if self.purpose.strip() or self.tip.strip():
            html += u'<a title="%s" ' % _(u'Pedagogical Help')
            html += u'onmousedown="Javascript:updateCoords(event);" '
            html += u"onclick=\"Javascript:showMe('p"+self.id+"', 420, 240);\" "
            html += u'href="Javascript:void(0)" style="cursor:help;"> ' 
            html += u'<img alt="%s" class="info" src="/images/info.png" ' \
                    % _('Information')
            html += u'style="align:middle;" /></a>\n'
            html += u'<div id="p%s" style="display:none;">' % self.id
            html += u'<div style="float:right;">'
            html += u'<img alt="%s" src="/images/stock-stop.png" ' % _('Close')
            html += u' title="%s" ' % _(u"Close")
            html += u'onmousedown="Javascript:hideMe();"/></div>'

            if self.purpose != "":
                html += u'<div class="popupDivLabel">'
                html += u' ' + _(u"Purpose") + u'</div>'
                html += self.purpose 
                
            if self.tip != "":
                html += u'<div class="block"><b>' + _(u"Tip:") + u'</b></div>'
                html += self.tip 
                html += u'\n'
                
            html += u'</div><br/><br/>\n'    
        
        return html
Example #39
0
    def renderEditButtons(self, undo=True):
        """
        Returns an XHTML string for the edit buttons
        """

        html = common.submitImage(u"done", self.id, u"/images/stock-apply.png",
                                  _(u"Done"), 1)

        if undo:
            html += common.submitImage(u"cancel", self.id,
                                       u"/images/stock-undo.png",
                                       _(u"Undo Edits"), 1)
        else:
            html += common.submitImage(u"no_cancel", self.id,
                                       u"/images/stock-undoNOT.png",
                                       _(u"Can NOT Undo Edits"), 1)

        html += common.confirmThenSubmitImage(
            _(u"This will delete this iDevice."
              u"\\n"
              u"Do you really want to do this?"), u"delete", self.id,
            u"/images/stock-cancel.png", _(u"Delete"), 1)

        if self.idevice.isFirst():
            html += common.image(u"movePrev", u"/images/stock-go-up-off.png")
        else:
            html += common.submitImage(u"movePrev",
                                       self.id, u"/images/stock-go-up.png",
                                       _(u"Move Up"), 1)

        if self.idevice.isLast():
            html += common.image(u"moveNext", u"/images/stock-go-down-off.png")
        else:
            html += common.submitImage(u"moveNext", self.id,
                                       u"/images/stock-go-down.png",
                                       _(u"Move Down"), 1)

        options = [(_(u"---Move To---"), "")]
        options += self.__getNodeOptions(self.package.root, 0)
        html += common.select(u"move", self.id, options)

        if self.purpose.strip() or self.tip.strip():
            html += u'<a title="%s" ' % _(u'Pedagogical Help')
            html += u'onmousedown="Javascript:updateCoords(event);" '
            html += u"onclick=\"Javascript:showMe('p" + self.id + "', 420, 240);\" "
            html += u'href="Javascript:void(0)" style="cursor:help;"> '
            html += u'<img alt="%s" class="info" src="/images/info.png" ' \
                    % _('Information')
            html += u'style="align:middle;" /></a>\n'
            html += u'<div id="p%s" style="display:none;">' % self.id
            html += u'<div style="float:right;">'
            html += u'<img alt="%s" src="/images/stock-stop.png" ' % _('Close')
            html += u' title="%s" ' % _(u"Close")
            html += u'onmousedown="Javascript:hideMe();"/></div>'

            if self.purpose != "":
                html += u'<div class="popupDivLabel">'
                html += u' ' + _(u"Purpose") + u'</div>'
                html += self.purpose

            if self.tip != "":
                html += u'<div class="block"><b>' + _(u"Tip:") + u'</b></div>'
                html += self.tip
                html += u'\n'

            html += u'</div><br/><br/>\n'

        return html
Example #40
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = u"<div>\n"
        html += common.ideviceShowEditMessage(self)
        
        
        html += self.titleElement.renderEdit()
        html += self.contentElement.renderEdit()
        html += self.alphabetElement.renderEdit()

        #messages to show the user for different events
        html += self.wrongGuessTextElement.renderEdit()
        html += self.lostLevelTextElement.renderEdit()
        html += self.levelPassedTextElement.renderEdit()
        html += self.gameWonTextElement.renderEdit()
        html += self.resetButtonTextElement.renderEdit()

        divId = "fieldtype_advanced"  + self.id
        html += "<input name='showbox" + divId + "' type='checkbox' onchange='$(\"#" + divId + "\").toggle()'/>"
        
        html += _("Show Advanced Options") + "<br/>"
        html += "<div id='" + divId + "' style='display: none' "
        html += ">"
        
        #styles for buttons
        html += self.letterButtonStyleElement.renderEdit()
        html += self.wrongLetterButtonStyleElement.renderEdit()
        html += self.rightLetterButtonStyleElement.renderEdit()

        #style of the text fields
        html += self.hintFieldStyleElement.renderEdit()
        html += self.wordAreaStyleElement.renderEdit()

        html += self.resetButtonStyleElement.renderEdit()
        html += "</div>"
        
        #render edit of these images
        for imgElement in self.chanceImageElements:
            html += imgElement.renderEdit()
            html += common.submitImage(imgElement.id, imgElement.field.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Remove This Life")) + "<br/>"

        addChanceButtonLabel = _("Add Chance")
        html += common.submitButton("addChance"+unicode(self.id), addChanceButtonLabel)
        html += "<br/>"

        #show words to be guessed
        html += _("<h2>Words to Guess</h2>")
        for wordIndex in range(0, len(self.wordElements)):
            word = self.wordElements[wordIndex]
            html += word.renderEdit()
            html += self.hintElements[wordIndex].renderEdit()
            html += "<br/>"
            if wordIndex > 0:
                html += common.submitImage(word.id, word.field.idevice.id, 
                                   "/images/stock-cancel.png",
                                   _("Remove This Word")) + "<br/>"
        
        html += common.submitButton("addWord"+unicode(self.id), _("Add Word"))        
        html += "<br/>"
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html