--- loncom/homework/grades.pm 2002/05/21 02:29:22 1.26
+++ loncom/homework/grades.pm 2002/07/07 20:08:45 1.36
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.26 2002/05/21 02:29:22 albertel Exp $
+# $Id: grades.pm,v 1.36 2002/07/07 20:08:45 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,6 +29,9 @@
# 6/8 Gerd Kortemeyer
# 7/26 H.K. Ng
# 8/20 Gerd Kortemeyer
+# Year 2002
+# June, July 2002 H.K. Ng
+#
package Apache::grades;
use strict;
@@ -50,6 +53,7 @@ sub moreinfo {
if ($ENV{'form.symb'}) {
$request->print(''."\n");
}
+# $request->print(''."\n");
$request->print(''."\n");
$request->print("Student:".''."
\n");
$request->print("Domain:".''."
\n");
@@ -62,8 +66,8 @@ sub moreinfo {
sub verifyreceipt {
my $request=shift;
my $courseid=$ENV{'request.course.id'};
- my $cdom=$ENV{"course.$courseid.domain"};
- my $cnum=$ENV{"course.$courseid.num"};
+# my $cdom=$ENV{"course.$courseid.domain"};
+# my $cnum=$ENV{"course.$courseid.num"};
my $receipt=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}).'-'.
$ENV{'form.receipt'};
$receipt=~s/[^\-\d]//g;
@@ -74,8 +78,8 @@ sub verifyreceipt {
if ((&Apache::lonnet::allowed('mgr',$courseid)) && ($symb)) {
$request->print('
'.$matches.' match(es)
'); + $request->printf(''.$matches." match%s
",$matches <= 1 ? '' : 'es'); +# needs to print who is matched } return ''; } +sub student_gradeStatus { + my ($url,$udom,$uname) = @_; + my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); + my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); + foreach my $part (&getpartlist($url)) { + my ($temp,$part,$type)=split(/_/,$part); + if ($type eq 'solved') { + my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2); + $status = 'partial' if ($foo =~ /^partially/); + $status = 'nothing' if ($status eq ''); + return $type,$status; + } + } + return ''; +} + +sub get_fullname { + my ($sname,$sdom) = @_; + my %name=&Apache::lonnet::get('environment', ['lastname','generation', + 'firstname','middlename'], + $sdom,$sname); + my $fullname; + my ($tmp) = keys(%name); + if ($tmp !~ /^(con_lost|error|no_such_host)/i) { + $fullname=$name{'lastname'}.$name{'generation'}; + if ($fullname =~ /[^\s]+/) { $fullname.=', '; } + $fullname.=$name{'firstname'}.' '.$name{'middlename'}; + } + return $fullname; +} + sub listStudents { my ($request) = shift; - my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"}; - my $cnum=$ENV{"course.$ENV{'request.course.id'}.num"}; - my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}); - $request->print(<