version 1.204.2.3, 2004/09/16 17:48:05
|
version 1.218, 2004/09/29 05:46:11
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# 2/9,2/13 Guy Albertelli |
|
# 6/8 Gerd Kortemeyer |
|
# 7/26 H.K. Ng |
|
# 8/20 Gerd Kortemeyer |
|
# Year 2002 |
|
# June-August H.K. Ng |
|
# Year 2003 |
|
# February, March H.K. Ng |
|
# July, H. K. Ng |
|
# |
|
|
|
package Apache::grades; |
package Apache::grades; |
use strict; |
use strict; |
Line 174 sub get_display_part {
|
Line 164 sub get_display_part {
|
if ($symb eq '') { $symb=&Apache::lonnet::symbread($url) } |
if ($symb eq '') { $symb=&Apache::lonnet::symbread($url) } |
} |
} |
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); |
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); |
&Apache::lonnet::logthis("\nsymb $symb\n url $url\npartID $partID\ndisplay $display \n"); |
|
if (defined($display) and $display ne '') { |
if (defined($display) and $display ne '') { |
$display.= " (<font color=\"#999900\">id $partID</font>)"; |
$display.= " (<font color=\"#999900\">id $partID</font>)"; |
} else { |
} else { |
Line 365 sub getclasslist {
|
Line 354 sub getclasslist {
|
# |
# |
my %sections; |
my %sections; |
my %fullnames; |
my %fullnames; |
foreach (keys(%$classlist)) { |
foreach my $student (keys(%$classlist)) { |
# the following undefs are for 'domain', and 'username' respectively. |
my $end = |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
$classlist->{$student}->[&Apache::loncoursedata::CL_END()]; |
@{$classlist->{$_}}; |
my $start = |
|
$classlist->{$student}->[&Apache::loncoursedata::CL_START()]; |
|
my $id = |
|
$classlist->{$student}->[&Apache::loncoursedata::CL_ID()]; |
|
my $section = |
|
$classlist->{$student}->[&Apache::loncoursedata::CL_SECTION()]; |
|
my $fullname = |
|
$classlist->{$student}->[&Apache::loncoursedata::CL_FULLNAME()]; |
|
my $status = |
|
$classlist->{$student}->[&Apache::loncoursedata::CL_STATUS()]; |
# filter students according to status selected |
# filter students according to status selected |
if ($filterlist && $ENV{'form.Status'} ne 'Any') { |
if ($filterlist && $ENV{'form.Status'} ne 'Any') { |
if ($ENV{'form.Status'} ne $status) { |
if ($ENV{'form.Status'} ne $status) { |
delete ($classlist->{$_}); |
delete ($classlist->{$student}); |
next; |
next; |
} |
} |
} |
} |
$section = ($section ne '' ? $section : 'no'); |
$section = ($section ne '' ? $section : 'none'); |
if (&canview($section)) { |
if (&canview($section)) { |
if ($getsec eq 'all' || $getsec eq $section) { |
if ($getsec eq 'all' || $getsec eq $section) { |
$sections{$section}++; |
$sections{$section}++; |
$fullnames{$_}=$fullname; |
$fullnames{$student}=$fullname; |
} else { |
} else { |
delete($classlist->{$_}); |
delete($classlist->{$student}); |
} |
} |
} else { |
} else { |
delete($classlist->{$_}); |
delete($classlist->{$student}); |
} |
} |
} |
} |
my %seen = (); |
my %seen = (); |
Line 2320 sub viewgrades {
|
Line 2318 sub viewgrades {
|
my $sectionClass; |
my $sectionClass; |
if ($ENV{'form.section'} eq 'all') { |
if ($ENV{'form.section'} eq 'all') { |
$sectionClass='Class </h3>'; |
$sectionClass='Class </h3>'; |
} elsif ($ENV{'form.section'} eq 'no') { |
} elsif ($ENV{'form.section'} eq 'none') { |
$sectionClass='Students in no Section </h3>'; |
$sectionClass='Students in no Section </h3>'; |
} else { |
} else { |
$sectionClass='Students in Section '.$ENV{'form.section'}.'</h3>'; |
$sectionClass='Students in Section '.$ENV{'form.section'}.'</h3>'; |
Line 3464 sub scantron_filenames {
|
Line 3462 sub scantron_filenames {
|
} |
} |
|
|
sub scantron_uploads { |
sub scantron_uploads { |
|
my ($file2grade) = @_; |
my $result= '<select name="scantron_selectfile">'; |
my $result= '<select name="scantron_selectfile">'; |
$result.="<option></option>"; |
$result.="<option></option>"; |
foreach my $filename (sort(&scantron_filenames())) { |
foreach my $filename (sort(&scantron_filenames())) { |
$result.="<option>$filename</option>\n"; |
$result.="<option".($filename eq $file2grade ? ' selected="on"':'').">$filename</option>\n"; |
} |
} |
$result.="</select>"; |
$result.="</select>"; |
return $result; |
return $result; |
Line 3513 sub scantron_CODEunique {
|
Line 3512 sub scantron_CODEunique {
|
} |
} |
|
|
sub scantron_selectphase { |
sub scantron_selectphase { |
my ($r) = @_; |
my ($r,$file2grade) = @_; |
my ($symb,$url)=&get_symb_and_url($r); |
my ($symb,$url)=&get_symb_and_url($r); |
if (!$symb) {return '';} |
if (!$symb) {return '';} |
my $sequence_selector=&getSequenceDropDown($r,$symb); |
my $sequence_selector=&getSequenceDropDown($r,$symb); |
my $default_form_data=&defaultFormData($symb,$url); |
my $default_form_data=&defaultFormData($symb,$url); |
my $grading_menu_button=&show_grading_menu_form($symb,$url); |
my $grading_menu_button=&show_grading_menu_form($symb,$url); |
my $file_selector=&scantron_uploads(); |
my $file_selector=&scantron_uploads($file2grade); |
my $format_selector=&scantron_scantab(); |
my $format_selector=&scantron_scantab(); |
my $CODE_selector=&scantron_CODElist(); |
my $CODE_selector=&scantron_CODElist(); |
my $CODE_unique=&scantron_CODEunique(); |
my $CODE_unique=&scantron_CODEunique(); |
Line 3846 sub scantron_find_student {
|
Line 3845 sub scantron_find_student {
|
|
|
sub scantron_filter { |
sub scantron_filter { |
my ($curres)=@_; |
my ($curres)=@_; |
if (ref($curres) && $curres->is_problem() && !$curres->randomout) { |
# randomout is dysfunctional at best for this purpose |
|
if (ref($curres) && $curres->is_problem()) { #&& !$curres->randomout) { |
return 1; |
return 1; |
} |
} |
return 0; |
return 0; |
Line 3998 sub scantron_form_start {
|
Line 3998 sub scantron_form_start {
|
<input type="hidden" name="selectpage" value="$ENV{'form.selectpage'}" /> |
<input type="hidden" name="selectpage" value="$ENV{'form.selectpage'}" /> |
<input type="hidden" name="scantron_format" value="$ENV{'form.scantron_format'}" /> |
<input type="hidden" name="scantron_format" value="$ENV{'form.scantron_format'}" /> |
<input type="hidden" name="scantron_selectfile" value="$ENV{'form.scantron_selectfile'}" /> |
<input type="hidden" name="scantron_selectfile" value="$ENV{'form.scantron_selectfile'}" /> |
<input type="hidden" name="scantron_maxbubble" value="$max_bubble'" /> |
<input type="hidden" name="scantron_maxbubble" value="$max_bubble" /> |
<input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" /> |
<input type="hidden" name="scantron_CODElist" value="$ENV{'form.scantron_CODElist'}" /> |
<input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" /> |
<input type="hidden" name="scantron_CODEunique" value="$ENV{'form.scantron_CODEunique'}" /> |
<input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_options_redo'}" /> |
<input type="hidden" name="scantron_options_redo" value="$ENV{'form.scantron_options_redo'}" /> |
Line 4471 sub scantron_validate_CODE {
|
Line 4471 sub scantron_validate_CODE {
|
$line,'incorrectCODE',\%allcodes); |
$line,'incorrectCODE',\%allcodes); |
return(1,$currentphase); |
return(1,$currentphase); |
} |
} |
if (exists($usedCODEs{$CODE}) && $ENV{'form.scantron_CODEunique'} |
if (exists($usedCODEs{$CODE}) |
|
&& $ENV{'form.scantron_CODEunique'} eq 'yes' |
&& !$$scan_record{'scantron.CODE_ignore_dup'}) { |
&& !$$scan_record{'scantron.CODE_ignore_dup'}) { |
&scantron_get_correction($r,$i,$scan_record, |
&scantron_get_correction($r,$i,$scan_record, |
\%scantron_config, |
\%scantron_config, |
Line 4638 SCANTRONFORM
|
Line 4639 SCANTRONFORM
|
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
$form{'CODE'}=$scan_record->{'scantron.CODE'}; |
} |
} |
my $result=&Apache::lonnet::ssi($resource->src(),%form); |
my $result=&Apache::lonnet::ssi($resource->src(),%form); |
|
if (&Apache::loncommon::connection_aborted($r)) { last; } |
} |
} |
$completedstudents{$uname}={'line'=>$line}; |
$completedstudents{$uname}={'line'=>$line}; |
|
if (&Apache::loncommon::connection_aborted($r)) { last; } |
} continue { |
} continue { |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('scantron\.'); |
&Apache::lonnet::delenv('scantron\.'); |
Line 4710 sub scantron_upload_scantron_data_save {
|
Line 4712 sub scantron_upload_scantron_data_save {
|
} |
} |
return ''; |
return ''; |
} |
} |
$r->print("Doing upload to ".$ENV{'form.courseid'}." <br />"); |
my %coursedata=&Apache::lonnet::coursedescription($ENV{'form.domainid'}.'_'.$ENV{'form.courseid'}); |
|
$r->print("Doing upload to ".$coursedata{'description'}." <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 4727 sub scantron_upload_scantron_data_save {
|
Line 4730 sub scantron_upload_scantron_data_save {
|
$fname=~s/[^\w\.\-]//g; |
$fname=~s/[^\w\.\-]//g; |
# 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'; } |
|
my $uploadedfile=$fname; |
$fname='scantron_orig_'.$fname; |
$fname='scantron_orig_'.$fname; |
if (length($ENV{'form.upfile'}) < 2) { |
if (length($ENV{'form.upfile'}) < 2) { |
$r->print("<font color='red'>Error:</font> The file you attempted to upload, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."); |
$r->print("<font color='red'>Error:</font> The file you attempted to upload, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>, contained no information. Please check that you entered the correct filename."); |
Line 4735 sub scantron_upload_scantron_data_save {
|
Line 4739 sub scantron_upload_scantron_data_save {
|
if ($result =~ m|^/uploaded/|) { |
if ($result =~ m|^/uploaded/|) { |
$r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); |
$r->print("<font color='green'>Success:</font> Successfully uploaded ".(length($ENV{'form.upfile'})-1)." bytes of data into location <tt>".$result."</tt>"); |
} else { |
} else { |
$r->print("<font color='red'>Error:</font> An error (".$result.") occured when attempting to upload the file, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>"); |
$r->print("<font color='red'>Error:</font> An error (".$result.") occurred when attempting to upload the file, <tt>".&HTML::Entities::encode($ENV{'form.upfile.filename'},'<>&"')."</tt>"); |
} |
} |
} |
} |
if ($symb) { |
if ($symb) { |
$r->print(&show_grading_menu_form($symb,$url)); |
$r->print(&scantron_selectphase($r,$uploadedfile)); |
} else { |
} else { |
$r->print($doanotherupload); |
$r->print($doanotherupload); |
} |
} |
Line 4904 GRADINGMENUJS
|
Line 4908 GRADINGMENUJS
|
|
|
$result.=&mt('Student Status').':</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef); |
$result.=&mt('Student Status').':</b>'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef); |
|
|
if (ref($sections) && (grep /no/,@$sections)) { |
|
$result.=' (Section "no" implies the students were not assigned a section.)<br />'; |
|
} |
|
$result.='</td></tr>'; |
$result.='</td></tr>'; |
|
|
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |
$result.='<tr bgcolor="#ffffe6"valign="top"><td>'. |