From: Robert Lupton the Good <rhl@astro.Princeton.EDU>
To: help-gnats@gnu.org
Subject: patch for gnatsweb.pl
Date: Mon, 16 Sep 2002 07:45:00 -0000 [thread overview]
Message-ID: <15749.58061.833413.564756@wire7.Princeton.EDU> (raw)
In-Reply-To: <20020915103254.22538.88942.Mailman@monty-python.gnu.org>
(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 "<td>$_:</td>\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 "<td>",
$q->textfield(-name=>$lc_fieldname,
-size=>$width, -value=>$$values_hash{$_});
***************
*** 2013,2022 ****
# one can simply say "not closed".
if ($_ eq $STATE_FIELD)
{
print "<br>",
$q->checkbox_group(-name=>'ignoreclosed',
-values=>['Ignore Closed'],
! -defaults=>['Ignore Closed']),
}
print "</td>\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 "<br>",
$q->checkbox_group(-name=>'ignoreclosed',
-values=>['Ignore Closed'],
! -defaults=>\@defaults),
}
print "</td>\n";
***************
*** 2024,2030 ****
print "<td>";
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
next prev parent reply other threads:[~2002-09-16 13:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20020915103254.22538.88942.Mailman@monty-python.gnu.org>
2002-09-16 6:56 ` Patch " Robert Lupton the Good
2002-09-16 7:24 ` patch " Robert Lupton the Good
2002-09-16 7:45 ` Robert Lupton the Good [this message]
2002-09-16 6:48 Patch " Robert Lupton the Good
2002-09-17 9:47 ` Yngve Svendsen
2002-09-23 12:22 ` Lars Henriksen
2002-09-25 11:18 ` Lars Henriksen
2002-09-25 11:43 ` Yngve Svendsen
2002-09-25 13:13 ` Lars Henriksen
2002-09-26 15:46 ` Robert Lupton the Good
2002-09-27 0:32 ` Robert Lupton the Good
2002-09-30 2:07 ` Lars Henriksen
-- strict thread matches above, loose matches on Subject: below --
2002-09-16 6:46 Robert Lupton the Good
2001-09-06 14:09 patch " David, Lysander
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=15749.58061.833413.564756@wire7.Princeton.EDU \
--to=rhl@astro.princeton.edu \
--cc=help-gnats@gnu.org \
/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).