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

www lon-capa-cvs@mail.lon-capa.org
Thu, 23 Jan 2003 22:28:55 -0000


www		Thu Jan 23 17:28:55 2003 EDT

  Modified files:              
    /loncom/homework	essayresponse.pm 
  Log:
  Additional work on file upload.
  
  
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.18 loncom/homework/essayresponse.pm:1.19
--- loncom/homework/essayresponse.pm:1.18	Thu Jan 23 14:32:36 2003
+++ loncom/homework/essayresponse.pm	Thu Jan 23 17:28:55 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.18 2003/01/23 19:32:36 www Exp $
+# $Id: essayresponse.pm,v 1.19 2003/01/23 22:28:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -62,8 +62,14 @@
         if ($uploadedfiletypes) {
            $result.=
 '<tr><td>Submit a file: <input type="file" size="50" name="HWFILE'.
-		$part.'_'.$id.'" value="'.$uploadedfile.'" onChange="this.form.enctype='.
-"'multipart/form-data'".';" /><br />Allowed filetypes: <b>'.$uploadedfiletypes.'</b><br />(Hand in a file you have prepared on your computer)</td></tr>'; 
+		$part.'_'.$id.'" onFocus="this.form.enctype='.
+"'multipart/form-data'".';" /><br />Allowed filetypes: <b>'.$uploadedfiletypes.'</b><br />';
+           if ($uploadedfile) {
+	       $result.='Currently submitted: <tt>'.$uploadedfile.'</tt>';
+           } else {
+              $result.='(Hand in a file you have prepared on your computer)';
+           }
+           $result.='</td></tr>'; 
         }
 	$result.='<tr><td>'.
 	    '<input type="radio" name="HWDRAFT'.$part.'_'.$id.'" value="yes" checked>'.
@@ -87,6 +93,10 @@
 	    $Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators
 		if ($collaborators ne $previous_list);
 	}
+        my $filename= $ENV{'form.HWFILE'.$part.'_'.$id.'.filename'};
+        if ($filename =~ /[^\s]/) {
+	    $Apache::lonhomework::results{"resource.$part.$id.uploadedfile"}=$filename;
+        }
 	if ( defined $ENV{'form.submitted'}) {
 	    my $response      = $ENV{'form.HWVAL'.$id};
 	    if ( $response =~ /[^\s]/) {