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.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.idevice.keyInstruc) html += "</td><td></td></tr><tr><td>\n" html += common.richTextArea(self.answerId, self.option.answer) html += "</td><td align=\"center\">\n" html += common.option(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><tr><td align=\"center\"><b>%s</b>" % _("Feedback") html += common.elementInstruc(self.idevice.feedbackInstruc) html += "</td><td></td><td></td></tr><tr><td>\n" html += common.richTextArea(self.feedbackId, self.option.feedback) html += "</td><td></td><td></td></tr>\n" return html
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
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.question.questionInstruc) html += u" " + common.submitImage(self.id, self.idevice.id, "/images/stock-cancel.png", _("Delete question")) html += common.richTextArea("question"+self.id, self.question.question) 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><th align=\"left\">%s " % _("Correct") html += common.elementInstruc(self.question.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"+unicode(self.id), value) html += u"<br />" html += u"</div>\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 += common.richTextArea(self.quesId, self.question.question) html += "<b>%s</b>\n" % _("Feedback") html += common.elementInstruc(self.idevice.feedbackInstruc) html += common.richTextArea(self.feedbackId, self.question.feedback) 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 with the form element for editing this field """ if self.discussion.isNone: return "" html = common.textInput("topic" + self.id, self.discussion.topic) html += common.elementInstruc(self.discussion.instruc) html += u"<br/>\n" html += common.richTextArea("dIntro" + self.id, self.discussion.intro) return html
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.richTextArea("instruc"+self.id, self.field.instruc) html += "<br/>" return html
def renderEdit(self): """ Returns an XHTML string with the form element for editing this field """ html = "" if self.idevice.message <> "": html += '<p style="color: red; font-weight: bold;">' html += '%s</p>' % self.idevice.message html += u'<p>' html += common.textInput("name"+ self.id, self.idevice.title) html += u'</p>' forums = [(_(u"New Forum"), 'newForum')] forums += [(pt.forumName, pt.forumName) for pt in self.idevice.forumsCache.getForums()] if self.idevice.isNewForum: selected = 'newForum' else: selected = self.forum.forumName html = common.formField('select', _(u"Forum Name:"), 'changeForum', 'forumSelect'+self.id, '', forums, selected) if not self.idevice.noForum: introduction = self.forum.introduction.replace("\r", "") introduction = introduction.replace("\n","\\n") html += common.textInput("fName"+ self.id, self.forum.forumName) html += common.elementInstruc(self.forum.nameInstruc) html += "<p><b>%s</b></p>" % _("Introduction") html += common.richTextArea("fIntro"+self.id, introduction) topics = [(_('None'), 'none'), (_('New Topic'), 'newTopic')] topics += [(pt.topic, pt.topic) for pt in self.forum.discussions] if self.idevice.isNewTopic: selected = 'newTopic' else: selected = self.idevice.discussion.topic html = common.formField('select', _(u"Discussion Topic/Thread:"), 'changeTopic', 'topicSelect'+self.id, '', topics, selected) html += self.discussionElement.renderEdit() lmss = [(_(u"Please select a LMS"), ''), (_('Moodle'), 'moodle'), (_('Other'), 'other')] html = common.formField('select', _(u"Learning Management System:"), 'changeLms', 'lmsSelect'+self.id, self.forum.lmsInstruc, lmss, self.forum.lms.lms) html += self.lmsElement.renderEdit() return html
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
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
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
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
def renderEdit(self): """ Returns an XHTML string with the form element for editing this field """ html = "" if self.idevice.message <> "": html += '<br/><font color="red">' html += '<b>%s</font></b><br/>' % self.idevice.message html += '<br/>' + common.textInput("name"+ self.id, self.idevice.title) html += '<br/><br/><b>%s</b><br/>' % _(u"Forum Name:") html += '<select onchange=' html += '"submitChange(\'%s\',\'forumSelect%s\');" ' % ("changeForum", self.id) html += 'name="forumSelect%s" id="forumSelect%s">\n' % (self.id, self.id) html += '<option value = "" ' if self.idevice.noForum: html += 'selected ' html += '>'+ _(u"Select a Forum") + '</option>' html += '<option value = "newForum" ' if self.idevice.isNewForum: html += 'selected ' html += '>'+ _(u"New Forum") + '</option>' for prototype in self.idevice.forumsCache.getForums(): html += '<option value="'+u'%s' % prototype.forumName+'" ' if self.forum.forumName == prototype.forumName: html += 'selected ' html += '>' + prototype.forumName + '</option>\n' html += '</select> \n' if not self.idevice.noForum: introduction = self.forum.introduction.replace("\r", "") introduction = introduction.replace("\n","\\n") html += common.textInput("fName"+ self.id, self.forum.forumName) html += common.elementInstruc(self.forum.nameInstruc) html += "<br/><br/><b>%s</b><br/>" % _("Introduction") html += common.richTextArea("fIntro"+self.id, introduction) html += "<br/>\n" html += '<br/><b>%s</b><br/>' % _(u"Discussion Topic/Thread:") html += '<select onchange=' html += '"submitChange(\'%s\',\'topicSelect%s\');" ' % ("changeTopic", self.id) html += 'name="topicSelect%s" id="topicSelect%s">\n' % (self.id, self.id) html += '<option value = "none"' html += '>%s </option>' % _("None") html += '<option value = "newTopic" ' if self.idevice.isNewTopic: html += 'selected ' html += '>'+ _(u"New Topic") + '</option>' for prototype in self.forum.discussions: html += '<option value="'+prototype.name+'" ' if self.idevice.discussion.topic == prototype.topic: html += 'selected ' html += '>' + prototype.topic + '</option>\n' html += '</select> \n' html += self.discussionElement.renderEdit() html += '<br/><br/><b>%s</b><br/>' % _(u"Learning Management System:") html += '<select onchange=' html += '"submitChange(\'%s\',\'lmsSelect%s\');" ' % ("changeLms", self.id) html += 'name="lmsSelect%s" id="lmsSelect%s">\n' % (self.id, self.id) html += '<option value="">%s</option>' % _(u"Please select a LMS") html += '<option value = "moodle" ' if self.forum.lms.lms == "moodle": html += 'selected ' html += '>'+ _(u"Moodle") + '</option>' html += '<option value = "other" ' if self.forum.lms.lms == "other": html += 'selected ' html += '>'+ _(u"Other") + '</option>' html += '</select>\n' html += common.elementInstruc(self.forum.lmsInstruc) html += "<br/><br/>" html += self.lmsElement.renderEdit() return html