[LON-CAPA-cvs] cvs: rat / lonsequence.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 16 Jan 2007 21:19:12 -0000


albertel		Tue Jan 16 16:19:12 2007 EDT

  Modified files:              
    /rat	lonsequence.pm 
  Log:
  - display of maps with entities in titles was incorrect
  
  
Index: rat/lonsequence.pm
diff -u rat/lonsequence.pm:1.29 rat/lonsequence.pm:1.30
--- rat/lonsequence.pm:1.29	Thu Nov  2 16:27:58 2006
+++ rat/lonsequence.pm	Tue Jan 16 16:19:11 2007
@@ -2,7 +2,7 @@
 #
 # Sequence Handler
 #
-# $Id: lonsequence.pm,v 1.29 2006/11/02 21:27:58 albertel Exp $
+# $Id: lonsequence.pm,v 1.30 2007/01/16 21:19:11 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,6 +37,7 @@
 use Apache::lonpageflip();
 use Apache::loncommon();
 use Apache::lonlocal;
+use HTML::Entities();
 
 my %selhash;
 my $successtied;
@@ -169,10 +170,15 @@
 		$r->print('<form name="form'.$idx.'">');
             }
 	    my ($title,$url)=split(/\:/,$_);
-            $title=~s/\&colon\;/\:/g;
-            $url=~s/\&colon\;/\:/g;
-            unless ($title) { $title=(split(/\//,$url))[-1] };
-            unless ($title) { $title='<i>'.&mt('Empty').'</i>'; }
+	    $title = &LONCAPA::map::qtescape($title);
+	    unless ($title) { $title=(split(/\//,$url))[-1] };
+            my $enc_title = &HTML::Entities::encode($title,'\'"<>&');
+	    unless ($title) {
+		$title='<i>'.&mt('Empty').'</i>';
+		$enc_title = &mt('Empty');
+	    }
+	    $url  = &LONCAPA::map::qtescape($url);
+            my $enc_url = &HTML::Entities::encode($url,'\'"<>&');
             if ($url) {
 		if ($successtied) {
 		    my $checked='';
@@ -181,16 +187,17 @@
 	           }
 	           $selhash{"pre_${idx}_link"}=$url;
 	           $selhash{"pre_${idx}_title"}=$title;
-
+		    
+		    $url  = &HTML::Entities::encode($url, '\'"<>&');
 		    $r->print(<<ENDCHECKBOX);
 <input type='checkbox' name='filelink' 
-value='$url' onClick='javascript:queue("form$idx")'$checked>
-<input type='hidden' name='title' value='$title'>
+value='$enc_url' onClick='javascript:queue("form$idx")'$checked />
+<input type='hidden' name='title' value='$enc_title' />
 ENDCHECKBOX
                 }
-		$r->print('<a href="'.&LONCAPA::map::qtescape($url).'">');
+		$r->print('<a href="'.$enc_url.'">');
             }
-            $r->print(&LONCAPA::map::qtescape($title));
+            $r->print($enc_title);
             if ($url) { $r->print('</a>'); }
             if ($successtied) {
 		$r->print('</form>');