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

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 22 Apr 2003 20:43:40 -0000


sakharuk		Tue Apr 22 16:43:40 2003 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  1. Empty space was added (2 mm) after textline;
  2. Textfield box was implemented with width and heigth calculated based on rows and cols attributes. 
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.93 loncom/homework/inputtags.pm:1.94
--- loncom/homework/inputtags.pm:1.93	Mon Apr 21 16:59:02 2003
+++ loncom/homework/inputtags.pm	Tue Apr 22 16:43:40 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.93 2003/04/21 20:59:02 albertel Exp $
+# $Id: inputtags.pm,v 1.94 2003/04/22 20:43:40 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -124,11 +124,17 @@
     }
     $result.=&Apache::edit::modifiedfield();
   } elsif ($target eq 'tex') {
+      my $number_of_lines = &Apache::lonxml::get_param('rows',$parstack,$safeeval);
+      my $width_of_box = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
       if ($$tagstack[-2] eq 'essayresponse' and $Apache::lonhomework::type eq 'exam') {
-	  my $number_of_lines= &Apache::lonxml::get_param('rows',$parstack,$safeeval);
 	  $result = '\fbox{\fbox{\parbox{\textwidth-5mm}{';
-	for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
-	$result.='\strut \\\\\strut \\\\\strut \\\\\strut \\\\}}}';
+	  for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
+	  $result.='\strut \\\\\strut \\\\\strut \\\\\strut \\\\}}}';
+      } else {
+	  my $TeXwidth=$width_of_box/80;
+	  $result = '\vskip 1 mm \fbox{\fbox{\parbox{'.$TeXwidth.'\textwidth-5mm}{';
+	  for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
+	  $result.='}}}\vskip 2 mm ';
       }
   }
   return $result;
@@ -182,7 +188,7 @@
   } elsif ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
       my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
       if ($size != 0) {$size=$size*2; $size.=' mm';} else {$size='40 mm';}
-      $result='\framebox['.$size.'][s]{\tiny\strut}';
+      $result='\framebox['.$size.'][s]{\tiny\strut}\vskip 2 mm';
   }
   return $result;
 }