示例#1
0
 def render_GET(self, request):
     """Render the preferences"""
     log.debug("render_GET")
     html  = common.docType()
     html += u"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
     html += u"<head>\n"
     html += u"<style type=\"text/css\">\n"
     html += u"@import url(/css/exe.css);\n"
     html += u'@import url(/style/base.css);\n'
     html += u"@import url(/style/standardwhite/content.css);</style>\n"
     html += u"<title>"+_("eXe : elearning XHTML editor")+"</title>\n"
     html += u"<meta http-equiv=\"content-type\" content=\"text/html; "
     html += u" charset=UTF-8\"></meta>\n";
     html += u"</head>\n"
     html += u"<body>\n"
     html += u"<div id=\"main\"> \n"     
     html += u"<form method=\"post\" action=\"\" "
     html += u"id=\"contentForm\" >"  
     html += common.formField('select', _(u"Select Language"),
                              'locale',
                              options = self.localeNames,
                              selection = self.config.locale)
     html += u"<div id=\"editorButtons\"> \n"     
     html += u"<br/>" 
     html += common.submitButton("ok", _("OK"))
     html += common.submitButton("cancel", _("Cancel"))
     html += u"</div>\n"
     html += u"</div>\n"
     html += u"<br/></form>\n"
     html += u"</body>\n"
     html += u"</html>\n"
     return html.encode('utf8')
示例#2
0
 def render_GET(self, request):
     """Called for all requests to this object"""
     log.debug("render_GET")
     self.process(request)
     html = common.docType()
     html += '<html xmlns="http://www.w3.org/1999/xhtml">\n'
     html += "<head>\n"
     html += '<style type="text/css">\n'
     html += "@import url(/css/exe.css);\n"
     html += "@import url(/style/base.css);\n"
     html += "@import url(/style/standardwhite/content.css);</style>\n"
     html += '<script type="text/javascript" src="/scripts/libot_drag.js">'
     html += "</script>\n"
     html += '<script type="text/javascript" src="/scripts/common.js">'
     html += "</script>\n"
     html += '<script type="text/javascript" src="/scripts/editor.js">'
     html += "</script>\n"
     html += "<title>" + _("eXe : elearning XHTML editor") + "</title>\n"
     html += '<meta http-equiv="content-type" content="text/html; '
     html += ' charset=UTF-8"></meta>\n'
     html += "</head>\n"
     html += "<body>\n"
     html += '<div id="main"> \n'
     html += '<form method="post" action="' + self.url + '" '
     html += 'id="contentForm" >'
     html += common.hiddenField("action")
     html += common.hiddenField("object")
     html += common.hiddenField("isChanged", "1")
     html += '<font color="red"><b>' + self.message + "</b></font>"
     html += '<div id="editorButtons"> \n'
     html += self.renderList()
     html += self.editorPane.renderButtons(request)
     if self.isNewIdevice:
         html += "<br/>" + common.submitButton("delete", _("Delete"), False)
     else:
         html += "<br/>" + common.submitButton("delete", _("Delete"))
     html += '<br/><input class="button" type="button" name="save" '
     title = "none"
     if self.editorPane.idevice.edit == False:
         title = self.editorPane.idevice.title
         title = title.replace(" ", "+")
     html += 'onclick=saveIdevice("%s") value="%s"/>' % (escape(title), _("Save"))
     html += u'<br/><input class="button" type="button" name="import" onclick="importPackage(\'package\')"'
     html += u' value="%s" />' % _("Import iDevice")
     html += u'<br/><input class="button" type="button" name="export" '
     html += u"onclick=\"exportPackage('package','%d')\"" % self.isNewIdevice
     html += u' value="%s" />' % _("Export iDevice")
     html += u'<br/><input class="button" type="button" name="quit" '
     html += u"onclick=JavaScript:window.close()"
     html += u' value="%s" />\n' % _("Quit")
     html += common.hiddenField("pathpackage")
     html += "</fieldset>"
     html += "</div>\n"
     html += self.editorPane.renderIdevice(request)
     html += "</div>\n"
     html += "<br/></form>\n"
     html += "</body>\n"
     html += "</html>\n"
     return html.encode("utf8")
示例#3
0
 def render_GET(self, request):
     """Called for all requests to this object"""
     log.debug("render_GET")
     self.process(request)
     html  = common.docType()
     html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
     html += "<head>\n"
     html += "<style type=\"text/css\">\n"
     html += "@import url(/css/exe.css);\n"
     html += '@import url(/style/base.css);\n'
     html += "@import url(/style/standardwhite/content.css);</style>\n"
     html += '<script type="text/javascript" src="/scripts/libot_drag.js">'
     html += '</script>\n'
     html += '<script type="text/javascript" src="/scripts/common.js">'
     html += '</script>\n'
     html += '<script type="text/javascript" src="/scripts/editor.js">'
     html += '</script>\n'
     html += "<title>"+_("eXe : elearning XHTML editor")+"</title>\n"
     html += "<meta http-equiv=\"content-type\" content=\"text/html; "
     html += " charset=UTF-8\"></meta>\n";
     html += "</head>\n"
     html += "<body>\n"
     html += "<div id=\"main\"> \n"     
     html += "<form method=\"post\" action=\""+self.url+"\" "
     html += "id=\"contentForm\" >"  
     html += common.hiddenField("action")
     html += common.hiddenField("object")
     html += common.hiddenField("isChanged", "1") 
     html += "<font color=\"red\"<b>"+self.message+"</b></font>"
     html += "<div id=\"editorButtons\"> \n"     
     html += self.renderList()
     html += self.editorPane.renderButtons(request)
     if self.isNewIdevice:
         html += "<br/>" + common.submitButton("delete", _("Delete"), 
                                                     False)
     else:
         html += "<br/>" + common.submitButton("delete", _("Delete"))
     html += '<br/><input class="button" type="button" name="save" '
     title = "none"
     if self.editorPane.idevice.edit == False:
         title = self.editorPane.idevice.title
     html += 'onclick=saveIdevice("%s") value="%s"/>' % (title, _("Save"))
     html += u'<br/><input class="button" type="button" name="import" onclick="importPackage(\'package\')"' 
     html += u' value="%s" />'  % _("Import iDevice")
     html += u'<br/><input class="button" type="button" name="export" '
     html += u'onclick="exportPackage(\'package\',\'%d\')"' % self.isNewIdevice
     html += u' value="%s" />'  % _("Export iDevice")
     html += common.hiddenField("pathpackage")
     html += "</fieldset>"
     html += "</div>\n"
     html += self.editorPane.renderIdevice(request)
     html += "</div>\n"
     html += "<br/></form>\n"
     html += "</body>\n"
     html += "</html>\n"
     return html.encode('utf8')
示例#4
0
 def renderButtons(self, request):
     """
     Render the idevice being edited
     """
     html = "<font color=\"red\"<b>"+self.message+"</b></font>"
     html += "<fieldset><legend><b>" + _("Add Field")+ "</b></legend>"
     html += common.submitButton("addText", _("Text Line"))
     html += common.elementInstruc(self.lineInstruc) + "<br/>"
     html += common.submitButton("addTextArea", _("Text Box"))
     html += common.elementInstruc(self.textBoxInstruc) + "<br/>"
     html += common.submitButton("addImage", _("Image"))  
     html += common.elementInstruc(self.imageInstruc) + "<br/>"
     html += common.submitButton("addFeedback", _("Feedback"))
     html += common.elementInstruc(self.feedbackInstruc) + "<br/>"
     html += common.submitButton("addMP3", _("MP3"))
     html += common.elementInstruc(self.mp3Instruc) + "<br/>"
     html += "</fieldset>\n"
     html += "<fieldset><legend><b>" + _("Actions") + "</b></legend>"
     if self.idevice.edit:
         html += common.submitButton("preview", _("Preview"))
     else:
         html += common.submitButton("edit", _("Edit"))
     html += "<br/>"
     html += common.submitButton("cancel", _("Cancel"))
     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
示例#6
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"
        html += common.textInput("title" + self.id, self.idevice.title)

        html += '<br/><br/>RSS URL ' + common.textInput(
            "url" + self.id, self.idevice.url)
        html += common.submitButton(u"loadRss" + self.id, _(u"Load"))
        html += common.elementInstruc(self.idevice.urlInstruc)
        html += u"<br/>\n"
        html += self.rssElement.renderEdit()
        emphasisValues = [(_(u"No emphasis"), Idevice.NoEmphasis),
                          (_(u"Some emphasis"), Idevice.SomeEmphasis)]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        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
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        self.previewing = True

        html  = u'<div class="iDevice"><br/>\n'

   # JRJ
	# Quitamos el prefijo "FPD -"
	# (let's remove the "FPD -" prefix)
	if self.idevice.title.find("FPD - ") == 0:
		self.idevice.title = x_(u"Translation")
        html += common.textInput("title"+self.id, self.idevice.title)
        html += self.storyElement.renderEdit()

        for element in self.questionElements:
            html += element.renderEdit() 
         
        html += u"</table>\n"
        value = _(u"Add another activity")    
        html += common.submitButton(u"addQuestion"+unicode(self.id), value)
        html += u"<br /><br />" + self.renderEditButtons(undo=self.idevice.undo)
        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 = "<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(undo=self.idevice.undo)
        html += "</div>\n"
        self.idevice.isAnswered = True

        return html
示例#9
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/>'
        html += common.textInput(
            "title" + self.id,
            self.idevice.alt_title) + '<br/>'  #changed kthamm 111221

        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
示例#10
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
 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
示例#12
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = u"<div>\n"
        html += self.titleElement.renderEdit()
        html += self.contentElement.renderEdit()
        html += self.mainAreaElement.renderEdit()

        html +=u"<strong>"+_("Game Options") +"</strong>"
        
        html += self.clickToStartElement.renderEdit()
        html += self.positiveResponseElement.renderEdit()
        html += self.negativeResponseElement.renderEdit()
        html += self.partbinNumCols.renderEdit()
        """
        Timer Options
        """
        html += "<input type='hidden' name='checktimer%s' value='true'/>" % self.id
        html += common.checkbox("enabletimer%s" % self.id, self.idevice.gameTimerShown.content, \
                title=_("Enable Timer"), instruction=_("Enable showing the timer in the game"))
        html += self.gameTimeLimit.renderEdit()

        for placableObjectElement in self.placableObjectElements:
            html += placableObjectElement.renderEdit()
        
        html += "<br/>"
        html += common.submitButton("addPlacableObject"+unicode(self.id), _("Add Placable Object"))
        html += "<br/>"
        
        
        html += self.renderEditButtons()
        html += u"</div>\n"
        return html
示例#13
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
示例#14
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"
     html += common.textInput("title" + self.id, self.idevice.title)
     html += '<br/><br/>RSS URL ' + common.textInput("url" + self.id,
                                                     self.idevice.url)
     html += common.submitButton(u"loadRss"+self.id, _(u"Load"))
     html += common.elementInstruc(self.idevice.urlInstruc)
     html += u"<br/>\n"
     html += self.rssElement.renderEdit()
     emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                       (_(u"Some emphasis"),   Idevice.SomeEmphasis)]
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     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
    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
示例#16
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = "<div class=\"iDevice\">\n"

        # JRJ
        # Quitamos el prefijo "FPD -"
        # (let's remove the "FPD -" prefix)
        if self.idevice.title.find("FPD - ") == 0:
            self.idevice.title = x_(u"Now it's your turn")

        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"+self.id, value)
        
        html += "<br/><br/>" 
        html += self.renderEditButtons(undo=self.idevice.undo)
        html += "</div>\n"


        return html
示例#17
0
 def render_GET(self, request):
     """Called for all requests to this object"""
     log.debug("render_GET")
     self.process(request)
     html = common.docType()
     html += '<html xmlns="http://www.w3.org/1999/xhtml">\n'
     html += "<head>\n"
     html += '<style type="text/css">\n'
     html += "@import url(/css/exe.css);\n"
     html += "@import url(/style/base.css);\n"
     html += "@import url(/style/standardwhite/content.css);</style>\n"
     html += '<script type="text/javascript" src="/scripts/libot_drag.js">'
     html += "</script>\n"
     html += '<script type="text/javascript" src="/scripts/common.js">'
     html += "</script>\n"
     html += "<title>" + _("eXe : elearning XHTML editor") + "</title>\n"
     html += '<meta http-equiv="content-type" content="text/html; '
     html += ' charset=UTF-8"></meta>\n'
     html += "</head>\n"
     html += "<body>\n"
     html += '<div id="main"> \n'
     html += '<form method="post" action="' + self.url + '" '
     html += 'id="contentForm" >'
     html += common.hiddenField("action")
     html += common.hiddenField("object")
     html += common.hiddenField("isChanged", "1")
     html += '<font color="red"<b>' + self.message + "</b></font>"
     html += '<div id="editorButtons"> \n'
     html += self.renderList()
     html += self.editorPane.renderButtons(request)
     if self.isNewIdevice:
         html += "<br/>" + common.submitButton("delete", _("Delete"), False)
         html += "<br/>" + common.submitButton("save", _("Save"), False)
     else:
         html += "<br/>" + common.submitButton("delete", _("Delete"))
         html += "<br/>" + common.submitButton("save", _("Save"))
     html += "<br/>" + common.submitButton("add", _("Save as"))
     html += "</fieldset>"
     html += "</div>\n"
     html += self.editorPane.renderIdevice(request)
     html += "</div>\n"
     html += "<br/></form>\n"
     html += "</body>\n"
     html += "</html>\n"
     return html.encode("utf8")
示例#18
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
示例#19
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"
     html += common.textInput("title" + self.id, self.idevice.title) + "<br/><br/>"
     sites = [(_(u"English Wikipedia Article"), "http://en.wikipedia.org/wiki/"),
              (_(u"Catalan Wikipedia Article"), "http://ca.wikipedia.org/wiki/"),
              (_(u"Chinese Wikipedia Article"), "http://zh.wikipedia.org/wiki/"),
              (_(u"Dutch Wikipedia Article"),   "http://nl.wikipedia.org/wiki/"),
              (_(u"French Wikipedia Article"),  "http://fr.wikipedia.org/wiki/"),
              (_(u"German Wikipedia Article"),  "http://de.wikipedia.org/wiki/"),
              (_(u"Greek Wikipedia Article"), "http://el.wikipedia.org/wiki/"),
              (_(u"Italian Wikipedia Article"), "http://it.wikipedia.org/wiki/"),
              (_(u"Japanese Wikipedia Article"),"http://ja.wikipedia.org/wiki/"),
              (_(u"Magyar Wikipedia Article"),"http://hu.wikipedia.org/wiki/"),
              (_(u"Polish Wikipedia Article"),  "http://pl.wikipedia.org/wiki/"),
              (_(u"Portugese Wikipedia Article"), "http://pt.wikipedia.org/wiki/"),
              (_(u"Slovenian Wikipedia Article"), "http://sl.wikipedia.org/wiki/"),
              (_(u"Spanish Wikipedia Article"), "http://es.wikipedia.org/wiki/"),
              (_(u"Swedish Wikipedia Article"), "http://sv.wikipedia.org/wiki/"),
              (_(u"Wikibooks Article"),         "http://en.wikibooks.org/wiki/"),
              (_(u"Wikiversity"),         "http://en.wikiversity.org/wiki/"),
              (_(u"Wiktionary"),         "http://en.wiktionary.org/wiki/"),
              (_(u"Wikieducator Content"),      "http://wikieducator.org/"),
              (_(u"Other"),                     "")]          
     this_package = None
     if self.idevice is not None and self.idevice.parentNode is not None:
         this_package = self.idevice.parentNode.package
     html += common.formField('select', this_package, _('Site'),'s',
                              'site'+self.id,
                              self.idevice.langInstruc,
                              sites,
                              self.idevice.site)
     url = "none"
     if self.idevice.site == "":
         url = "block"
     html += '<div style="display:%s"> %s: <br/>' % (url, _("Own site"))
     html += common.textInput("ownUrl"+self.id, self.idevice.ownUrl) + '<br/></div>'
     html += "<br/>"
     html += common.textInput("article", self.idevice.articleName)
     html += common.elementInstruc(self.idevice.searchInstruc)
     html += common.submitButton(u"loadWikipedia"+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
示例#20
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
    def renderButtons(self, request):
        """
        Render the idevice being edited
        """
        html = "<font color=\"red\"><b>" + self.message + "</b></font>"

        html += "<fieldset><legend><b>" + _("Add Field") + "</b></legend>"
        html += common.submitButton("addText", _("Text Line"))
        html += common.elementInstruc(self.lineInstruc) + "<br/>"
        html += common.submitButton("addTextArea", _("Text Box"))
        html += common.elementInstruc(self.textBoxInstruc) + "<br/>"
        html += common.submitButton("addFeedback", _("Feedback"))
        html += common.elementInstruc(self.feedbackInstruc) + "<br/>"
        #  Attachments are now embeddable:
        #html += common.submitButton("addAttachment", _("Attachment"))
        #html += common.elementInstruc(self.attachInstruc) + "<br/>"
        #  MP3 fields are now embeddable:
        #html += common.submitButton("addMP3", _("MP3"))
        #html += common.elementInstruc(self.mp3Instruc) + "<br/>"
        html += "</fieldset>\n"

        html += "<fieldset><legend><b>" + _("Actions") + "</b></legend>"

        if self.idevice.edit:
            html += common.submitButton("preview", _("Preview"),
                                        not self.parent.isGeneric)
        else:
            html += common.submitButton("edit", _("Edit"))

        html += "<br/>"
        html += common.submitButton("cancel", _("Cancel"))
        #html += "</fieldset>"

        return html
示例#22
0
    def renderButtons(self, request):
        """
        Render the idevice being edited
        """
        html = "<font color=\"red\"><b>"+self.message+"</b></font>"
        
        html += "<fieldset><legend><b>" + _("Add Field")+ "</b></legend>"
        html += common.submitButton("addText", _("Text Line"))
        html += common.elementInstruc(self.lineInstruc) + "<br/>"
        html += common.submitButton("addTextArea", _("Text Box"))
        html += common.elementInstruc(self.textBoxInstruc) + "<br/>"
        html += common.submitButton("addFeedback", _("Feedback"))
        html += common.elementInstruc(self.feedbackInstruc) + "<br/>"
        #  Attachments are now embeddable:
        #html += common.submitButton("addAttachment", _("Attachment"))
        #html += common.elementInstruc(self.attachInstruc) + "<br/>"
        #  MP3 fields are now embeddable:
        #html += common.submitButton("addMP3", _("MP3"))
        #html += common.elementInstruc(self.mp3Instruc) + "<br/>"
        html += "</fieldset>\n"

        html += "<fieldset><legend><b>" + _("Actions") + "</b></legend>"

        if self.idevice.edit:
            html += common.submitButton("preview", _("Preview"), not self.parent.isGeneric)
        else:
            html += common.submitButton("edit", _("Edit"))

        html += "<br/>"
        html += common.submitButton("cancel", _("Cancel"))
        #html += "</fieldset>"

        return html
示例#23
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = u"<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title"+self.id, self.idevice.title)
     html += u"<br/><br/>\n"
     html += self.instructionElement.renderEdit()
     for element in self.questionElements:
         html += element.renderEdit() 
     value = _(u"Add another question")    
     html += common.submitButton("addQuestion"+unicode(self.id), value)
     html += u"<br /><br />" + self.renderEditButtons(undo=self.idevice.undo)
     html += u"</div>\n"
     return html
示例#24
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = u'<div class="iDevice"><br/>\n'
     html += common.textInput("title"+self.id, self.idevice.title)
     html += self.storyElement.renderEdit()
     for element in self.questionElements:
         html += element.renderEdit() 
     html += u"</table>\n"
     value = _(u"Add another activity")    
     html += common.submitButton(u"addQuestion"+unicode(self.id), value)
     html += u"<br /><br />" + self.renderEditButtons()
     html += u"</div>\n"
     return html
示例#25
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
示例#26
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html = u'<div class="iDevice">\n'
        html += common.textInput("title" + self.id, self.idevice.title)
        html += "<br/><br/>\n"
        value = _("Add another Term")
        html += common.submitButton("addTerm" + self.id, value)
        for element in self.termElements:
            html += element.renderEdit()

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

        return html
示例#27
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
示例#28
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        html  = u'<div class="iDevice">\n'
        html += common.textInput("title"+self.id, self.idevice.title)
        html += "<br/><br/>\n"
        value = _("Add another Term")
        html += common.submitButton("addTerm" + self.id, value)
        for element in self.termElements:
            html += element.renderEdit()

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

        return html
示例#29
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
示例#30
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        
        html  = u"<div class=\"iDevice\"><br/>\n"
        html += common.textInput("title"+self.id, self.idevice.title)
        html += u"<br/><br/>\n"
        html += self.instructionElement.renderEdit()

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

        return html
示例#31
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
示例#32
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)
        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
示例#33
0
    def renderEdit(self, style):
        """
        Returns an XHTML string with the form element for editing this block
        """
        self.previewing = True

        html  = u'<div class="iDevice"><br/>\n'
        html += common.textInput("title"+self.id, self.idevice.title)
        html += self.storyElement.renderEdit()

        for element in self.questionElements:
            html += element.renderEdit() 
         
        html += u"</table>\n"
        value = _(u"Add another activity")    
        html += common.submitButton(u"addQuestion"+unicode(self.id), value)
        html += u"<br /><br />" + self.renderEditButtons(undo=self.idevice.undo)
        html += u"</div>\n"
        return html
示例#34
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"
     html += common.textInput("title" + self.id, self.idevice.title)
     sites = [(_(u"English Wikipedia Article"), "http://en.wikipedia.org/"),
              (_(u"Chinese Wikipedia Article"), "http://zh.wikipedia.org/"),
              (_(u"German Wikipedia Article"),  "http://de.wikipedia.org/"),
              (_(u"French Wikipedia Article"),  "http://fr.wikipedia.org/"),
              (_(u"Japanese Wikipedia Article"),"http://ja.wikipedia.org/"),
              (_(u"Italian Wikipedia Article"), "http://il.wikipedia.org/"),
              (_(u"Polish Wikipedia Article"),  "http://pl.wikipedia.org/"),
              (_(u"Dutch Wikipedia Article"),   "http://nl.wikipedia.org/"),
              (_(u"Portugese Wikipedia Article"),
                                                "http://pt.wikipedia.org/"),
              (_(u"Spanish Wikipedia Article"), "http://es.wikipedia.org/"),
              (_(u"Swedish Wikipedia Article"), "http://sv.wikipedia.org/"),
              (_(u"Wikibooks Article"),         "http://en.wikibooks.org/"),
              (_(u"Wikieducator Content"),      "http://wikieducator.org/")]
     html += common.formField('select', _('Site'),
                              'site'+self.id, '',
                              self.idevice.langInstruc,
                              sites,
                              self.idevice.site)
     html += common.textInput("article", self.idevice.articleName)
     html += common.elementInstruc(self.idevice.searchInstruc)
     html += common.submitButton(u"loadWikipedia"+self.id, _(u"Load"))
     html += u"<br/>\n"
     html += self.articleElement.renderEdit()
     emphasisValues = [(_(u"No emphasis"),     Idevice.NoEmphasis),
                       (_(u"Some emphasis"),   Idevice.SomeEmphasis),
                       (_(u"Strong emphasis"), Idevice.StrongEmphasis)]
     html += common.formField('select', _('Emphasis'),
                              'emphasis'+self.id, '',
                              '', # TODO: Instructions
                              emphasisValues,
                              self.idevice.emphasis)
     html += self.renderEditButtons()
     html += u"</div>\n"
     return html
示例#35
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
示例#36
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = u'<div class="iDevice"><br/>\n'
     html += common.textInput("title"+self.id, self.idevice.title)
     html += common.formField('richTextArea', _(u'Story:'),
                              'story', self.id,
                              self.storyInstruc,
                              self.story)
     html += u'<div class="block">'
     html += u"<strong>%s</strong>" % _("Question(s)")
     html += u'</div>'
     html += u'<table width ="100%">\n'
     for element in self.questionElements:
         html += element.renderEdit() 
     html += u"</table>\n"
     value = _(u"Add another question")    
     html += common.submitButton(u"addQuestion"+unicode(self.id), value)
     html += u"<br /><br />" + self.renderEditButtons()
     html += u"</div>\n"
     return html
示例#37
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
示例#38
0
 def renderEdit(self, style):
     """
     Returns an XHTML string with the form element for editing this block
     """
     html  = "<div class=\"iDevice\"><br/>\n"
     html += common.textInput("title"+self.id, self.idevice.title)
     html += common.formField('richTextArea',_(u'Question:'),'question',
                             self.id, self.questionInstruc,
                             self.question)
     html += common.formField('richTextArea',_(u'Hint:'),'hint',
                             self.id, self.hintInstruc,
                             self.hint)
     html += "<table width =\"100%%\">"
     html += "<tbody>"
     for element in self.optionElements:
         html += element.renderEdit() 
     html += "</tbody>"
     html += "</table>\n"
     value = _("Add another option")    
     html += common.submitButton("addOption"+unicode(self.id), value)
     html += "<br /><br />" + self.renderEditButtons()
     html += "</div>\n"
     return html
示例#39
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
示例#40
0
 def render_GET(self, request):
     """Called for all requests to this object"""
     
     # Processing 
     log.debug("render_GET")
     self.process(request)
     
     # Rendering
     html  = common.docType()
     html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
     html += "<head>\n"
     html += "<style type=\"text/css\">\n"
     html += "@import url(/css/exe.css);\n"
     html += '@import url(/style/base.css);\n'
     html += "@import url(/style/standardwhite/content.css);</style>\n"
     html += '<script type="text/javascript" src="/scripts/libot_drag.js">'
     html += '</script>\n'
     html += '<script type="text/javascript" src="/scripts/common.js">'
     html += '</script>\n'
     html += '<script type="text/javascript" src="/scripts/editor.js">'
     html += '</script>\n'
     html += "<title>"+_("eXe : elearning XHTML editor")+"</title>\n"
     html += "<meta http-equiv=\"content-type\" content=\"text/html; "
     html += " charset=UTF-8\"></meta>\n";
     html += "</head>\n"
     html += "<body>\n"
     html += "<div id=\"main\"> \n"     
     html += "<form method=\"post\" action=\""+self.url+"\" "
     html += "id=\"contentForm\" >"  
     html += common.hiddenField("action")
     html += common.hiddenField("object")
     html += common.hiddenField("isChanged", "1") 
     html += "<font color=\"red\"><b>"+self.message+"</b></font>"
     html += "<div id=\"editorButtons\"> \n"     
     html += self.renderList()
     html += self.editorPane.renderButtons(request, self.showHide)
     if self.isNewIdevice:
         html += "<br/>" + common.submitButton("delete", _("Delete"), 
                                                     False)
     else:
         html += "<br/>" + common.submitButton("delete", _("Delete"))
     html += '<br/><input class="button" type="button" name="save" '
     title = "none"
     if self.editorPane.idevice.edit == False:
         title = self.editorPane.idevice.title
         title = title.replace(" ", "+")
     html += 'onclick=saveIdevice("%s") value="%s"/>' % (escape(title), _("Save"))
     html += u'<br/><input class="button" type="button" name="import" ' 
     if self.showHide:
         html += ' disabled="disabled" '
     html += u' onclick="importPackage(\'package\')" value="%s" />'  % _("Import iDevice")
     html += u'<br/><input class="button" type="button" name="export" '
     if self.showHide:
         html += ' disabled="disabled" '
     html += u'onclick="exportPackage(\'package\',\'%d\')"' % self.isNewIdevice
     html += u' value="%s" />'  % _("Export iDevice")
     #JR: anado un boton que permite mostrar u ocultar iDevices
     if self.showHide:
         html += "<br/>" + common.submitButton("showHide", _("Show/Hide"), False)
     else:
         html += "<br/>" + common.submitButton("showHide", _("Show/Hide"))
     html += u'<br/><input class="button" type="button" name="quit" '
     html += u'onclick=JavaScript:window.close()'         
     html += u' value="%s" />\n'  % _("Quit")
     html += common.hiddenField("pathpackage")
     html += "</fieldset>"
     html += "</div>\n"
     #if ("showHide" in request.args):
     if self.showHide:  
         html += self.editorPane.renderShowHideiDevices(self.ideviceStore.getFactoryIdevices())
     else:
         html += self.editorPane.renderIdevice(request)
     html += "</div>\n"
     html += "<br/></form>\n"
     html += "</body>\n"
     html += "</html>\n"
     return html.encode('utf8')
示例#41
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
示例#42
0
    def renderView(self, feedbackId=None, preview=False):
        
        # Shows the text with inputs for the missing parts
       
        dT = common.getExportDocType()
        sectionTag = "div"
        if dT == "HTML5":
            sectionTag = "section"

        html = ['<%s class="activity" id="activity-%s">' % (sectionTag,self.id)]
        
        if preview: 
            # to render, use the content with the preview-able resource paths:
            self.field.encodedContent = self.field.content_w_resourcePaths
            html += ['<div class="activity-form">']
        else:
            # to render, use the flattened content, withOUT resource paths: 
            self.field.encodedContent = self.field.content_wo_resourcePaths
            html += ['<form name="cloze-form-'+self.id+'" action="#" class="activity-form cloze-form">']

        html += ['<div id="cloze%s">' % self.id]
        # Store our args in some hidden fields
        def storeValue(name):
            value = str(bool(getattr(self.field, name))).lower()
            return common.hiddenField('clozeFlag%s.%s' % (self.id, name), value)
        #html.append(storeValue('showScore'))
      
        if feedbackId:
            html.append(common.hiddenField('clozeVar%s.feedbackId' % self.id,'ta'+feedbackId))
        # Mix the parts together
        words = ""
        wordslista='<option selected="selected"> </option>'
        wordsarray=[]
        listaotras=[]
        listaotras2=[]
        wordsarraylimpo=[] 
        
        for i, (text, missingWord) in enumerate(self.field.parts):
            if missingWord:
                wordsarray.append([missingWord])
        listaotras=self.field.otras.split('|')
        for i, (missingWord) in enumerate(listaotras):
            if missingWord:
                listaotras2.append([missingWord])
        wordsarray=wordsarray + listaotras2 
        wordsarraylimpo= [wordsarray[i] for i in range(len(wordsarray)) if wordsarray[i] not in wordsarray[:i]]
        random.shuffle(wordsarraylimpo)
        for wdlista in wordsarraylimpo:
           wordslista +='<option value="%s">%s</option>' % (escape(wdlista[0], True), wdlista[0])
          
        for i, (text, missingWord) in enumerate(self.field.parts):
            if text:
                html.append(text)
            if missingWord:
                words += "'" + missingWord + "',"
                # The edit box for the user to type into
                inputHtml = ['<label for="clozeBlank%s.%s" class="sr-av">%s (%s):</label>' % (self.id, i, c_("Cloze"), (i+1))]
                inputHtml += ['<select id="clozeBlank%s.%s">' % (self.id, i),wordslista,'</select>']
                html += inputHtml
                            
                # Hidden span with correct answer
                html += ['<span style="display:none" id="clozeAnswer%s.%s">%s</span>' % (self.id, i, self.ecrypt(missingWord))]

        # Score string
        html += ['<div class="block iDevice_buttons">']
        html += ['<p>']
        
        if preview:
            html += [common.button('getScore%s' % self.id, c_(u"Check"), id='getScore%s' % self.id, class_ = "cloze-score-toggler")]
        else:
            html += [common.submitButton('getScore%s' % self.id, c_(u"Check"), id='getScore%s' % self.id)]
        if feedbackId:
            html += [common.button('feedback%s' % self.id, c_(u"Show Feedback"), class_ = "feedbackbutton cloze-feedback-toggler")]
         
        codotras=self.ecrypt(self.field.otras)
        html += [common.hiddenField('clozeOtras%s' % self.id,codotras)]   
        html += ['<input type="hidden" name="clozeFlag%s.strictMarking" id="clozeFlag%s.strictMarking" value="false" />' % (self.id,self.id)]
        html += ['<input type="hidden" name="clozeFlag%s.checkCaps" id="clozeFlag%s.checkCaps" value="false" />' % (self.id,self.id)]
        html += ['<input type="hidden" name="clozeFlag%s.instantMarking" id="clozeFlag%s.instantMarking" value="false" />' % (self.id,self.id)]
        html += [common.javaScriptIsRequired()]
        html += ['</p>']
        html += ['</div>']
        html += ['<div class="score js-feedback" id="clozeScore%s"></div>' % self.id]        
        html += ['</div>']
        if preview: 
            html += ['</div>']
        else:
            html += ['</form>']
        html += ['</%s>' % sectionTag]
        return '\n'.join(html)
示例#43
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
示例#44
0
 def render_GET(self, request):
     """Called for all requests to this object"""
     
     # Processing 
     log.debug("render_GET")
     self.process(request)
     
     # Rendering
     html  = common.docType()
     html += "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
     html += "<head>\n"
     html += "<style type=\"text/css\">\n"
     html += "@import url(/css/exe.css);\n"
     html += '@import url(/style/base.css);\n'
     html += "@import url(/style/standardwhite/content.css);</style>\n"
     html += '<script type="text/javascript" src="/scripts/authoring.js">'
     html += '</script>\n'
     html += '<script type="text/javascript" src="/scripts/common.js">'
     html += '</script>\n'
     html += '<script type="text/javascript" src="/scripts/editor.js">'
     html += '</script>\n'
     html += "<title>"+_("eXe : elearning XHTML editor")+"</title>\n"
     html += "<meta http-equiv=\"content-type\" content=\"text/html; "
     html += " charset=UTF-8\"></meta>\n";
     html += "</head>\n"
     html += "<body>\n"
     html += "<div id=\"main\"> \n"     
     html += "<form method=\"post\" action=\""+self.url+"\" "
     html += "id=\"contentForm\" >"  
     html += common.hiddenField("action")
     html += common.hiddenField("object")
     html += common.hiddenField("isChanged", "1") 
     if self.message != '':
         html += "<script>Ext.Msg.alert('"+_('Info')+"', '"+self.message+"');</script>"
     html += "<div id=\"editorButtons\"> \n"     
     html += self.renderList()
     html += self.editorPane.renderButtons(request)
     if self.isNewIdevice:
         html += "<br/>" + common.submitButton("delete", _("Delete"), 
                                                     False)
     else:
         html += '<br /><input type="button" class="button" onclick="deleteIdevice()" value="'+_("Delete")+'" />'
     html += '<br/><input class="button" type="button" name="save" '
     title = "none"
     if self.editorPane.idevice.edit == False:
         title = self.editorPane.idevice.title
         title = title.replace(" ", "+")
     html += 'onclick=saveIdevice("%s") value="%s"/>' % (escape(title), _("Save"))
     html += u'<br/><input class="button" type="button" name="import" ' 
     html += u' onclick="importPackage(\'package\')" value="%s" />'  % _("Import iDevice")
     html += u'<br/><input class="button" type="button" name="export" '
     html += u'onclick="exportPackage(\'package\',\'%d\')"' % self.isNewIdevice
     html += u' value="%s" />'  % _("Export iDevice")
     html += u'<br/><input class="button" type="button" name="quit" '
     #html += u'onclick="parent.Ext.getCmp(\'ideviceeditorwin\').close()"'        
     html += u'onclick="quitDialog()"'  
     html += u' value="%s" />\n'  % _("Quit")
     html += common.hiddenField("pathpackage")
     html += "</fieldset>"
     html += "</div>\n"
     html += self.editorPane.renderIdevice(request)
     html += "</div>\n"
     html += "<br/></form>\n"
     html += "</body>\n"
     html += "</html>\n"
     return html.encode('utf8')
示例#45
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"
        html += common.textInput("title" + self.id,
                                 self.idevice.title) + "<br/><br/>"

        sites = [
            (_(u"English Wikipedia Article"), "http://en.wikipedia.org/wiki/"),
            (_(u"Basque Wikipedia Article"), "http://eu.wikipedia.org/wiki/"),
            (_(u"Catalan Wikipedia Article"), "http://ca.wikipedia.org/wiki/"),
            (_(u"Chinese Wikipedia Article"), "http://zh.wikipedia.org/wiki/"),
            (_(u"Dutch Wikipedia Article"), "http://nl.wikipedia.org/wiki/"),
            (_(u"French Wikipedia Article"), "http://fr.wikipedia.org/wiki/"),
            (_(u"German Wikipedia Article"), "http://de.wikipedia.org/wiki/"),
            (_(u"Galician Wikipedia Article"),
             "http://gl.wikipedia.org/wiki/"),
            (_(u"Greek Wikipedia Article"), "http://el.wikipedia.org/wiki/"),
            (_(u"Italian Wikipedia Article"), "http://it.wikipedia.org/wiki/"),
            (_(u"Japanese Wikipedia Article"),
             "http://ja.wikipedia.org/wiki/"),
            (_(u"Magyar Wikipedia Article"), "http://hu.wikipedia.org/wiki/"),
            (_(u"Polish Wikipedia Article"), "http://pl.wikipedia.org/wiki/"),
            (_(u"Portugese Wikipedia Article"),
             "http://pt.wikipedia.org/wiki/"),
            (_(u"Slovenian Wikipedia Article"),
             "http://sl.wikipedia.org/wiki/"),
            (_(u"Spanish Wikipedia Article"), "http://es.wikipedia.org/wiki/"),
            (_(u"Swedish Wikipedia Article"), "http://sv.wikipedia.org/wiki/"),
            (_(u"Wikibooks Article"), "http://en.wikibooks.org/wiki/"),
            (_(u"Wikiversity"), "http://en.wikiversity.org/wiki/"),
            (_(u"Wiktionary"), "http://en.wiktionary.org/wiki/"),
            (_(u"Wikieducator Content"), "http://wikieducator.org/"),
            (_(u"Other"), "")
        ]

        this_package = None
        if self.idevice is not None and self.idevice.parentNode is not None:
            this_package = self.idevice.parentNode.package
        html += common.formField('select', this_package, _('Site'), 's',
                                 'site' + self.id, self.idevice.langInstruc,
                                 sites, self.idevice.site)

        url = "none"
        if self.idevice.site == "":
            url = "block"
        html += '<div style="display:%s"> %s: <br/>' % (url, _("Own site"))
        html += common.textInput("ownUrl" + self.id,
                                 self.idevice.ownUrl) + '<br/></div>'
        html += "<br/>"
        html += common.textInput("article", self.idevice.articleName)
        html += common.elementInstruc(self.idevice.searchInstruc)
        html += common.submitButton(u"loadWikipedia" + 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