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

ng lon-capa-cvs@mail.lon-capa.org
Thu, 01 Aug 2002 15:20:34 -0000


ng		Thu Aug  1 11:20:34 2002 EDT

  Modified files:              
    /loncom/homework	essayresponse.pm 
  Log:
  Shows on screen an option to save either as an answer or as a draft copy.
  Saves the submission with the appropriate awarddetail.
  
  
  
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.12 loncom/homework/essayresponse.pm:1.13
--- loncom/homework/essayresponse.pm:1.12	Fri Jul 26 16:27:33 2002
+++ loncom/homework/essayresponse.pm	Thu Aug  1 11:20:34 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.12 2002/07/26 20:27:33 ng Exp $
+# $Id: essayresponse.pm,v 1.13 2002/08/01 15:20:34 ng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -45,22 +45,31 @@
 
 	my $ncol= &Apache::lonnet::EXT("resource.$part".'_'."$id.maxcollaborators");
 	my $coll= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"});
+	$result='<br /><table border="1">';
 	if ($ncol > 0) {
-	    $result .='<br />Collaborators: <input type="text" size="70" max="80" name="HWCOL'.
-		$id.'" value="'.$coll.'" /><br />'.
+	    $result .='<tr><td>'.
+		'Collaborators: <input type="text" size="70" max="80" name="HWCOL'.
+		$part.'_'.$id.'" value="'.$coll.'" /><br />'.
 		'(Enter maximum '.$ncol.' collaborators using username or username@domain, e.g. '.
 		'smithje or smithje@'.$ENV{'user.domain'}.'.)<br />';
 	    $result .= &check_collaborators($ncol,$coll) if ($coll =~ /\w+/);
+	    $result .='</td></tr>';
 	}
+	$result.='<tr><td>'.
+	    '<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="yes" checked>'.
+	    ' Submit text below as answer to receive credit <br />'.
+	    '<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="no">'.
+	    ' Save text below as a draft answer (not submitting it for credit yet) '.
+	    '</td></tr></table>';
     }
     return $result;
 }
 
 sub end_essayresponse {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
-    my $part=$Apache::inputtags::part;
-    my $id  = &Apache::response::start_response($parstack,$safeeval);
-    my $collaborators = $ENV{'form.HWCOL'.$id};	
+    my $part          = $Apache::inputtags::part;
+    my $id            = &Apache::response::start_response($parstack,$safeeval);
+    my $collaborators = $ENV{'form.HWCOL'.$part.'_'.$id};	
     if ($collaborators =~ /[^\s]/) {
 	my $previous_list= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"});
 
@@ -72,7 +81,8 @@
 	    my $response      = $ENV{'form.HWVAL'.$id};
 	    if ( $response =~ /[^\s]/) {
 		$Apache::lonhomework::results{"resource.$part.$id.submission"}=$response;
-		$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}="SUBMITTED";
+		$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=
+		    $ENV{'form.HWDRAFT'.$part.'_'.$id} eq 'yes' ? 'SUBMITTED' : 'DRAFT';
 		my %previous=&Apache::response::check_for_previous($response,$part,$id);
 		&Apache::response::handle_previous(\%previous,'SUBMITTED');
 	    }