version 1.474, 2007/11/01 00:47:42
|
version 1.480, 2007/11/05 11:46:08
|
Line 42 use Apache::Constants qw(:common);
|
Line 42 use Apache::Constants qw(:common);
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonenc; |
use Apache::lonenc; |
use String::Similarity; |
use String::Similarity; |
|
use Data::Dumper; |
use LONCAPA; |
use LONCAPA; |
|
|
use POSIX qw(floor); |
use POSIX qw(floor); |
Line 1973 KEYWORDS
|
Line 1974 KEYWORDS
|
$mode='answer'; |
$mode='answer'; |
} |
} |
&Apache::lonxml::clear_problem_counter(); |
&Apache::lonxml::clear_problem_counter(); |
$request->print(&show_problem($request,$symb,$uname,$udom,1,1,$mode)); |
$request->print(&show_problem($request,$symb,$uname,$udom,1,1,$mode,{'request.prefix' => 'ctr'.$counter})); |
} |
} |
|
|
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname); |
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname); |
Line 3362 sub editgrades {
|
Line 3363 sub editgrades {
|
|
|
my $symb=&get_symb($request); |
my $symb=&get_symb($request); |
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); |
my $title='<h3><span class="LC_info">'.&mt('Current Grade Status').'</span></h3>'; |
my $title='<h2>'.&mt('Current Grade Status').'</h2>'; |
$title.='<h4>'.&mt('<b>Current Resource: </b>[_1]',$env{'form.probTitle'}).'</h4><br />'."\n"; |
$title.='<h4>'.&mt('<b>Current Resource: </b>[_1]',$env{'form.probTitle'}).'</h4>'."\n"; |
$title.='<h4>'.&mt('<b>Section: </b>[_1]',$section_display).'</h4>'."\n"; |
$title.='<h4>'.&mt('<b>Section: </b>[_1]',$section_display).'</h4>'."\n"; |
|
|
my $result= '<table border="0"><tr><td bgcolor="#777777">'."\n"; |
my $result= &Apache::loncommon::start_data_table(). |
$result.= '<table border="0"><tr bgcolor="#deffff">'. |
&Apache::loncommon::start_data_table_header_row(). |
'<td rowspan=2 valign="center"> <b>No.</b> </td>'. |
'<th rowspan="2" valign="middle">'.&mt('No.').'</th>'. |
'<td rowspan=2 valign="center">'.&nameUserString('header')."</td>\n"; |
'<th rowspan="2" valign="middle">'.&nameUserString('header')."</th>\n"; |
|
|
my %scoreptr = ( |
my %scoreptr = ( |
'correct' =>'correct_by_override', |
'correct' =>'correct_by_override', |
'incorrect'=>'incorrect_by_override', |
'incorrect'=>'incorrect_by_override', |
Line 3395 sub editgrades {
|
Line 3395 sub editgrades {
|
} |
} |
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); |
foreach my $partid (@partid) { |
foreach my $partid (@partid) { |
$header .= '<td align="center"> <b>Old Score</b> </td>'. |
$header .= '<th align="center">'.&mt('Old Score').'</th>'. |
'<td align="center"> <b>New Score</b> </td>'; |
'<th align="center">'.&mt('New Score').'</th>'; |
$columns{$partid}=2; |
$columns{$partid}=2; |
foreach my $stores (@parts) { |
foreach my $stores (@parts) { |
my ($part,$type) = &split_part_type($stores); |
my ($part,$type) = &split_part_type($stores); |
Line 3405 sub editgrades {
|
Line 3405 sub editgrades {
|
my $display=&Apache::lonnet::metadata($url,$stores.'.display'); |
my $display=&Apache::lonnet::metadata($url,$stores.'.display'); |
$display =~ s/\[Part: (\w)+\]//; |
$display =~ s/\[Part: (\w)+\]//; |
$display =~ s/Number of Attempts/Tries/; |
$display =~ s/Number of Attempts/Tries/; |
$header .= '<td align="center"> <b>Old '.$display.'</b> </td>'. |
$header .= '<th align="center">'.&mt('Old '.$display).'</th>'. |
'<td align="center"> <b>New '.$display.'</b> </td>'; |
'<th align="center">'.&mt('New '.$display).'</th>'; |
$columns{$partid}+=2; |
$columns{$partid}+=2; |
} |
} |
} |
} |
foreach my $partid (@partid) { |
foreach my $partid (@partid) { |
my $display_part=&get_display_part($partid,$symb); |
my $display_part=&get_display_part($partid,$symb); |
$result .= '<td colspan="'.$columns{$partid}. |
$result .= '<th colspan="'.$columns{$partid}.'" align="center">'. |
'" align="center"><b>Part:</b> '.$display_part. |
&mt('Part: [_1] (Weight = [_2])',$display_part,$weight{$partid}). |
' (Weight = '.$weight{$partid}.')</td>'; |
'</th>'; |
|
|
} |
} |
$result .= '</tr><tr bgcolor="#deffff">'; |
$result .= &Apache::loncommon::end_data_table_header_row(). |
$result .= $header; |
&Apache::loncommon::start_data_table_header_row(). |
$result .= '</tr>'."\n"; |
$header. |
my $noupdate; |
&Apache::loncommon::end_data_table_header_row(); |
|
my @noupdate; |
my ($updateCtr,$noupdateCtr) = (1,1); |
my ($updateCtr,$noupdateCtr) = (1,1); |
for ($i=0; $i<$env{'form.total'}; $i++) { |
for ($i=0; $i<$env{'form.total'}; $i++) { |
my $line; |
my $line; |
Line 3432 sub editgrades {
|
Line 3433 sub editgrades {
|
my $usec=$classlist->{"$uname:$udom"}[5]; |
my $usec=$classlist->{"$uname:$udom"}[5]; |
if (!&canmodify($usec)) { |
if (!&canmodify($usec)) { |
my $numcols=scalar(@partid)*4+2; |
my $numcols=scalar(@partid)*4+2; |
$noupdate.=$line."<td colspan=\"$numcols\"><span class=\"LC_warning\">Not allowed to modify student</span></td></tr>"; |
push(@noupdate, |
|
$line."<td colspan=\"$numcols\"><span class=\"LC_warning\">". |
|
&mt('Not allowed to modify student')."</span></td></tr>"); |
next; |
next; |
} |
} |
my %aggregate = (); |
my %aggregate = (); |
Line 3501 sub editgrades {
|
Line 3504 sub editgrades {
|
'<td align="center">'.$awarded.' </td>'; |
'<td align="center">'.$awarded.' </td>'; |
} |
} |
} |
} |
$line.='</tr>'."\n"; |
$line.="\n"; |
|
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
Line 3534 sub editgrades {
|
Line 3537 sub editgrades {
|
} |
} |
} |
} |
|
|
$result.='<tr bgcolor="#ffffde"><td align="right"> '.$updateCtr.' </td>'.$line; |
$result.=&Apache::loncommon::start_data_table_row(). |
|
'<td align="right"> '.$updateCtr.' </td>'.$line. |
|
&Apache::loncommon::end_data_table_row(); |
$updateCtr++; |
$updateCtr++; |
} else { |
} else { |
$noupdate.='<tr bgcolor="#ffffde"><td align="right"> '.$noupdateCtr.' </td>'.$line; |
push(@noupdate, |
|
'<td align="right"> '.$noupdateCtr.' </td>'.$line); |
$noupdateCtr++; |
$noupdateCtr++; |
} |
} |
if ($aggregateflag) { |
if ($aggregateflag) { |
Line 3545 sub editgrades {
|
Line 3551 sub editgrades {
|
$cdom,$cnum); |
$cdom,$cnum); |
} |
} |
} |
} |
if ($noupdate) { |
if (@noupdate) { |
# my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3; |
# my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3; |
my $numcols=scalar(@partid)*4+2; |
my $numcols=scalar(@partid)*4+2; |
$result .= '<tr bgcolor="#ffffff"><td align="center" colspan="'.$numcols.'">No Changes Occurred For the Students Below</td></tr><tr bgcolor="#ffffde">'.$noupdate; |
$result .= &Apache::loncommon::start_data_table_row('LC_empty_row'). |
|
'<td align="center" colspan="'.$numcols.'">'. |
|
&mt('No Changes Occurred For the Students Below'). |
|
'</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
foreach my $line (@noupdate) { |
|
$result.= |
|
&Apache::loncommon::start_data_table_row(). |
|
$line. |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
} |
} |
$result .= '</table></td></tr></table>'."\n". |
$result .= &Apache::loncommon::end_data_table(). |
&show_grading_menu_form ($symb); |
&show_grading_menu_form($symb); |
my $msg = '<br /><b>Number of records updated = '.$rec_update. |
my $msg = '<p><b>'. |
' for '.$count.' student'.($count <= 1 ? '' : 's').'.</b><br />'. |
&mt('Number of records updated = [_1] for [quant,_2,student].', |
'<b>Total number of students = '.$env{'form.total'}.'</b><br />'; |
$rec_update,$count).'</b><br />'. |
|
'<b>'.&mt('Total number of students = [_1]',$env{'form.total'}). |
|
'</b></p>'; |
return $title.$msg.$result; |
return $title.$msg.$result; |
} |
} |
|
|
Line 5099 sub username_to_idmap {
|
Line 5117 sub username_to_idmap {
|
|
|
sub scantron_fixup_scanline { |
sub scantron_fixup_scanline { |
my ($scantron_config,$scan_data,$line,$whichline,$field,$args)=@_; |
my ($scantron_config,$scan_data,$line,$whichline,$field,$args)=@_; |
|
|
|
|
if ($field eq 'ID') { |
if ($field eq 'ID') { |
if (length($args->{'newid'}) > $$scantron_config{'IDlength'}) { |
if (length($args->{'newid'}) > $$scantron_config{'IDlength'}) { |
return ($line,1,'New value too large'); |
return ($line,1,'New value too large'); |
Line 5130 sub scantron_fixup_scanline {
|
Line 5149 sub scantron_fixup_scanline {
|
$$scantron_config{'CODElength'})=$args->{'CODE'}; |
$$scantron_config{'CODElength'})=$args->{'CODE'}; |
} |
} |
} elsif ($field eq 'answer') { |
} elsif ($field eq 'answer') { |
|
&scantron_get_maxbubble(); # Need the bubble counter info. |
my $length=$scantron_config->{'Qlength'}; |
my $length=$scantron_config->{'Qlength'}; |
my $off=$scantron_config->{'Qoff'}; |
my $off=$scantron_config->{'Qoff'}; |
my $on=$scantron_config->{'Qon'}; |
my $on=$scantron_config->{'Qon'}; |
my $answer=${off}x$length; |
my $answer=${off}x$length; |
if ($args->{'response'} eq 'none') { |
my $question_number = $args->{'question'} -1; |
&scan_data($scan_data, |
my $first_position = $first_bubble_line{$question_number}; |
"$whichline.no_bubble.".$args->{'question'},'1'); |
my $bubble_count = $bubble_lines_per_response{$question_number}; |
} else { |
my $bubbles_per_line= $$scantron_config{'Qlength'}; |
if ($on eq 'letter') { |
my $final_answer; |
my @alphabet=('A'..'Z'); |
if ($$scantron_config{'Qon'} eq 'letter' || |
$answer=$alphabet[$args->{'response'}]; |
$$scantron_config{'Qon'} eq 'number') { |
} elsif ($on eq 'number') { |
$bubbles_per_line = 10; |
$answer=$args->{'response'}+1; |
} |
if ($answer == 10) { $answer = '0'; } |
if (defined $args->{'response'}) { |
|
|
|
if ($args->{'response'} eq 'none') { |
|
&scan_data($scan_data, |
|
"$whichline.no_bubble.".$args->{'question'},'1'); |
} else { |
} else { |
substr($answer,$args->{'response'},1)=$on; |
my ($bubble_line, $bubble_number) = split(/:/,$args->{'response'}); |
|
if ($on eq 'letter') { |
|
my @alphabet=('A'..'Z'); |
|
$answer=$alphabet[$bubble_number]; |
|
} elsif ($on eq 'number') { |
|
$answer=$args->$bubble_number+1; |
|
if ($answer == 10) { $answer = '0'; } |
|
} else { |
|
substr($answer,$args->{'response'},1)=$on; |
|
} |
|
&scan_data($scan_data, |
|
"$whichline.no_bubble.".$args->{'question'},undef,'1'); |
|
for (my $l = 0; $l < $bubble_count; $l++) { |
|
if ($l eq $bubble_line) { |
|
$final_answer .= $answer; |
|
} else { |
|
$final_answer .= ' '; |
|
} |
|
} |
} |
} |
&scan_data($scan_data, |
# $where=$length*($args->{'question'}-1)+$scantron_config->{'Qstart'}; |
"$whichline.no_bubble.".$args->{'question'},undef,'1'); |
#substr($line,$where-1,$length)=$answer; |
|
substr($line, |
|
$scantron_config->{'Qstart'}+$first_position-1, |
|
$bubbles_per_line) = $final_answer; |
} |
} |
my $where=$length*($args->{'question'}-1)+$scantron_config->{'Qstart'}; |
|
substr($line,$where-1,$length)=$answer; |
|
} |
} |
return $line; |
return $line; |
} |
} |
Line 6529 sub scantron_bubble_selector {
|
Line 6572 sub scantron_bubble_selector {
|
|
|
my $total_lines = $lines*2; |
my $total_lines = $lines*2; |
my @alphabet=('A'..'Z'); |
my @alphabet=('A'..'Z'); |
|
|
$r->print("<table border='1'><tr><td rowspan='".$total_lines."'>$quest</td>"); |
$r->print("<table border='1'><tr><td rowspan='".$total_lines."'>$quest</td>"); |
|
|
for (my $l = 0; $l < $lines; $l++) { |
for (my $l = 0; $l < $lines; $l++) { |
Line 6562 sub scantron_bubble_selector {
|
Line 6606 sub scantron_bubble_selector {
|
# multiline questions (different values e.g..). |
# multiline questions (different values e.g..). |
|
|
for (my $i=0;$i<$max;$i++) { |
for (my $i=0;$i<$max;$i++) { |
|
my $value = "$l:$i"; # Relative bubble line #: Bubble in line. |
$r->print("\n". |
$r->print("\n". |
'<td><label><input type="radio" name="scantron_correct_Q_'. |
'<td><label><input type="radio" name="scantron_correct_Q_'. |
$quest.'" value="'.$i.'" />'.$alphabet[$i]."</label></td>"); |
$quest.'" value="'.$value.'" />'.$alphabet[$i]."</label></td>"); |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
|
|
Line 7214 sub show_grading_menu_form {
|
Line 7259 sub show_grading_menu_form {
|
'<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'}.'" />'."\n". |
'<input type="hidden" name="saveState" value="'.$env{'form.saveState'}.'" />'."\n". |
'<input type="hidden" name="command" value="gradingmenu" />'."\n". |
'<input type="hidden" name="command" value="gradingmenu" />'."\n". |
'<input type="submit" name="submit" value="Grading Menu" />'."\n". |
'<input type="submit" name="submit" value="'.&mt('Grading Menu').'" />'."\n". |
'</form>'."\n"; |
'</form>'."\n"; |
return $result; |
return $result; |
} |
} |
Line 7284 sub grading_menu {
|
Line 7329 sub grading_menu {
|
$Str .= '<input type="hidden" name="command" value="" />'. |
$Str .= '<input type="hidden" name="command" value="" />'. |
'<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="handgrade" value="'.$hdgrade.'" />'."\n". |
'<input type="hidden" name="handgrade" value="'.$hdgrade.'" />'."\n". |
'<input type="hidden" name="probTitle" value="'.$probTitle.'" ue="" />'."\n". |
'<input type="hidden" name="probTitle" value="'.$probTitle.'" />'."\n". |
'<input type="hidden" name="saveState" value="" />'."\n". |
'<input type="hidden" name="saveState" value="" />'."\n". |
'<input type="hidden" name="gradingMenu" value="1" />'."\n". |
'<input type="hidden" name="gradingMenu" value="1" />'."\n". |
'<input type="hidden" name="showgrading" value="yes" />'."\n"; |
'<input type="hidden" name="showgrading" value="yes" />'."\n"; |
Line 7308 sub grading_menu {
|
Line 7353 sub grading_menu {
|
$Str .= ' '.(' 'x8).$menudata->{'short_description'}. |
$Str .= ' '.(' 'x8).$menudata->{'short_description'}. |
"\n"; |
"\n"; |
} |
} |
$Str .="</dl>\n"; |
|
$Str .="</form>\n"; |
$Str .="</form>\n"; |
$request->print(<<GRADINGMENUJS); |
$request->print(<<GRADINGMENUJS); |
<script type="text/javascript" language="javascript"> |
<script type="text/javascript" language="javascript"> |