help-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: Empty table cells in Gnatsweb query results


From: Yngve Svendsen
Subject: PATCH: Empty table cells in Gnatsweb query results
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
address@hidden


2001-04-04  Yngve Svendsen  <address@hidden>

        * 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";
   }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]