validator/httpd/cgi-bin check,1.430,1.431

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv13877/httpd/cgi-bin

Modified Files:
	check 
Log Message:
Bringing back number of errors to the results (not counting warnings and other messages), 
and adding info on outcome (pass/fail) at very top of results page.

See also:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=1810
http://www.w3.org/Bugs/Public/show_bug.cgi?id=1816




Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.430
retrieving revision 1.431
diff -u -d -r1.430 -r1.431
--- check	27 Jul 2005 04:32:01 -0000	1.430
+++ check	27 Jul 2005 09:23:51 -0000	1.431
@@ -806,7 +806,15 @@
     $T->param(has_errors => 1);
   }
   $T->param(valid_errors_num => $num_errors);
-  $T->param(file_errors => &report_errors($File));
+  my ($number_of_errors, $reported_errors) = &report_errors($File);
+  if ($number_of_errors > 1) {
+    $number_of_errors = "$number_of_errors errors"
+  }
+  else {
+    $number_of_errors = "$number_of_errors error"
+  }
+  $T->param(file_errors => $reported_errors);
+   $T->param(number_of_errors => $number_of_errors);
   if ($File->{'Is Valid'}) {
     $T->param(VALID => TRUE);
     $T->param(valid_status => 'Valid');
@@ -1423,6 +1431,7 @@
 sub report_errors ($) {
   my $File = shift;
   my $Errors = [];
+  my $number_of_errors = 0;
 
   # Hash to keep track of how many of each error is reported.
   my %Msgs; # Used to generate a UID for explanations.
@@ -1472,18 +1481,19 @@
       {
         $err->{class} = 'msg_err';
         $err->{err_type_err} = 1;
+        $number_of_errors += 1;
       }
-      elsif ($err->{type} eq 'W')
+      elsif (($err->{type} eq 'W') or ($err->{type} eq 'X') ) 
       {
         $err->{class} = 'msg_warn';
         $err->{err_type_warn} = 1;
       }
-      # TODO other classes for "W", "E" etc?
+      # TODO other classes for "X" etc? FIXME find all types of message.
 
       push @{$Errors}, $err;
     }
   }
-  return $Errors;
+  return $number_of_errors, $Errors;
 }
 
 #

Received on Wednesday, 27 July 2005 09:23:57 UTC