version 1.429, 2007/08/18 00:57:25
|
version 1.438, 2007/09/02 02:10:31
|
Line 45 use LONCAPA;
|
Line 45 use LONCAPA;
|
|
|
use POSIX qw(floor); |
use POSIX qw(floor); |
|
|
|
|
my %perm=(); |
my %perm=(); |
|
my %bubble_lines_per_response; # no. bubble lines for each response. |
|
# index is "symb.part_id" |
|
|
|
|
# ----- These first few routines are general use routines.---- |
# ----- These first few routines are general use routines.---- |
# |
# |
Line 194 sub showResourceInfo {
|
Line 198 sub showResourceInfo {
|
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
return $result,$responseType,$hdgrade,$partlist,$handgrade; |
} |
} |
|
|
|
sub reset_caches { |
|
&reset_analyze_cache(); |
|
&reset_perm(); |
|
} |
|
|
sub get_order { |
{ |
my ($partid,$respid,$symb,$uname,$udom)=@_; |
my %analyze_cache; |
my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
|
$url=&Apache::lonnet::clutter($url); |
sub reset_analyze_cache { |
my $subresult=&Apache::lonnet::ssi($url, |
undef(%analyze_cache); |
('grade_target' => 'analyze'), |
} |
('grade_domain' => $udom), |
|
('grade_symb' => $symb), |
sub get_analyze { |
('grade_courseid' => |
my ($symb,$uname,$udom)=@_; |
$env{'request.course.id'}), |
my $key = "$symb\0$uname\0$udom"; |
('grade_username' => $uname)); |
return $analyze_cache{$key} if (exists($analyze_cache{$key})); |
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2); |
|
my %analyze=&Apache::lonnet::str2hash($subresult); |
my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb); |
return ($analyze{"$partid.$respid.shown"}); |
$url=&Apache::lonnet::clutter($url); |
|
my $subresult=&Apache::lonnet::ssi($url, |
|
('grade_target' => 'analyze'), |
|
('grade_domain' => $udom), |
|
('grade_symb' => $symb), |
|
('grade_courseid' => |
|
$env{'request.course.id'}), |
|
('grade_username' => $uname)); |
|
(undef,$subresult)=split(/_HASH_REF__/,$subresult,2); |
|
my %analyze=&Apache::lonnet::str2hash($subresult); |
|
return $analyze_cache{$key} = \%analyze; |
|
} |
|
|
|
sub get_order { |
|
my ($partid,$respid,$symb,$uname,$udom)=@_; |
|
my $analyze = &get_analyze($symb,$uname,$udom); |
|
return $analyze->{"$partid.$respid.shown"}; |
|
} |
|
|
|
sub get_radiobutton_correct_foil { |
|
my ($partid,$respid,$symb,$uname,$udom)=@_; |
|
my $analyze = &get_analyze($symb,$uname,$udom); |
|
foreach my $foil (@{&get_order($partid,$respid,$symb,$uname,$udom)}) { |
|
if ($analyze->{"$partid.$respid.foil.value.$foil"} eq 'true') { |
|
return $foil; |
|
} |
|
} |
|
} |
} |
} |
|
|
#--- Clean response type for display |
#--- Clean response type for display |
#--- Currently filters option/rank/radiobutton/match/essay/Task |
#--- Currently filters option/rank/radiobutton/match/essay/Task |
# response types only. |
# response types only. |
Line 258 sub cleanRecord {
|
Line 294 sub cleanRecord {
|
} elsif ($response eq 'radiobutton') { |
} elsif ($response eq 'radiobutton') { |
my %answer=&Apache::lonnet::str2hash($answer); |
my %answer=&Apache::lonnet::str2hash($answer); |
my ($toprow,$bottomrow); |
my ($toprow,$bottomrow); |
my $correct=($order->[0])+1; |
my $correct = |
for (my $i=1;$i<=$#$order;$i++) { |
&get_radiobutton_correct_foil($partid,$respid,$symb,$uname,$udom); |
my $foil=$order->[$i]; |
foreach my $foil (@$order) { |
if (exists($answer{$foil})) { |
if (exists($answer{$foil})) { |
if ($i == $correct) { |
if ($foil eq $correct) { |
$toprow.='<td><b>true</b></td>'; |
$toprow.='<td><b>true</b></td>'; |
} else { |
} else { |
$toprow.='<td><i>true</i></td>'; |
$toprow.='<td><i>true</i></td>'; |
Line 723 LISTJAVASCRIPT
|
Line 759 LISTJAVASCRIPT
|
|
|
my $saveStatus = $env{'form.Status'} eq '' ? 'Active' : $env{'form.Status'}; |
my $saveStatus = $env{'form.Status'} eq '' ? 'Active' : $env{'form.Status'}; |
$env{'form.Status'} = $saveStatus; |
$env{'form.Status'} = $saveStatus; |
|
|
$gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n". |
$gradeTable.='<label><input type="radio" name="lastSub" value="lastonly" '.$checklastsub.' /> last submission only </label>'."\n". |
'<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n". |
'<label><input type="radio" name="lastSub" value="last" /> last submission & parts info </label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" /> by dates and submissions </label>'."\n". |
Line 734 LISTJAVASCRIPT
|
Line 769 LISTJAVASCRIPT
|
'<option value=".25">Quarter Points</option>'. |
'<option value=".25">Quarter Points</option>'. |
'<option value=".1">Tenths of a Point</option>'. |
'<option value=".1">Tenths of a Point</option>'. |
'</select>'. |
'</select>'. |
|
&build_section_inputs(). |
'<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
|
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
'<input type="hidden" name="submitonly" value="'.$submitonly.'" />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" /><br />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" /><br />'."\n". |
'<input type="hidden" name="showgrading" value="'.$env{'form.showgrading'}.'" /><br />'."\n". |
'<input type="hidden" name="showgrading" value="'.$env{'form.showgrading'}.'" /><br />'."\n". |
Line 1661 sub download_all_link {
|
Line 1695 sub download_all_link {
|
return |
return |
} |
} |
|
|
|
sub build_section_inputs { |
|
my $section_inputs; |
|
if ($env{'form.section'} eq '') { |
|
$section_inputs .= '<input type="hidden" name="section" value="all" />'."\n"; |
|
} else { |
|
my @sections = &Apache::loncommon::get_env_multiple('form.section'); |
|
foreach my $section (@sections) { |
|
$section_inputs .= '<input type="hidden" name="section" value="'.$section.'" />'."\n"; |
|
} |
|
} |
|
return $section_inputs; |
|
} |
|
|
# --------------------------- show submissions of a student, option to grade |
# --------------------------- show submissions of a student, option to grade |
sub submission { |
sub submission { |
my ($request,$counter,$total) = @_; |
my ($request,$counter,$total) = @_; |
Line 1741 sub submission {
|
Line 1788 sub submission {
|
$env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; |
$env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; |
} |
} |
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'}; |
my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'}; |
|
|
$request->print('<form action="/adm/grades" method="post" name="SCORE" enctype="multipart/form-data">'."\n". |
$request->print('<form action="/adm/grades" method="post" name="SCORE" enctype="multipart/form-data">'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="command" value="handgrade" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
Line 1756 sub submission {
|
Line 1802 sub submission {
|
'<input type="hidden" name="vProb" value="'.$env{'form.vProb'}.'" />'."\n". |
'<input type="hidden" name="vProb" value="'.$env{'form.vProb'}.'" />'."\n". |
'<input type="hidden" name="vAns" value="'.$env{'form.vAns'}.'" />'."\n". |
'<input type="hidden" name="vAns" value="'.$env{'form.vAns'}.'" />'."\n". |
'<input type="hidden" name="lastSub" value="'.$env{'form.lastSub'}.'" />'."\n". |
'<input type="hidden" name="lastSub" value="'.$env{'form.lastSub'}.'" />'."\n". |
'<input type="hidden" name="section" value="'.$env{'form.section'}.'" />'."\n". |
&build_section_inputs(). |
'<input type="hidden" name="submitonly" value="'.$env{'form.submitonly'}.'" />'."\n". |
'<input type="hidden" name="submitonly" value="'.$env{'form.submitonly'}.'" />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" />'."\n". |
'<input type="hidden" name="handgrade" value="'.$env{'form.handgrade'}.'" />'."\n". |
'<input type="hidden" name="NCT"'. |
'<input type="hidden" name="NCT"'. |
Line 2965 sub viewgrades {
|
Line 3011 sub viewgrades {
|
$result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n". |
$result.= '<form action="/adm/grades" method="post" name="classgrade">'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="command" value="editgrades" />'."\n". |
'<input type="hidden" name="section" value="'.$env{'form.section'}.'" />'."\n". |
&build_section_inputs(). |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n"; |
'<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n"; |
|
|
my $sectionClass; |
my $sectionClass; |
|
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
if ($env{'form.section'} eq 'all') { |
if ($env{'form.section'} eq 'all') { |
$sectionClass='Class </h3>'; |
$sectionClass='Class </h3>'; |
} elsif ($env{'form.section'} eq 'none') { |
} elsif ($env{'form.section'} eq 'none') { |
$sectionClass='Students in no Section </h3>'; |
$sectionClass=&mt('Students in no Section').'</h3>'; |
} else { |
} else { |
$sectionClass='Students in Section '.$env{'form.section'}.'</h3>'; |
$sectionClass=&mt('Students in Section(s) [_1]',$section_display).'</h3>'; |
} |
} |
$result.='<h3>Assign Common Grade To '.$sectionClass; |
$result.='<h3>'.&mt('Assign Common Grade To [_1]',$sectionClass); |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
$result.= '<table border=0><tr><td bgcolor="#777777">'."\n". |
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
'<table border=0><tr bgcolor="#ffffdd"><td>'; |
#radio buttons/text box for assigning points for a section or class. |
#radio buttons/text box for assigning points for a section or class. |
Line 3084 sub viewgrades {
|
Line 3131 sub viewgrades {
|
'onClick="javascript:submit();" target="_self" /></form>'."\n"; |
'onClick="javascript:submit();" target="_self" /></form>'."\n"; |
if (scalar(%$fullname) eq 0) { |
if (scalar(%$fullname) eq 0) { |
my $colspan=3+scalar(@parts); |
my $colspan=3+scalar(@parts); |
$result='<span class="LC_warning">There are no students in section "'.$env{'form.section'}. |
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
'" with enrollment status "'.$env{'form.Status'}.'" to modify or grade.</span>'; |
$result='<span class="LC_warning">'. |
|
&mt('There are no students in section(s) [_1] with enrollment status [_2] to modify or grade', |
|
$section_display, $env{'form.Status'}). |
|
'</span>'; |
} |
} |
$result.=&show_grading_menu_form($symb); |
$result.=&show_grading_menu_form($symb); |
return $result; |
return $result; |
Line 3162 sub editgrades {
|
Line 3212 sub editgrades {
|
my ($request) = @_; |
my ($request) = @_; |
|
|
my $symb=&get_symb($request); |
my $symb=&get_symb($request); |
my $title='<h3><span class="LC_info">Current Grade Status</span></h3>'; |
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
$title.='<h4><b>Current Resource: </b>'.$env{'form.probTitle'}.'</h4><br />'."\n"; |
my $title='<h3><span class="LC_info">'.&mt('Current Grade Status').'</span></h3>'; |
$title.='<h4><b>Section: </b>'.$env{'form.section'}.'</h4>'."\n"; |
$title.='<h4>'.&mt('<b>Current Resource: </b>[_1]',$env{'form.probTitle'}).'</h4><br />'."\n"; |
|
$title.='<h4>'.&mt('<b>Section: </b>[_1]',$section_display).'</h4>'."\n"; |
|
|
my $result= '<table border="0"><tr><td bgcolor="#777777">'."\n"; |
my $result= '<table border="0"><tr><td bgcolor="#777777">'."\n"; |
$result.= '<table border="0"><tr bgcolor="#deffff">'. |
$result.= '<table border="0"><tr bgcolor="#deffff">'. |
Line 3865 LISTJAVASCRIPT
|
Line 3916 LISTJAVASCRIPT
|
'<label><input type="radio" name="lastSub" value="none" /> none</label>'."\n". |
'<label><input type="radio" name="lastSub" value="none" /> none</label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" checked="checked" /> by dates and submissions</label>'."\n". |
'<label><input type="radio" name="lastSub" value="datesub" checked="checked" /> by dates and submissions</label>'."\n". |
'<label><input type="radio" name="lastSub" value="all" /> all details</label>'."\n"; |
'<label><input type="radio" name="lastSub" value="all" /> all details</label>'."\n"; |
|
|
$result.='<input type="hidden" name="section" value="'.$getsec.'" />'."\n". |
$result.=&build_section_inputs(); |
'<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
$result.='<input type="hidden" name="Status" value="'.$env{'form.Status'}.'" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="command" value="displayPage" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="symb" value="'.&Apache::lonenc::check_encrypt($symb).'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n"; |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."<br />\n"; |
Line 4381 one of the predefined configurations for
|
Line 4432 one of the predefined configurations for
|
like. |
like. |
|
|
Next each scanline is checked for any errors of either 'missing |
Next each scanline is checked for any errors of either 'missing |
bubbles' (it's an error because it may have been missed scanned |
bubbles' (it's an error because it may have been mis-scanned |
because too light bubbling), 'double bubble' (each bubble line should |
because too light bubbling), 'double bubble' (each bubble line should |
have no more that one letter picked), invalid or duplicated CODE, |
have no more that one letter picked), invalid or duplicated CODE, |
invalid student ID |
invalid student ID |
Line 4392 username:domain.
|
Line 4443 username:domain.
|
|
|
During the validation phase the instructor can choose to skip scanlines. |
During the validation phase the instructor can choose to skip scanlines. |
|
|
After the validation phase, there is now 3 bubble sheet files |
After the validation phase, there are now 3 bubble sheet files |
|
|
scantron_original_filename (unmodified original file) |
scantron_original_filename (unmodified original file) |
scantron_corrected_filename (file where the corrected information has replaced the original information) |
scantron_corrected_filename (file where the corrected information has replaced the original information) |
Line 6462 sub scantron_validate_doublebubble {
|
Line 6513 sub scantron_validate_doublebubble {
|
=cut |
=cut |
|
|
sub scantron_get_maxbubble { |
sub scantron_get_maxbubble { |
|
|
if (defined($env{'form.scantron_maxbubble'}) && |
if (defined($env{'form.scantron_maxbubble'}) && |
$env{'form.scantron_maxbubble'}) { |
$env{'form.scantron_maxbubble'}) { |
return $env{'form.scantron_maxbubble'}; |
return $env{'form.scantron_maxbubble'}; |
Line 6476 sub scantron_get_maxbubble {
|
Line 6528 sub scantron_get_maxbubble {
|
|
|
&Apache::lonxml::clear_problem_counter(); |
&Apache::lonxml::clear_problem_counter(); |
|
|
|
my $uname = $env{'form.student'}; |
|
my $udom = $env{'form.userdom'}; |
|
my $cid = $env{'request.course.id'}; |
|
my $total_lines = 0; |
|
%bubble_lines_per_response = (); |
|
|
foreach my $resource (@resources) { |
foreach my $resource (@resources) { |
|
my $symb = $resource->symb(); |
my $result=&Apache::lonnet::ssi($resource->src(), |
my $result=&Apache::lonnet::ssi($resource->src(), |
('symb' => $resource->symb())); |
('symb' => $resource->symb()), |
|
('grade_target' => 'analyze'), |
|
('grade_courseid' => $cid), |
|
('grade_domain' => $udom), |
|
('grade_username' => $uname)); |
|
my (undef, $an) = |
|
split(/_HASH_REF__/,$result, 2); |
|
|
|
my %analysis = &Apache::lonnet::str2hash($an); |
|
|
|
|
|
|
|
foreach my $part_id (@{$analysis{'parts'}}) { |
|
my $bubble_lines = $analysis{"$part_id.bubble_lines"}[0]; |
|
if (!$bubble_lines) { |
|
$bubble_lines = 1; |
|
} |
|
$bubble_lines_per_response{"$symb.$part_id"} = $bubble_lines; |
|
$total_lines = $total_lines + $bubble_lines; |
|
} |
|
|
} |
} |
&Apache::lonnet::delenv('scantron\.'); |
&Apache::lonnet::delenv('scantron\.'); |
$env{'form.scantron_maxbubble'} = |
$env{'form.scantron_maxbubble'} = |
&Apache::lonxml::get_problem_counter()-1; |
$total_lines; |
|
|
return $env{'form.scantron_maxbubble'}; |
return $env{'form.scantron_maxbubble'}; |
} |
} |
|
|
Line 7040 sub gather_clicker_ids {
|
Line 7118 sub gather_clicker_ids {
|
# Set up a couple variables. |
# Set up a couple variables. |
my $username_idx = &Apache::loncoursedata::CL_SNAME(); |
my $username_idx = &Apache::loncoursedata::CL_SNAME(); |
my $domain_idx = &Apache::loncoursedata::CL_SDOM(); |
my $domain_idx = &Apache::loncoursedata::CL_SDOM(); |
|
my $status_idx = &Apache::loncoursedata::CL_STATUS(); |
|
|
foreach my $student (keys(%$classlist)) { |
foreach my $student (keys(%$classlist)) { |
|
if ($classlist->{$student}->[$status_idx] ne 'Active') { next; } |
my $username = $classlist->{$student}->[$username_idx]; |
my $username = $classlist->{$student}->[$username_idx]; |
my $domain = $classlist->{$student}->[$domain_idx]; |
my $domain = $classlist->{$student}->[$domain_idx]; |
my $clickers = |
my $clickers = |
Line 7303 ENDHEADER
|
Line 7382 ENDHEADER
|
$result.="\n".'<input type="hidden" name="correct:'.$correct_count.':'.$correct_ids{$id}.'" value="'.$responses{$id}.'" />'; |
$result.="\n".'<input type="hidden" name="correct:'.$correct_count.':'.$correct_ids{$id}.'" value="'.$responses{$id}.'" />'; |
$correct_count++; |
$correct_count++; |
} elsif ($clicker_ids{$id}) { |
} elsif ($clicker_ids{$id}) { |
$result.="\n".'<input type="hidden" name="student:'.$clicker_ids{$id}.'" value="'.$responses{$id}.'" />'; |
if ($clicker_ids{$id}=~/\,/) { |
$student_count++; |
# More than one user with the same clicker! |
|
$result.="\n<hr />".&mt('Clicker registered more than once').": <tt>".$id."</tt><br />"; |
|
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
|
"<select name='multi".$id."'>"; |
|
foreach my $reguser (sort(split(/\,/,$clicker_ids{$id}))) { |
|
$result.="<option value='".$reguser."'>".&Apache::loncommon::plainname(split(/\:/,$reguser)).' ('.$reguser.')</option>'; |
|
} |
|
$result.='</select>'; |
|
$unknown_count++; |
|
} else { |
|
# Good: found one and only one user with the right clicker |
|
$result.="\n".'<input type="hidden" name="student:'.$clicker_ids{$id}.'" value="'.$responses{$id}.'" />'; |
|
$student_count++; |
|
} |
} else { |
} else { |
$result.="\n<hr />".&mt('Unregistered Clicker')." <tt>".$id."</tt><br />"; |
$result.="\n<hr />".&mt('Unregistered Clicker')." <tt>".$id."</tt><br />"; |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
$result.="\n".'<input type="hidden" name="unknown:'.$id.'" value="'.$responses{$id}.'" />'. |
Line 7455 ENDHEADER
|
Line 7547 ENDHEADER
|
my $id=$1; |
my $id=$1; |
if (($env{'form.uname'.$id}) && ($env{'form.udom'.$id})) { |
if (($env{'form.uname'.$id}) && ($env{'form.udom'.$id})) { |
$user=$env{'form.uname'.$id}.':'.$env{'form.udom'.$id}; |
$user=$env{'form.uname'.$id}.':'.$env{'form.udom'.$id}; |
|
} elsif ($env{'form.multi'.$id}) { |
|
$user=$env{'form.multi'.$id}; |
} |
} |
} |
} |
if ($user) { |
if ($user) { |
Line 7500 ENDHEADER
|
Line 7594 ENDHEADER
|
sub handler { |
sub handler { |
my $request=$_[0]; |
my $request=$_[0]; |
|
|
&reset_perm(); |
&reset_caches(); |
if ($env{'browser.mathml'}) { |
if ($env{'browser.mathml'}) { |
&Apache::loncommon::content_type($request,'text/xml'); |
&Apache::loncommon::content_type($request,'text/xml'); |
} else { |
} else { |
Line 7613 sub handler {
|
Line 7707 sub handler {
|
} |
} |
} |
} |
$request->print(&Apache::loncommon::end_page()); |
$request->print(&Apache::loncommon::end_page()); |
|
&reset_caches(); |
return ''; |
return ''; |
} |
} |
|
|