[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /homework inputtags.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 09 Jun 2006 16:31:01 -0000


albertel		Fri Jun  9 12:31:01 2006 EDT

  Modified files:              (Branch: version_2_1_X)
    /loncom/homework	inputtags.pm 
  Log:
  - backport 1.193 1.195
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.186 loncom/homework/inputtags.pm:1.186.2.1
--- loncom/homework/inputtags.pm:1.186	Wed Jan  4 00:56:16 2006
+++ loncom/homework/inputtags.pm	Fri Jun  9 12:31:00 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.186 2006/01/04 05:56:16 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
 #
@@ -229,7 +229,9 @@
 	$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 {
@@ -244,12 +246,17 @@
 		}
 		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.= '<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.'" />';
 	    }
 	} else {