mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix for form_bulder (finally!!!) - at leasrt the unit test now pass...
This commit is contained in:
+30
-24
@@ -155,47 +155,53 @@ class SelectField(BaseField):
|
||||
else:
|
||||
return self.get_html_default( prefix )
|
||||
def get_html_checkboxes( self, prefix="" ):
|
||||
|
||||
rval = []
|
||||
box_len = 0
|
||||
for text in self.options:
|
||||
if box_len < len(text) :
|
||||
box_len = len(text)
|
||||
|
||||
if box_len <= 5 :
|
||||
rval.append('<table><tr>')
|
||||
|
||||
nn = 0
|
||||
ctr = 0
|
||||
box_len = 0
|
||||
for text, value, selected in self.options:
|
||||
if box_len > 5 :
|
||||
if box_len < len(text) :
|
||||
box_len = len(text)
|
||||
|
||||
if box_len <= 5 :
|
||||
rval.append('<table><tr>')
|
||||
|
||||
nn = 0
|
||||
ctr = 0
|
||||
style = ""
|
||||
|
||||
for text, value, selected in self.options:
|
||||
if len(self.options) > 2 and ctr % 2 == 1:
|
||||
#if ctr % 2 == 1:
|
||||
style = " class=\"odd_row\""
|
||||
else:
|
||||
style = ""
|
||||
if box_len > 5:
|
||||
if selected:
|
||||
rval.append( '<div%s><input type="checkbox" name="%s%s" value="%s" checked>%s</div>' % ( style, prefix, self.name, value, text) )
|
||||
else:
|
||||
rval.append( '<div%s><input type="checkbox" name="%s%s" value="%s">%s</div>' % ( style, prefix, self.name, value, text) )
|
||||
else :
|
||||
#If maximum length of all the texts is less than or equal 5, put 5 checkboxes on one line.
|
||||
if nn == 5 :
|
||||
nn = 0
|
||||
rval.append('</tr><tr>')
|
||||
else:
|
||||
#If maximum length of all the texts is less than or equal 5, put 5 checkboxes on one line.
|
||||
if nn == 5:
|
||||
nn = 0
|
||||
rval.append('</tr><tr>')
|
||||
if selected:
|
||||
rval.append( '<td><input type="checkbox" name="%s%s" value="%s" checked>%s</td>' % ( prefix, self.name, value, text) )
|
||||
else:
|
||||
rval.append( '<td><input type="checkbox" name="%s%s" value="%s">%s</td>' % ( prefix, self.name, value, text) )
|
||||
nn = nn + 1
|
||||
nn = nn + 1
|
||||
ctr += 1
|
||||
|
||||
if box_len <= 5 :
|
||||
rval.append('</tr></table>')
|
||||
|
||||
if box_len <= 5 :
|
||||
rval.append('</tr></table>')
|
||||
style = ""
|
||||
if len(self.options) > 2 and ctr % 2 == 1:
|
||||
style = " class=\"odd_row\""
|
||||
# if selected:
|
||||
# rval.append( '<div%s><input type="checkbox" name="%s" value="%s" checked>%s</div>' % ( style, self.name, value, text) )
|
||||
# else:
|
||||
# rval.append( '<div%s><input type="checkbox" name="%s" value="%s">%s</div>' % ( style, self.name, value, text) )
|
||||
ctr += 1
|
||||
|
||||
return "\n".join( rval )
|
||||
rval = []
|
||||
# rval = []
|
||||
|
||||
# ctr = 0
|
||||
# for text, value, selected in self.options:
|
||||
|
||||
Reference in New Issue
Block a user