--- loncom/homework/inputtags.pm 2005/11/21 22:45:13 1.184
+++ loncom/homework/inputtags.pm 2006/06/09 16:31:00 1.186.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.184 2005/11/21 22:45:13 albertel Exp $
+# $Id: inputtags.pm,v 1.186.2.1 2006/06/09 16:31:00 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -131,7 +131,7 @@ sub addchars {
}
sub start_textfield {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result = "";
my $id = &start_input($parstack,$safeeval);
my $resid=$Apache::inputtags::response[-1];
@@ -155,17 +155,18 @@ sub start_textfield {
if ($oldresponse ne '') {
#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 {
#right or wrong don't show it
#$result='
'.$oldresponse.'
';
$result='';
#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') {
- 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 the seed text is still there it wasn't a real submission
$env{'form.HWVAL_'.$resid}='';
@@ -176,7 +177,8 @@ sub start_textfield {
$result.=&Apache::edit::text_arg('Columns:','cols',$token,4);
$result.=&Apache::edit::text_arg
('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);
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
@@ -227,7 +229,9 @@ sub start_textline {
$Apache::lonxml::evaluate--;
my $partid=$Apache::inputtags::part;
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 $maxlength;
if ($size eq '') { $size=20; } else {
@@ -242,12 +246,17 @@ sub start_textline {
}
my $readonly=&Apache::lonxml::get_param('readonly',$parstack,
$safeeval);
- if (lc($readonly) eq 'yes') {
+ if (lc($readonly) eq 'yes'
+ || $Apache::inputtags::status[-1] eq 'CANNOT_ANSWER') {
$readonly=' readonly="readonly" ';
} else {
$readonly='';
}
- $result.= '';
}
} else {
@@ -620,7 +629,12 @@ sub decideoutput {
$bgcolor=$possiblecolors{'correct'};
$button=0;
} 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;
} else {
$message = &mt("Unknown message").": $award";