version 1.161, 2003/11/21 22:59:42
|
version 1.162, 2003/11/25 21:44:45
|
Line 3379 sub scantron_uploads {
|
Line 3379 sub scantron_uploads {
|
my $cdom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $cdom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $cname=$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $cname=$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
&Apache::locommon::propath($cdom,$cname)); |
&Apache::loncommon::propath($cdom,$cname)); |
foreach my $filename (@files) { |
foreach my $filename (@files) { |
($filename)=split(/&/,$filename); |
($filename)=split(/&/,$filename); |
if ($filename!~/^scantron_orig_/) { next ; } |
if ($filename!~/^scantron_orig_/) { next ; } |
Line 3416 sub scantron_selectphase {
|
Line 3416 sub scantron_selectphase {
|
#FIXME allow instructor to be able to download the scantron file |
#FIXME allow instructor to be able to download the scantron file |
# and to upload it, |
# and to upload it, |
$result.= <<SCANTRONFORM; |
$result.= <<SCANTRONFORM; |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantro_process"> |
<table width="100%" border="0"> |
<input type="hidden" name="command" value="scantron_validate" /> |
|
$default_form_data |
|
<table width="100%" border="0"> |
|
<tr> |
<tr> |
<td bgcolor="#777777"> |
<td bgcolor="#777777"> |
|
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="scantro_process"> |
|
<input type="hidden" name="command" value="scantron_validate" /> |
|
$default_form_data |
<table width="100%" border="0"> |
<table width="100%" border="0"> |
<tr bgcolor="#e6ffff"> |
<tr bgcolor="#e6ffff"> |
<td> |
<td> |
Line 3450 sub scantron_selectphase {
|
Line 3450 sub scantron_selectphase {
|
<input type="text" name="scantron_maxbubble" /> |
<input type="text" name="scantron_maxbubble" /> |
</td> |
</td> |
</tr> |
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> |
|
<input type="submit" value="Validate Scantron Records" /> |
|
</td> |
|
</tr> |
|
</table> |
|
</form> |
|
</td> |
|
</tr> |
|
SCANTRONFORM |
|
|
|
$r->print($result); |
|
|
|
if (&Apache::lonnet::allowed('usc',$ENV{'request.role.domain'}) || |
|
&Apache::lonnet::allowed('usc',$ENV{'request.course.id'})) { |
|
|
|
$r->print(<<SCANTRONFORM); |
|
<tr> |
|
<td bgcolor="#777777"> |
|
<table width="100%" border="0"> |
|
<tr bgcolor="#e6ffff"> |
|
<td> |
|
Specify a Scantron data file to upload. |
|
</td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td> |
|
SCANTRONFORM |
|
&scantron_upload_scantron_data($r); |
|
|
|
$r->print(<<SCANTRONFORM); |
|
</td> |
|
</tr> |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
|
SCANTRONFORM |
|
} |
|
|
|
$r->print(<<SCANTRONFORM); |
</table> |
</table> |
<input type="submit" value="Validate Scantron Records" /> |
|
</form> |
</form> |
$grading_menu_button |
$grading_menu_button |
SCANTRONFORM |
SCANTRONFORM |
|
|
return $result; |
return |
} |
} |
|
|
sub get_scantron_config { |
sub get_scantron_config { |
Line 4112 sub scantron_upload_scantron_data {
|
Line 4148 sub scantron_upload_scantron_data {
|
'domainid'); |
'domainid'); |
my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'}, |
my $domsel=&Apache::loncommon::select_dom_form($ENV{'request.role.domain'}, |
'domainid'); |
'domainid'); |
|
my $default_form_data=&defaultFormData(&get_symb_and_url($r)); |
$r->print(<<UPLOAD); |
$r->print(<<UPLOAD); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |
function checkUpload(formname) { |
function checkUpload(formname) { |
Line 4124 sub scantron_upload_scantron_data {
|
Line 4161 sub scantron_upload_scantron_data {
|
</script> |
</script> |
|
|
<form enctype='multipart/form-data' action='/adm/grades' name='rules' method='post'> |
<form enctype='multipart/form-data' action='/adm/grades' name='rules' method='post'> |
|
$default_form_data |
Course: <input name='courseid' type='text' /> |
Course: <input name='courseid' type='text' /> |
Domain: $domsel $select_link |
Domain: $domsel $select_link |
<br /> |
<br /> |
Line 4138 UPLOAD
|
Line 4176 UPLOAD
|
|
|
sub scantron_upload_scantron_data_save { |
sub scantron_upload_scantron_data_save { |
my($r)=@_; |
my($r)=@_; |
$r->print("Doing upload to ".$ENV{'form.courseid'}); |
if (!&Apache::lonnet::allowed('usc',$ENV{'form.domainid'}) && |
|
!&Apache::lonnet::allowed('usc', |
|
$ENV{'form.domainid'}.'_'.$ENV{'form.courseid'})) { |
|
$r->print("You are not allowed to upload Scantron data to the requested course.<br />"); |
|
$r->print(&show_grading_menu_form(&get_symb_and_url($r))); |
|
return ''; |
|
} |
|
$r->print("Doing upload to ".$ENV{'form.courseid'}." <br />"); |
my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'}, |
my $home=&Apache::lonnet::homeserver($ENV{'form.courseid'}, |
$ENV{'form.domainid'}); |
$ENV{'form.domainid'}); |
my $fname=$ENV{'form.upfile.filename'}; |
my $fname=$ENV{'form.upfile.filename'}; |
Line 4156 sub scantron_upload_scantron_data_save {
|
Line 4201 sub scantron_upload_scantron_data_save {
|
# See if there is anything left |
# See if there is anything left |
unless ($fname) { return 'error: no uploaded file'; } |
unless ($fname) { return 'error: no uploaded file'; } |
$fname='scantron_orig_'.$fname; |
$fname='scantron_orig_'.$fname; |
&Apache::lonnet::logthis("fname is $fname"); |
|
$r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'}, |
$r->print(&Apache::lonnet::finishuserfileupload($ENV{'form.courseid'}, |
$ENV{'form.domainid'}, |
$ENV{'form.domainid'}, |
$home,'upfile',$fname)); |
$home,'upfile',$fname)); |
|
$r->print(&show_grading_menu_form(&get_symb_and_url($r))); |
return ''; |
return ''; |
} |
} |
|
|
Line 4446 sub handler {
|
Line 4491 sub handler {
|
} elsif ($command eq 'scantron_process' && $perm{'mgr'}) { |
} elsif ($command eq 'scantron_process' && $perm{'mgr'}) { |
$request->print(&scantron_process_students($request)); |
$request->print(&scantron_process_students($request)); |
} elsif ($command eq 'scantronupload' && |
} elsif ($command eq 'scantronupload' && |
&Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})) { |
(&Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})|| |
$request->print(&scantron_upload_scantron_data($request)); |
&Apache::lonnet::allowed('usc',$ENV{'request.course.id'}))) { |
|
$request->print(&scantron_upload_scantron_data($request)); |
} elsif ($command eq 'scantronupload_save' && |
} elsif ($command eq 'scantronupload_save' && |
&Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})) { |
(&Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})|| |
|
&Apache::lonnet::allowed('usc',$ENV{'request.course.id'}))) { |
$request->print(&scantron_upload_scantron_data_save($request)); |
$request->print(&scantron_upload_scantron_data_save($request)); |
|
} elsif ($command eq 'scantrondownload' && |
|
&Apache::lonnet::allowed('usc',$ENV{'request.course.id'})) { |
|
$request->print(&scantron_download_scantron_data($request)); |
} elsif ($command) { |
} elsif ($command) { |
$request->print("Access Denied ($command)"); |
$request->print("Access Denied ($command)"); |
} |
} |