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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 14 Dec 2004 20:12:30 -0000


banghart		Tue Dec 14 15:12:30 2004 EDT

  Modified files:              
    /loncom/homework	essayresponse.pm 
  Log:
  	Inform student that only one file can be uploaded.
  	(sidesteps problems with typing multiple files in upload field)
  
  
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.53 loncom/homework/essayresponse.pm:1.54
--- loncom/homework/essayresponse.pm:1.53	Tue Dec 14 13:44:56 2004
+++ loncom/homework/essayresponse.pm	Tue Dec 14 15:12:30 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.53 2004/12/14 18:44:56 banghart Exp $
+# $Id: essayresponse.pm,v 1.54 2004/12/14 20:12:30 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -65,7 +65,7 @@
 	    $result .='</td></tr>';
 	}
         if ($uploadedfiletypes) {
-	    $result.='<tr><td>'.&mt('Submit a file:').
+	    $result.='<tr><td>'.&mt('Submit a file: (only one file can be uploaded)').
 		' <br /><input type="file" size="50" name="HWFILE'.
 #		$part.'_'.$id.'" onFocus="this.form.enctype='.
 #		"'multipart/form-data'".';" /><br />'.
@@ -127,19 +127,18 @@
 		}
                 my $uploadedflag=0;
                 if ($filename =~ /[^\s]/) {
-                   &Apache::lonnet::logthis("the file to upload is $filename");
- 	           my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes");
-                   $uploadedfiletypes=~s/[^\w\,]//g;
-                   $uploadedfiletypes=','.$uploadedfiletypes.',';
-                   my ($extension)=($filename=~/\.(\w+)$/);
-	           if ($uploadedfiletypes=~/\,$extension\,/i) {
-	              $Apache::lonhomework::results{"resource.$part.$id.uploadedfile"}=$filename;
-                      $Apache::lonhomework::results{"resource.$part.$id.uploadedurl"}=
-                         &Apache::lonnet::userfileupload('HWFILE'.$part.'_'.$id,undef,'essayresponse');
-                      $uploadedflag=1;
-		   } else {
-		      $award='INVALID_FILETYPE';
-                   }
+ 	            my $uploadedfiletypes= &Apache::lonnet::EXT("resource.$part".'_'."$id.uploadedfiletypes");
+                    $uploadedfiletypes=~s/[^\w\,]//g;
+                    $uploadedfiletypes=','.$uploadedfiletypes.',';
+                    my ($extension)=($filename=~/\.(\w+)$/);
+	            if ($uploadedfiletypes=~/\,$extension\,/i) {
+	                $Apache::lonhomework::results{"resource.$part.$id.uploadedfile"}=$filename;
+                        $Apache::lonhomework::results{"resource.$part.$id.uploadedurl"}=
+                        &Apache::lonnet::userfileupload('HWFILE'.$part.'_'.$id,undef,'essayresponse');
+                        $uploadedflag=1;
+		    } else {
+		        $award='INVALID_FILETYPE';
+                    }
 	        } else {
 	           $Apache::lonhomework::results{"resource.$part.$id.uploadedfile"}="";
                    $Apache::lonhomework::results{"resource.$part.$id.uploadedurl"}="";