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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 17 Jan 2006 23:09:51 -0000


banghart		Tue Jan 17 18:09:51 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	Start returning commented documents from Instructor to Portfolio
  	Add file upload fields
  	Stub for receiving upload
  	work in progress, not functional
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.302 loncom/homework/grades.pm:1.303
--- loncom/homework/grades.pm:1.302	Thu Dec 15 12:53:20 2005
+++ loncom/homework/grades.pm	Tue Jan 17 18:09:50 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.302 2005/12/15 17:53:20 albertel Exp $
+# $Id: grades.pm,v 1.303 2006/01/17 23:09:50 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1577,7 +1577,7 @@
 	}
 	my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'};
 
-	$request->print('<form action="/adm/grades" method="post" name="SCORE">'."\n".
+	$request->print('<form action="/adm/grades" method="post" name="SCORE" enctype="multipart/form-data">'."\n".
 			'<input type="hidden" name="command"    value="handgrade" />'."\n".
 			'<input type="hidden" name="saveState"  value="'.$env{'form.saveState'}.'" />'."\n".
 			'<input type="hidden" name="Status"     value="'.$env{'form.Status'}.'" />'."\n".
@@ -1807,9 +1807,14 @@
 			}
 			if (@files) {
 			    $lastsubonly.='<br /><font color="red" size="1">Like all files provided by users, this file may contain virusses</font><br />';
+			    my $file_counter = 0;
 			    foreach my $file (@files) {
+			        $file_counter ++;
 				&Apache::lonnet::allowuploaded('/adm/grades',$file);
 				$lastsubonly.='<br /><a href="'.$file.'" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>';
+				$lastsubonly.='Return commented document to student. <input type="file" name="returndoc'.$file_counter.'" />'."\n";
+				$lastsubonly.='<input type="hidden" name="returndocorig'.$file_counter.'" value="'.$file.'" />';
+
 			    }
 			    $lastsubonly.='<br />';
 			}
@@ -2040,6 +2045,14 @@
 		    }
 		}
 	    }
+	    if ($env{'form.returndoc1'}) {
+	        # if multiple files are uploaded names will be 'returndoc2', 'returndoc3'
+	        my $file_counter = 1;
+	        while ($env{'form.returndoc'.$file_counter}) {
+	            $request->print("<font color=\"red\">Will upload document</font>".$env{'form.returndocorig'.$file_counter});
+	            $file_counter ++;
+	        }
+	    }
 	    $ctr++;
 	}
     }