From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7894 invoked from network); 16 Sep 2002 13:56:49 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by sources.redhat.com with SMTP; 16 Sep 2002 13:56:49 -0000 Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17qwMp-0007qz-00; Mon, 16 Sep 2002 09:56:47 -0400 Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17qwLZ-0007gD-00 for help-gnats@gnu.org; Mon, 16 Sep 2002 09:55:29 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17qwLW-0007g0-00 for help-gnats@gnu.org; Mon, 16 Sep 2002 09:55:28 -0400 Received: from claven.astro.princeton.edu ([128.112.25.10]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17qwLW-0007fw-00 for help-gnats@gnu.org; Mon, 16 Sep 2002 09:55:26 -0400 Received: from wire7.Princeton.EDU (IDENT:tMkFGJotVnm8oSYzfDEsx1IcBkFolRfb@wire7 [128.112.24.203]) by claven.astro.princeton.edu (8.11.6/8.11.6) with ESMTP id g8GDtPG02911 for ; Mon, 16 Sep 2002 09:55:25 -0400 Received: (from rhl@localhost) by wire7.Princeton.EDU (8.11.6/8.11.2) id g8GDtPP28148; Mon, 16 Sep 2002 09:55:25 -0400 From: Robert Lupton the Good MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15749.58061.833413.564756@wire7.Princeton.EDU> To: help-gnats@gnu.org Subject: patch for gnatsweb.pl In-Reply-To: <20020915103254.22538.88942.Mailman@monty-python.gnu.org> References: <20020915103254.22538.88942.Mailman@monty-python.gnu.org> X-Mailer: VM 7.03 under Emacs 20.7.1 Sender: help-gnats-admin@gnu.org Errors-To: help-gnats-admin@gnu.org X-BeenThere: help-gnats@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General discussion about GNU GNATS List-Archive: Date: Mon, 16 Sep 2002 07:45:00 -0000 X-SW-Source: 2002-q3/txt/msg00086.txt.bz2 (This is my "patch.6", and brings me up-to-date, except that I haven't posted my custom sort calback from gnatsweb-site.pl) I should mention that all 7 of these patches are designed to be applied in series; I'd be happy to regenerate them relative to some baseline if requested. This patch: 1/ Check that $fields{$SUBMITTER_ID_FIELD} is defined; my site doesn't use it and gnats (otherwise) works fine. 2/ Fixes the code for "load stored query" to set options in scrolling lists as appropriate rather then simply inserting the corresponding regexp. This is especially important when using my exact-matches-for-scrolling-selections patch. 3/ Make "load stored query" handle "Ignore Closed" correctly. 4/ Fix the code that trims stored query cookies. There were two problems: "field=&" wasn't removed (just "field=;"), and the (long) return_url was included. This URL doesn't seem to be needed (if it is, we need to add a regexp to strip it's [quoted] "field=&" entries) R *** /u/gnats/src/Patches/gnatsweb.pl Fri Sep 13 08:45:31 2002 --- /u/dss/cgi-bin/gnatsweb-v4.pl Fri Sep 13 17:00:07 2002 *************** *** 1154,1160 **** { push(@errors, "Synopsis is blank or 'unknown'"); } ! if($fields{$SUBMITTER_ID_FIELD} eq 'unknown') { push(@errors, "Submitter-Id is 'unknown'"); } --- 1154,1161 ---- { push(@errors, "Synopsis is blank or 'unknown'"); } ! if(defined($fields{$SUBMITTER_ID_FIELD}) && ! $fields{$SUBMITTER_ID_FIELD} eq 'unknown') { push(@errors, "Submitter-Id is 'unknown'"); } *************** *** 2004,2009 **** --- 2005,2037 ---- print "$_:\n"; # 2nd column is regexp search field + # + # If we're loading a query the $$values_hash{$_} may contain + # a number of options ORd together rather than being a true + # regexp. If this is so, remove them from the value and set + # them as defaults for the scrolling list in column 3 + my $ary_ref = fieldinfo($_, 'values'); + my @ary_defaults; + if (fieldinfo($_, 'fieldtype') =~ 'enum') + { + my $value = ""; + if($$values_hash{$_}) + { + foreach (split(/\|/, $$values_hash{$_})) { + if (/^\^(.*)\$$/ && grep(/$1/, @$ary_ref)) + { + push @ary_defaults, $_; + } + else + { + $value .= "|" if($value); + $value .= $_; + } + } + $$values_hash{$_} = $value; + } + } + print "", $q->textfield(-name=>$lc_fieldname, -size=>$width, -value=>$$values_hash{$_}); *************** *** 2013,2022 **** # one can simply say "not closed". if ($_ eq $STATE_FIELD) { print "
", $q->checkbox_group(-name=>'ignoreclosed', -values=>['Ignore Closed'], ! -defaults=>['Ignore Closed']), } print "\n"; --- 2041,2062 ---- # one can simply say "not closed". if ($_ eq $STATE_FIELD) { + my @defaults; + if (defined(%$values_hash)) + { + if (defined($$values_hash{Ignoreclosed})) + { + @defaults = $$values_hash{Ignoreclosed}; + } + } + else + { + @defaults = 'Ignore Closed'; + } print "
", $q->checkbox_group(-name=>'ignoreclosed', -values=>['Ignore Closed'], ! -defaults=>\@defaults), } print "\n"; *************** *** 2024,2030 **** print ""; if (fieldinfo($_, 'fieldtype') =~ 'enum') { - my $ary_ref = fieldinfo($_, 'values'); my $size = scalar(@$ary_ref); my %ary_ref_names; foreach (@$ary_ref) { $ary_ref_names{"^$_\$"} = "$_"; } --- 2064,2069 ---- *************** *** 2033,2038 **** --- 2072,2078 ---- print $q->scrolling_list(-name=>$lc_fieldname, -values=>$ary_ref, -labels=>\%ary_ref_names, + -defaults=>\@ary_defaults, -multiple=>1, -size=>$size); } *************** *** 2622,2633 **** # Don't save certain params. $q->delete('cmd'); my $query_string = $q->query_string(); # strip empty params out of $query_string. in a gnats db with many # fields, the query-string will become very long, and may exceed the # 4K limit for cookies. ! $query_string =~ s/\w+=;//g; if (length($query_string . $global_cookie_path . "gnatsweb-query-$queryname") > 4050) { # this cookie is going to be longer than 4K, so we'll have to punt --- 2662,2674 ---- # Don't save certain params. $q->delete('cmd'); + $q->delete('return_url'); my $query_string = $q->query_string(); # strip empty params out of $query_string. in a gnats db with many # fields, the query-string will become very long, and may exceed the # 4K limit for cookies. ! $query_string =~ s/\w+=[;&]//g; if (length($query_string . $global_cookie_path . "gnatsweb-query-$queryname") > 4050) { # this cookie is going to be longer than 4K, so we'll have to punt *************** *** 2893,2901 **** if($key eq "Submitter_id") { $key = "Submitter-Id"; } ! # I'm guessing here... (RHL) $val =~ s/%2A/*/g; $val =~ s/%20/ /g; $val =~ s/%5B/[/g; $val =~ s/%5D/]/g; $val =~ s/%5E/^/g; --- 2934,2943 ---- if($key eq "Submitter_id") { $key = "Submitter-Id"; } ! # Undo hex escapes $val =~ s/%2A/*/g; $val =~ s/%20/ /g; + $val =~ s/%24/\$/g; $val =~ s/%5B/[/g; $val =~ s/%5D/]/g; $val =~ s/%5E/^/g; _______________________________________________ Help-gnats mailing list Help-gnats@gnu.org http://mail.gnu.org/mailman/listinfo/help-gnats