version 1.180, 2005/11/15 22:28:30
|
version 1.186.2.1, 2006/06/09 16:31:00
|
Line 131 sub addchars {
|
Line 131 sub addchars {
|
} |
} |
|
|
sub start_textfield { |
sub start_textfield { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result = ""; |
my $result = ""; |
my $id = &start_input($parstack,$safeeval); |
my $id = &start_input($parstack,$safeeval); |
my $resid=$Apache::inputtags::response[-1]; |
my $resid=$Apache::inputtags::response[-1]; |
Line 155 sub start_textfield {
|
Line 155 sub start_textfield {
|
if ($oldresponse ne '') { |
if ($oldresponse ne '') { |
|
|
#get rid of any startup text if the user has already responded |
#get rid of any startup text if the user has already responded |
&Apache::lonxml::get_all_text("/textfield",$parser); |
&Apache::lonxml::get_all_text("/textfield",$parser,$style); |
} |
} |
} else { |
} else { |
#right or wrong don't show it |
#right or wrong don't show it |
#$result='<table border="1"><tr><td><i>'.$oldresponse.'</i></td></tr></table>'; |
#$result='<table border="1"><tr><td><i>'.$oldresponse.'</i></td></tr></table>'; |
$result=''; |
$result=''; |
#get rid of any startup text |
#get rid of any startup text |
&Apache::lonxml::get_all_text("/textfield",$parser); |
&Apache::lonxml::get_all_text("/textfield",$parser,$style); |
} |
} |
} elsif ($target eq 'grade') { |
} elsif ($target eq 'grade') { |
my $seedtext=&Apache::lonxml::get_all_text("/textfield",$parser); |
my $seedtext=&Apache::lonxml::get_all_text("/textfield",$parser, |
|
$style); |
if ($seedtext eq $env{'form.HWVAL_'.$resid}) { |
if ($seedtext eq $env{'form.HWVAL_'.$resid}) { |
# if the seed text is still there it wasn't a real submission |
# if the seed text is still there it wasn't a real submission |
$env{'form.HWVAL_'.$resid}=''; |
$env{'form.HWVAL_'.$resid}=''; |
Line 176 sub start_textfield {
|
Line 177 sub start_textfield {
|
$result.=&Apache::edit::text_arg('Columns:','cols',$token,4); |
$result.=&Apache::edit::text_arg('Columns:','cols',$token,4); |
$result.=&Apache::edit::text_arg |
$result.=&Apache::edit::text_arg |
('Click-On Texts (comma sep):','addchars',$token,10); |
('Click-On Texts (comma sep):','addchars',$token,10); |
my $bodytext=&Apache::lonxml::get_all_text("/textfield",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/textfield",$parser, |
|
$style); |
$result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',80,2); |
$result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',80,2); |
} 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 227 sub start_textline {
|
Line 229 sub start_textline {
|
$Apache::lonxml::evaluate--; |
$Apache::lonxml::evaluate--; |
my $partid=$Apache::inputtags::part; |
my $partid=$Apache::inputtags::part; |
my $id=$Apache::inputtags::response[-1]; |
my $id=$Apache::inputtags::response[-1]; |
if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { |
if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER' |
|
|| ($Apache::inputtags::status[-1] eq 'CANNOT_ANSWER' && |
|
$Apache::lonhomework::history{"resource.$partid.solved"} !~ /^correct/ )) { |
my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval); |
my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval); |
my $maxlength; |
my $maxlength; |
if ($size eq '') { $size=20; } else { |
if ($size eq '') { $size=20; } else { |
Line 242 sub start_textline {
|
Line 246 sub start_textline {
|
} |
} |
my $readonly=&Apache::lonxml::get_param('readonly',$parstack, |
my $readonly=&Apache::lonxml::get_param('readonly',$parstack, |
$safeeval); |
$safeeval); |
if (lc($readonly) eq 'yes') { |
if (lc($readonly) eq 'yes' |
|
|| $Apache::inputtags::status[-1] eq 'CANNOT_ANSWER') { |
$readonly=' readonly="readonly" '; |
$readonly=' readonly="readonly" '; |
} else { |
} else { |
$readonly=''; |
$readonly=''; |
} |
} |
$result.= '<input type="text" '.$readonly.' name="HWVAL_'.$id.'" value="'. |
my $name = 'HWVAL_'.$id; |
|
if ($Apache::inputtags::status[-1] eq 'CANNOT_ANSWER') { |
|
$name = "none"; |
|
} |
|
$result.= '<input type="text" '.$readonly.' name="'.$name.'" value="'. |
$oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />'; |
$oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />'; |
} |
} |
} else { |
} else { |
Line 388 sub checkstatus {
|
Line 397 sub checkstatus {
|
|
|
sub valid_award { |
sub valid_award { |
my ($award) =@_; |
my ($award) =@_; |
foreach my $possibleaward ('MISSING_ANSWER', 'ERROR', 'NO_RESPONSE', |
foreach my $possibleaward ('EXTRA_ANSWER','MISSING_ANSWER', 'ERROR', |
|
'NO_RESPONSE', |
'TOO_LONG', 'UNIT_INVALID_INSTRUCTOR', |
'TOO_LONG', 'UNIT_INVALID_INSTRUCTOR', |
'UNIT_INVALID_STUDENT', 'UNIT_IRRECONCIBLE', |
'UNIT_INVALID_STUDENT', 'UNIT_IRRECONCIBLE', |
'UNIT_FAIL', 'NO_UNIT', |
'UNIT_FAIL', 'NO_UNIT', |
Line 403 sub valid_award {
|
Line 413 sub valid_award {
|
} |
} |
|
|
sub finalizeawards { |
sub finalizeawards { |
my ($awardref,$msgref)=@_; |
my ($awardref,$msgref,$nameref,$reverse)=@_; |
my $result=undef; |
my $result=undef; |
my $award; |
my $award; |
my $msg; |
my $msg; |
Line 419 sub finalizeawards {
|
Line 429 sub finalizeawards {
|
if ($blankcount == ($#$awardref + 1)) { $result = 'NO_RESPONSE'; } |
if ($blankcount == ($#$awardref + 1)) { $result = 'NO_RESPONSE'; } |
} |
} |
if (defined($result)) { return ($result,$msg); } |
if (defined($result)) { return ($result,$msg); } |
foreach my $possibleaward ('MISSING_ANSWER', 'ERROR', 'NO_RESPONSE', |
|
'TOO_LONG', 'UNIT_INVALID_INSTRUCTOR', |
# these awards are ordered from most important error through best correct |
'UNIT_INVALID_STUDENT', 'UNIT_IRRECONCIBLE', |
|
'UNIT_FAIL', 'NO_UNIT', |
my @awards = ('EXTRA_ANSWER', 'MISSING_ANSWER', 'ERROR', 'NO_RESPONSE', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', |
'TOO_LONG', |
'BAD_FORMULA', 'SIG_FAIL', 'INCORRECT', |
'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT', |
'MISORDERED_RANK', 'INVALID_FILETYPE', |
'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT', |
'DRAFT', 'SUBMITTED', 'ASSIGNED_SCORE', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', |
'APPROX_ANS', 'EXACT_ANS','COMMA_FAIL') { |
'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK', |
|
'INVALID_FILETYPE', 'DRAFT', 'SUBMITTED', 'ASSIGNED_SCORE', |
|
'APPROX_ANS', 'EXACT_ANS'); |
|
if ($reverse) { @awards=reverse(@awards); } |
|
foreach my $possibleaward (@awards) { |
($result,$msg)=&checkstatus($possibleaward,$awardref,$msgref); |
($result,$msg)=&checkstatus($possibleaward,$awardref,$msgref); |
if (defined($result)) { return ($result,$msg); } |
if (defined($result)) { return ($result,$msg); } |
} |
} |
Line 527 sub decideoutput {
|
Line 541 sub decideoutput {
|
$message = ''; |
$message = ''; |
$bgcolor=$possiblecolors{'no_feedback'}; |
$bgcolor=$possiblecolors{'no_feedback'}; |
$button=1; |
$button=1; |
|
} elsif ($award eq 'EXTRA_ANSWER') { |
|
$message = &mt('Some extra items were submitted.'); |
|
$bgcolor=$possiblecolors{'not_charged_try'}; |
|
$button = 1; |
} elsif ($award eq 'MISSING_ANSWER') { |
} elsif ($award eq 'MISSING_ANSWER') { |
$message = &mt('Some items were not submitted.'); |
$message = &mt('Some items were not submitted.'); |
$bgcolor=$possiblecolors{'not_charged_try'}; |
$bgcolor=$possiblecolors{'not_charged_try'}; |
Line 611 sub decideoutput {
|
Line 629 sub decideoutput {
|
$bgcolor=$possiblecolors{'correct'}; |
$bgcolor=$possiblecolors{'correct'}; |
$button=0; |
$button=0; |
} elsif ($award eq '') { |
} elsif ($award eq '') { |
$bgcolor=$possiblecolors{'not_charged_try'}; |
if ($handgrade && $Apache::inputtags::status[-1] eq 'SHOW_ANSWER') { |
|
$message = &mt("Nothing submitted."); |
|
$bgcolor=$possiblecolors{'charged_try'}; |
|
} else { |
|
$bgcolor=$possiblecolors{'not_charged_try'}; |
|
} |
$button=1; |
$button=1; |
} else { |
} else { |
$message = &mt("Unknown message").": $award"; |
$message = &mt("Unknown message").": $award"; |
Line 781 sub setgradedata {
|
Line 804 sub setgradedata {
|
return ''; |
return ''; |
} |
} |
$Apache::lonhomework::results{"resource.$id.award"} = $award; |
$Apache::lonhomework::results{"resource.$id.award"} = $award; |
|
if ($award eq 'SUBMITTED') { |
|
&Apache::response::add_to_gradingqueue(); |
|
} |
} |
} |
|
|
sub grade { |
sub grade { |
Line 837 sub gradestatus {
|
Line 863 sub gradestatus {
|
|
|
my $status = $Apache::inputtags::status['-1']; |
my $status = $Apache::inputtags::status['-1']; |
&Apache::lonxml::debug("gradestatus has :$status:"); |
&Apache::lonxml::debug("gradestatus has :$status:"); |
if ( $status ne 'CLOSED' && $status ne 'UNAVAILABLE' && |
if ( $status ne 'CLOSED' |
$status ne 'INVALID_ACCESS') { |
&& $status ne 'UNAVAILABLE' |
|
&& $status ne 'INVALID_ACCESS' |
|
&& $status ne 'NEEDS_CHECKIN' |
|
&& $status ne 'NOT_IN_A_SLOT') { |
my $award = $Apache::lonhomework::history{"resource.$id.award"}; |
my $award = $Apache::lonhomework::history{"resource.$id.award"}; |
my $awarded = $Apache::lonhomework::history{"resource.$id.awarded"}; |
my $awarded = $Apache::lonhomework::history{"resource.$id.awarded"}; |
my $solved = $Apache::lonhomework::history{"resource.$id.solved"}; |
my $solved = $Apache::lonhomework::history{"resource.$id.solved"}; |