[LON-CAPA-cvs] cvs: loncom /homework rankresponse.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Mon, 17 Mar 2003 20:08:21 -0000
sakharuk Mon Mar 17 15:08:21 2003 EDT
Modified files:
/loncom/homework rankresponse.pm
Log:
Can be printed now. Tested on my example and Ed's more sofisticated one (/msu/kashy/Testing/C2LC/A7rankingColors.problem). Works fine. Nevertheless needs more testing and especially for the situations where answers are there.
Index: loncom/homework/rankresponse.pm
diff -u loncom/homework/rankresponse.pm:1.2 loncom/homework/rankresponse.pm:1.3
--- loncom/homework/rankresponse.pm:1.2 Mon Jan 27 19:14:55 2003
+++ loncom/homework/rankresponse.pm Mon Mar 17 15:08:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# rank style response
#
-# $Id: rankresponse.pm,v 1.2 2003/01/28 00:14:55 albertel Exp $
+# $Id: rankresponse.pm,v 1.3 2003/03/17 20:08:21 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -91,13 +91,13 @@
sub end_foilgroup {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
- if ($target eq 'grade' || $target eq 'web' || $target eq 'answer') {
+ if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex') {
my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
$safeeval,'-2');
my $tol = &Apache::lonxml::get_param('tol',$parstack,$safeeval,'-2');
if (!defined($tol)) { $tol=0; }
- if ($target eq 'web') {
+ if ($target eq 'web' || $target eq 'tex') {
$result=&displayfoils($target,$max,$randomize,$tol);
} elsif ($target eq 'answer' ) {
$result=&displayanswers($max,$randomize,$tol);
@@ -250,26 +250,34 @@
my $part=$Apache::inputtags::part;
my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
my %lastresponse=&Apache::lonnet::str2hash($lastresponse);
+ my $localcount = 1;
foreach my $name (@whichfoils) {
my $lastopt=$lastresponse{$name};
- my $optionlist="<option></option>\n";
+ my $optionlist='';
+ if ($target ne 'tex') {$optionlist="<option></option>\n";}
my $option;
foreach $option (@whichopt) {
if ($option eq $lastopt) {
- $optionlist.="<option selected=\"on\">$option</option>\n";
+ if ($target ne 'tex') {$optionlist.="<option selected=\"on\">$option</option>\n";}
} else {
- $optionlist.="<option>$option</option>\n";
+ if ($target ne 'tex') {$optionlist.="<option>$option</option>\n";}
}
}
- $optionlist='<select name="HWVAL_'.
- $Apache::inputtags::response[-1].':'.$temp.'">'.
- $optionlist."</select>\n";
+ if ($target ne 'tex') {
+ $optionlist='<select name="HWVAL_'.
+ $Apache::inputtags::response[-1].':'.$temp.'">'.
+ $optionlist."</select>\n";
+ } else {
+ $optionlist=' '.$temp.' '.$optionlist.' ';
+ }
my $text=$Apache::response::foilgroup{$name.'.text'};
- $result.='<br />'.$optionlist.$text."\n";
+ if ($target ne 'tex') {
+ $result.='<br />'.$optionlist.$text."\n";
+ } else {$result.=' \\\\ '.$localcount.'. '.$text."\n"; $localcount++;}
$temp++;
}
}
- $result.="<br />";
+ if ($target ne 'tex') {$result.="<br />";} else {$result.=' \\\\ ';}
return $result;
}
@@ -395,7 +403,7 @@
sub start_foil {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
- if ($target eq 'web' ) {
+ if ($target eq 'web' || $target eq 'tex') {
&Apache::lonxml::startredirection;
} elsif ($target eq 'edit') {
$result=&Apache::edit::tag_start($target,$token,"Foil");
@@ -423,10 +431,10 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $text ='';
my $result = '';
- if ($target eq 'web') {
+ if ($target eq 'web' || $target eq 'tex') {
$text=&Apache::lonxml::endredirection;
}
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') {
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);
if ($value ne 'unused') {
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);