version 1.152, 2008/09/11 17:38:14
|
version 1.158, 2009/05/04 13:42:50
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
|
|
|
|
|
|
|
|
|
|
package Apache::optionresponse; |
package Apache::optionresponse; |
use strict; |
use strict; |
use Apache::response(); |
use Apache::response(); |
Line 45 sub start_optionresponse {
|
Line 50 sub start_optionresponse {
|
%Apache::hint::option=(); |
%Apache::hint::option=(); |
undef(%Apache::response::foilnames); |
undef(%Apache::response::foilnames); |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
$result.=&Apache::edit::start_table($token). |
$result.=&Apache::edit::start_table($token) |
"<tr><td>Multiple Option Response Question ". |
.'<tr><td><span class="LC_nobreak">'.&mt('Multiple Option Response Question').'</span> ' |
&Apache::loncommon::help_open_topic('Option_Response_Problems')."</td><td>Delete:". |
.&Apache::loncommon::help_open_topic('Option_Response_Problems')."</td>" |
&Apache::edit::deletelist($target,$token) |
.'<td><span class="LC_nobreak">'.&mt('Delete?').' ' |
."</td><td> ". |
.&Apache::edit::deletelist($target,$token) |
&Apache::edit::end_row(). |
.'</span></td>' |
&Apache::edit::start_spanning_row(). |
."<td> " |
"\n"; |
.&Apache::edit::end_row() |
|
.&Apache::edit::start_spanning_row() |
|
."\n"; |
$result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max', |
$result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max', |
$token,'4'). |
$token,'4'). |
&Apache::edit::select_arg('Randomize Foil Order','randomize', |
&Apache::edit::select_arg('Randomize Foil Order:','randomize', |
['yes','no'],$token). |
['yes','no'],$token). |
&Apache::edit::select_arg(&mt('Display of options when printed'),'TeXlayout', |
&Apache::edit::select_arg(&mt('Display of options when printed'),'TeXlayout', |
[['horizontal',&mt('Normal list')], |
[['horizontal','Normal list'], |
['vertical',&mt('Listed in a vertical column')]],$token). |
['vertical','Listed in a vertical column']],$token). |
&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
Line 432 sub displayfoils {
|
Line 439 sub displayfoils {
|
my $lastopt=$lastresponse{$name}; |
my $lastopt=$lastresponse{$name}; |
my $optionlist="<option></option>\n"; |
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; |
my $fieldname = $env{'request.symb'}.'&part_'.$Apache::inputtags::part.'&optionresponse'.'&HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp; |
$optionlist = &Apache::lonxml::print_pdf_start_combobox($fieldname); |
$optionlist = &Apache::lonxml::print_pdf_start_combobox($fieldname); |
} |
} |
Line 440 sub displayfoils {
|
Line 448 sub displayfoils {
|
foreach my $option (@opt) { |
foreach my $option (@opt) { |
my $escopt=&HTML::Entities::encode($option,'\'"&<>'); |
my $escopt=&HTML::Entities::encode($option,'\'"&<>'); |
if ($option eq $lastopt) { |
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); |
$optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option); |
} else { |
} else { |
$optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n"; |
$optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n"; |
} |
} |
} else { |
} 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); |
$optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option); |
} else { |
} else { |
$optionlist.="<option value='".$escopt."'>$option</option>\n"; |
$optionlist.="<option value='".$escopt."'>$option</option>\n"; |
Line 509 sub displayfoils {
|
Line 519 sub displayfoils {
|
'\end{enumerate} \vskip -8 mm \strut '; |
'\end{enumerate} \vskip -8 mm \strut '; |
$internal_counter++; |
$internal_counter++; |
} |
} |
if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') { |
if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes' |
$text =~ s/.*indent(.*)$/$1/; |
&& $Apache::inputtags::status[-1] eq 'CAN_ANSWER') { |
$text = $1; |
$text =~ s/\\item//m; |
$result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\'; |
$result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\'; |
$temp++; |
$temp++; |
} |
} |
Line 774 sub insert_drawoptionlist {
|
Line 784 sub insert_drawoptionlist {
|
1; |
1; |
__END__ |
__END__ |
|
|
|
=head1 NAME |
|
|
|
Apache::optionresponse.pm; |
|
|
|
=head1 SYNOPSIS |
|
|
|
Handles tags associated with showing a list of |
|
options. |
|
|
|
This is part of the LearningOnline Network with CAPA project |
|
described at http://www.lon-capa.org. |
|
|
|
=head1 HANDLER SUBROUTINE |
|
|
|
start_optionresponse() |
|
|
|
=head1 OTHER SUBROUTINES |
|
|
|
=over |
|
|
|
=item end_optionresponse() |
|
|
|
=item start_foilgroup() |
|
|
|
=item end_foilgroup() |
|
|
|
=item getfoilcounts() |
|
|
|
=item displayanswers() |
|
|
|
=item check_for_invalid() |
|
|
|
=item displayfoils() |
|
|
|
=item optionlist_correction() |
|
|
|
=item webbubbles() |
|
|
|
=item bubbles() |
|
|
|
=item start_conceptgroup() |
|
|
|
=item end_conceptgroup() |
|
|
|
=item insert_conceptgroup() |
|
|
|
=item start_foil() |
|
|
|
=item end_foil() |
|
|
|
=item start_drawoptionlist() |
|
|
|
=item end_drawoptionlist() |
|
|
|
=item insert_foil() |
|
|
|
=item insert_drawoptionlist() |
|
|
|
=back |
|
|
|
=cut |