--- loncom/interface/lonindexer.pm 2004/10/20 10:51:50 1.125 +++ loncom/interface/lonindexer.pm 2004/10/21 11:18:41 1.128 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.125 2004/10/20 10:51:50 foxr Exp $ +# $Id: lonindexer.pm,v 1.128 2004/10/21 11:18:41 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,31 +74,6 @@ my @Omit = (); -# -# Escapes strings that may have embedded 's that will be put into -# javascript strings as 'strings'. -# The assumptions are: -# There has been no effort to escape ' with \' -# Any \'s in the string are intended to be there as part of the URL -# and must also be escaped. -# Parameters: -# input - The string to escape. -# Returns: -# The escaped string (' replaced by \' and \ replaced by \\). -# -sub javascript_escape { - my ($input) = @_; - - # I imagine a regexp wizard could combine the two expressions below. - # If you do you might want to comment the result. - - $input =~ s/\\/\\\\/g; # Escape the /'s..(must be first)> - $input =~ s/\'/\\\'/g; # Esacpe the 's.... - - return $input; -} - - # ----------------------------- Handling routine called via Apache and mod_perl sub handler { @@ -172,6 +147,7 @@ sub handler { } $r->print(< + ENDJS } @@ -871,7 +849,7 @@ sub display_line { $diropen.'.gif"'); $r->print (' name="'.$msg.'" height="22" type="image" border="0">'. "\n"); - my $quotable_filecom = &javascript_escape($filecom[0]); + my $quotable_filecom = &Apache::loncommon::escape_single($filecom[0]); $r->print ('print (' border="0" />'."\n"); @@ -899,7 +877,7 @@ sub display_line { '.gif"'); $r->print (' name="'.$msg.'" height="22" type="image" border="0">'. "\n"); - my $quotable_curdir = &javascript_escape($curdir); + my $quotable_curdir = &Apache::loncommon::escape_single($curdir); $r->print ('"); if ($ENV{'form.catalogmode'} eq 'interactive') { - my $quotable_filelink = &javascript_escape($filelink); + my $quotable_filelink = &Apache::loncommon::escape_single($filelink); $r->print(""); $r->print("". @@ -991,7 +969,7 @@ sub display_line { if ($filelink=~/\.(page|sequence)$/) { $r->print(''); } - my $quotable_filelink = &javascript_escape($filelink); + my $quotable_filelink = &Apache::loncommon::escape_single($filelink); $r->print (" print(''."print (' name="'.$msg.'" height="22" type="image" border="0">'. "\n"); - my $quotable_curdir = &javascript_escape($curdir); + my $quotable_curdir = &Apache::loncommon::escape_single($curdir); $r->print (''. @@ -1257,6 +1235,10 @@ sub cleanup { } } + + + + =head1 NAME Apache::lonindexer - mod_perl module for cross server filesystem browsing