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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Sep 2002 07:08:40 -0000


albertel		Mon Sep 23 03:08:40 2002 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - BUG#723 don't show student's submission when not answererable
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.60 loncom/homework/inputtags.pm:1.61
--- loncom/homework/inputtags.pm:1.60	Wed Aug  7 12:23:05 2002
+++ loncom/homework/inputtags.pm	Mon Sep 23 03:08:40 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.60 2002/08/07 16:23:05 albertel Exp $
+# $Id: inputtags.pm,v 1.61 2002/09/23 07:08:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -79,21 +79,25 @@
   my $resid=$Apache::inputtags::response[-1];
   if ($target eq 'web') {
     $Apache::lonxml::evaluate--;
-    my $partid=$Apache::inputtags::part;
-    my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"});
-    my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
-    if ( $cols eq '') { $cols = 80; }
-    my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval);
-    if ( $rows eq '') { $rows = 10; }
     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
-      $result= '<textarea name="HWVAL'.$resid.'" '.
-	"rows=\"$rows\" cols=\"$cols\">".$oldresponse;
+	my $partid=$Apache::inputtags::part;
+	my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"});
+	my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
+	if ( $cols eq '') { $cols = 80; }
+	my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval);
+	if ( $rows eq '') { $rows = 10; }
+	$result= '<textarea name="HWVAL'.$resid.'" '.
+	    "rows=\"$rows\" cols=\"$cols\">".$oldresponse;
+	if ($oldresponse ne '') {
+	    #get rid of any startup text if the user has already responded
+	    &Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
+	}
     } else {
-      $result='<table border="1"><tr><td><i>'.$oldresponse.'</i></td></tr></table>';
-    }
-    if ($oldresponse ne '') {
-      #get rid of any startup text if the user has already responded
-      &Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
+	#right or wrong don't show it
+	#$result='<table border="1"><tr><td><i>'.$oldresponse.'</i></td></tr></table>';
+	$result='';
+	#get rid of any startup text
+	&Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
     }
   } elsif ($target eq 'grade') {
     my $seedtext=&Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
@@ -140,16 +144,18 @@
   my $result = "";
   if ($target eq 'web') {
     $Apache::lonxml::evaluate--;
-    my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
-    if ($size eq '') { $size=20; }
-    my $partid=$Apache::inputtags::part;
-    my $id=$Apache::inputtags::response[-1];
-    my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"});
     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
+      my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
+      if ($size eq '') { $size=20; }
+      my $partid=$Apache::inputtags::part;
+      my $id=$Apache::inputtags::response[-1];
+      my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"});
       $result= '<input type="text" name="HWVAL'.$id.'" value="'.
 	$oldresponse.'" size="'.$size.'" />';
     } else {
-      $result='<i>'.$oldresponse.'</i>';
+      #right or wrong don't show what was last typed in.
+      #$result='<i>'.$oldresponse.'</i>';
+      $result='';
     }
   } elsif ($target eq 'edit') {
     $result=&Apache::edit::tag_start($target,$token);