version 1.2, 2001/02/09 03:24:45
|
version 1.3, 2001/02/13 18:41:00
|
Line 1
|
Line 1
|
# The LON-CAPA Grading handler |
# The LON-CAPA Grading handler |
# Guy Albertelli |
# 2/9 Guy Albertelli |
# 11/30 Gerd Kortemeyer |
|
# 6/1 Gerd Kortemeyer |
|
|
|
package Apache::grades; |
package Apache::grades; |
use strict; |
use strict; |
use Apache::style; |
use Apache::style; |
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::loncommon; |
use Apache::lonhomework; |
use Apache::lonhomework; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
|
|
Line 24 sub moreinfo {
|
Line 23 sub moreinfo {
|
} |
} |
|
|
|
|
|
#FIXME - needs to be much smarter |
sub finduser { |
sub finduser { |
my ($name) = @_; |
my ($name) = @_; |
|
return ($name,$ENV{'user.domain'}); |
} |
} |
|
|
sub submission { |
sub submission { |
my ($request) = @_; |
my ($request) = @_; |
|
my $url=$ENV{'form.url'}; |
|
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; } |
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; } |
my ($uname,$udom) = &finduser($ENV{'form.student'}); |
my ($uname,$udom) = &finduser($ENV{'form.student'}); |
if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; } |
if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; } |
# my $answer=&Apache::lonnet::reply( |
my $symb=&Apache::lonnet::symbread($url); |
# "restore:$udom:$uname:". |
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } |
# $ENV{'request.course.id'}.':'. |
my $home=&Apache::lonnet::homeserver($uname,$udom); |
# &Apache::lonnet::escape($symb), |
my $answer=&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,$home, |
# &Apache::lonnet::homeserver($uname,$udom)); |
$ENV{'request.course.id'}); |
return ''; |
my $result="<h2> Submission Record </h2> $uname:$udom for $url".$answer; |
|
return $result; |
} |
} |
|
|
sub send_header { |
sub send_header { |
Line 75 sub handler {
|
Line 78 sub handler {
|
} else { |
} else { |
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$url); |
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$url); |
if ($command eq 'submission') { |
if ($command eq 'submission') { |
&submission($request); |
$request->print(&submission($request)); |
} else { |
} else { |
$request->print("Unknown action:$command:"); |
$request->print("Unknown action:$command:"); |
} |
} |