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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 23 Nov 2004 14:37:34 -0000


albertel		Tue Nov 23 09:37:34 2004 EDT

  Modified files:              
    /loncom/homework	grades.pm essayresponse.pm 
  Log:
  - grading of uploaded and portfiles should work now.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.231 loncom/homework/grades.pm:1.232
--- loncom/homework/grades.pm:1.231	Tue Nov 23 09:19:32 2004
+++ loncom/homework/grades.pm	Tue Nov 23 09:37:33 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.231 2004/11/23 14:19:32 albertel Exp $
+# $Id: grades.pm,v 1.232 2004/11/23 14:37:33 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1670,17 +1670,25 @@
 			$lastsubonly.='<tr><td bgcolor="#ffffe6"><b>Part:</b> '.
 			    $display_part.' <font color="#999999">( ID '.$respid.
 			    ' )</font>&nbsp; &nbsp;';
-			my $file_url;
+			my @files;
 			if ($record{"resource.$partid.$respid.portfiles"}) {
-			    $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio'.$record{"resource.$partid.$respid.portfiles"};
-			    &Apache::lonnet::logthis("found a portfolio file".$record{"resource.$partid.$respid.portfiles"});
-			    &Apache::lonnet::logthis("uploaded URL file".$record{"resource.$partid.$respid.uploadedurl"});
-			} else {
-			    $file_url=$record{"resource.$partid.$respid.uploadedurl"};
+			    my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio';
+			    foreach my $file (split(',',$record{"resource.$partid.$respid.portfiles"})) {
+				push(@files,$file_url.$file);
+			    
+				&Apache::lonnet::logthis("found a portfolio file".$record{"resource.$partid.$respid.portfiles"});
+				&Apache::lonnet::logthis("uploaded URL file".$record{"resource.$partid.$respid.uploadedurl"});
+			    }
 			}
-			if ($file_url) {
-			    &Apache::lonnet::allowuploaded('/adm/grades',$file_url);
-			    $lastsubonly.='<a href="'.$file_url.'" target="lonGRDs"><img src="/adm/lonIcons/unknown.gif" border=0"> File uploaded by student</a> <font color="red" size="1">Like all files provided by users, this file may contain virusses</font><br />';
+			if ($record{"resource.$partid.$respid.uploadedurl"}) {
+			    push(@files,$record{"resource.$partid.$respid.uploadedurl"});
+			}
+			if (@files) {
+			    $lastsubonly.='<br /><font color="red" size="1">Like all files provided by users, this file may contain virusses</font><br />';
+			    foreach my $file (@files) {
+				&Apache::lonnet::allowuploaded('/adm/grades',$file);
+				$lastsubonly.='<br /><a href="'.$file.'" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border=0"> '.$file.'</a>';
+			    }
 			}
 			$lastsubonly.='<b>Submitted Answer: </b>'.
 			    &cleanRecord($subval,$responsetype,$symb,$partid,
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.49 loncom/homework/essayresponse.pm:1.50
--- loncom/homework/essayresponse.pm:1.49	Sun Nov 21 14:18:43 2004
+++ loncom/homework/essayresponse.pm	Tue Nov 23 09:37:33 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # essay (ungraded) style responses
 #
-# $Id: essayresponse.pm,v 1.49 2004/11/21 19:18:43 banghart Exp $
+# $Id: essayresponse.pm,v 1.50 2004/11/23 14:37:33 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -140,10 +140,8 @@
                    }
 	        }
                 if ($portfiles =~ /[^\s]/) {
-                    $portfiles =~ /(.*)(,$)/;
-                    $portfiles = $1;
+                    $portfiles =~s/,$//;
                     $Apache::lonhomework::results{"resource.$part.$id.portfiles"}=$portfiles;
-                    $Apache::lonhomework::results{"resource.$part.$id.uploadedurl"}=$portfiles;
                     my @submitted_files = split /,/,$portfiles;
 		    my ($dsymb,$crsid,$domain,$name)=&Apache::lonxml::whichuser();
 		    &Apache::lonnet::unmark_as_readonly($domain,$name,$dsymb.$crsid);