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

perl/modules/W3C/LinkChecker/bin checklink,4.68,4.69

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 14 Sep 2007 05:14:32 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1IW3Vg-0008Lc-5l@lionel-hutz.w3.org>

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

Modified Files:
	checklink 
Log Message:
* pre-filling form with the URI being checked
* only output footer intro blurb on home page, not results
* giving class to "progress" <pre> for styling



Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 4.68
retrieving revision 4.69
diff -u -d -r4.68 -r4.69
--- checklink	13 Sep 2007 16:38:22 -0000	4.68
+++ checklink	14 Sep 2007 05:14:29 -0000	4.69
@@ -375,7 +375,7 @@
     @{$Opts{Base_Locations}} = @bases;
     # Transform the parameter into a URI
     $uri = &urize($uri);
-    &check_uri($uri, $is_first, $Opts{Depth}, undef, undef, 1);
+    &check_uri(undef, $uri, $is_first, $Opts{Depth}, undef, undef, 1);
     $is_first &&= 0;
   }
   undef $is_first;
@@ -464,7 +464,6 @@
     $cookie = $query->cookie(%cookie);
   }
 
-  undef $query; # Not needed any more.
 
   # All Apache configurations don't set HTTP_AUTHORIZATION for CGI scripts.
   # If we're under mod_perl, there is a way around it...
@@ -487,7 +486,8 @@
     }
   }
 
-  &check_uri($uri, 1, $Opts{Depth}, $cookie);
+  &check_uri($query, $uri, 1, $Opts{Depth}, $cookie);
+  undef $query; # Not needed any more.
   &html_footer();
 }
 
@@ -713,13 +713,15 @@
 # Check for broken links in a resource #
 ########################################
 
-sub check_uri ($$$;$$$)
+sub check_uri ($$$$;$$$)
 {
-  my ($uri, $is_first, $depth, $cookie, $referer, $is_start) = @_;
+  my ($query, $uri, $is_first, $depth, $cookie, $referer, $is_start) = @_;
   $is_start ||= $is_first;
 
   if ($Opts{HTML}) {
     &html_header($uri, 0, $cookie) if $is_first;
+    &print_form($query) if $is_start;
+    
     print('<h2>');
   }
 
@@ -803,7 +805,7 @@
              &encode(sprintf($Cfg{Markup_Validator_URI}, $esc_uri)),
              &encode(sprintf($Cfg{CSS_Validator_URI}, $esc_uri)),
              &encode($Opts{_Self_URI}));
-      print("<pre>\n");
+      print("<pre id=\"progress\">\n");
     }
   }
 
@@ -971,9 +973,9 @@
         }
       }
       if ($depth < 0) {
-        &check_uri($u, 0, -1, undef, $uri);
+        &check_uri($query, $u, 0, -1, undef, $uri);
       } else {
-        &check_uri($u, 0, $depth-1, undef, $uri);
+        &check_uri($query, $u, 0, $depth-1, undef, $uri);
       }
     }
   }
@@ -2218,11 +2220,15 @@
 sub html_footer ()
 {
   printf("<p>%s</p>\n", &global_stats()) if ($doc_count > 0 && !$Opts{Quiet});
-  printf(<<'EOF', $Cfg{Doc_URI}, $Cfg{Doc_URI}, $PACKAGE, $REVISION);
+  if (! $doc_count) {
+  printf(<<'EOF', $Cfg{Doc_URI}, $Cfg{Doc_URI}); 
   <div class="intro">
       <p>This Link Checker looks for issues in links, anchors and referenced objects in a Web page, or recursively on a whole Web site. 
       For best results, it is recommended to first ensure that the documents checked use <a href="http://validator.w3.org/">Valid (X)HTML Markup</a>. The Link Checker is part of the W3C's <a href="http://www.w3.org/QA/Tools/">validators and Quality Web tools</a>.</p>
   </div>
+EOF
+}
+printf(<<'EOF', $PACKAGE, $REVISION);
 </div><!-- main -->
 <ul class="navbar" id="menu">
   <li><a href="%s" accesskey="3" title="Documentation for this Link Checker Service">Docs</a></li>
@@ -2269,6 +2275,7 @@
   my $chk = ' checked="checked"';
   $q->param('hide_type', 'all') unless $q->param('hide_type');
 
+  my $requested_uri = &encode($q->param('uri') || ''); 
   my $sum = $q->param('summary')              ? $chk : '';
   my $red = $q->param('hide_redirects')       ? $chk : '';
   my $all = ($q->param('hide_type') ne 'dir') ? $chk : '';
@@ -2292,7 +2299,7 @@
   print "<form action=\"", $Opts{_Self_URI}, "\" method=\"get\" onsubmit=\"return uriOk()\">
 <p><label for=\"uri\">Enter the address (<a href=\"http://www.w3.org/Addressing/\">URL</a>)
 of a document that you would like to check:</label></p>
-<p><input type=\"text\" size=\"50\" id=\"uri\" name=\"uri\" value=\"\"></p>
+<p><input type=\"text\" size=\"50\" id=\"uri\" name=\"uri\" value=\"",$requested_uri,"\"></p>
 <fieldset>
   <legend>Options</legend>
   <p>
Received on Friday, 14 September 2007 05:14:37 GMT

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