W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2010

link-checker commit: adding status (error, warning, info) icon

From: Mercurial notifier <nobody@w3.org>
Date: Thu, 05 Aug 2010 14:47:10 +0000
To: link-checker updates <www-validator-cvs@w3.org>
Message-Id: <E1Oh1iw-0005wN-Nu@blinky.w3.org>
changeset:   197:9ce8cfe9a7be
user:        ot
date:        Tue Sep 18 06:43:26 2007 +0000
files:       bin/checklink docs/linkchecker.css
description:
adding status (error, warning, info) icon


diff -r 8547b39dd6d4 -r 9ce8cfe9a7be bin/checklink
--- a/bin/checklink	Tue Sep 18 06:39:18 2007 +0000
+++ b/bin/checklink	Tue Sep 18 06:43:26 2007 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2007 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 4.72 2007-09-18 06:09:56 ot Exp $
+# $Id: checklink,v 4.73 2007-09-18 06:43:25 ot Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -204,7 +204,7 @@
   $PROGRAM     = 'W3C-checklink';
   $VERSION     = '4.3';
   $REVISION    = sprintf('version %s (c) 1999-2007 W3C', $VERSION);
-  my ($cvsver) = q$Revision: 4.72 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver) = q$Revision: 4.73 $ =~ /(\d+[\d\.]*\.\d+)/;
   $AGENT       = sprintf('%s/%s [%s] %s',
                          $PROGRAM, $VERSION, $cvsver, LWP::RobotUA->_agent());
 
@@ -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) = @_;
diff -r 8547b39dd6d4 -r 9ce8cfe9a7be docs/linkchecker.css
--- a/docs/linkchecker.css	Tue Sep 18 06:39:18 2007 +0000
+++ b/docs/linkchecker.css	Tue Sep 18 06:43:26 2007 +0000
@@ -4,7 +4,7 @@
    Copyright 2000-2007 W3C (MIT, INRIA, Keio). All Rights Reserved.
    See http://www.w3.org/Consortium/Legal/ipr-notice.html#Copyright
 
-   $Id: linkchecker.css,v 1.20 2007-09-14 05:30:56 ot Exp $
+   $Id: linkchecker.css,v 1.21 2007-09-18 06:43:26 ot Exp $
 */
 
 html, body {
@@ -315,12 +315,14 @@
     padding:0;
     border-bottom: 1px solid #EAEBEE;
 }
-dl.report dt {border-top: 1px solid #EAEBEE;}
 dl.report dt, dl.report dd {
   border-left: 1px solid #EAEBEE;
   border-right: 1px solid #EAEBEE;
   border-bottom: 0;
   padding: 1em;
+}
+dl.report dt {border-top: 1px solid #EAEBEE;
+  padding-left: .5em;
 }
 dl.report dd {
   border-top: 0;
@@ -341,7 +343,8 @@
   background-color: aqua;
 }
 .redirect {
-  background-color: yellow;
+  font-weight: normal;
+  font-style: italic;
 }
 .broken {
   background-color: red;
@@ -350,5 +353,13 @@
   background-color: fuchsia;
 }
 .dubious {
-  background-color: #ccc;
+  background-color: #dadada;
 }
+
+span.err_type img {
+    width: 1.2em;
+    height: 1.2em;
+    padding-bottom: .2em;
+    margin-right: .5em;
+    vertical-align: middle;
+}
\ No newline at end of file
Received on Thursday, 5 August 2010 14:47:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:43 UTC