示例#1
0
 def inputfield(self, escape_html_chars='<>":={}()', label=0):
     s = [
         '<select id="%s" name="%s" %s  size="%d" %s>' %
         (self.name, self.name, self.__accesskeyfield__(), self.size,
          " multiple" * (self.multiselect > 0))
     ]
     for i in self.options:
         if type(i) is types.TupleType:
             optionvalue = i[0]
             optiontext = i[1]
         else:
             optionvalue = optiontext = i
         if type(self.default) is types.ListType:
             optionselected = optionvalue in self.default
         else:
             optionselected = optionvalue == self.default
         s.append('<option value="%s"%s>%s</option>' %
                  (charset.recode(
                      charset.escapeHTML(optionvalue, escape_html_chars),
                      self.charset, 'html4'), ' selected' *
                   (optionselected),
                   charset.recode(
                       charset.escapeHTML(optiontext, escape_html_chars),
                       self.charset, 'html4')))
     s.append('</select>')
     return self.__label__(label) + self.inputfield_template % string.join(
         s, '\n')
示例#2
0
 def contentprint(self):
     """
 HTML output of self.content using the print template
 in self.contentprint_template.
 """
     return self.contentprint_template % (charset.recode(
         charset.escapeHTML(self.content), self.charset, 'html4'))
示例#3
0
 def contentprint(self):
   """
   HTML output of self.content using the print template
   in self.contentprint_template.
   """
   return self.contentprint_template % (
     charset.recode(
       charset.escapeHTML(self.content),
       self.charset,'html4'
     )
   )
示例#4
0
  def inputfield(self,escape_html_chars='<>":={}()',label=0):
    s = ['<select id="%s" name="%s" %s  size="%d" %s>' % (
      self.name,self.name,self.__accesskeyfield__(),self.size," multiple"*(self.multiselect>0))]
    for i in self.options:
      if type(i) is types.TupleType:
        optionvalue = i[0]
	optiontext = i[1]
      else:
        optionvalue = optiontext = i
      if type(self.default) is types.ListType:
	optionselected = optionvalue in self.default
      else:
	optionselected = optionvalue == self.default
      s.append(
	'<option value="%s"%s>%s</option>' % (
	  charset.recode(charset.escapeHTML(optionvalue,escape_html_chars),self.charset,'html4'),
	  ' selected'*(optionselected),
	  charset.recode(charset.escapeHTML(optiontext,escape_html_chars),self.charset,'html4')
	)
      )
    s.append('</select>')
    return self.__label__(label)+self.inputfield_template % string.join(s,'\n')
示例#5
0
 def __defaultprint__(self):
   """
   HTML output of self.content.
   """
   return charset.recode(charset.escapeHTML(self.default),self.charset,'html4')
示例#6
0
 def __defaultprint__(self):
     """
 HTML output of self.content.
 """
     return charset.recode(charset.escapeHTML(self.default), self.charset,
                           'html4')