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 with the form element for editing this field """ log.debug("renderEdit") html = u'<div class="block">' html += u"<b>"+self.field.name+":</b>\n" html += common.elementInstruc(self.field.instruc) html += u"</div>\n" html += common.textInput("path"+self.id, "", 50) html += u'<input type="button" onclick="addFlash(\'%s\')"' % self.id html += u' value="%s" />' % _(u"Select Flash Object") html += common.elementInstruc(self.field.fileInstruc) html += u'<div class="block"><b>%s</b></div>\n' % _(u"Display as:") html += u"<input type=\"text\" " html += u"id=\"width"+self.id+"\" " html += u"name=\"width"+self.id+"\" " html += u"value=\"%s\" " % self.field.width html += u"size=\"4\" />px\n" html += u"by \n" html += u"<input type=\"text\" " html += u"id=\"height"+self.id+"\" " html += u"name=\"height"+self.id+"\" " html += u"value=\"%s\" " % self.field.height html += u"size=\"4\" />px\n" return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = "<div class=\"iDevice\"><br/>\n" html += common.textInput("title"+self.id, self.idevice.title) html += u"<br/><br/>\n" html += common.textInput("path"+self.id, "", 50) html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u'value="%s" />\n' % _(u"Add files") html += u'<input type="submit" name="%s" value="%s"' % ("upload"+self.id, _(u"Upload")) html += common.elementInstruc(self.idevice.fileInstruc) html += u'<br/>\n' html += u'<b>%s</b>\n' % _(u'Applet Code:') html += common.elementInstruc(self.idevice.codeInstruc) html += u'<br/>\n' html += common.textArea('code'+self.id, self.idevice.appletCode) if self.idevice.userResources: html += '<table>' for resource in self.idevice.userResources: html += '<tr><td>%s</td><td>' % resource.storageName html += common.submitImage(self.id, resource.storageName, "/images/stock-cancel.png", _("Delete File")) html += '</td></tr>\n' html += '</table>' html += u'<br/>\n' html += self.renderEditButtons() html += u'\n</div>\n' return html
def renderEdit(self): """ Returns an XHTML string for editing this option element """ html = u"<tr><td align=\"center\"><b>%s</b>" % _("Option") html += common.elementInstruc(self.field.idevice.answerInstruc) header = "" if self.index == 0: header = _("Correct") + "<br/>" + _("Option") html += u"</td><td align=\"center\"><b>%s</b>\n" % header html += common.elementInstruc(self.field.idevice.keyInstruc) html += "</td><td></td></tr><tr><td>\n" html += common.textArea("ans"+self.id, self.field.answer, rows="4") html += "</td><td align=\"center\">\n" html += common.option("c"+self.field.question.id, self.field.isCorrect, self.index) html += "</td><td>\n" html += common.submitImage("del"+self.id, self.field.idevice.id, "/images/stock-cancel.png", _(u"Delete option")) html += "</td></tr><tr><td align=\"center\"><b>%s</b>" % _("Feedback") html += common.elementInstruc(self.field.idevice.feedbackInstruc) html += "</td><td></td><td></td></tr><tr><td>\n" html += common.textArea('f'+self.id, self.field.feedback, rows="4") html += "</td><td></td><td></td></tr>\n" return html
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
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 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
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, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = u'<div class="iDevice">\n' html += common.textInput("path"+self.id, "", 50) html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u' value="%s" />\n' % _(u"Select a file") html += common.elementInstruc(self.idevice.filenameInstruc) html += u'<div class="block">\n' html += u'\n<b>%s</b>\n' % _(u'Label') html += common.elementInstruc(self.idevice.labelInstruc) html += u'</div>\n' html += common.textInput(u'label'+self.id, self.idevice.label) html += common.formField('richTextArea',u'Description:','description', self.id, self.idevice.descriptionInstruc, self.idevice.description) if self.idevice.userResources: html += u'<span style="text-decoration:underline">' html += self.idevice.userResources[0].storageName html += u'</span>\n' html += u'<div class="block">\n' html += self.renderEditButtons() html += u'</div>\n' html += u'\n</div>\n' return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = "<div class=\"iDevice\"><br/>\n" html += common.textInput("title"+self.id, self.idevice.title) html += u"<br/><br/>\n" types = [(_(u"Geogebra"), "geogebra"), (_(u"Other"), "other")] html += u"<b>%s</b>" % _("Applet Type") html += '<select onchange="submitChange(\'changeType%s\', \'type%s\')";' % (self.id, self.id) html += 'name="type%s" id="type%s">\n' % (self.id, self.id) for type, value in types: html += "<option value=\""+value+"\" " if self.idevice.type == value: html += "selected " html += ">" + type + "</option>\n" html += "</select> \n" html += common.elementInstruc(self.idevice.typeInstruc) + "<br/><br/>" if self.idevice.message <> "": html += '<p style="color:red"><b>' + self.idevice.message + '</b></p>' html += common.textInput("path"+self.id, "", 50) html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u'value="%s" />\n' % _(u"Add files") html += u'<input type="submit" name="%s" value="%s"' % ("upload"+self.id, _(u"Upload")) html += common.elementInstruc(self.idevice.fileInstruc) html += u'<br/>\n' html += u'<b>%s</b>\n' % _(u'Applet Code:') html += common.elementInstruc(self.idevice.codeInstruc) html += u'<br/>\n' html += common.textArea('code'+self.id, self.idevice.appletCode,rows="12") if self.idevice.userResources: html += '<table>' for resource in self.idevice.userResources: html += '<tr><td>%s</td><td>' % resource.storageName html += common.submitImage(self.id, resource.storageName, "/images/stock-cancel.png", _("Delete File")) html += '</td></tr>\n' html += '</table>' html += u'<br/>\n' html += self.renderEditButtons(undo=self.idevice.undo) html += u'\n</div>\n' return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = u"<div class=\"iDevice\">\n" html += self.imageElement.renderEdit() floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'], [_(u'None'), 'none']] 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, _("Align:"), "float" + self.id, '', '', floatArr, self.idevice.float) html += u'<div class="block"><b>%s</b></div>' % _(u"Caption:") html += common.textInput("caption" + self.id, self.idevice.caption) html += common.elementInstruc(self.idevice.captionInstruc) html += "<br/>" + self.textElement.renderEdit() html += self.renderEditButtons() html += u"</div>\n" return html
def renderEdit(self, style): """ Returns an XHTML string with the form element for editing this block """ html = u'<div class="block">\n' html += u"<strong>%s</strong> " % _('URL:') html += common.elementInstruc(self.idevice.urlInstruc) html += u"</div>\n" html += u'<div class="block">\n' html += common.textInput("url"+self.id, self.idevice.url) heightArr = [['small', '200'], ['medium', '300'], ['large', '500'], ['super-size', '800']] html += u"</div>\n" html += u'<div class="block">\n' 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, _('Frame Height:'), "height"+self.id, options = heightArr, selection = self.idevice.height) html += u"</div>\n" html += self.renderEditButtons() return html
def renderEdit(self, style): """ Returns an XHTML string with the form element for editing this block """ html = u'<div class="block">\n' html += u"<strong>%s</strong> " % _('URL:') html += common.elementInstruc(self.idevice.urlInstruc) html += u"</div>\n" html += u'<div class="block">\n' html += common.textInput("url" + self.id, self.idevice.url) heightArr = [['small', '200'], ['medium', '300'], ['large', '500'], ['super-size', '800']] html += u"</div>\n" html += u'<div class="block">\n' 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, _('Frame Height:'), "height" + self.id, options=heightArr, selection=self.idevice.height) html += u"</div>\n" html += self.renderEditButtons() return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = u'<div class="iDevice">\n' html += u'<div class="block">\n' label = _(u"Filename") if self.idevice.userResources: label += u": " label += u'<span style="text-decoration:underline">' label += self.idevice.userResources[0].storageName label += u"</span>\n" html += common.formField("textInput", label, "path" + self.id, "", self.idevice.filenameInstruc, size=50) html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u' value="%s" />\n' % _(u"Select a file") html += u"</div>\n" html += u'<div class="block">\n' html += u"\n<b>%s</b>\n" % _(u"Label") html += common.elementInstruc(self.idevice.labelInstruc) html += u"</div>\n" html += common.textInput(u"label" + self.id, self.idevice.label) html += common.formField( "richTextArea", _(u"Description:"), "description", self.id, self.idevice.descriptionInstruc, self.idevice.description, ) html += u'<div class="block">\n' html += self.renderEditButtons() html += u"</div>\n" html += u"\n</div>\n" return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = u"<div class=\"iDevice\">\n" html += self.mediaElement.renderEdit() floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'], [_(u'None'), 'none']] html += common.formField('select', _("Align:"), "float" + self.id, '', self.idevice.alignInstruc, floatArr, self.idevice.float) html += u'<div class="block"><b>%s</b></div>' % _(u"Caption:") html += common.textInput("caption" + self.id, self.idevice.caption) html += common.elementInstruc(self.idevice.captionInstruc) html += "<br/>" + self.textElement.renderEdit() emphasisValues = [(_(u"No emphasis"), Idevice.NoEmphasis), (_(u"Some emphasis"), Idevice.SomeEmphasis)] html += common.formField('select', _('Emphasis'), 'emphasis', self.id, '', # TODO: Instructions emphasisValues, self.idevice.emphasis) html += self.renderEditButtons() html += u"</div>\n" return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = u"<div class=\"iDevice\">\n" html += self.flashMovieElement.renderEdit() floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'], [_(u'None'), 'none']] html += common.formField('select', _("Align:"), "float" + self.id, options = floatArr, selection = self.idevice.float) html += u'<div class="block">' html += u"<b>%s </b>" % _(u"Caption:") html += common.elementInstruc(self.idevice.captionInstruc) html += u'</div>\n' html += u'<div class="block">' html += common.textInput("caption" + self.id, self.idevice.caption) html += u'</div>\n' html += u'<div class="block">' html += self.textElement.renderEdit() html += self.renderEditButtons() html += u'</div>\n' html += u"</div>\n" return html
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 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 elements for editing this block """ log.debug("renderEdit") html = u"<div class=\"iDevice\">\n" html += self.flashElement.renderEdit() floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'], [_(u'None'), 'none']] 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, _("Align:"), "float" + self.id, options=floatArr, selection=self.idevice.float) html += u"\n" html += u"<b>%s </b>" % _(u"Caption:") html += common.textInput("caption" + self.id, self.idevice.caption) html += common.elementInstruc(self.idevice.captionInstruc) html += "<br/>" + self.textElement.renderEdit() html += self.renderEditButtons() html += u"</div>\n" return html
def renderPreview(self): """ Returns an XHTML string with the form element for previewing this field """ html = "<b>" + self.field.name + "</b> " html += "<br/>" html += common.textInput("path"+self.id, "", 50) html += u'<input type="button" ' html += u' value="%s" />' % _(u"Select MP3 file") if self.field.instruc != "": html += common.elementInstruc(self.field.instruc) html += '<br/><b>%s</b><br/>' % _(u"Caption:") html += common.textInput("", "") html += common.elementInstruc(self.field.captionInstruc) html += "<br/>\n" return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = u'<div class="iDevice">\n' html += u'<div class="block">\n' label = _(u'Filename:') if self.idevice.userResources: label += u': ' label += u'<span style="text-decoration:underline">' label += self.idevice.userResources[0].userName label += u'</span>\n' html += u'<div>' html += common.formField('textInput', label, 'path'+self.id, '', self.idevice.filenameInstruc, size=50) html += u'</div"><div style="padding-top:28px;" >' html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u' value="%s" />\n' % _(u"Select a file") html += u'</div><br style="clear:both;" />' html += u'</div>\n' html += u'<div class="block">\n' html += u'\n<b>%s</b>\n' % _(u'Label:') html += common.elementInstruc(self.idevice.labelInstruc) html += u'</div>\n' html += common.textInput(u'label'+self.id, self.idevice.label) html += self.descriptionElement.renderEdit() html += u'<div class="block">\n' html += self.renderEditButtons() html += u'</div>\n' html += u'\n</div>\n' return html
def renderEdit(self, style): """ Returns an XHTML string with the form element for editing this block """ html = u'<p class="exe-text-field">\n' html += u"<label for='url%s'>%s</label> " % (self.id, _('URL:')) html += common.elementInstruc(self.idevice.urlInstruc) html += common.textInput("url" + self.id, self.idevice.url) html += ' <span class="exe-field-instructions">' + _( "Remember that HTTP pages cannot be included into HTTPS websites." ) + '</span>' heightArr = [[_('small'), '200'], [_('medium'), '300'], [_('large'), '500'], [_('super-size'), '800']] html += u"</p>\n" 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, _('Frame Height:'), "height" + self.id, options=heightArr, selection=self.idevice.height) html += self.renderEditButtons() return html
def renderEdit(self): """ Returns an XHTML string for editing this question element """ html = "<tr><td><b>%s</b>\n" % _("Activity") html += common.elementInstruc(self.idevice.questionInstruc) html += self.question_question.renderEdit() html += "<b>%s</b>\n" % _("Feedback") html += common.elementInstruc(self.idevice.feedbackInstruc) html += self.question_feedback.renderEdit() html += "</td><td>\n" html += common.submitImage(self.id, self.idevice.id, "/images/stock-cancel.png", _("Delete question")) html += "</td></tr>\n" return html
def renderEdit(self): html = u"<div>\n" html += common.textInput("path"+self.id, "", 50, \ onclick="addFile('%s')" % self.id, readonly="readonly" ) html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u'value="%s" />\n' % _(u"Browse") buttonName = _(u"Replace") if self.field.fileResource is None: buttonName = _(u"Upload") html += u'<input type="submit" name="%s" value="%s" />' % ("upload"+self.id, buttonName) html += common.elementInstruc(self.field.fileInstruc) html += self.fileDescriptionElement.renderEdit() if self.field.fileResource is not None: html += "<div class='block'><strong>" html += _("File") + ": %s " % self.field.fileResource.storageName if self.showDelFile: html += common.submitImage("delfile" + self.id, self.field.fileResource.storageName, "/images/stock-cancel.png", _("Delete File")) html += "</strong></div>" else: html += "<i>"+_("No File Uploaded Currently") + "</i>" html += "<br/></div>" html += field_engine_make_delete_button(self) return html
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
def renderEdit(self, style): """ Returns an XHTML string with the form element for editing this block """ html = u'<div class="block">\n' html += u"<strong>%s</strong> " % _("URL:") html += common.elementInstruc(self.idevice.urlInstruc) html += u"</div>\n" html += u'<div class="block">\n' html += common.textInput("url" + self.id, self.idevice.url) heightArr = [[_("small"), "200"], [_("medium"), "300"], [_("large"), "500"], [_("super-size"), "800"]] html += u"</div>\n" html += u'<div class="block">\n' 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, _("Frame Height:"), "height" + self.id, options=heightArr, selection=self.idevice.height, ) html += u"</div>\n" html += self.renderEditButtons() return html
def renderEdit(self): """ Returns an XHTML string with the form element for editing this field """ log.debug("renderEdit") html = "" html += u'<b>'+self.field.name+':</b>\n' html += common.elementInstruc(self.field.instruc)+'<br/>' html += common.textInput("path"+self.id, "", 50) html += u'<input type="button" onclick="addMp3(\'%s\')"' % self.id html += u' value="%s" />' % _(u"Select an MP3") if self.field.mediaResource: html += '<p style="color: red;">'+ self.field.mediaResource.storageName + '</P>' html += '<br/><b>%s</b><br/>' % _(u"Caption:") html += common.textInput("caption" + self.id, self.field.caption) html += common.elementInstruc(self.field.captionInstruc) return html
def renderEdit(self): """ Returns an XHTML string with the form element for editing this field """ log.debug("renderEdit") if not self.field.imageResource: self.field.setDefaultImage() html = u'<div class="block">\n' html += u"<b>"+self.field.name+":</b>\n" html += common.elementInstruc(self.field.instruc) html += u"</div>\n" html += u'<div class="block">\n' html += u'<img alt="%s" ' % _('Add JPEG Image') html += u'id="img%s" ' % self.id html += u"onclick=\"addJpgImage('"+self.id+"');\" " html += u'src="resources/%s" '%(self.field.imageResource.storageName) html += u"/>\n" html += u"</div>\n" html += u'<script type="text/javascript">\n' html += u"document.getElementById('img"+self.id+"')." html += "addEventListener('load', magnifierImageChanged, true);\n" html += u'</script>\n' html += u'<div class="block">\n' html += common.textInput("path"+self.id, "", 50) html += u'<input type="button" class="block" ' html += u' onclick="addJpgImage(\'%s\')"' % self.id html += u' value="%s" />' % _(u"Select an image (JPG file)") html += u'<div class="block"><b>%s</b>' % _(u"Display as:") html += common.elementInstruc(self.field.idevice.dimensionInstruc) html += u'</div>\n' html += u'<input type="text" ' html += u'id="width%s" ' % self.id html += u'name="width%s" ' % self.id html += u'value="%s" ' % self.field.width html += u'onchange="changeMagnifierImageWidth(\'%s\');" ' % self.id html += u'size="4" /> pixels <strong>by</strong> ' html += u'<input type="text" ' html += u'id="height%s" ' % self.id html += u'name="height%s" ' % self.id html += u'value="%s" ' % self.field.height html += u'onchange="changeMagnifierImageHeight(\'%s\');" ' % self.id html += u'size="4" /> pixels.\n' html += u'\n' html += u'(%s) \n' % _(u'blank for original size') html += u'</div>\n' return html
def renderEdit(self, style): """ Returns an XHTML string with the form element for editing this block """ html = u'<div>' html += '<span class="js-idevice-title-label">' html += '<label for="title'+self.id+'">'+_('Title')+':</label> ' html += common.elementInstruc(_('The title and the icon are not required. If you leave them empty the iDevice will have no emphasis.')) html += '</span>' html += common.hiddenField("iconiDevice" + self.id, self.idevice.icon) html += u'<a class="js-show-icon-panel-button" href="javascript:showMessageBox(\'iconpanel\');" title="%s"><img src="/images/stock-insert-image.png" alt="%s" width="16" height="16" /></a>' % (_('Select an icon'),_('Choose an Image')) # Get icon source (if it exists) icon = self.idevice.icon icon_exists = False if icon != '': idevice_icon = Path(G.application.config.stylesDir / style / 'icon_' + self.idevice.icon + '.gif') if idevice_icon.exists(): icon_exists = True else: idevice_icon = Path(G.application.config.stylesDir/style/"icon_" + self.idevice.icon + ".png") if idevice_icon.exists(): icon_exists = True # Icon HTML element html += u'<img class="js-idevide-icon-preview" name="iconiDevice%s" id="iconiDevice"' % (self.id) if icon_exists: html += u' src="/style/%s/icon_%s%s"' % (style, icon, idevice_icon.ext) else: html += u' src="/images/empty.gif"' html += u'/>' # Delete button html += u'<a href="javascript:deleteIcon(%s);" id="deleteIcon%s" class="deleteIcon" title="%s"' % (self.id, self.id, _('Delete')) # If the icon doesn't exists if not icon_exists: html += u' style="display: none;"' html += u'>' html += u'<img class="js-delete-icon" alt="%s" src="%s"/>' % (_('Delete'), '/images/stock-delete.png') html += u'</a>' html += common.textInput("title" + self.id, self.idevice.title) html += u'<div class="js-icon-panel-container">' html += u'<div id="iconpaneltitle">%s</div>' % _("Icons") html += u'<div id="iconpanelcontent">' html += self.__renderIcons(style) html += u'</div>' html += u"</div>" for element in self.elements: html += element.renderEdit() html += self.renderEditButtons() html += u"</div>" return html
def renderQuestionPreview(self): """ Returns an XHTML string for previewing this question element """ html = self.renderQuestion() html += " \n" html += common.elementInstruc(self.question.hint, "panel-amusements.png", "Hint") return html
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
def renderEdit(self): """ Returns an XHTML string for editing this question element """ html = "<tr><td><b>%s</b>\n" % _("Activity") html += common.elementInstruc(self.idevice.questionInstruc) html += common.richTextArea(self.quesId, self.question.question) html += self.imageElement.renderEdit() html += "<b>%s</b>\n" % _("Feedback") html += common.elementInstruc(self.idevice.feedbackInstruc) html += common.richTextArea(self.feedbackId, self.question.feedback) if self.imageElement.field.imageResource is None: self.imageElement.field.setDefaultImage() html += "</td><td>\n" html += common.submitImage(self.id, self.idevice.id, "/images/stock-cancel.png", _("Delete question")) html += "</td></tr>\n" return html
def renderQuestionPreview(self): #TODO merge renderQuestionView and renderQuestionPreview """ Returns an XHTML string for previewing this question element """ is_preview = 1 html = self.renderQuestion(is_preview) html += common.elementInstruc(self.question_hint.field.content, "panel-amusements.png", "Hint") return html
def renderPreview(self): """ Returns an XHTML string with the form element for previewing this field """ html = "<b>" + self.field.name + "</b> " if self.field.instruc != "": html += common.elementInstruc(self.field.instruc) html += "<br/>\n" html += common.textInput(self.id, self.field.content) html += "<br/>\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 renderPreview(self): """ Returns an XHTML string with the form element for previewing this field """ html = "<b>" + self.field.name + "</b> " if self.field.instruc != "": html += common.elementInstruc(self.field.instruc) html += "<br/>\n" html += common.textArea(self.id, self.field.content) html += "<br/>\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 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, style): """ Returns an XHTML string with the form element for editing this block """ html = u'<div><div class="block">\n' html += common.elementInstruc(self.idevice.instruc) html += common.textInput("title"+self.id, self.idevice.title) html += u"</div>\n" html += u"<div class=\"block\">" html += u"<div class=\"block\">" html += u"<strong>%s</strong>" % _("Email Address") html += common.elementInstruc(_("Enter the email address you want\ feedback to be sent to")) html += u"</div>\n" if self.idevice.address == "": self.idevice.address = self.package.email html += common.textInput("address"+self.id, self.idevice.address) html += u"<div class=\"block\">\n" html += u"<strong>%s</strong>" % _("Subject") if self.idevice.subject == "": if self.package.title == "": self.idevice.subject = _("Feedback on ") + \ self.package.name + " - " + self.idevice.parentNode.title else: self.idevice.subject = \ _("Feedback on ") + self.package.title + " - " + \ self.idevice.parentNode.title html += common.elementInstruc(_("Enter default subject of feedback")) html += u"</div>\n" html += common.textInput("subject"+self.id, self.idevice.subject) html += u"<div class=\"block\">\n" html += u"<strong>%s</strong>" % _("Comment") html += u"<div>\n" html += common.textInput("comment"+self.id, self.idevice.subject) html += "</div>\n" for element in self.elements: html += element.renderEdit() + "<br/>" html += self.renderEditButtons() html += u"</div>\n" return html
def renderEdit(self, style): """ Returns an XHTML string with the form element for editing this block """ heightArr = [['small', '300'], ['normal', '500'], ['large', '700']] html = u'<div><div class="block">\n' html += u"<strong>%s</strong>" % _("PDF import") html += common.elementInstruc(self.idevice.appletInstruc) html += u'</div>' html += u'<div class="block">\n' html += u"<strong>%s</strong>" % _("Path to PDF file") html += u'</div>\n' html += u'<div class="block">\n' html += common.textInput("path"+self.id, self.idevice.path, 50) html += u'<input type="button" onclick="addPdf(\'%s\')"' % self.id html += u"value=\"%s\"/>\n" % _(u"Add file") html += u'</div>' html += u'<div class="block">\n' html += u"<strong>%s</strong>" % _("Pages to import") html += common.elementInstruc(self.idevice.pagesInstruc) html += u'</div>\n' html += u'<div class="block">\n' html += common.textInput("pages"+self.id, self.idevice.pages, 10) html += u"</div>\n" html += u"<div>\n" 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, _('Frame Height:'), "height" + self.id, options = heightArr, selection = self.idevice.height) html += u"</div>\n" for element in self.elements: html += element.renderEdit() + "<br/>" html += u"</div>\n" html += self.renderEditButtons() return html
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
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") html = u'<div class="iDevice">\n' html += u'<div class="block">\n' label = _(u'Filename:') if self.idevice.userResources: label += u': ' label += u'<span style="text-decoration:underline">' label += self.idevice.userResources[0].storageName label += u'</span>\n' html += u'<div>' 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('textInput', this_package, label, 'path' + self.id, '', self.idevice.filenameInstruc, size=40) html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u' value="%s" />\n' % _(u"Select a file") html += u'</div><br style="clear:both;" />' html += u'</div>\n' html += u'<div class="block">\n' html += u'\n<b>%s</b>\n' % _(u'Label:') html += common.elementInstruc(self.idevice.labelInstruc) html += u'</div>\n' html += common.textInput(u'label' + self.id, self.idevice.label) html += self.descriptionElement.renderEdit() html += u'<div class="block">\n' html += self.renderEditButtons() html += u'</div>\n' html += u'\n</div>\n' return html
def renderPreview(self): """ Returns an XHTML string with the form element for previewing this field """ html = "<b>" + self.field.name + "</b> " if self.field.instruc != "": html += common.elementInstruc(self.field.instruc) html += "<br/>" html += common.image("img"+self.id, "/images/"+ImageEditorElement.DefaultImage, self.field.width, self.field.height) floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'], [_(u'None'), 'none']] this_package = None html += common.formField('select', this_package, _("Align:"), "float" + self.id, '', '', floatArr, '') html += "<br/>\n" return html
def renderEdit(self): """ Returns an XHTML string for editing this option element """ html = self.question_question.renderEdit() html += _("True") + " " html += common.option(self.keyId, self.question.isCorrect, "true") html += _("False") + " " html += common.option(self.keyId, not self.question.isCorrect, "false") html += "<br/><br/>\n" html += common.elementInstruc(self.idevice.keyInstruc) html += self.question_feedback.renderEdit() html += self.question_hint.renderEdit() html += common.submitImage(self.id, self.idevice.id, "/images/stock-cancel.png", _("Delete question")) html += "<br/><br/>\n" return html
def renderEdit(self): html = u"<div>\n" html += common.textInput("path"+self.id, "", 50, \ onclick="addFile('%s')" % self.id, readonly="readonly" ) html += u'<input type="button" onclick="addFile(\'%s\')"' % self.id html += u'value="%s" />\n' % _(u"Browse") buttonName = _(u"Replace") if self.field.fileResource is None: buttonName = _(u"Upload") html += u'<input type="submit" name="%s" value="%s" />' % ( "upload" + self.id, buttonName) html += common.elementInstruc(self.field.fileInstruc) html += self.fileDescriptionElement.renderEdit() if self.field.fileResource is not None: html += "<div class='block'><strong>" html += _("File") + ": %s " % self.field.fileResource.storageName if self.showDelFile: html += common.submitImage("delfile" + self.id, self.field.fileResource.storageName, "/images/stock-cancel.png", _("Delete File")) html += "</strong></div>" else: html += "<i>" + _("No File Uploaded Currently") + "</i>" html += "<br/></div>" html += field_engine_make_delete_button(self) return html
def renderEdit(self, style): """ Returns an XHTML string with the form elements for editing this block """ log.debug("renderEdit") floatArr = [[_(u'Left'), 'left'], [_(u'Right'), 'right'], [_(u'None'), 'none']] html = u"<div class=\"iDevice\">\n" # Caption html += '<div class="block">' html += u"<strong>%s</strong>" % _(u"Caption:") html += common.elementInstruc(self.idevice.captionInstruc) html += '</div>' html += '<div class="block">' html += common.textInput("caption" + self.id, self.idevice.caption) html += '</div>' # Text html += '<div class="block">' html += self.textElement.renderEdit() html += '</div>' # Image html += self.imageMagnifierElement.renderEdit() this_package = None if self.idevice is not None and self.idevice.parentNode is not None: this_package = self.idevice.parentNode.package # Align html += common.formField('select', this_package, _("Align:"), "float" + self.id, '', self.idevice.alignInstruc, floatArr, self.idevice.float) # Initial and Max Zoom opts zoomOpts = [] for i in range(100, 201, 10): zoomOpts.append(('%d%%' % (i), str(i))) # Initial Zoom Size selection = self.idevice.imageMagnifier.initialZSize html += common.formField('select', this_package, _(u"Initial Zoom"), "initial" + self.id, '', self.idevice.initialZoomInstruc, zoomOpts, selection) # Maximum Zoom selection = self.idevice.imageMagnifier.maxZSize html += common.formField('select', this_package, _(u"Maximum zoom"), "maxZoom" + self.id, '', self.idevice.maxZoomInstruc, zoomOpts, selection) # Size of Magnifying Glass glassSizeArr = [ [_(u'Small'), '1'], [_(u'Medium'), '2'], [_(u'Large'), '3'], [_(u'Extra large'), '4'], ] html += common.formField('select', this_package, _(u"Size of magnifying glass: "), "glass" + self.id, '', self.idevice.glassSizeInstruc, glassSizeArr, self.idevice.imageMagnifier.glassSize) html += self.renderEditButtons(undo=self.idevice.undo) html += u"</div>\n" return html
def renderEdit(self, style): """ Renders a table of thumbnails allowing the user to move/add/delete/change each gallery image """ this_package = None if self.idevice is not None and self.idevice.parentNode is not None: this_package = self.idevice.parentNode.package html = [u'<div class="iDevice">', common.formField('textInput', this_package, _('Title'), "title"+self.id, '', self.idevice.titleInstruc, self.idevice.title), u'<div class="block">', u'<input type="button" ', u'onclick="addGalleryImage(\'%s\')"' % self.id, u'value="%s" />\n' % _(u"Add images"), common.elementInstruc(self.idevice.addImageInstr), u'</div>', ] if len(self.idevice.images) == 0: html += [u'<p class="exeImageGallery no-images">', _(u'No Images Loaded'), u'</p>'] else: def genCell(image, i, id): """Generates a single cell of our table""" def submitLink(method): """Makes submitLink javascript code""" method = 'gallery.%s.%s' % (method, image.id) params = "'%s', %s, true" % (method, self.id) return "javascript:submitLink(%s)" % params def confirmThenSubmitLink(msg, method): method = 'gallery.%s.%s' % (method, image.id) params = "'%s', '%s', %s, true" % (re.escape(msg), method, self.id) return "javascript:confirmThenSubmitLink(%s)" % params changeGalleryImage = '\n'.join([ u'<a title="%s"' % _(u'Change Image'), u' href="#" ', u' onclick="changeGalleryImage(' + u"'%s', '%s')" % (self.id, image.id) + u'">']) result = [changeGalleryImage, u'<img class="exeImageGallery-thumbnail"', u' alt="%s"' % image.caption, u' src="%s"/></a>' % image.thumbnailSrc, u'<span>', u'<input id="caption%s" ' % image.id, u' name="caption%s" ' % image.id, u' value="%s" ' % image.caption, u' />', # Edit button changeGalleryImage, u'<img alt="%s"' % _(u'Change Image'), u' class="submit" width="16" height="16"' u' src="/images/stock-edit.png"/>' u'</a> '] # Move left button if image.index > 0: result += [ u'<a title="%s"' % _(u'Move Image Left'), u' href="%s">' % submitLink('moveLeft'), u'<img alt="%s"' % _(u'Go Back'), u' class="submit" width="16" height="16"' u' src="/images/stock-go-back.png"/>' u'</a> ', ] else: result += [ u'<img class="submit" width="16" height="16"' u' src="/images/stock-go-back-off.png"/>'] # Move right button if image.index < len(image.parent.images)-1: result += [ u' <a title="%s"' % _(u'Move Image Right'), u' href="%s">' % submitLink('moveRight'), u'<img alt="%s"' % _(u'Go Forward'), u' class="submit" width="16" height="16"' u' src="/images/stock-go-forward.png" /></a>', ] else: result += [ u'<img alt="%s" ' % _(u'Go Forward (Not Available)'), u' class="submit" width="16" height="16"' u' src="/images/stock-go-forward-off.png"/>'] result += [ # Delete button u' <a title="%s"' % _(u'Delete Image'), u' href="%s">' % (confirmThenSubmitLink(_('Delete this image?'), 'delete')), u'<img class="submit" width="16" height="16" alt="%s" ' \ % _(u'Delete'), u' src="/images/stock-delete.png" /></a>', u' <a href="javascript:addGalleryImage(%s)"' % id, u' title="%s"><img src="/images/stock-add.png"' % _(u"Add images"), u' class="submit" width="16" height="16" alt="%s" /></a>' % _(u"Add images"), u' </span>'] return result html += self._generateTable(genCell) html += [self.renderEditButtons(undo=self.idevice.undo), u'</div>'] return u'\n '.join(html)
def renderIdevice(self, request): """ Returns an XHTML string for rendering the new idevice """ html = "<div id=\"editorWorkspace\">\n" html += "<script type=\"text/javascript\">\n" html += "<!--\n" html += """ function submitLink(action, object, changed) { var form = document.getElementById("contentForm") form.action.value = action; form.object.value = object; form.isChanged.value = changed; form.submit(); }\n""" html += """ function submitIdevice() { var form = document.getElementById("contentForm") if (form.ideviceSelect.value == "newIdevice") form.action.value = "newIdevice" else form.action.value = "changeIdevice" form.object.value = form.ideviceSelect.value; form.isChanged.value = 1; form.submit(); }\n""" html += """ function submitStyle() { var form = document.getElementById("contentForm") form.action.value = "changeStyle"; form.object.value = form.styleSelect.value; form.isChanged.value = 0; form.submit(); }\n""" html += "//-->\n" html += "</script>\n" self.purpose = self.idevice.purpose.replace("\r", "") self.purpose = self.purpose.replace("\n", "\\n") self.tip = self.idevice.tip.replace("\r", "") self.tip = self.tip.replace("\n", "\\n") if self.idevice.edit: html += "<b>" + _("Name") + ": </b>\n" html += common.elementInstruc(self.nameInstruc) + "<br/>" html += '<input type="text" name= "title" id="title" value="%s"/>' % self.idevice.title this_package = None html += common.formField('richTextArea', this_package, _(u"Pedagogical Tip"), 'tip', '', self.tipInstruc, self.tip) html += "<b>" + _("Emphasis") + ":</b> " html += "<select onchange=\"submit();\" name=\"emphasis\">\n" emphasisValues = { Idevice.NoEmphasis: _(u"No emphasis"), Idevice.SomeEmphasis: _(u"Some emphasis") } for value, description in emphasisValues.items(): html += "<option value=\"" + unicode(value) + "\" " if self.idevice.emphasis == value: html += "selected " html += ">" + description + "</option>\n" html += "</select> \n" html += common.elementInstruc(self.emphasisInstruc) html += "<br/><br/>\n" if self.idevice.emphasis > 0: html += self.__renderStyles() + " " html += u'<a href="#" ' html += u'onmousedown="Javascript:updateCoords(event);"\n' html += u'onclick="Javascript:showMe(\'iconpanel\', 350, 100);">' html += u'Select an icon:</a> \n' icon = self.idevice.icon if icon != "": html += '<img align="middle" ' html += 'src="/style/%s/icon_%s' % ( self.style.get_dirname(), icon) html += '.gif"/><br/>' html += u'<div id="iconpanel" style="display:none; z-index:99;">' html += u'<div style="float:right;" >\n' html += u'<img alt="%s" ' % _("Close") html += u'src="/images/stock-stop.png" title="%s"\n' % _( "Close") html += u'onmousedown="Javascript:hideMe();"/></div><br/> \n' html += u'<div align="center"><b>%s:</b></div><br/>' % _( "Icons") html += self.__renderIcons() html += u'</div><br/>\n' for element in self.elements: html += element.renderEdit() else: html += "<b>" + self.idevice.title + "</b><br/><br/>" for element in self.elements: html += element.renderPreview() if self.idevice.purpose != "" or self.idevice.tip != "": html += "<a title=\"" + _("Pedagogical Help") + "\" " html += "onmousedown=\"Javascript:updateCoords(event);\" \n" html += "onclick=\"Javascript:showMe('phelp', 380, 240);\" \n" html += "href=\"Javascript:void(0)\" style=\"cursor:help;\">\n " html += '<img alt="%s" src="/images/info.png" border="0" \n' % _( 'Info') html += "align=\"middle\" /></a>\n" html += "<div id=\"phelp\" style=\"display:none;\">\n" html += "<div style=\"float:right;\" " html += '<img alt="%s" src="/images/stock-stop.png" \n' % _( 'Close') html += " title='" + _( "Close") + "' border='0' align='middle' \n" html += "onmousedown=\"Javascript:hideMe();\"/></div>\n" if self.idevice.purpose != "": html += "<b>Purpose:</b><br/>%s<br/>" % self.purpose if self.idevice.tip != "": html += "<b>Tip:</b><br/>%s<br/>" % self.idevice.tip html += "</div>\n" html += "</div>\n" self.message = "" return html
def renderIdevice(self, request): """ Returns an XHTML string for rendering the new idevice """ html = "<div id=\"editorWorkspace\">\n" html += "<script type=\"text/javascript\">\n" html += "<!--\n" html += """ function selectStyleIcon(icon,e) { var div = document.getElementById("styleIcons"); var imgs = div.getElementsByTagName("IMG"); for (var i=0;i<imgs.length;i++) { imgs[i].style.border = "1px solid #E8E8E8"; } e.style.border = "1px solid #333333"; submitLink("selectIcon",icon,1); } function submitLink(action, object, changed) { var form = document.getElementById("contentForm") form.action.value = action; form.object.value = object; form.isChanged.value = changed; form.submit(); }\n""" html += """ function submitIdevice() { var form = document.getElementById("contentForm") if (form.ideviceSelect.value == "newIdevice") form.action.value = "newIdevice" else form.action.value = "changeIdevice" form.object.value = form.ideviceSelect.value; form.isChanged.value = 1; form.submit(); }\n""" html += """ function submitStyle() { var form = document.getElementById("contentForm") form.action.value = "changeStyle"; form.object.value = form.styleSelect.value; form.isChanged.value = 0; form.submit(); }\n""" html += "//-->\n" html += "</script>\n" self.purpose = self.idevice.purpose.replace("\r", "") self.purpose = self.purpose.replace("\n", "\\n") self.tip = self.idevice.tip.replace("\r", "") self.tip = self.tip.replace("\n", "\\n") if self.idevice.edit: html += "<b>" + _("Name") + ": </b>\n" html += common.elementInstruc(self.nameInstruc) + "<br/>" html += '<input type="text" name= "title" id="title" value="%s"/>' % self.idevice.title this_package = None html += common.formField('richTextArea', this_package, _(u"Pedagogical Tip"), 'tip', '', self.tipInstruc, self.tip) html += "<b>" + _("Emphasis") + ":</b> " html += "<select onchange=\"submit();\" name=\"emphasis\">\n" emphasisValues = { Idevice.NoEmphasis: _(u"No emphasis"), Idevice.SomeEmphasis: _(u"Some emphasis") } for value, description in emphasisValues.items(): html += "<option value=\"" + unicode(value) + "\" " if self.idevice.emphasis == value: html += "selected " html += ">" + description + "</option>\n" html += "</select> \n" html += common.elementInstruc(self.emphasisInstruc) html += "<br/><br/>\n" if self.idevice.emphasis > 0: html += self.__renderStyles() + " " html += u'<a style="margin-right:.5em" href="javascript:void(0)" ' html += u'onclick="showMessageBox(\'iconpanel\');">' html += u'%s</a>' % _('Select an icon') icon = self.idevice.icon if icon != "": iconExists = False myIcon = Path(G.application.config.stylesDir / self.style.get_dirname() / "icon_" + self.idevice.icon + ".gif") if myIcon.exists(): iconExists = True else: myIcon = Path(G.application.config.stylesDir / self.style.get_dirname() / "icon_" + self.idevice.icon + ".png") if myIcon.exists(): iconExists = True if iconExists: html += '<img style="vertical-align:middle;max-width:60px;height:auto" ' html += 'src="/style/%s/icon_%s' % ( self.style.get_dirname(), icon) html += '%s"/><br />' % myIcon.ext html += u'<div style="display:none;z-index:99;">' html += u'<div id="iconpaneltitle">' + _("Icons") + '</div>' html += u'<div id="iconpanelcontent">' html += self.__renderIcons() html += u'</div>' html += u'</div>\n' html += u'<br style="clear:both;margin-bottom:10px" />' for element in self.elements: html += element.renderEdit() else: html += "<b>" + self.idevice.title + "</b><br/><br/>" for element in self.elements: html += element.renderPreview() if self.idevice.purpose != "" or self.idevice.tip != "": html += "<a title=\"" + _("Pedagogical Help") + "\" " html += "onclick=\"showMessageBox('phelp');\" " html += "href=\"javascript:void(0)\" style=\"cursor:help;\">\n " html += '<img alt="%s" src="/images/info.png" border="0" ' % _( 'Info') html += "align=\"middle\" /></a>\n" html += "<div style='display:none;'>" if self.idevice.purpose != "": html += "<div id='phelptitle'>" + _('Purpose') + "</div>" html += "<div id='phelpcontent'>" + self.purpose + "</div>" if self.idevice.tip != "": html += "<div id='phelptitle'>" + _('Tip:') + "</div>" html += "<div id='phelpcontent'>" + self.idevice.tip + "</div>" html += "</div>" html += "</div>\n" html += "</div>\n" self.message = "" return html
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