Code

Fix height calculation for Multilink.menu()
authorstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 16 Feb 2009 21:19:51 +0000 (21:19 +0000)
committerstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 16 Feb 2009 21:19:51 +0000 (21:19 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4134 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/templating.py

index 0cf33a958ebce6c817f4c87fc7f800e0170fdafe..73459f4dccc9f5af7b5cb97dcd6426057122292c 100644 (file)
@@ -2083,7 +2083,18 @@ class MultilinkHTMLProperty(HTMLProperty):
             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)