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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 31 May 2002 21:50:31 -0000


albertel		Fri May 31 17:50:31 2002 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  - lonindexer now deals with titles with HTML and " in them properly (BUG#487)
  - Complex RAT needs to escape " before sending them out. (And currently uses &#34 rather than &quot)
  - Simple Rat seems to work okay.
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.41 loncom/interface/lonindexer.pm:1.42
--- loncom/interface/lonindexer.pm:1.41	Thu May  9 19:01:41 2002
+++ loncom/interface/lonindexer.pm	Fri May 31 17:50:30 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.41 2002/05/09 23:01:41 www Exp $
+# $Id: lonindexer.pm,v 1.42 2002/05/31 21:50:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -743,8 +743,8 @@
 	    $title = &Apache::lonnet::metadata($filelink,'title')
 		if ($metafile == 1);
 	    $title=$listname unless $title;
-	    my $titleesc=$title;
-	    $titleesc=~s/\'/\\'/; #' (clean up this spare quote
+	    my $titleesc=HTML::Entities::encode($title);
+	    $titleesc=~s/\'/\\'/; #' (clean up this spare quote)
             $r->print("<a href=\"javascript:select_data(\'",
                       $titleesc,"','",$filelink,"')\">");
 	    $r->print("<img src='",$iconpath,"select.gif' border='0' /></a>".
@@ -756,6 +756,7 @@
 	    $title = &Apache::lonnet::metadata($filelink,'title')
 		if ($metafile == 1);
 	    $title=$listname unless $title;
+	    my $titleesc=&HTML::Entities::encode($title);
 	    $r->print("<form name='form$fnum'>\n");
 	    $r->print("<input type='checkbox' name='filelink"."' ".
 		      "value='$filelink' onClick='".
@@ -765,11 +766,11 @@
 	    }
 	    $r->print(">\n");
 	    $r->print("<input type='hidden' name='title"."' ".
-		      "value='$title'>\n");
+		      "value='$titleesc'>\n");
 	    $r->print("</form>\n");
 	    $r->print("</td><td valign='bottom' nowrap bgcolor=$fileclr>");
 	    $hash{"pre_${fnum}_link"}=$filelink;
-	    $hash{"pre_${fnum}_title"}=$title;
+	    $hash{"pre_${fnum}_title"}=$titleesc;
   	    $fnum++;
 	}