diff roundup/cgi/templating.py @ 4042:8831882170fc

Fix height calculation for Multilink.menu()
author Stefan Seefeld <stefan@seefeld.name>
date Mon, 16 Feb 2009 21:19:51 +0000
parents b6a2251394dd
children 32965347a663
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Mon Feb 16 21:10:04 2009 +0000
+++ b/roundup/cgi/templating.py	Mon Feb 16 21:19:51 2009 +0000
@@ -2083,7 +2083,18 @@
             for opt in linkcl.filter(None, conditions, sort_on)
             if self._db.security.hasPermission("View", self._client.userid,
                 linkcl.classname, itemid=opt)]
-        height = height or min(len(options), 7)
+        
+        # make sure we list the current values if they're retired
+        for val in value:
+            if val not in options:
+                options.insert(0, val)
+
+        if not height:
+            height = len(options)
+            if value:
+                # The "no selection" option.
+                height += 1
+            height = min(height, 7)
         l = ['<select multiple name="%s" size="%s">'%(self._formname, height)]
         k = linkcl.labelprop(1)
 

Roundup Issue Tracker: http://roundup-tracker.org/