version 1.96, 2004/10/21 03:34:06
|
version 1.101, 2005/06/21 21:00:55
|
Line 30 package Apache::radiobuttonresponse;
|
Line 30 package Apache::radiobuttonresponse;
|
use strict; |
use strict; |
use HTML::Entities(); |
use HTML::Entities(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse')); |
&Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse')); |
Line 114 sub start_foilgroup {
|
Line 115 sub start_foilgroup {
|
} |
} |
|
|
sub storesurvey { |
sub storesurvey { |
if ( !defined($ENV{'form.submitted'})) { return ''; } |
if ( !&Apache::response::submitted() ) { return ''; } |
my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1']}; |
my $response = $env{'form.HWVAL_'.$Apache::inputtags::response['-1']}; |
&Apache::lonxml::debug("Here I am!:$response:"); |
&Apache::lonxml::debug("Here I am!:$response:"); |
if ( $response !~ /[0-9]+/) { return ''; } |
if ( $response !~ /[0-9]+/) { return ''; } |
my $part = $Apache::inputtags::part; |
my $part = $Apache::inputtags::part; |
Line 137 sub grade_response {
|
Line 138 sub grade_response {
|
my ($max,$randomize)=@_; |
my ($max,$randomize)=@_; |
#keep the random numbers the same must always call this |
#keep the random numbers the same must always call this |
my ($answer,@whichfoils)=&whichfoils($max,$randomize); |
my ($answer,@whichfoils)=&whichfoils($max,$randomize); |
if (!defined($ENV{'form.submitted'})) { return; } |
if ( !&Apache::response::submitted() ) { return; } |
my $response; |
my $response; |
if ($ENV{'form.submitted'} eq 'scantron') { |
if ($env{'form.submitted'} eq 'scantron') { |
$response=&Apache::response::getresponse(); |
$response=&Apache::response::getresponse(); |
} else { |
} else { |
$response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1']}; |
$response = $env{'form.HWVAL_'.$Apache::inputtags::response['-1']}; |
} |
} |
if ( $response !~ /[0-9]+/) { return; } |
if ( $response !~ /[0-9]+/) { return; } |
my $part=$Apache::inputtags::part; |
my $part=$Apache::inputtags::part; |
Line 312 sub whichfoils {
|
Line 313 sub whichfoils {
|
&Apache::lonxml::error(&HTML::Entities::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>",'<>&"')); |
&Apache::lonxml::error(&HTML::Entities::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>",'<>&"')); |
} |
} |
} |
} |
|
if (!$havetrue && $Apache::lonhomework::type ne 'survey') { |
|
&Apache::lonxml::error("There are no true statements available.<br />"); |
|
} |
} else { |
} else { |
my $current=0; |
my $current=0; |
&Apache::lonhomework::showhash(%Apache::response::foilgroup); |
&Apache::lonhomework::showhash(%Apache::response::foilgroup); |
Line 603 sub end_foil {
|
Line 607 sub end_foil {
|
my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval); |
my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval); |
if ($value ne 'unused') { |
if ($value ne 'unused') { |
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); |
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); |
if (!$name) { $name=$Apache::lonxml::curdepth; } |
if (!$name) { |
|
&Apache::lonxml::warning("Foils without names exist. This can cause problems to malfunction."); |
|
$name=$Apache::lonxml::curdepth; |
|
} |
if (defined($Apache::response::foilnames{$name})) { |
if (defined($Apache::response::foilnames{$name})) { |
&Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name)); |
&Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name)); |
} |
} |