コード例 #1
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.idevice.mainFieldSet.renderEditInOrder(
                 self.mainElements, to_field = "correctoverlay")
     
     html += _("""<p class='edit_inline_hint'>Put each item you want to be sorted into
          its own <b>sortable item</b> box below in the correct order.  It will be
          automatically shuffled when the student sees it
          </p>""")
     
     for sortableElement in self.sortableItemElements:
         html += "<table><tr><td valign='top'>"
         html += sortableElement.renderEdit()
         html += "</td><td valign='top'>"
         html += field_engine_make_delete_button(sortableElement)
         html += "</td></table>"
         #html += "<br/>"
         
     html += common.submitButton(
                     "addSortableItem"+unicode(self.id),
                      _("Add Another Item to be Sorted"),
                      extra_classes = "add_item_button")
     html += "<br/>&nbsp;<br/>"
     
     html += self.idevice.mainFieldSet.renderEditInOrder(
                 self.mainElements, from_field="correctoverlay")
     
     html += self.renderEditButtons()
     html += u"</div>\n"
     return html
コード例 #2
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 += \
        _("""
        <h2>Click The Elements in Order Game</h2>
        <p>
                This builds a Javascript game where the player has to click on a certain place on the main area according to the hint.  
                When they click correctly the positive feedback will come and the game will advance.  When they click the wrong
                area negative feedback will be shown.  When they click on the correct area an item can be revealed there.  A delay
                can be set to make the item disappear if desired after a delay.
        </p>

        """)
        html += self.titleElement.renderEdit()

        for textAreaFieldName, textAreaElement in self.mainTextAreaElements.iteritems(
        ):
            html += textAreaElement.renderEdit()

        #for textFieldName, textElement in self.mainTextElements.iteritems():
        #    html += textElement.renderEdit()
        for textFieldName in self.idevice.textFieldsBasic:
            html += self.mainTextElements[textFieldName].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 += ">"

        for textFieldName in self.idevice.textFieldsAdvanced:
            html += self.mainTextElements[textFieldName].renderEdit()

        html += "</div>"
        html += "<br/>"

        html += self.questionOrderChoiceElement.renderEdit()
        html += self.timerChoiceElement.renderEdit()

        html += _("<h2>Clickable Areas</h2>")
        for clickableAreaElement in self.clickableAreaElements:
            html += clickableAreaElement.renderEdit()

        html += "<br/>"
        html += common.submitButton("addClickableArea" + unicode(self.id),
                                    _("Add Clickable Area"))
        html += "<br/>"

        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
コード例 #3
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 += \
        _("""
        <h2>Click The Elements in Order Game</h2>
        <p>
                This builds a Javascript game where the player has to click on a certain place on the main area according to the hint.  
                When they click correctly the positive feedback will come and the game will advance.  When they click the wrong
                area negative feedback will be shown.  When they click on the correct area an item can be revealed there.  A delay
                can be set to make the item disappear if desired after a delay.
        </p>

        """)
        html += self.titleElement.renderEdit()
        
        for textAreaFieldName, textAreaElement in self.mainTextAreaElements.iteritems():
            html += textAreaElement.renderEdit()

        #for textFieldName, textElement in self.mainTextElements.iteritems():
        #    html += textElement.renderEdit()
        for textFieldName in self.idevice.textFieldsBasic:
            html += self.mainTextElements[textFieldName].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 += ">"
            
            
        for textFieldName in self.idevice.textFieldsAdvanced:
            html += self.mainTextElements[textFieldName].renderEdit()
        
        html += "</div>"
        html += "<br/>"

        html += self.questionOrderChoiceElement.renderEdit()
        html += self.timerChoiceElement.renderEdit()

        html += _("<h2>Clickable Areas</h2>")
        for clickableAreaElement in self.clickableAreaElements:
            html += clickableAreaElement.renderEdit()

        html += "<br/>"
        html += common.submitButton("addClickableArea"+unicode(self.id), _("Add Clickable Area"))
        html += "<br/>"

        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
コード例 #4
0
 def renderEdit(self, style):
     html = u""
     html  = u"<div>\n"
     html += common.ideviceShowEditMessage(self)
     
     html += self.idevice.mainFieldSet.renderEditInOrder(
                 self.mainElements)
     
     html += self.renderEditButtons()
     html += u"</div>\n"
     
     return html
コード例 #5
0
ファイル: sortblock.py プロジェクト: RichDijk/eXe
    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.idevice.mainFieldSet.renderEditInOrder(self.mainElements)
        for sortableElement in self.sortableItemElements:
            html += sortableElement.renderEdit()
            html += field_engine_make_delete_button(sortableElement)
            html += "<br/>"

        html += common.submitButton("addSortableItem" + unicode(self.id), _("Add Another Item to be Sorted"))
        html += "<br/>"
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
コード例 #6
0
ファイル: sortblock.py プロジェクト: UstadMobile/eXePUB
    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.idevice.mainFieldSet.renderEditInOrder(self.mainElements)
        for sortableElement in self.sortableItemElements:
            html += sortableElement.renderEdit()
            html += field_engine_make_delete_button(sortableElement)
            html += "<br/>"

        html += common.submitButton("addSortableItem" + unicode(self.id),
                                    _("Add Another Item to be Sorted"))
        html += "<br/>"
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
コード例 #7
0
 def renderEdit(self, style):
     idevice_dir_name = self.idevice.get_idevice_dirname()
     html = u"<div>"
     html += common.ideviceShowEditMessage(self)
     
     html  = u"<div class='idevice_authoring_container' " \
         + "data-idevicetype='%s' " % idevice_dir_name \
         + "data-ideviceid='%s'>\n" % self.idevice.id
     
     
     # the content without wrapping div etc.
     content_html = self.content_element.field.content_w_resourcePaths
     
     html += content_html
     
     html += "</div>"
     html += "<input type='hidden' name='%s_htmlcontent'/>\n" % self.id
     html += "<input type='hidden' name='%s_resources'/>\n" % self.id
     html += self.renderEditButtons()
     html += u"</div>\n"
     
     return html
コード例 #8
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
コード例 #9
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 += """<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
コード例 #10
0
ファイル: hangmanblock.py プロジェクト: UstadMobile/eXePUB
    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