[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 02 Jul 2004 08:09:49 -0000


albertel		Fri Jul  2 04:09:49 2004 EDT

  Modified files:              
    /loncom/homework	randomlabel.pm 
  Log:
  - BUG#3136, returns in <label>s cause a 'vt' to appear in the label
  - <labelgourp>s with out a name blew things up, now is just doesn't set the variables up
  
  
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.60 loncom/homework/randomlabel.pm:1.61
--- loncom/homework/randomlabel.pm:1.60	Fri Mar 12 16:01:14 2004
+++ loncom/homework/randomlabel.pm	Fri Jul  2 04:09:49 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # random labelling tool
 #
-# $Id: randomlabel.pm,v 1.60 2004/03/12 21:01:14 albertel Exp $
+# $Id: randomlabel.pm,v 1.61 2004/07/02 08:09:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -260,6 +260,7 @@
 
 sub add_vars {
     my ($name,$order,$label,$labelorder,$value,$image,$safeeval) = @_;
+    if (!defined($name) || $name eq '') { return; }
     my $code = '${'.$name."}{'".($order+1)."'}='".$label."';";
     my $out=Apache::run::run($code,$safeeval);
     if ($value) {
@@ -451,6 +452,8 @@
 	    my $description = &Apache::lonxml::get_param('description',
 							 $parstack,$safeeval);
 	    push(@Apache::randomlabel::description,$description);
+	} else {
+	    $ltext=~s/[\r\n]*//gs
 	}
 	push(@Apache::randomlabel::label_arr,$ltext);
     }