W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2007

perl/modules/W3C/LinkChecker/bin checklink,4.72,4.73

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 18 Sep 2007 06:43:27 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1IXWnv-0006Y8-Ve@lionel-hutz.w3.org>

Update of /sources/public/perl/modules/W3C/LinkChecker/bin
In directory hutz:/tmp/cvs-serv25134/bin

Modified Files:
	checklink 
Log Message:
adding status (error, warning, info) icon

Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 4.72
retrieving revision 4.73
diff -u -d -r4.72 -r4.73
--- checklink	18 Sep 2007 06:09:56 -0000	4.72
+++ checklink	18 Sep 2007 06:43:25 -0000	4.73
@@ -1733,7 +1733,7 @@
     my @unique = &sort_unique(map { line_number($_) }
                               keys %{$anchors->{$anchor}});
     if ($Opts{HTML}) {
-      $format = "<tr class=\"broken\"><td>%s</td><td>%s</td></tr>\n";
+      $format = "<tr><td class=\"broken\">%s</td><td>%s</td></tr>\n";
     } else {
       my $s = (scalar(@unique) > 1) ? 's' : '';
       $format = "\t%s\tLine$s: %s\n";
@@ -1852,19 +1852,19 @@
       my $redirmsg =
         $redirect_loop ? ' <em>redirect loop detected</em>' : '';
       printf("
-<dt%s>%s</dt>
-<dd>What to do: <strong%s>%s</strong>%s<br></dd>
+<dt%s>%s%s</dt>
+<dd>What to do: <em>%s</em>%s<br></dd>
 <dd>Response status code: %s<br>
 Response message: %s%s%s</dd>
 <dd>Line%s: %s</dd>\n",
              # Anchor for return codes
              $idref,
+             # Color
+             &status_icon($c),
              # List of redirects
              $redirected ?
              join(' redirected to ', @redirects_urls) . $redirmsg :
              &show_url($u),
-             # Color
-             &bgcolor($c),
              # What to do
              $whattodo,
              # Redirect too?
@@ -1890,7 +1890,7 @@
         my $fragment_direction = '';
         if ($currloc->{code} == 200) {
           $fragment_direction =
-            ' <strong class="broken">They need to be fixed!</strong>';
+            ' <strong>They need to be fixed!</strong>';
         }
         printf("<dd><dl><dt>Broken fragments and their line numbers: %s</dt>\n",
                $fragment_direction);
@@ -2026,7 +2026,7 @@
   } else {
     print('<h3>') if $Opts{HTML};
     print("\nList of broken links");
-    print(' and redirects') if $Opts{Redirects};
+    #print(' and redirects') if $Opts{Redirects};
 
     # Sort the URI's by HTTP Code
     my %code_summary;
@@ -2183,6 +2183,29 @@
   return;
 }
 
+sub status_icon($)
+{
+  my ($code) = @_;
+  my $icon_type;
+  my $r = HTTP::Response->new($code);
+  if ($r->is_success()) {
+    return '';
+  } elsif ($code == RC_ROBOTS_TXT()) {
+    $icon_type = 'info';
+  } elsif ($code == 300) {
+    $icon_type = 'info';
+  } elsif ($code == 401) {
+    $icon_type = 'error';
+  } elsif ($r->is_redirect()) {
+    $icon_type = 'warning';
+  } elsif ($r->is_error()) {
+    $icon_type = 'error';
+  } else {
+    $icon_type = 'error';
+  }
+  return('<span class="err_type"><img src="http://validator.w3.org/images/info_icons/'.$icon_type.'.png" alt="'.$icon_type.'" /></span>');
+  
+}
 sub bgcolor ($)
 {
   my ($code) = @_;
Received on Tuesday, 18 September 2007 06:52:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:59 GMT