[LON-CAPA-cvs] cvs: loncom /homework grades.pm
ng
lon-capa-cvs@mail.lon-capa.org
Fri, 11 Jul 2003 12:54:07 -0000
This is a MIME encoded message
--ng1057928047
Content-Type: text/plain
ng Fri Jul 11 08:54:07 2003 EDT
Modified files:
/loncom/homework grades.pm
Log:
fix bug 1358 - clicking on SUBM button does not show part status - speeds up display
fix bug 829 - submission page by default shows active student
- add option to filter students according to active/drop/any
--ng1057928047
Content-Type: text/plain
Content-Disposition: attachment; filename="ng-20030711085407.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.109 loncom/homework/grades.pm:1.110
--- loncom/homework/grades.pm:1.109 Wed Jul 2 11:30:21 2003
+++ loncom/homework/grades.pm Fri Jul 11 08:54:07 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.109 2003/07/02 15:30:21 matthew Exp $
+# $Id: grades.pm,v 1.110 2003/07/11 12:54:07 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -367,28 +367,47 @@
$request->print(<<LISTJAVASCRIPT);
<script type="text/javascript" language="javascript">
- function checkSelect(checkBox) {
- var ctr=0;
- var sense="";
- if (checkBox.length > 1) {
- for (var i=0; i<checkBox.length; i++) {
- if (checkBox[i].checked) {
- ctr++;
- }
- }
- sense = "a student or group of students";
- } else {
- if (checkBox.checked) {
- ctr = 1;
- }
- sense = "the student";
- }
- if (ctr == 0) {
- alert("Please select "+sense+" before clicking on the $viewgrade button.");
- return false;
+ function checkSelect(checkBox) {
+ var ctr=0;
+ var sense="";
+ if (checkBox.length > 1) {
+ for (var i=0; i<checkBox.length; i++) {
+ if (checkBox[i].checked) {
+ ctr++;
+ }
+ }
+ sense = "a student or group of students";
+ } else {
+ if (checkBox.checked) {
+ ctr = 1;
+ }
+ sense = "the student";
+ }
+ if (ctr == 0) {
+ alert("Please select "+sense+" before clicking on the $viewgrade button.");
+ return false;
+ }
+ document.gradesub.submit();
+ }
+
+ function reLoadList(formname) {
+ if (formname.saveStatusOld.value == pullDownSelection(formname.status)) {return;}
+ formname.command.value = 'submission';
+ formname.submit();
+ }
+
+ function pullDownSelection(selectOne) {
+ var selection="";
+ if (selectOne.length > 1) {
+ for (var i=0; i<selectOne.length; i++) {
+ if (selectOne[i].selected) {
+ return selectOne[i].value;
+ }
+ }
+ } else {
+ if (selectOne.selected) return selectOne.value;
+ }
}
- document.gradesub.submit();
- }
</script>
LISTJAVASCRIPT
@@ -405,6 +424,10 @@
if ($ENV{'form.handgrade'} eq 'yes') {
$gradeTable.='<input type="radio" name="lastSub" value="hdgrade" '.$checkhdgrade.' /> handgrade only'."\n";
}
+
+ my $saveStatus = $ENV{'form.status'} eq '' ? 'Active' : $ENV{'form.status'};
+ $ENV{'form.status'} = $saveStatus;
+
$gradeTable.='<input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last sub only'."\n".
'<input type="radio" name="lastSub" value="last" /> last sub & parts info'."\n".
'<input type="radio" name="lastSub" value="all" /> all details'."\n".
@@ -417,58 +440,85 @@
'<input type="hidden" name="probTitle" value="'.$ENV{'form.probTitle'}.'" />'."\n".
'<input type="hidden" name="url" value="'.$url.'" />'."\n".
'<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
- 'To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
+ '<input type="hidden" name="saveStatusOld" value="'.$saveStatus.'" />'."\n";
+
+ $gradeTable.='<b>Student Status:</b> <select onchange="javascript:reLoadList(this.form);" name="status">'.
+ '<option value="Active" '.($saveStatus eq 'Active' ? 'selected' : '').'>Active</option>'.
+ '<option value="Expired" '.($saveStatus eq 'Expired' ? 'selected' : '').'>Expired</option>'.
+ '<option value="Any" '.($saveStatus eq 'Any' ? 'selected' : '').'>Any</option>'.
+ '</select><br />'."\n";
+
+ $gradeTable.='To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n".
' on the check boxes for the group of students.<br />'."\n".
- '<input type="hidden" name="command" value="processGroup" />'."\n".
- '<input type="button" '."\n".
+ '<input type="hidden" name="command" value="processGroup" />'."\n";
+ $gradeTable.='<input type="button" '."\n".
'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n".
'value="'.$viewgrade.'" />'."\n";
-
- my (undef,undef,$fullname) = &getclasslist($getsec,$ENV{'form.showgrading'} eq 'yes' ? '1' : '0');
-
+
+ my (undef, undef, $fullname) = &getclasslist($getsec,'1');
$gradeTable.='<table border="0"><tr><td bgcolor="#777777">'.
- '<table border="0"><tr bgcolor="#e6ffff">'.
- '<td><b> Select </b></td><td><b> Fullname </b></td>'.
- '<td><b> Username </b></td><td><b> Domain </b></td>';
- foreach (sort(@$partlist)) {
- $gradeTable.='<td><b> Part '.(split(/_/))[0].' Status </b></td>';
+ '<table border="0"><tr bgcolor="#e6ffff">';
+ my $loop = 0;
+ while ($loop < 2) {
+ $gradeTable.='<td><b> Select </b></td><td><b> Fullname </b>'.
+ '<font color="#999999">(Username)</font> </td>';
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ foreach (sort(@$partlist)) {
+ $gradeTable.='<td><b> Part '.(split(/_/))[0].' Status </b></td>';
+ }
+ }
+ $loop++;
}
$gradeTable.='</tr>'."\n";
my $ctr = 0;
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
my ($uname,$udom) = split(/:/,$student);
- my (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
- my $statusflg = '';
- foreach (keys(%status)) {
- $statusflg = 1 if ($status{$_} ne 'nothing');
- my ($foo,$partid,$foo1) = split(/\./,$_);
- if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
- $statusflg = '';
- $gradeTable.='<input type="hidden" name="'.
- $student.':submitted_by" value="'.
- $status{'resource.'.$partid.'.submitted_by'}.'" />';
+ my %status = ();
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ (%status) =&student_gradeStatus($url,$symb,$udom,$uname,$partlist);
+ my $statusflg = '';
+ foreach (keys(%status)) {
+ $statusflg = 1 if ($status{$_} ne 'nothing');
+ my ($foo,$partid,$foo1) = split(/\./,$_);
+ if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
+ $statusflg = '';
+ $gradeTable.='<input type="hidden" name="'.
+ $student.':submitted_by" value="'.
+ $status{'resource.'.$partid.'.submitted_by'}.'" />';
+ }
}
+ next if ($statusflg eq '' && $submitonly eq 'yes');
}
- next if ($statusflg eq '' && $submitonly eq 'yes');
$ctr++;
if ( $perm{'vgr'} eq 'F' ) {
- $gradeTable.='<tr bgcolor="#ffffe6">'.
- '<td align="center"><input type=checkbox name="stuinfo" value="'.
- $student.':'.$$fullname{$student}.'"></td>'."\n".
- '<td> '.$$fullname{$student}.' </td>'."\n".
- '<td> '.$uname.' </td>'."\n".
- '<td align="middle"> '.$udom.' </td>'."\n";
-
- foreach (sort keys(%status)) {
- next if (/^resource.*?submitted_by$/);
- $gradeTable.='<td align="middle"> '.$status{$_}.' </td>'."\n";
+ $gradeTable.='<tr bgcolor="#ffffe6">' if ($ctr%2 ==1);
+ $gradeTable.='<td align="center"><input type=checkbox name="stuinfo" value="'.
+ $student.':'.$$fullname{$student}.' "></td>'."\n".
+ '<td> '.$$fullname{$student}.' '."\n".
+ '<font color="#999999">('.$uname.')</font></td>'."\n";
+
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ foreach (sort keys(%status)) {
+ next if (/^resource.*?submitted_by$/);
+ $gradeTable.='<td align="middle"> '.$status{$_}.' </td>'."\n";
+ }
}
- $gradeTable.='</tr>'."\n";
+ $gradeTable.='</tr>'."\n" if ($ctr%2 ==0);
}
}
+ if ($ctr%2 ==1) {
+ $gradeTable.='<td> </td><td> </td>';
+ if ($ENV{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
+ foreach (@$partlist) {
+ $gradeTable.='<td> </td>';
+ }
+ }
+ $gradeTable.='</tr>';
+ }
+
$gradeTable.='</table></td></tr></table>'.
'<input type="button" '.
'onClick="javascript:checkSelect(this.form.stuinfo);" '.
@@ -479,7 +529,8 @@
$gradeTable='<br /> <font color="red">There are no students currently enrolled.</font>';
} else {
$gradeTable='<br /> <font color="red">'.
- 'No submissions found for this resource for any students. ('.$num_students.' checked for submissions</font><br />';
+ 'No submissions found for this resource for any students. ('.$num_students.
+ ' checked for submissions</font><br />';
}
} elsif ($ctr == 1) {
$gradeTable =~ s/type=checkbox/type=checkbox checked/;
--ng1057928047--