--- loncom/homework/optionresponse.pm 2008/12/11 01:59:01 1.151.2.1
+++ loncom/homework/optionresponse.pm 2008/09/11 17:38:14 1.152
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.151.2.1 2008/12/11 01:59:01 raeburn Exp $
+# $Id: optionresponse.pm,v 1.152 2008/09/11 17:38:14 onken Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,23 +45,21 @@ sub start_optionresponse {
%Apache::hint::option=();
undef(%Apache::response::foilnames);
if ($target eq 'edit') {
- $result.=&Apache::edit::start_table($token)
- .'
'.&mt('Multiple Option Response Question').' '
- .&Apache::loncommon::help_open_topic('Option_Response_Problems')." | "
- .''.&mt('Delete?').' '
- .&Apache::edit::deletelist($target,$token)
- .' | '
- ." "
- .&Apache::edit::end_row()
- .&Apache::edit::start_spanning_row()
- ."\n";
+ $result.=&Apache::edit::start_table($token).
+ " |
Multiple Option Response Question ".
+ &Apache::loncommon::help_open_topic('Option_Response_Problems')." | Delete:".
+ &Apache::edit::deletelist($target,$token)
+ ." | ".
+ &Apache::edit::end_row().
+ &Apache::edit::start_spanning_row().
+ "\n";
$result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max',
$token,'4').
- &Apache::edit::select_arg('Randomize Foil Order:','randomize',
+ &Apache::edit::select_arg('Randomize Foil Order','randomize',
['yes','no'],$token).
&Apache::edit::select_arg(&mt('Display of options when printed'),'TeXlayout',
- [['horizontal','Normal list'],
- ['vertical','Listed in a vertical column']],$token).
+ [['horizontal',&mt('Normal list')],
+ ['vertical',&mt('Listed in a vertical column')]],$token).
&Apache::edit::end_row().&Apache::edit::start_spanning_row();
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
@@ -161,8 +159,12 @@ ENDTABLE
} # else nothing changed so just use the default mechanism
}
if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
+ if($env{'form.pdfFormFields'} ne 'yes') {
$result .= ' \renewcommand{\labelenumi}{\Alph{enumi}.}
\begin{enumerate} ';
+ } else {
+ $result .= "\\\\";
+ }
}
return $result;
}
@@ -292,7 +294,11 @@ sub end_foilgroup {
$result.=&Apache::edit::end_table();
}
if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
+ if($env{'form.pdfFormFields'} ne 'yes') {
$result .= '\end{enumerate}';
+ } else {
+ $result .= "\\\\";
+ }
}
&Apache::response::poprandomnumber();
return $result;
@@ -425,13 +431,27 @@ sub displayfoils {
}
my $lastopt=$lastresponse{$name};
my $optionlist="\n";
+
+ if($target eq 'tex' and $env{'form.pdfFormFields'} eq 'yes') {
+ my $fieldname = $env{'request.symb'}.'&part_'.$Apache::inputtags::part.'&optionresponse'.'&HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp;
+ $optionlist = &Apache::lonxml::print_pdf_start_combobox($fieldname);
+ }
+
foreach my $option (@opt) {
my $escopt=&HTML::Entities::encode($option,'\'"&<>');
- if ($option eq $lastopt) {
- $optionlist.="\n";
- } else {
- $optionlist.="\n";
- }
+ if ($option eq $lastopt) {
+ if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
+ $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
+ } else {
+ $optionlist.="\n";
+ }
+ } else {
+ if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
+ $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
+ } else {
+ $optionlist.="\n";
+ }
+ }
}
if ($target ne 'tex') {
if ($Apache::lonhomework::type ne 'exam') {
@@ -469,13 +489,18 @@ sub displayfoils {
if ($text=~m/\\item /) {
if ($Apache::lonhomework::type eq 'exam') {
$text=~s/\\item/\\vskip 2 mm/;
- }
- $result.= $texoptionlist.$text;
- } else {
+ } elsif ($env{'form.pdfFormFields'} ne 'yes') {
+ $result.= $texoptionlist.$text;
+ }
+ } else {
if ($Apache::lonhomework::type eq 'exam') {
$result.= $texoptionlist.' '.$text;
- } else {
- if ($text=~/\S/) {$result.= $texoptionlist.'\vspace*{-2 mm}\item '.$text;} else {$result.= $texoptionlist;}
+ } elsif ($env{'form.pdfFormFields'} ne 'yes') {
+ if ($text=~/\S/) {
+ $result.= $texoptionlist.'\vspace*{-2 mm}\item '.$text;
+ } else {
+ $result.= $texoptionlist;
+ }
}
}
if ($Apache::lonhomework::type eq 'exam') {
@@ -484,6 +509,12 @@ sub displayfoils {
'\end{enumerate} \vskip -8 mm \strut ';
$internal_counter++;
}
+ if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
+ $text =~ s/.*indent(.*)$/$1/;
+ $text = $1;
+ $result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\';
+ $temp++;
+ }
$displayoptionintex=0;
}
}
|