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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 21 Feb 2006 18:36:31 -0000


albertel		Tue Feb 21 13:36:31 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - adding a per criteria grading history
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.112 loncom/homework/bridgetask.pm:1.113
--- loncom/homework/bridgetask.pm:1.112	Mon Feb 20 17:57:41 2006
+++ loncom/homework/bridgetask.pm	Tue Feb 21 13:36:30 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.112 2006/02/20 22:57:41 albertel Exp $
+# $Id: bridgetask.pm,v 1.113 2006/02/21 18:36:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1792,6 +1792,7 @@
 		    '<li><a href="#next_'.$link.'">Next</a></li>'."\n".
 		    '</ul>'."\n".
                     '</div>'."\n";
+		$result.=&grading_history($version,$dim,$instance,$id);
 		$last_link=$link;
 	    }
 	} elsif ($target eq 'grade' && $env{'form.webgrade'}) {
@@ -1840,6 +1841,38 @@
     }
 }
 
+sub grading_history {
+    my ($version,$dim,$instance,$criteria) = @_;
+    if (!&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+	return '';
+    }
+    my ($result,$grader);
+    my $scope="resource.$version.0.$dim.$instance.$criteria";
+    foreach my $t (1..$Apache::lonhomework::history{'version'}) {
+	if (exists($Apache::lonhomework::history{$t.':resource.0.regrader'})) {
+	    my ($gname,$gdom) = 
+		split('@',$Apache::lonhomework::history{$t.':resource.0.regrader'});
+	    my $fullname = &Apache::loncommon::plainname($gname,$gdom);
+	    $grader = &Apache::loncommon::aboutmewrapper($fullname,
+							 $gname,$gdom);
+	}
+	my $entry;
+	if (exists($Apache::lonhomework::history{"$t:$scope.status"})) {
+	    $entry.="<tt>".$Apache::lonhomework::history{"$t:$scope.status"}.'</tt>';
+	}
+	if (exists($Apache::lonhomework::history{"$t:$scope.comment"})) {
+	    $entry.=' comment: "'.$Apache::lonhomework::history{"$t:$scope.comment"}.'"';
+	}
+	if ($entry) {
+	    $result.= "<li>$grader : $entry </li>";
+	}
+    }
+    if ($result) {
+	return '<ul class="pastgrading">'.$result.'</ul>';
+    }
+    return '';
+}
+
 sub start_IntroParagraph {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;