This is the mail archive of the gnats-devel@sources.redhat.com mailing list for the GNATS project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Empty table cells in Gnatsweb query results


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]