public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
From: Lars Henriksen <Lars.Henriksen@netman.dk>
To: Yngve Svendsen <yngve.svendsen@sun.com>
Cc: Dieperink Alwin <alwin.dieperink@elca.ch>,
	"'help-gnats@gnu.org'" <help-gnats@gnu.org>
Subject: Re: Removed lines in responsible
Date: Thu, 31 Oct 2002 15:34:00 -0000	[thread overview]
Message-ID: <20021031202927.GA834415@cluster1.netman.dk> (raw)
Message-ID: <20021031153400.2BLYlIjU3dEAsa2xGqbZm-Q2N0n9rGP7Oqe8UXPIg2I@z> (raw)
In-Reply-To: <20021028083728.GA708614@cluster1.netman.dk>

On Mon, Oct 28, 2002 at 09:37:28AM +0100, Lars Henriksen wrote:
> On Sun, Oct 27, 2002 at 10:48:14PM +0100, Yngve Svendsen wrote:
> > At 13:25 24.10.2002 +0200, Lars Henriksen wrote:
> > ... 
> > Committed. there were some problems with hash references, but I cleaned it 
> > up.
> 
> Oops. Sorry about that. Some of my local changes crept in here. I have found
> that with many categories and many responsibles, it's nice to have the menues
> alphabetically sorted (as they were in gnatsweb 2.9.3). I have been planning
> to submit a patch so here it comes (see below).

Unfortunately I managed to mess up my own changes so the patch mentioned above
wasn't quite correct.

I you want alphabetically sorted Category and Responsible menues (like in
gnatsweb 2.9.3) here is the patch.

Lars Henriksen

Index: gnatsweb.pl
===================================================================
RCS file: /cvsroot/gnatsweb/gnatsweb/gnatsweb.pl,v
retrieving revision 1.115
diff -u -r1.115 gnatsweb.pl
--- gnatsweb.pl	27 Oct 2002 22:33:18 -0000	1.115
+++ gnatsweb.pl	31 Oct 2002 20:25:59 -0000
@@ -1063,7 +1063,11 @@
     # Get default value(s).
     my $default = fieldinfo($_, 'default');
 
-    my $values = fieldinfo($_, 'values');
+    my @values = @{fieldinfo($_, 'values')};
+    if ($_ eq $CATEGORY_FIELD || $_ eq $SUBMITTER_ID_FIELD)
+    {
+      @values = sort {lc($a) cmp lc($b)} @values;
+    }
 
     # The "intro" provides a way for the site callback to print something
     # at the top of a given field.
@@ -1081,16 +1085,16 @@
       # Force user to choose a category.
       if ($_ eq $CATEGORY_FIELD)
       {
-        push(@$values, "unknown") if (!grep /^unknown$/, @$values);
+        push(@values, "unknown") if (!grep /^unknown$/, @values);
         $default = "unknown";
       }
-      print popup_or_scrolling_menu($_, $values, $default),
+      print popup_or_scrolling_menu($_, \@values, $default),
             "</td>\n</tr>\n";
     }
     elsif (fieldinfo ($_, 'fieldtype') eq 'multienum')
     {
       my $defaultsref = parse_multienum($default, $_);
-      print multiselect_menu($_, $values, $defaultsref),
+      print multiselect_menu($_, \@values, $defaultsref),
             "</td>\n</tr>\n";
     }
     elsif (fieldinfo($_, 'fieldtype') eq "multitext")
@@ -1563,7 +1567,12 @@
 
     $field_number++;
 
-    my $values = fieldinfo($_, 'values');
+    my @values = @{fieldinfo ($_, 'values')};
+    if ($_ eq $CATEGORY_FIELD ||
+        $_ eq $SUBMITTER_ID_FIELD ||
+        $_ eq $RESPONSIBLE_FIELD) {
+      @values = sort {lc($a) cmp lc($b)} @values;
+    }
 
     # The "intro" provides a way for the site callback to print something
     # at the top of a given field.
@@ -1576,18 +1585,18 @@
     {
       my $default = $fields{$_};
       # Check whether field value is a known enumeration value.
-      if (!(grep /^$default$/, @$values))
+      if (!(grep /^$default$/, @values))
       {
-	push(@$values, 'unknown') if (!grep /^unknown$/, @$values);
+	push(@values, 'unknown') if (!grep /^unknown$/, @values);
 	$default = 'unknown';
       }
-      print popup_or_scrolling_menu($_, $values, $default),
+      print popup_or_scrolling_menu($_, \@values, $default),
             "</td>\n</tr>\n";
     }
     elsif (fieldinfo ($_, 'fieldtype') eq 'multienum')
     {
       my $defaultsref = parse_multienum($fields{$_}, $_);
-      print multiselect_menu($_, $values, $defaultsref),
+      print multiselect_menu($_, \@values, $defaultsref),
       "</td>\n</tr>\n";
     }
     elsif (fieldinfo ($_, 'fieldtype') eq 'multitext')
@@ -1867,8 +1876,12 @@
     if (fieldinfo($_, 'fieldtype') =~ /enum/)
     {
       print "<tr><td valign=top>$_:</td>\n<td>";
-      my $value_list=fieldinfo($_, 'values');
-      my @values=('any', @$value_list);
+      my @values = @{fieldinfo($_, 'values')};
+      if ($_ eq $RESPONSIBLE_FIELD || $_ eq $CATEGORY_FIELD)
+      {
+        @values=sort {lc($a) cmp lc($b)} @values;
+      }
+      @values=('any', @values);
       if (fieldinfo($_, 'fieldtype') eq 'enum')
       {
         print popup_or_scrolling_menu ($_, \@values, $values[0]);
@@ -2054,11 +2067,15 @@
     print "<td>";
     if (fieldinfo($_, 'fieldtype') =~ 'enum')
     {
-      my $ary_ref = fieldinfo($_, 'values');
-      my $size = scalar(@$ary_ref);
+      my @values = @{fieldinfo($_, 'values')};
+      if ($_ eq $RESPONSIBLE_FIELD || $_ eq $CATEGORY_FIELD)
+      {
+        @values = sort {lc($a) cmp lc($b)} @values;
+      }
+      my $size = @values;
       $size = 4 if $size > 4;
       print $q->scrolling_list(-name=>$_,
-                               -values=>$ary_ref,
+                               -values=>\@values,
                                -multiple=>1,
                                -size=>$size);
     }


_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

  reply	other threads:[~2002-10-31 20:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A13B47F8EC3FD111A91500C04FD2A282021FA39F@exchange.elca.ch>
     [not found] ` <5.1.0.14.2.20021014210535.04654818@ms-etro01-01.norway>
2002-10-24  4:29   ` Lars Henriksen
2002-10-27 13:48     ` Yngve Svendsen
2002-10-28  0:45       ` Lars Henriksen
2002-10-31 12:50         ` Lars Henriksen [this message]
2002-10-31 15:34           ` Lars Henriksen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021031202927.GA834415@cluster1.netman.dk \
    --to=lars.henriksen@netman.dk \
    --cc=alwin.dieperink@elca.ch \
    --cc=help-gnats@gnu.org \
    --cc=yngve.svendsen@sun.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).