version 1.125, 2004/10/20 10:51:50
|
version 1.127, 2004/10/21 09:53:44
|
Line 74 my @Omit = ();
|
Line 74 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 |
# ----------------------------- Handling routine called via Apache and mod_perl |
sub handler { |
sub handler { |
Line 871 sub display_line {
|
Line 846 sub display_line {
|
$diropen.'.gif"'); |
$diropen.'.gif"'); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
"\n"); |
"\n"); |
my $quotable_filecom = &javascript_escape($filecom[0]); |
my $quotable_filecom = &Apache::loncommon::javascript_escape($filecom[0]); |
$r->print ('<a href="javascript:gothere(\''.$quotable_filecom. |
$r->print ('<a href="javascript:gothere(\''.$quotable_filecom. |
'\')"><img src="'.$iconpath.'server.gif"'); |
'\')"><img src="'.$iconpath.'server.gif"'); |
$r->print (' border="0" /></a>'."\n"); |
$r->print (' border="0" /></a>'."\n"); |
Line 899 sub display_line {
|
Line 874 sub display_line {
|
'.gif"'); |
'.gif"'); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
"\n"); |
"\n"); |
my $quotable_curdir = &javascript_escape($curdir); |
my $quotable_curdir = &Apache::loncommon::javascript_escape($curdir); |
$r->print ('<a href="javascript:gothere(\''.$quotable_curdir |
$r->print ('<a href="javascript:gothere(\''.$quotable_curdir |
.'\')"><img src='. |
.'\')"><img src='. |
$iconpath.'quill.gif border="0" name="'.$msg. |
$iconpath.'quill.gif border="0" name="'.$msg. |
Line 930 sub display_line {
|
Line 905 sub display_line {
|
$r->print("<tr valign='$valign' bgcolor=$fileclr><td nowrap='1' align='top'>"); |
$r->print("<tr valign='$valign' bgcolor=$fileclr><td nowrap='1' align='top'>"); |
|
|
if ($ENV{'form.catalogmode'} eq 'interactive') { |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
my $quotable_filelink = &javascript_escape($filelink); |
my $quotable_filelink = &Apache::loncommon::javascript_escape($filelink); |
$r->print("<a href=\"javascript:select_data(\'", |
$r->print("<a href=\"javascript:select_data(\'", |
$quotable_filelink,"')\">"); |
$quotable_filelink,"')\">"); |
$r->print("<img src='",$iconpath,"select.gif' border='0' /></a>". |
$r->print("<img src='",$iconpath,"select.gif' border='0' /></a>". |
Line 991 sub display_line {
|
Line 966 sub display_line {
|
if ($filelink=~/\.(page|sequence)$/) { |
if ($filelink=~/\.(page|sequence)$/) { |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
my $quotable_filelink = &javascript_escape($filelink); |
my $quotable_filelink = &Apache::loncommon::javascript_escape($filelink); |
|
|
|
|
$r->print (" <a href=\"javascript:openWindow('".$quotable_filelink. |
$r->print (" <a href=\"javascript:openWindow('".$quotable_filelink. |
Line 1058 sub display_line {
|
Line 1033 sub display_line {
|
my $source = &Apache::lonnet::metadata($filelink,'sourceavail'); |
my $source = &Apache::lonnet::metadata($filelink,'sourceavail'); |
if($source eq 'open') { |
if($source eq 'open') { |
my $sourcelink = &Apache::lonsource::make_link($filelink,$listname); |
my $sourcelink = &Apache::lonsource::make_link($filelink,$listname); |
my $quotable_sourcelink = &javascript_escape($sourcelink); |
my $quotable_sourcelink = &Apache::loncommon::javascript_escape($sourcelink); |
$r->print('<td>'."<a href=\"javascript:openWindow('" |
$r->print('<td>'."<a href=\"javascript:openWindow('" |
.$quotable_sourcelink. |
.$quotable_sourcelink. |
"', 'previewsource', '700', '700', 'no', 'yes','yes')\";". |
"', 'previewsource', '700', '700', 'no', 'yes','yes')\";". |
Line 1137 sub display_line {
|
Line 1112 sub display_line {
|
'folder_pointer_'.$diropen.'.gif"'); |
'folder_pointer_'.$diropen.'.gif"'); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'. |
"\n"); |
"\n"); |
my $quotable_curdir = &javascript_escape($curdir); |
my $quotable_curdir = &Apache::loncommon::javascript_escape($curdir); |
$r->print ('<a href="javascript:gothere(\'' |
$r->print ('<a href="javascript:gothere(\'' |
.$quotable_curdir.'\')"><img src="'. |
.$quotable_curdir.'\')"><img src="'. |
$iconpath.'folder_'.$diropen.'.gif" border="0" /></a>'. |
$iconpath.'folder_'.$diropen.'.gif" border="0" /></a>'. |
Line 1257 sub cleanup {
|
Line 1232 sub cleanup {
|
} |
} |
} |
} |
|
|
|
|
|
|
|
|
|
|
=head1 NAME |
=head1 NAME |
|
|
Apache::lonindexer - mod_perl module for cross server filesystem browsing |
Apache::lonindexer - mod_perl module for cross server filesystem browsing |