[LON-CAPA-cvs] cvs: loncom /homework optionresponse.pm
onken
onken@source.lon-capa.org
Mon, 04 May 2009 13:42:50 -0000
onken Mon May 4 13:42:50 2009 EDT
Modified files:
/loncom/homework optionresponse.pm
Log:
Disable printing PDF-Forms-Comboboxes in optionresponse if a problem is not answerable for students.
and
Correct/simpliefy a RegEx which parse Answers of options.
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.157 loncom/homework/optionresponse.pm:1.158
--- loncom/homework/optionresponse.pm:1.157 Wed Dec 10 21:48:21 2008
+++ loncom/homework/optionresponse.pm Mon May 4 13:42:50 2009
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.157 2008/12/10 21:48:21 raeburn Exp $
+# $Id: optionresponse.pm,v 1.158 2009/05/04 13:42:50 onken Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -439,7 +439,8 @@
my $lastopt=$lastresponse{$name};
my $optionlist="<option></option>\n";
- if($target eq 'tex' and $env{'form.pdfFormFields'} eq 'yes') {
+ if($target eq 'tex' and $env{'form.pdfFormFields'} eq 'yes'
+ && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
my $fieldname = $env{'request.symb'}.'&part_'.$Apache::inputtags::part.'&optionresponse'.'&HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp;
$optionlist = &Apache::lonxml::print_pdf_start_combobox($fieldname);
}
@@ -447,13 +448,15 @@
foreach my $option (@opt) {
my $escopt=&HTML::Entities::encode($option,'\'"&<>');
if ($option eq $lastopt) {
- if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
+ if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
+ && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
$optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
} else {
$optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n";
}
} else {
- if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
+ if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
+ && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
$optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
} else {
$optionlist.="<option value='".$escopt."'>$option</option>\n";
@@ -516,9 +519,9 @@
'\end{enumerate} \vskip -8 mm \strut ';
$internal_counter++;
}
- if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
- $text =~ s/.*indent(.*)$/$1/;
- $text = $1;
+ if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
+ && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
+ $text =~ s/\\item//m;
$result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\';
$temp++;
}