";
} else {
if ($target eq 'tex') {
- $result .= '\item \vskip -2mm ';
- } else {
+ if($env{'form.pdfFormFields'} eq 'yes') {
+ my $fieldname = $env{'request.symb'}.
+ '&part_'. $Apache::inputtags::part.
+ '&radiobuttonresponse'.
+ '&HWVAL_' . $Apache::inputtags::response['-1'];
+ my $value = $temp;
+ my $text = $Apache::response::foilgroup{$name.'.text'};
+ $result .= &Apache::lonxml::print_pdf_radiobutton($fieldname,
+ $value,
+ $text)."\n";
+ } else {
+ $result .= '\item \vskip -2mm ';
+ }
+ } else {
$result.=" ";
}
}
if ($target eq 'tex') {
- $result .= '$\bigcirc$'.$Apache::response::foilgroup{$name.'.text'}.'\\\\'; #' stupid emacs
+ if($env{'form.pdfFormFields'} ne 'yes') {
+ $result .= '$\bigcirc$'.$Apache::response::foilgroup{$name.'.text'}.'\\\\'; #' stupid emacs
+ }
$i++;
} else {
$result .= '';
}
@@ -379,33 +405,6 @@ sub displayallfoils {
return $result;
}
-=pod
-
-=item &whichfoils($max,$randomize)
-
-Randomizes the list of foils.
-Respects
- - each foils desire to be randomized
- - the existance of Concept groups of foils (select 1 foil from each)
- - and selects a single correct statement from all possilble true statments
- - and limits it to a toal of $max foils
-
-WARNING: this routine uses the random number generator, it should only
-be called once per target, otherwise it can cause randomness changes in
-homework problems.
-
-Arguments
- $max - maximum number of foils to select (including the true one)
- (so a max of 5 is: 1 true, 4 false)
-
- $randomize - whether to randomize the listing of foils, by default
- will randomize, only if randomize is 'no' will it not
-
-Returns
- $answer - location in the array of the correct answer
- @foils - array of foil names in to display order
-
-=cut
sub whichfoils {
my ($max,$randomize)=@_;
@@ -441,7 +440,7 @@ sub whichfoils {
}
}
if (!$havetrue && $Apache::lonhomework::type ne 'survey') {
- &Apache::lonxml::error("There are no true statements available. ");
+ &Apache::lonxml::error(&mt('There are no true statements available.').' ');
}
} else {
my $current=0;
@@ -502,7 +501,7 @@ sub whichfoils {
my $dosplice=1;
if ($notrue && $Apache::lonhomework::type ne 'survey') {
$dosplice=0;
- &Apache::lonxml::error("There are no true statements available. ");
+ &Apache::lonxml::error(&mt('There are no true statements available.').' ');
}
#insert the true statement, keeping track of where it wants to be
if ($Apache::response::foilgroup{$truename.'.location'} eq 'top' && $dosplice) {
@@ -566,9 +565,13 @@ sub displayfoils {
$result.='\item \vskip -2 mm ';
}
if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
- if ($target ne 'tex') { $result.='Correct:'; } else { $result.='Correct: \textbf{';}
+ if ($target ne 'tex') {
+ $result.=&mt('Correct:').'';
+ } else {
+ $result.=&mt('Correct:').' \textbf{';
+ }
} else {
- $result.='Incorrect:';
+ $result.=&mt('Incorrect:');
}
if ($target eq 'web') { $result.="
";
@@ -759,11 +773,11 @@ sub end_foil {
if ($value ne 'unused') {
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
if ($name eq "") {
- &Apache::lonxml::warning("Foils without names exist. This can cause problems to malfunction.");
+ &Apache::lonxml::warning(&mt('Foils without names exist. This can cause problems to malfunction.'));
$name=$Apache::lonxml::curdepth;
}
if (defined($Apache::response::foilnames{$name})) {
- &Apache::lonxml::error(&mt("Foil name [_1] appears more than once. Foil names need to be unique.",$name));
+ &Apache::lonxml::error(&mt('Foil name [_1] appears more than once. Foil names need to be unique.',''.$name.''));
}
$Apache::response::foilnames{$name}++;
my $location =&Apache::lonxml::get_param('location',$parstack,
@@ -794,4 +808,87 @@ sub insert_foil {
}
1;
__END__
+
+
+
+=head1 NAME
+
+Apache::radiobuttonresponse
+
+=head1 SYNOPSIS
+
+Handles multiple-choice style responses.
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+=head1 SUBROUTINES
+
+=over
+
+=item start_radiobuttonresponse()
+
+=item bubble_line_count()
+
+=item end_radiobuttonresponse()
+
+=item start_foilgroup()
+
+=item storesurvey()
+
+=item grade_response()
+
+=item end_foilgroup()
+
+=item getfoilcounts()
+
+=item format_prior_answer()
+
+=item displayallfoils()
+
+=item &whichfoils($max,$randomize)
+
+Randomizes the list of foils.
+Respects
+ - each foils desire to be randomized
+ - the existance of Concept groups of foils (select 1 foil from each)
+ - and selects a single correct statement from all possilble true statments
+ - and limits it to a toal of $max foils
+
+WARNING: this routine uses the random number generator, it should only
+be called once per target, otherwise it can cause randomness changes in
+homework problems.
+
+Arguments
+ $max - maximum number of foils to select (including the true one)
+ (so a max of 5 is: 1 true, 4 false)
+
+ $randomize - whether to randomize the listing of foils, by default
+ will randomize, only if randomize is 'no' will it not
+
+Returns
+ $answer - location in the array of the correct answer
+ @foils - array of foil names in to display order
+
+=item displayfoils()
+
+=item displayallanswers()
+
+=item displayanswers()
+
+=item start_conceptgroup()
+
+=item end_conceptgroup()
+
+=item insert_conceptgroup()
+
+=item start_foil()
+
+=item end_foil()
+
+=item insert_foil()
+
+=back
+
+=cut