Diff for /loncom/interface/lonindexer.pm between versions 1.124 and 1.125

version 1.124, 2004/09/25 17:58:01 version 1.125, 2004/10/20 10:51:50
Line 73  my @Only = (); Line 73  my @Only = ();
 my @Omit = ();  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 {
     my $r = shift;      my $r = shift;
Line 147  sub handler { Line 174  sub handler {
  <html>   <html>
  <script type="text/javascript">   <script type="text/javascript">
  function load() {   function load() {
  window.opener.document.forms["$ENV{'form.form'}"].elements["$ENV{'form.element'}"].value='$ENV{'form.acts'}';   window.opener.document.forms["$ENV{'form.form'}"]
       .elements["$ENV{'form.element'}"]
       .value='$ENV{'form.acts'}';
  $extra   $extra
  window.close();   window.close();
  }   }
Line 842  sub display_line { Line 871  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");
  $r->print ('<a href="javascript:gothere(\''.$filecom[0].   my $quotable_filecom = &javascript_escape($filecom[0]);
    $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");
  $r->print (&mt("Domain")." - $listname ");   $r->print (&mt("Domain")." - $listname ");
Line 869  sub display_line { Line 899  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");
  $r->print ('<a href="javascript:gothere(\''.$curdir.'\')"><img src='.   my $quotable_curdir = &javascript_escape($curdir);
    $r->print ('<a href="javascript:gothere(\''.$quotable_curdir
      .'\')"><img src='.
    $iconpath.'quill.gif border="0" name="'.$msg.     $iconpath.'quill.gif border="0" name="'.$msg.
    '" height="22" /></a>');     '" height="22" /></a>');
  my $domain=(split(m|/|,$startdir))[2];   my $domain=(split(m|/|,$startdir))[2];
Line 898  sub display_line { Line 930  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);
             $r->print("<a href=\"javascript:select_data(\'",              $r->print("<a href=\"javascript:select_data(\'",
                       $filelink,"')\">");                        $quotable_filelink,"')\">");
     $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".      $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".
       "\n");        "\n");
     $r->print("</td><td nowrap>");      $r->print("</td><td nowrap>");
Line 958  sub display_line { Line 991  sub display_line {
  if ($filelink=~/\.(page|sequence)$/) {   if ($filelink=~/\.(page|sequence)$/) {
     $r->print('</form>');      $r->print('</form>');
  }   }
  $r->print (" <a href=\"javascript:openWindow('".$filelink.   my $quotable_filelink = &javascript_escape($filelink);
   
   
    $r->print (" <a href=\"javascript:openWindow('".$quotable_filelink.
    "', 'previewfile', '450', '500', 'no', 'yes','yes')\";".     "', 'previewfile', '450', '500', 'no', 'yes','yes')\";".
    " TARGET=_self>$listname</a> ");     " TARGET=_self>$listname</a> ");
   
  $r->print (" (<a href=\"javascript:openWindow('".$filelink.   $r->print (" (<a href=\"javascript:openWindow('".$quotable_filelink.
    ".meta', 'metadatafile', '500', '550', 'no', 'yes','no')\"; ".     ".meta', 'metadatafile', '500', '550', 'no', 'yes','no')\"; ".
    "TARGET=_self>metadata</a>) ");     "TARGET=_self>metadata</a>) ");
  $r->print("</td>\n");   $r->print("</td>\n");
Line 1022  sub display_line { Line 1058  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);
  $r->print('<td>'."<a href=\"javascript:openWindow('".$sourcelink.   my $quotable_sourcelink = &javascript_escape($sourcelink);
    $r->print('<td>'."<a href=\"javascript:openWindow('"
     .$quotable_sourcelink.
   "', 'previewsource', '700', '700', 'no', 'yes','yes')\";".    "', 'previewsource', '700', '700', 'no', 'yes','yes')\";".
   " TARGET=_self>Yes</a> "."</td>\n");    " TARGET=_self>Yes</a> "."</td>\n");
     } else { #A cuddled else. :P      } else { #A cuddled else. :P
Line 1099  sub display_line { Line 1137  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");
  $r->print ('<a href="javascript:gothere(\''.$curdir.'\')"><img src="'.   my $quotable_curdir = &javascript_escape($curdir);
    $r->print ('<a href="javascript:gothere(\''
      .$quotable_curdir.'\')"><img src="'.
    $iconpath.'folder_'.$diropen.'.gif" border="0" /></a>'.     $iconpath.'folder_'.$diropen.'.gif" border="0" /></a>'.
    "\n");     "\n");
  $r->print ("$listname</td>\n");   $r->print ("$listname</td>\n");

Removed from v.1.124  
changed lines
  Added in v.1.125


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>