--- loncom/homework/grades.pm 2002/09/06 20:59:28 1.48 +++ loncom/homework/grades.pm 2002/09/20 23:35:30 1.49 @@ -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.49 2002/09/20 23:35:30 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) { @@ -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.='Part '.(split(/_/))[0].''. + 'Type: '.$responsetype.''. + 'Handgrade: '.$handgrade.''; + } + $result.=''; + + my $viewgrade; + if ($ENV{'form.handgrade'} eq 'yes') { + $viewgrade = 'View/Grade'; + } else { + $viewgrade = 'View'; + } + + $result='

 '. + $viewgrade. + ' Submissions for a Student or a Group of Students

'. + ''.$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.='
'. + 'Resource: '.$url.'
'; - $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.=''. - ''. - ''; - } - $result.='
'. - 'Resource: '.$url.'
Part '.(split(/_/))[0].'Type: '.$responsetype.'Handgrade: '.$handgrade.'
'; $request->print($result); my $checkhdgrade = $ENV{'form.handgrade'} eq 'yes' ? 'checked' : ''; @@ -352,9 +367,11 @@ LISTJAVASCRIPT my $gradeTable='
'."\n". ' View Problem: no '."\n". ' yes
'."\n". - ' Submissions: '."\n". - ' handgrade only'."\n". - ' last sub only'."\n". + ' Submissions: '."\n"; + if ($ENV{'form.handgrade'} eq 'yes') { + $gradeTable.=' handgrade only'."\n"; + } + $gradeTable.=' last sub only'."\n". ' last sub & parts info'."\n". ' all details'."\n". ''."\n". @@ -364,13 +381,13 @@ LISTJAVASCRIPT '
'."\n". ''."\n". ''."\n". - 'To view/grade a submission, click on the check box next to the student\'s name. Then '."\n". - 'click on the View/Grade button. To view the submissions for a group of students, click'."\n". + '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.
'."\n". ''."\n". ''."\n"; + 'value="'.$viewgrade.'" />'."\n"; my ($classlist,$seclist,$ids,$stusec,$fullname) = &getclasslist($getsec,'0'); @@ -419,7 +436,7 @@ LISTJAVASCRIPT $gradeTable.=''. ''."\n"; + 'value="'.$viewgrade.'" />'."\n"; if ($ctr == 0) { $gradeTable='
 '. 'No submission found for this resource.
'; @@ -2105,8 +2122,10 @@ sub view_edit_entire_class_form { ''."\n". ''."\n"; $result.=' Select section: '."
\n"; $result.=' 
'."\n"; @@ -2154,7 +2173,13 @@ sub viewGradeaStu_form { my ($classlist,$sections) = &getclasslist('all','0'); my $result.='
'."\n"; $result.=''."\n"; + $result.=' '; + if ($handgrade eq 'yes') { + $result.="View/Grade "; + } else { + $result.="View "; + } + $result.='an Individual Student\'s Submission'."\n"; $result.='
'."\n"; - $result.=' View/Grade an Individual Student\'s Submission
'."\n"; $result.='
'."\n". ''."\n". @@ -2165,18 +2190,26 @@ sub viewGradeaStu_form { ''."\n"; $result.=' Select section: '."\n"; $result.='  Display students who has: '. ' submitted'. ' everybody
'; - $result.=' (Section "no" implies the students were not assigned a section.)
' - if (grep /no/,@$sections); - - $result.='
 '."\n". - '
'."\n"; + if (ref($sections)) { + $result.=' (Section "no" implies the students were not assigned a section.)
' + if (grep /no/,@$sections); + } + + + $result.='
 '."\n"; $result.='
'."\n"; $result.='
'."\n"; return $result;