version 1.201, 2004/05/14 20:26:22
|
version 1.202, 2004/05/14 21:30:27
|
Line 3420 sub getSequenceDropDown {
|
Line 3420 sub getSequenceDropDown {
|
return $result; |
return $result; |
} |
} |
|
|
sub scantron_uploads { |
sub scantron_filenames { |
if (!-e $Apache::lonnet::perlvar{'lonScansDir'}) { return ''}; |
|
my $result= '<select name="scantron_selectfile">'; |
|
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::loncommon::propath($cdom,$cname)); |
&Apache::loncommon::propath($cdom,$cname)); |
$result.="<option></option>"; |
my @possiblenames; |
foreach my $filename (sort(@files)) { |
foreach my $filename (sort(@files)) { |
($filename)=split(/&/,$filename); |
($filename)=split(/&/,$filename); |
if ($filename!~/^scantron_orig_/) { next ; } |
if ($filename!~/^scantron_orig_/) { next ; } |
$filename=~s/^scantron_orig_//; |
$filename=~s/^scantron_orig_//; |
|
push(@possiblenames,$filename); |
|
} |
|
return @possiblenames; |
|
} |
|
|
|
sub scantron_uploads { |
|
my $result= '<select name="scantron_selectfile">'; |
|
$result.="<option></option>"; |
|
foreach my $filename (sort(&scantron_filenames())) { |
$result.="<option>$filename</option>\n"; |
$result.="<option>$filename</option>\n"; |
} |
} |
$result.="</select>"; |
$result.="</select>"; |
Line 3602 SCANTRONFORM
|
Line 3609 SCANTRONFORM
|
<td> Filename of scoring office file: </td><td> $file_selector </td> |
<td> Filename of scoring office file: </td><td> $file_selector </td> |
</tr> |
</tr> |
<tr bgcolor="#ffffe6"> |
<tr bgcolor="#ffffe6"> |
<td> |
|
Records to download |
|
</td> |
|
<td> |
|
<input type="radio" name="scantron_options" value="download_skipped"/> Skipped Records <br /> |
|
<input type="radio" name="scantron_options" value="download_corrected"/> Corrected Records <br /> |
|
<input checked="on" type="radio" name="scantron_options" value="dowload_orig"/> Original Records |
|
</td> |
|
</tr> |
|
<tr bgcolor="#ffffe6"> |
|
<td colspan="2"> |
<td colspan="2"> |
<input type="submit" value="Validate Scantron Records" /> |
<input type="submit" value="Show List of Files" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 4673 sub scantron_upload_scantron_data_save {
|
Line 4670 sub scantron_upload_scantron_data_save {
|
return ''; |
return ''; |
} |
} |
|
|
|
sub valid_file { |
|
my ($requested_file)=@_; |
|
foreach my $filename (sort(&scantron_filenames())) { |
|
&Apache::lonnet::logthis("$requested_file $filename"); |
|
if ($requested_file eq $filename) { return 1; } |
|
} |
|
return 0; |
|
} |
|
|
|
sub scantron_download_scantron_data { |
|
my ($r)=@_; |
|
my $default_form_data=&defaultFormData(&get_symb_and_url($r,1)); |
|
my $cname=$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
|
my $cdom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
|
my $file=$ENV{'form.scantron_selectfile'}; |
|
if (! &valid_file($file)) { |
|
$r->print(<<ERROR); |
|
<p> |
|
The requested file name was invalid. |
|
</p> |
|
ERROR |
|
$r->print(&show_grading_menu_form(&get_symb_and_url($r,1))); |
|
return; |
|
} |
|
my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file; |
|
my $corrected='/uploaded/'.$cdom.'/'.$cname.'/scantron_corrected_'.$file; |
|
my $skipped='/uploaded/'.$cdom.'/'.$cname.'/scantron_skipped_'.$file; |
|
&Apache::lonnet::allowuploaded('/adm/grades',$orig); |
|
&Apache::lonnet::allowuploaded('/adm/grades',$corrected); |
|
&Apache::lonnet::allowuploaded('/adm/grades',$skipped); |
|
$r->print(<<DOWNLOAD); |
|
<p> |
|
<a href="$orig">Original</a> file as uploaded by the scantron office. |
|
</p> |
|
<p> |
|
<a href="$corrected">Corrections</a>, a file of corrected records that were used in grading. |
|
</p> |
|
<p> |
|
<a href="$skipped">Skipped</a>, a file of records that were skipped. |
|
</p> |
|
DOWNLOAD |
|
$r->print(&show_grading_menu_form(&get_symb_and_url($r,1))); |
|
return ''; |
|
} |
|
|
#-------- end of section for handling grading scantron forms ------- |
#-------- end of section for handling grading scantron forms ------- |
# |
# |
Line 4964 sub handler {
|
Line 5005 sub handler {
|
(&Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})|| |
(&Apache::lonnet::allowed('usc',$ENV{'request.role.domain'})|| |
&Apache::lonnet::allowed('usc',$ENV{'request.course.id'}))) { |
&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' && |
} elsif ($command eq 'scantron_download' && |
&Apache::lonnet::allowed('usc',$ENV{'request.course.id'})) { |
&Apache::lonnet::allowed('usc',$ENV{'request.course.id'})) { |
$request->print(&scantron_download_scantron_data($request)); |
$request->print(&scantron_download_scantron_data($request)); |
} elsif ($command) { |
} elsif ($command) { |