This is the mail archive of the
gnats-devel@sources.redhat.com
mailing list for the GNATS project.
PATCH: Empty table cells in Gnatsweb query results
- To: gnats-devel at sources dot redhat dot com
- Subject: PATCH: Empty table cells in Gnatsweb query results
- From: Yngve Svendsen <yngve dot svendsen at clustra dot com>
- Date: Thu, 05 Apr 2001 00:12:50 +0200
Fix for problems where the table in the Query Results page contained empty
cells.
Yngve Svendsen
IS Engineer
Clustra AS, Trondheim, Norway
yngve.svendsen@clustra.com
2001-04-04 Yngve Svendsen <yngve.svendsen@clustra.com>
* gnatsweb.pl (display_query_results): Use the provided 'nonempty'
routine to pad empty cells with 's instead of the if used in
the last checkin. This only takes care of the cases where the empty
cells are not at the end of a row.
* gnatsweb.pl (display_query_results): When there are one or more
empty cells at the end of a query result row, the remaining cells
are padded with 's.
Index: gnatsweb.pl
===================================================================
RCS file: /cvs/gnats/gnats/contrib/gnatsweb/gnatsweb.pl,v
retrieving revision 2.30
diff -u -p -r2.30 gnatsweb.pl
--- gnatsweb.pl 2001/03/28 23:35:39 2.30
+++ gnatsweb.pl 2001/04/04 22:08:17
@@ -1793,6 +1793,7 @@ sub display_query_results
$ufield='Number';
}
print "\n<th><a href=\"$href\">$ufield</a></th>\n";
+ $nooffields = @ufields;
}
# Reset param 'sortby' to its original value, so that 'store query' works.
@@ -1835,19 +1836,20 @@ sub display_query_results
# map them back into strings.
if ($fieldtypes[$whichfield] eq 'enum')
{
- my $enumvals = fieldinfo($ufields[$whichfield], 'values');
- $fieldcontents = $$enumvals[$fieldcontents - 1] || 'invalid';
+ my $enumvals = fieldinfo($ufields[$whichfield], 'values');
+ $fieldcontents = $$enumvals[$fieldcontents - 1] || 'invalid';
}
$fieldcontents = $q->escapeHTML($fieldcontents);
- if ($fieldcontents)
- {
- print "<td nowrap>$fieldcontents</td>";
- }
- else
- {
- print "<td nowrap> </td>";
- }
+ $fieldcontents = nonempty($q->escapeHTML($fieldcontents));
+ print "<td nowrap>$fieldcontents</td>";
$whichfield++;
+ }
+ # Pad the remaining, empty columns with 's
+ my $n = @{$_};
+ while ($nooffields - $n > 0)
+ {
+ print "<td> </td>";
+ $n++;
}
print "\n</tr>\n";
}