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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 30 May 2006 18:08:36 -0000


albertel		Tue May 30 14:08:36 2006 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - when in CANNOT_ANSWER mode, continue to show the text field, but make it read-only and don't set the real field name
  
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.192 loncom/homework/inputtags.pm:1.193
--- loncom/homework/inputtags.pm:1.192	Tue May 30 08:45:37 2006
+++ loncom/homework/inputtags.pm	Tue May 30 14:08:35 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.192 2006/05/30 12:45:37 www Exp $
+# $Id: inputtags.pm,v 1.193 2006/05/30 18:08:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -283,7 +283,8 @@
 	$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') {
 	    my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
 	    my $maxlength;
 	    if ($size eq '') { $size=20; } else {
@@ -298,12 +299,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.'" />';
 	    }
 	    if ($Apache::lonhomework::type eq 'exam'