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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 23 Sep 2003 21:20:42 -0000


albertel		Tue Sep 23 17:20:42 2003 EDT

  Modified files:              
    /loncom/homework	randomlabel.pm 
  Log:
  - texwidth and TeXwidth should work in randomlabel
  - default to 90 if no texwidth specified rather than blowing up
  
  
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.48 loncom/homework/randomlabel.pm:1.49
--- loncom/homework/randomlabel.pm:1.48	Mon Sep  8 15:17:34 2003
+++ loncom/homework/randomlabel.pm	Tue Sep 23 17:20:42 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # random labelling tool
 #
-# $Id: randomlabel.pm,v 1.48 2003/09/08 19:17:34 albertel Exp $
+# $Id: randomlabel.pm,v 1.49 2003/09/23 21:20:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -92,7 +92,8 @@
     }
     my $w= &check_int(&Apache::lonxml::get_param('width',$parstack,$safeeval));
     my $h= &check_int(&Apache::lonxml::get_param('height',$parstack,$safeeval));
-    my $texwidth= &Apache::lonxml::get_param('texwidth',$parstack,$safeeval);
+    my $texwidth= &Apache::lonxml::get_param('texwidth',$parstack,$safeeval,undef,1);
+    if (!$texwidth) { $texwidth=90; }
     $Apache::randomlabel::tlabel_cnt=0;
     $Apache::randomlabel::ilabel_cnt=0;
     if ($target eq 'web') {
@@ -178,7 +179,8 @@
 	$result='\end{picture}\\\\';
 	my $height=&Apache::lonxml::get_param('height',$parstack,$safeeval);
 	my $width=&Apache::lonxml::get_param('width',$parstack,$safeeval);
-	my $texwidth=&Apache::lonxml::get_param('texwidth',$parstack,$safeeval);
+	my $texwidth=&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,undef,1);
+        if (!$texwidth) { $texwidth=90; }
 	my $howtoskipback = $texwidth*$height/$width;
 	$result.= ' \vskip -'.$howtoskipback.' mm }  \\\\ ';
     } elsif ($target eq 'edit') {
@@ -285,7 +287,8 @@
 	my $WY1=0; #  Web y-coord. of (ULC)
 	my $wwidth=&Apache::lonxml::get_param('width',$parstack,$safeeval,-2);
 	my $wheight=&Apache::lonxml::get_param('height',$parstack,$safeeval,-2);
-	my $texwidth=&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,-2);
+	my $texwidth=&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,-2,1);
+	if (!$texwidth) { $texwidth=90; }
 	my $TX1=0;
 	my $TY1=$texwidth*($wheight/$wwidth);
 	my $TX2=$texwidth;