comparison MoinMoin/util/web.py @ 422:1fe19d424346

added size attr to select widget imported from: moin--main--1.5--patch-426
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 04 Feb 2006 13:24:45 +0000
parents a54cebaab73e
children e0e016a553bd
comparison
equal deleted inserted replaced
421:8eefc299cf06 422:1fe19d424346
49 else: 49 else:
50 icon = "www" 50 icon = "www"
51 51
52 return request.theme.make_icon(icon) 52 return request.theme.make_icon(icon)
53 53
54 def makeSelection(name, values, selectedval=None): 54 def makeSelection(name, values, selectedval=None, size=1):
55 """ Make a HTML <select> element named `name` from a value list. 55 """ Make a HTML <select> element named `name` from a value list.
56 The list can either be a list of strings, or a list of 56 The list can either be a list of strings, or a list of
57 (value, label) tuples. 57 (value, label) tuples.
58 58
59 `selectedval` is the value that should be pre-selected. 59 `selectedval` is the value that should be pre-selected.
60 """ 60 """
61 from MoinMoin.widget import html 61 from MoinMoin.widget import html
62 result = html.SELECT(name=name) 62 result = html.SELECT(name=name, size="%d" % int(size))
63 for val in values: 63 for val in values:
64 if not isinstance(val, type(())): 64 if not isinstance(val, type(())):
65 val = (val, val) 65 val = (val, val)
66 result.append(html.OPTION( 66 result.append(html.OPTION(
67 value=val[0], selected=(val[0] == selectedval)) 67 value=val[0], selected=(val[0] == selectedval))