--- loncom/homework/grades.pm 2003/10/13 22:36:59 1.130.2.1.2.8
+++ loncom/homework/grades.pm 2003/10/14 00:05:16 1.130.2.1.2.9
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.130.2.1.2.8 2003/10/13 22:36:59 albertel Exp $
+# $Id: grades.pm,v 1.130.2.1.2.9 2003/10/14 00:05:16 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3146,17 +3146,18 @@ sub getSequenceDropDown {
}
sub scantron_uploads {
- #FIXME need to support scantron files put in another location,
- # maybe the course directory? a scantron dir in the course directory?
if (!-e $Apache::lonnet::perlvar{'lonScansDir'}) { return ''};
my $result= '";
return $result;
}
@@ -3921,14 +3922,47 @@ SCANTRONFORM
sub scantron_upload_scantron_data {
my ($r)=@_;
$r->print(&Apache::loncommon::coursebrowser_javascript($ENV{'request.role.domain'}));
- $r->print(&Apache::loncommon::selectcourse_link('rules',
- 'courseid','domain'));
- $r->print("Course: ");
- $r->print("Domain: ");
+ my $select_link=&Apache::loncommon::selectcourse_link('rules','courseid',
+ 'domainid');
+ my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'},
+ 'domainid');
+ $r->print(<
+ function checkUpload(formname) {
+ if (formname.upfile.value == "") {
+ alert("Please use the browse button to select a file from your local directory.");
+ return false;
+ }
+ formname.submit();
+ }
+
+
+UPLOAD
return '';
+}
+sub scantron_upload_scantron_data_save {
+ my($r)=@_;
+ $r->print("Doing upload to ".$ENV{'form.courseid'});
+ my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'},
+ $ENV{'form.domainid'});
+ my $fname='scantron_orig_'.$ENV{'form.upfile.filename'};
+ $r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'},
+ $ENV{'form.domainid'},
+ $home,'upfile',$fname));
+ return '';
}
+
+
#-------- end of section for handling grading scantron forms -------
#
#-------------------------------------------------------------------
@@ -4115,7 +4149,7 @@ sub handler {
$url = $ENV{'form.url'};
}
&send_header($request);
- if ($url eq '' && $symb eq '') {
+ if ($url eq '' && $symb eq '' && $command eq '') {
if ($ENV{'user.adv'}) {
if (($ENV{'form.codeone'}) && ($ENV{'form.codetwo'}) &&
($ENV{'form.codethree'})) {
@@ -4199,8 +4233,13 @@ sub handler {
$request->print(&scantron_validate_file($request));
} elsif ($command eq 'scantron_process' && $perm{'mgr'}) {
$request->print(&scantron_process_students($request));
- } elsif ($command eq 'scantronupload' && &Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})) {
+ } elsif ($command eq 'scantronupload' &&
+ &Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})) {
$request->print(&scantron_upload_scantron_data($request));
+
+ } elsif ($command eq 'scantronupload_save' &&
+ &Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})) {
+ $request->print(&scantron_upload_scantron_data_save($request));
} elsif ($command) {
$request->print("Access Denied");
}