Annotation of loncom/homework/grades.pm, revision 1.2
1.1 albertel 1: # The LON-CAPA Grading handler
2: # Guy Albertelli
3: # 11/30 Gerd Kortemeyer
4: # 6/1 Gerd Kortemeyer
5:
6: package Apache::grades;
7: use strict;
8: use Apache::style;
9: use Apache::lonxml;
10: use Apache::lonnet;
11: use Apache::lonhomework;
12: use Apache::Constants qw(:common);
13:
1.2 ! albertel 14: sub moreinfo {
! 15: my ($request,$reason) = @_;
! 16: $request->print("Unable to process request: $reason");
! 17: $request->print('<form action="/adm/grades" method="post">'."\n");
! 18: $request->print('<input type="hidden" name="url" value="'.$ENV{'form.url'}.'"></input>'."\n");
! 19: $request->print('<input type="hidden" name="command" value="'.$ENV{'form.command'}.'"></input>'."\n");
! 20: $request->print("Student:".'<input type="text" name="student" value="'.$ENV{'form.student'}.'"></input>'."<br />\n");
! 21: $request->print("Domain:".'<input type="text" name="domain" value="'.$ENV{'user.domain'}.'"></input>'."<br />\n");
! 22: $request->print('<input type="submit" name="submit" value="ReSubmit"></input>'."<br />\n");
! 23: $request->print('</form>');
! 24: }
! 25:
! 26:
! 27: sub finduser {
! 28: my ($name) = @_;
! 29:
! 30: }
! 31:
! 32: sub submission {
! 33: my ($request) = @_;
! 34: if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; }
! 35: my ($uname,$udom) = &finduser($ENV{'form.student'});
! 36: if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; }
! 37: # my $answer=&Apache::lonnet::reply(
! 38: # "restore:$udom:$uname:".
! 39: # $ENV{'request.course.id'}.':'.
! 40: # &Apache::lonnet::escape($symb),
! 41: # &Apache::lonnet::homeserver($uname,$udom));
! 42: return '';
! 43: }
! 44:
! 45: sub send_header {
! 46: my ($request)= @_;
! 47: $request->print(&Apache::lontexconvert::header());
! 48: $request->print('<body bgcolor="#FFFFFF">');
! 49: }
! 50:
! 51: sub send_footer {
! 52: my ($request)= @_;
! 53: $request->print('</body>');
! 54: $request->print(&Apache::lontexconvert::footer());
! 55: }
! 56:
1.1 albertel 57: sub handler {
58: my $request=$_[0];
59:
60: if ( $ENV{'user.name'} eq 'albertel' ) {$Apache::lonxml::debug=1;} else {$Apache::lonxml::debug=0;}
61:
62: if ($ENV{'browser.mathml'}) {
63: $request->content_type('text/xml');
64: } else {
65: $request->content_type('text/html');
66: }
67: $request->send_http_header;
68: return OK if $request->header_only;
69: my $url=$ENV{'form.url'};
1.2 ! albertel 70: my $command=$ENV{'form.command'};
! 71:
! 72: &send_header($request);
1.1 albertel 73: if ($url eq '') {
1.2 ! albertel 74: $request->print("Non-Contextual Access Unsupported:$command:$url:");
1.1 albertel 75: } else {
76: $Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$url);
1.2 ! albertel 77: if ($command eq 'submission') {
! 78: &submission($request);
! 79: } else {
! 80: $request->print("Unknown action:$command:");
! 81: }
1.1 albertel 82: }
1.2 ! albertel 83: &send_footer($request);
1.1 albertel 84: return OK;
85: }
86:
87: 1;
88:
89: __END__;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>