--- loncom/homework/radiobuttonresponse.pm 2008/12/11 03:29:30 1.134.2.1 +++ loncom/homework/radiobuttonresponse.pm 2008/09/05 12:50:45 1.135 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # mutliple choice style responses # -# $Id: radiobuttonresponse.pm,v 1.134.2.1 2008/12/11 03:29:30 raeburn Exp $ +# $Id: radiobuttonresponse.pm,v 1.135 2008/09/05 12:50:45 onken Exp $ # # Copyright Michigan State University Board of Trustees # @@ -65,21 +65,19 @@ sub start_radiobuttonresponse { if ($target eq 'meta') { $result=&Apache::response::meta_package_write('radiobuttonresponse'); } elsif ($target eq 'edit' ) { - $result.=&Apache::edit::start_table($token) - .''.&Apache::lonxml::description($token) - .&Apache::loncommon::help_open_topic('Radio_Response_Problems') - .'' - .''.&mt('Delete?').' ' - .&Apache::edit::deletelist($target,$token) - .'' - .' '.&Apache::edit::end_row() - .&Apache::edit::start_spanning_row(); + $result.=&Apache::edit::start_table($token). + ''.&Apache::lonxml::description($token). + &Apache::loncommon::help_open_topic('Radio_Response_Problems'). + "Delete:". + &Apache::edit::deletelist($target,$token) + ." ".&Apache::edit::end_row() + .&Apache::edit::start_spanning_row(); $result.= &Apache::edit::text_arg('Max Number Of Shown Foils:','max', - $token,'4').' 'x 3 . - &Apache::edit::select_arg('Randomize Foil Order:','randomize', - ['yes','no'],$token).' 'x 3 . - &Apache::edit::select_arg('Display Direction:','direction', + $token,'4'). + &Apache::edit::select_arg('Randomize Foil Order','randomize', + ['yes','no'],$token). + &Apache::edit::select_arg('Display Direction','direction', ['vertical','horizontal'],$token). &Apache::edit::end_row(). &Apache::edit::start_spanning_row()."\n"; @@ -102,7 +100,12 @@ sub start_radiobuttonresponse { } else { $result .= ' \renewcommand{\labelenumi}{\Alph{enumi}.}'; } - $result .= '\begin{enumerate}'; + if($env{'form.pdfFormFields'} eq 'yes') { + $result .= &Apache::lonxml::print_pdf_hiddenfield('meta', $env{'user.name'}, $env{'user.domain'}); + $result .= "\n\\\\\n\\\\\n"; + } else { + $result .= '\begin{enumerate}'; + } } elsif ($target eq 'analyze') { my $part_id="$Apache::inputtags::part.$id"; $Apache::lonhomework::analyze{"$part_id.type"} = 'radiobuttonresponse'; @@ -115,7 +118,9 @@ sub end_radiobuttonresponse { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result; if ($target eq 'edit') { $result=&Apache::edit::end_table(); } - if ($target eq 'tex') { $result .= '\end{enumerate}'; } + if ($target eq 'tex' and $env{'form.pdfFormFields'} ne 'yes') { + $result .= '\end{enumerate}'; + } &Apache::response::end_response; pop @Apache::lonxml::namespace; &Apache::lonxml::deregister('Apache::radiobuttonresponse',('foilgroup','foil','conceptgroup')); @@ -349,13 +354,27 @@ sub displayallfoils { $result.=""; } 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 .= '