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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 21 Sep 2005 21:54:23 -0000


albertel		Wed Sep 21 17:54:23 2005 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - don't make a new version on a regrade pass
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.51 loncom/homework/bridgetask.pm:1.52
--- loncom/homework/bridgetask.pm:1.51	Tue Sep 20 03:14:23 2005
+++ loncom/homework/bridgetask.pm	Wed Sep 21 17:54:20 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.51 2005/09/20 07:14:23 albertel Exp $
+# $Id: bridgetask.pm,v 1.52 2005/09/21 21:54:20 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -370,6 +370,10 @@
 		$webgrade.'" />';
 	    $result.='<input type="hidden" name="queue" value="'.
 		$env{'form.queue'}.'" />';
+	    if ($env{'form.regrade'}) {
+		$result.='<input type="hidden" name="regrade" value="'.
+		    $env{'form.regrade'}.'" />';
+	    }
 	}
     } else {
 	# page_start returned a starting result, delete it if we don't need it
@@ -577,13 +581,16 @@
 		&remove_from_queue($env{'form.queue'}); 
 
 		my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
-		$Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
-		    $Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"};
-		&Apache::grades::version_portfiles(
-					\%Apache::lonhomework::results,
-					 ["$version.0.bridgetask"],$courseid,
-					 $symb,$udom,$uname,
-					 ["$version.0.bridgetask"]);
+		
+		if ($env{'form.regrade'} ne 'yes') {
+		    $Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
+			$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"};
+		    &Apache::grades::version_portfiles(
+						       \%Apache::lonhomework::results,
+						       ["$version.0.bridgetask"],$courseid,
+						       $symb,$udom,$uname,
+						       ["$version.0.bridgetask"]);
+		}
 	    } else {
 		$Apache::lonhomework::results{"resource.$version.status"}='pass';
 		$Apache::lonhomework::results{"resource.$version.0.solved"}='correct_by_override';
@@ -592,13 +599,15 @@
 		&remove_from_queue($env{'form.queue'});
 
 		my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
-		$Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
-		    $Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"};
-		&Apache::grades::version_portfiles(
-					\%Apache::lonhomework::results,
-					 ["$version.0.bridgetask"],$courseid,
-					 $symb,$udom,$uname,
-					 ["$version.0.bridgetask"]);
+		if ($env{'form.regrade'} ne 'yes') {
+		    $Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
+			$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"};
+		    &Apache::grades::version_portfiles(
+						       \%Apache::lonhomework::results,
+						       ["$version.0.bridgetask"],$courseid,
+						       $symb,$udom,$uname,
+						       ["$version.0.bridgetask"]);
+		}
 	    }
 	    $Apache::lonhomework::results{"resource.status"}=
 		$Apache::lonhomework::results{"resource.$version.status"};
@@ -1013,6 +1022,7 @@
       <input type="hidden" name="gradingkey" value="$todo" />
       <input type="hidden" name="queue" value="$queue" />
       <input type="hidden" name="webgrade" value="no" />
+      <input type="hidden" name="regrade" value="yes" />
      <input type="submit" name="submit" value="Regrade" />
     </form>
   <td>$fullname->{$student}</td>
@@ -1188,9 +1198,10 @@
 		    '</td></tr>';
 		$result.='<tr><td colspan="4">';
 		my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
-		my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio';
+		my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
 		foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"})) {
 		    my $file=$file_url.$partial_file;
+		    $file=~s|/+|/|g;
 		    &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
 		    $result.='<nobr><a href="'.$file.'" target="lonGRDs"><img src="'.
 			&Apache::loncommon::icon($file).'" border=0"> '.$file.