# The LON-CAPA Grading handler
# Guy Albertelli
# 11/30 Gerd Kortemeyer
# 6/1 Gerd Kortemeyer
package Apache::grades;
use strict;
use Apache::style;
use Apache::lonxml;
use Apache::lonnet;
use Apache::lonhomework;
use Apache::Constants qw(:common);
sub moreinfo {
my ($request,$reason) = @_;
$request->print("Unable to process request: $reason");
$request->print('<form action="/adm/grades" method="post">'."\n");
$request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'"></input>'."\n");
$request->print('<input type="hidden" name="command" value="'.$ENV{'form.command'}.'"></input>'."\n");
$request->print("Student:".'<input type="text" name="student" value="'.$ENV{'form.student'}.'"></input>'."<br />\n");
$request->print("Domain:".'<input type="text" name="domain" value="'.$ENV{'user.domain'}.'"></input>'."<br />\n");
$request->print('<input type="submit" name="submit" value="ReSubmit"></input>'."<br />\n");
$request->print('</form>');
}
sub finduser {
my ($name) = @_;
}
sub submission {
my ($request) = @_;
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; }
my ($uname,$udom) = &finduser($ENV{'form.student'});
if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; }
# my $answer=&Apache::lonnet::reply(
# "restore:$udom:$uname:".
# $ENV{'request.course.id'}.':'.
# &Apache::lonnet::escape($symb),
# &Apache::lonnet::homeserver($uname,$udom));
return '';
}
sub send_header {
my ($request)= @_;
$request->print(&Apache::lontexconvert::header());
$request->print('<body bgcolor="#FFFFFF">');
}
sub send_footer {
my ($request)= @_;
$request->print('</body>');
$request->print(&Apache::lontexconvert::footer());
}
sub handler {
my $request=$_[0];
if ( $ENV{'user.name'} eq 'albertel' ) {$Apache::lonxml::debug=1;} else {$Apache::lonxml::debug=0;}
if ($ENV{'browser.mathml'}) {
$request->content_type('text/xml');
} else {
$request->content_type('text/html');
}
$request->send_http_header;
return OK if $request->header_only;
my $url=$ENV{'form.url'};
my $command=$ENV{'form.command'};
&send_header($request);
if ($url eq '') {
$request->print("Non-Contextual Access Unsupported:$command:$url:");
} else {
$Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$url);
if ($command eq 'submission') {
&submission($request);
} else {
$request->print("Unknown action:$command:");
}
}
&send_footer($request);
return OK;
}
1;
__END__;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>