本文整理汇总了Python中exe.webui.common.elementInstruc函数的典型用法代码示例。如果您正苦于以下问题:Python elementInstruc函数的具体用法?Python elementInstruc怎么用?Python elementInstruc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elementInstruc函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: renderButtons
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
示例2: renderEdit
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
示例3: renderEdit
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
示例4: renderEdit
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
示例5: renderEdit
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
示例6: renderQuestionPreview
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
示例7: renderEdit
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