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

raeburn raeburn@source.lon-capa.org
Tue, 03 Feb 2009 21:11:16 -0000


raeburn		Tue Feb  3 21:11:16 2009 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Bug 5889. Escape any [ and ] included in the parameter description (or parameter name) to prevent Locale::Maketext() from triggering an ISE.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.427 loncom/interface/lonparmset.pm:1.428
--- loncom/interface/lonparmset.pm:1.427	Wed Jan 28 17:13:03 2009
+++ loncom/interface/lonparmset.pm	Tue Feb  3 21:11:16 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.427 2009/01/28 17:13:03 bisitz Exp $
+# $Id: lonparmset.pm,v 1.428 2009/02/03 21:11:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1316,9 +1316,14 @@
 	if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
 	    $r->print(' checked="checked"');
 	}
-	$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? &mt($$allparms{$tempkey})
-		                                  : &mt($tempkey))
-		  .'</label></td>');
+        my $displaykey;
+        if ($$allparms{$tempkey}=~/\S/) {
+            $displaykey = $$allparms{$tempkey};
+        } else {
+            $displaykey = $tempkey;
+        }
+        $displaykey =~ s/(\[|\])/~$1/g;
+        $r->print(' />'.&mt($displaykey).'</label></td>');
  	$cnt++;
         if ($cnt==3) {
 	    $r->print("</tr>\n<tr>");