public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Empty table cells in Gnatsweb query results
@ 2001-04-04 15:14 Yngve Svendsen
  0 siblings, 0 replies; only message in thread
From: Yngve Svendsen @ 2001-04-04 15:14 UTC (permalink / raw)
  To: gnats-devel

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 &nbsp;'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 &nbsp;'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>&nbsp;</td>";
-      }
+      $fieldcontents = nonempty($q->escapeHTML($fieldcontents));
+      print "<td nowrap>$fieldcontents</td>";
        $whichfield++;
+    }
+    # Pad the remaining, empty columns with &nbsp;'s
+    my $n = @{$_};
+    while ($nooffields - $n > 0)
+    {
+      print "<td>&nbsp;</td>";
+      $n++;
      }
      print "\n</tr>\n";
    }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-04-04 15:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-04 15:14 PATCH: Empty table cells in Gnatsweb query results Yngve Svendsen

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).