--- loncom/homework/optionresponse.pm 2008/08/08 16:37:13 1.151 +++ 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 2008/08/08 16:37:13 bisitz Exp $ +# $Id: optionresponse.pm,v 1.152 2008/09/11 17:38:14 onken Exp $ # # Copyright Michigan State University Board of Trustees # @@ -159,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; } @@ -290,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; @@ -423,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') { @@ -467,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') { @@ -482,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; } }