[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 23 Nov 2004 16:04:34 -0000


matthew		Tue Nov 23 11:04:34 2004 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  Tightned up the code in &crumbs even further.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.98 loncom/interface/lonhtmlcommon.pm:1.99
--- loncom/interface/lonhtmlcommon.pm:1.98	Tue Nov 23 09:53:05 2004
+++ loncom/interface/lonhtmlcommon.pm	Tue Nov 23 11:04:33 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.98 2004/11/23 14:53:05 matthew Exp $
+# $Id: lonhtmlcommon.pm,v 1.99 2004/11/23 16:04:33 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -904,18 +904,20 @@
     $output.='<font size="'.$size.'">'.$prefix.'/';
     if ($ENV{'user.adv'}) {
 	my $path=$prefix.'/';
-	foreach (split('/',$uri)) {
-	    unless ($_) { next; }
-	    $path.=$_;
+	foreach my $dir (split('/',$uri)) {
+            if (! $dir) { next; }
+            $path .= $dir;
 	    unless ($path eq $uri) { $path.='/'; }
-            my $escaped_linkpath = &Apache::loncommon::escape_single($path);
+            my $linkpath = &Apache::loncommon::escape_single($path);
             if ($form) {
-		$escaped_linkpath="javascript:$form.action='".
-                    &Apache::loncommon::escape_single($path).
-                    "';$form.submit();";
+		$linkpath=
+                    qq{javascript:$form.action='$linkpath';$form.submit();};
             }
-	    my $escaped_target   = &Apache::loncommon::escape_single($target);
-	    $output.='<a href="'.$escaped_linkpath.'"'.($target?' target="'.$escaped_target.'"':'').'>'.$_.'</a>/';
+            if ($target) { 
+                $target = ' target="'.
+                    &Apache::loncommon::escape_single($target).'"';
+            }
+	    $output.=qq{<a href="$linkpath" $target>$dir</a>/};
 	}
     } else {
 	$output.=$uri;