--- loncom/interface/lonindexer.pm 2004/10/20 10:54:08 1.126 +++ loncom/interface/lonindexer.pm 2005/02/17 08:50:20 1.130 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.126 2004/10/20 10:54:08 foxr Exp $ +# $Id: lonindexer.pm,v 1.130 2005/02/17 08:50:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -136,7 +136,7 @@ sub handler { } #Hijack lonindexer to verify a title and be close down. if ($ENV{'form.launch'} eq '2') { - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); my $extra=''; if (defined($ENV{'form.titleelement'}) && $ENV{'form.titleelement'} ne '') { @@ -145,9 +145,12 @@ sub handler { $verify_title=~s/'/\\'/g; $extra='window.opener.document.forms["'.$ENV{'form.form'}.'"].elements["'.$ENV{'form.titleelement'}.'"].value=\''.$verify_title.'\';'; } + my $html=&Apache::lonxml::xmlbegin(); $r->print(< - - + + + ENDSUBM @@ -343,11 +347,14 @@ END } # ---------------------------------------------------------------- Print Header + my $html=&Apache::lonxml::xmlbegin(); $r->print(< +$html The LearningOnline Network With CAPA Directory Browser + + ENDJS } @@ -846,7 +854,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"); @@ -874,7 +882,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("". @@ -966,7 +974,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 (''. @@ -1233,29 +1241,6 @@ sub cleanup { } -# -# 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; -}