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

banghart lon-capa-cvs@mail.lon-capa.org
Tue, 07 Feb 2006 14:18:18 -0000


banghart		Tue Feb  7 09:18:18 2006 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  	saving work in progress, now saves file name in record.
  	It's a lie, no file uploaded yet.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.310 loncom/homework/grades.pm:1.311
--- loncom/homework/grades.pm:1.310	Tue Feb  7 08:38:16 2006
+++ loncom/homework/grades.pm	Tue Feb  7 09:18:18 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.310 2006/02/07 13:38:16 banghart Exp $
+# $Id: grades.pm,v 1.311 2006/02/07 14:18:18 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2293,19 +2293,21 @@
 	    $newrecord{'resource.'.$new_part.'.regrader'}=
 		"$env{'user.name'}:$env{'user.domain'}";
 	}
-	$request->print('form.part'.$new_part.'_returndoc1');
         if ($env{'form.part'.$new_part.'_returndoc1'}) {
-            # if multiple files are uploaded names will be 'returndoc2', 'returndoc3'
+            # if multiple files are uploaded names will be 'returndoc2','returndoc3'
+           
             my $portfolio_root = &Apache::loncommon::propath($domain,
     					 $stuname).
     					'/userfiles/portfolio';
                 $request->print('<br>'.$portfolio_root.'<br>');
+                
     #                my $result=&Apache::lonnet::userfileupload('uploaddoc','',
     #	        	 'portfolio'.$env{'form.currentpath'});
     
             my $file_counter = 1;
-            while ($env{'form.'.$new_part.'_returndoc'.$file_counter}) {
+            while ($env{'form.part'.$new_part.'_returndoc'.$file_counter}) {
                 my $fname=$env{'form.returndoc'.$file_counter.'.filename'};
+                $newrecord{'resource.'.$new_part.'.handback'} = $env{'form.returndocorig'.$file_counter};
                 $request->print("<br />".$fname." will be the uploaded file name");
                 $request->print("<font color=\"red\">Will upload document</font>".$env{'form.returndocorig'.$file_counter});
                 $file_counter++;
@@ -3336,13 +3338,13 @@
 	    unshift(@fields,['none','']);
 	    $i=&Apache::loncommon::csv_samples_select_table($request,\@records,
 							    \@fields);
-	    foreach my $rec (@records) {
-		my %temp = &Apache::loncommon::record_sep($rec);
-		if (%temp) {
-		    $keyfields=join(',',sort(keys(%temp)));
-		    last;
-		}
-	    }
+            foreach my $rec (@records) {
+                my %temp = &Apache::loncommon::record_sep($rec);
+                if (%temp) {
+                    $keyfields=join(',',sort(keys(%temp)));
+                    last;
+                }
+            }
 	}
     }
     &csvuploadmap_footer($request,$i,$keyfields);