Skip to content

Commit 8f4648c

Browse files
author
Richard Jones
committed
Added optional additional property to display in a Multilink form menu.
1 parent 738e3c2 commit 8f4648c

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

roundup/htmltemplate.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: htmltemplate.py,v 1.91 2002-05-31 00:08:02 richard Exp $
18+
# $Id: htmltemplate.py,v 1.92 2002-06-11 04:57:04 richard Exp $
1919

2020
__doc__ = """
2121
Template engine.
@@ -262,8 +262,13 @@ def do_multiline(self, property, rows=5, cols=40):
262262
return '<textarea name="%s" rows="%s" cols="%s">%s</textarea>'%(
263263
property, rows, cols, value)
264264

265-
def do_menu(self, property, size=None, height=None, showid=0):
266-
''' for a Link property, display a menu of the available choices
265+
def do_menu(self, property, size=None, height=None, showid=0,
266+
additional=[]):
267+
''' For a Link/Multilink property, display a menu of the available
268+
choices
269+
270+
If the additional properties are specified, they will be
271+
included in the text of each option in (brackets, with, commas).
267272
'''
268273
if not self.nodeid and self.form is None and self.filterspec is None:
269274
return _('[Field: not called from item]')
@@ -300,6 +305,11 @@ def do_menu(self, property, size=None, height=None, showid=0):
300305
lab = option
301306
if size is not None and len(lab) > size:
302307
lab = lab[:size-3] + '...'
308+
if additional:
309+
m = []
310+
for propname in additional:
311+
m.append(linkcl.get(optionid, propname))
312+
lab = lab + ' (%s)'%', '.join(m)
303313
lab = cgi.escape(lab)
304314
l.append('<option %svalue="%s">%s</option>'%(s, optionid,
305315
lab))
@@ -329,6 +339,11 @@ def do_menu(self, property, size=None, height=None, showid=0):
329339
lab = option
330340
if size is not None and len(lab) > size:
331341
lab = lab[:size-3] + '...'
342+
if additional:
343+
m = []
344+
for propname in additional:
345+
m.append(linkcl.get(optionid, propname))
346+
lab = lab + ' (%s)'%', '.join(m)
332347
lab = cgi.escape(lab)
333348
l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
334349
l.append('</select>')
@@ -1176,6 +1191,9 @@ def render(self, form):
11761191

11771192
#
11781193
# $Log: not supported by cvs2svn $
1194+
# Revision 1.91 2002/05/31 00:08:02 richard
1195+
# can now just display a link/multilink id - useful for stylesheet stuff
1196+
#
11791197
# Revision 1.90 2002/05/25 07:16:24 rochecompaan
11801198
# Merged search_indexing-branch with HEAD
11811199
#

0 commit comments

Comments
 (0)