--- loncom/homework/grades.pm 2002/09/06 20:59:28 1.48
+++ loncom/homework/grades.pm 2002/09/21 00:08:17 1.52
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.48 2002/09/06 20:59:28 albertel Exp $
+# $Id: grades.pm,v 1.52 2002/09/21 00:08:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -111,6 +111,10 @@ sub getclasslist {
my %classlist=&Apache::lonnet::dump('classlist',
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
$ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+ my ($tmp) = keys(%classlist);
+ # Bail out if we were unable to get the classlist
+ return if ($tmp =~ /^(con_lost|error|no_such_host)/i);
+
# codes to check for fields in the classlist
# should contain end:start:id:section:fullname
for (keys %classlist) {
@@ -288,7 +292,7 @@ sub verifyreceipt {
$contents.
''."\n";
}
- return $string.&show_grading_menu_form ($symb,$url);
+ return $string.&show_grading_menu_form($symb,$url);
}
#--- This is called by a number of programs.
@@ -297,6 +301,37 @@ sub verifyreceipt {
# on the problem page.
sub listStudents {
my ($request) = shift;
+
+ my ($symb,$url) = &get_symb_and_url();
+ my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"};
+ my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"};
+ my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};
+ my $submitonly= $ENV{'form.submitonly'} eq '' ? 'all' : $ENV{'form.submitonly'};
+
+ my $result;
+ my ($partlist,$handgrade) = &response_type($url);
+ for (sort keys(%$handgrade)) {
+ my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
+ $ENV{'form.handgrade'} = 'yes' if ($handgrade eq 'yes');
+ $result.='
'.
+ $viewgrade.
+ ' Submissions for a Student or a Group of Students
'.
+ '
'.
+ 'Resource: '.$url.'
'.$result;
+
$request->print(<
function checkSelect(checkBox) {
@@ -316,7 +351,7 @@ sub listStudents {
sense = "the student";
}
if (ctr == 0) {
- alert("Please select "+sense+" before clicking on the View/Grade button.");
+ alert("Please select "+sense+" before clicking on the $viewgrade button.");
return false;
}
document.gradesub.submit();
@@ -324,26 +359,6 @@ sub listStudents {
LISTJAVASCRIPT
- my ($symb,$url) = &get_symb_and_url();
- my $cdom = $ENV{"course.$ENV{'request.course.id'}.domain"};
- my $cnum = $ENV{"course.$ENV{'request.course.id'}.num"};
- my $getsec = $ENV{'form.section'} eq '' ? 'all' : $ENV{'form.section'};
- my $submitonly= $ENV{'form.submitonly'} eq '' ? 'all' : $ENV{'form.submitonly'};
-
- my $result='
'.
- 'View/Grade Submissions for a Student or a Group of Students
';
- $result.='
';
- $result.='
'.
- 'Resource: '.$url.'
';
- my ($partlist,$handgrade) = &response_type($url);
- for (sort keys(%$handgrade)) {
- my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
- $ENV{'form.handgrade'} = 'yes' if ($handgrade eq 'yes');
- $result.='
Part '.(split(/_/))[0].'
'.
- '
Type: '.$responsetype.'
'.
- '
Handgrade: '.$handgrade.'
';
- }
- $result.='
';
$request->print($result);
my $checkhdgrade = $ENV{'form.handgrade'} eq 'yes' ? 'checked' : '';
@@ -352,9 +367,11 @@ LISTJAVASCRIPT
my $gradeTable='
'.
''."\n";
+ 'value="'.$viewgrade.'" />'."\n";
if ($ctr == 0) {
$gradeTable=' '.
'No submission found for this resource. ';
- $gradeTable.=&show_grading_menu_form($symb,$url);
} elsif ($ctr == 1) {
$gradeTable =~ s/type=checkbox/type=checkbox checked/;
}
+ $gradeTable.=&show_grading_menu_form($symb,$url);
$request->print($gradeTable);
return '';
}
@@ -1128,6 +1145,7 @@ KEYWORDS
$endform.='(Next and Previous do not save the scores.)'."\n"
if ($ENV{'form.handgrade'} eq 'yes');
$endform.='
';
+ $endform.=&show_grading_menu_form($symb,$url);
$request->print($endform);
}
return '';
@@ -1566,12 +1584,22 @@ sub viewgrades {
''."\n".
''."\n".
''."\n";
- $result.='To assign the same score for all the students use the radio buttons or '.
- 'text box below. To assign scores individually fill in the score boxes for '.
- 'each student in the table below. A part that has already '.
- 'been graded does not get changed using the radio buttons or text box. '.
- 'If needed, it has to be changed individually.';
-
+ $result.='
Assign Common Grade To ';
+ if ($ENV{'form.section'} eq 'all') {
+ $result.='Class
';
+ } elsif ($ENV{'form.section'} eq 'no') {
+ $result.='Students in no Section ';
+ } else {
+ $result.='Students in Section '.$ENV{'form.section'}.'';
+ }
+ $result.= '
'."\n".
+ '
';
+# $result.='To assign the same score for all the students use the radio buttons or '.
+# 'text box below. To assign scores individually fill in the score boxes for '.
+# 'each student in the table below. A part that has already '.
+# 'been graded does not get changed using the radio buttons or text box. '.
+# 'If needed, it has to be changed individually.';
+# $result.='
';
#radio buttons/text box for assigning points for a section or class.
#handles different parts of a problem
my ($partlist,$handgrade) = &response_type($ENV{'form.url'});
@@ -1613,7 +1641,8 @@ sub viewgrades {
'
'."\n";
$ctsparts++;
}
- $result.='
';
+ $result.='
'.'
'.''."\n".
+ '';
$result.=' ';
$result.='Assign Grade to Specific Students in ';
+ if ($ENV{'form.section'} eq 'all') {
+ $result.='the Class ';
+ } elsif ($ENV{'form.section'} eq 'no') {
+ $result.='no Section ';
+ } else {
+ $result.='Section '.$ENV{'form.section'}.'';
+ }
$result.= '
'."\n".
'
'.
'
Fullname
Username
Domain
'."\n";
@@ -2098,18 +2135,20 @@ sub view_edit_entire_class_form {
my ($classlist,$sections) = &getclasslist('all','0');
my $result.='
'."\n";
$result.=''."\n";
+ if (ref($sections)) {
+ $result.=' (Section "no" implies the students were not assigned a section.) '
+ if (grep /no/,@$sections);
+ }
+
+
+ $result.=' '."\n".''."\n";
$result.='