[LON-CAPA-cvs] cvs: loncom /homework grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 10 Nov 2003 16:35:57 -0000
albertel Mon Nov 10 11:35:57 2003 EDT
Modified files:
/loncom/homework grades.pm
Log:
- grading interface allows one to select which parts to grade
(BUG#2102)
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.153 loncom/homework/grades.pm:1.154
--- loncom/homework/grades.pm:1.153 Mon Nov 10 11:28:10 2003
+++ loncom/homework/grades.pm Mon Nov 10 11:35:57 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.153 2003/11/10 16:28:10 albertel Exp $
+# $Id: grades.pm,v 1.154 2003/11/10 16:35:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -132,6 +132,10 @@
my ($url,$symb) = shift;
$symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))) if ($symb eq '');
my $allkeys = &Apache::lonnet::metadata($url,'keys');
+ my %vPart;
+ foreach my $partid (&Apache::loncommon::get_env_multiple('form.vPart')) {
+ $vPart{$partid}=1;
+ }
my %seen = ();
my (@partlist,%handgrade,%responseType);
foreach (split(/,/,&Apache::lonnet::metadata($url,'packages'))) {
@@ -141,6 +145,9 @@
if (&Apache::loncommon::check_if_partid_hidden($partid,$symb)) {
next;
}
+ if (%vPart && !exists($vPart{$partid})) {
+ next;
+ }
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!!
my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb);
$handgrade{$part} = ($value eq 'yes' ? 'yes' : 'no');
@@ -157,18 +164,31 @@
#--- Show resource title
#--- and parts and response type
sub showResourceInfo {
- my ($url,$probTitle) = @_;
+ my ($url,$probTitle,$checkboxes) = @_;
+ my $col=3;
+ if ($checkboxes) { $col=4; }
my $result ='<table border="0">'.
- '<tr><td colspan=3><font size=+1><b>Current Resource: </b>'.$probTitle.'</font></td></tr>'."\n";
+ '<tr><td colspan="'.$col.'"><font size="+1"><b>Current Resource: </b>'.
+ $probTitle.'</font></td></tr>'."\n";
my ($partlist,$handgrade,$responseType) = &response_type($url);
my %resptype = ();
my $hdgrade='no';
+ my %partsseen;
for my $part_resID (sort keys(%$handgrade)) {
my $handgrade=$$handgrade{$part_resID};
my ($partID,$resID) = split(/_/,$part_resID);
my $responsetype = $responseType->{$partID}->{$resID};
$hdgrade = $handgrade if ($handgrade eq 'yes');
- $result.='<tr><td><b>Part </b>'.$partID.' <font color="#999999">'.
+ $result.='<tr>';
+ if ($checkboxes) {
+ if (exists($partsseen{$partID})) {
+ $result.="<td> </td>";
+ } else {
+ $result.="<td><input type='checkbox' name='vPart' value='$partID' checked='on' /></td>";
+ }
+ $partsseen{$partID}=1;
+ }
+ $result.='<td><b>Part </b>'.$partID.' <font color="#999999">'.
$resID.'</font></td>'.
'<td><b>Type: </b>'.$responsetype.'</td></tr>';
# '<td><b>Handgrade: </b>'.$handgrade.'</td></tr>';
@@ -550,8 +570,7 @@
my $result='<h3><font color="#339933"> '.$viewgrade.
' Submissions for a Student or a Group of Students</font></h3>';
- my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($url,$ENV{'form.probTitle'});
- $result.=$table;
+ my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($url,$ENV{'form.probTitle'},($ENV{'form.showgrading'} eq 'yes'));
$request->print(<<LISTJAVASCRIPT);
<script type="text/javascript" language="javascript">
@@ -591,7 +610,8 @@
my $checkhdgrade = ($ENV{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1 ) ? 'checked' : '';
my $checklastsub = $checkhdgrade eq '' ? 'checked' : '';
- my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'."\n".
+ my $gradeTable='<form action="/adm/grades" method="post" name="gradesub">'.
+ "\n".$table.
' <b>View Problem Text: </b><input type="radio" name="vProb" value="no" checked="on" /> no '."\n".
'<input type="radio" name="vProb" value="yes" /> one student '."\n".
'<input type="radio" name="vProb" value="all" /> all students <br />'."\n".
@@ -1435,6 +1455,9 @@
'<input type="hidden" name="msgsub" value="'.$ENV{'form.msgsub'}.'" />'."\n".
'<input type="hidden" name="shownSub" value="0" />'."\n".
'<input type="hidden" name="savemsgN" value="'.$ENV{'form.savemsgN'}.'" />'."\n");
+ foreach my $partid (&Apache::loncommon::get_env_multiple('form.vPart')) {
+ $request->print('<input type="hidden" name="vPart" value="'.$partid.'" />'."\n");
+ }
}
my ($cts,$prnmsg) = (1,'');
@@ -3947,11 +3970,6 @@
#remotewindow.close();
#</script>");
$request->print(&Apache::loncommon::bodytag('Grading'));
- foreach my $key (sort(keys(%ENV))) {
- if ($key =~ /^form\./) {
- Apache->request->print("$key => $ENV{$key} <br />");
- }
- }
}
sub send_footer {