version 1.505, 2008/02/04 13:46:35
|
version 1.511, 2008/03/03 23:19:54
|
Line 3960 sub csvuploadassign {
|
Line 3960 sub csvuploadassign {
|
$grades{$store_key}=$entries{$fields{$dest}}; |
$grades{$store_key}=$entries{$fields{$dest}}; |
} |
} |
} |
} |
if (! %grades) { push(@skipped,"$username:$domain no data to save"); } |
if (! %grades) { |
$grades{"resource.regrader"}="$env{'user.name'}:$env{'user.domain'}"; |
push(@skipped,&mt("[_1]: no data to save","$username:$domain")); |
my $result=&Apache::lonnet::cstore(\%grades,$symb, |
} else { |
|
$grades{"resource.regrader"}="$env{'user.name'}:$env{'user.domain'}"; |
|
my $result=&Apache::lonnet::cstore(\%grades,$symb, |
$env{'request.course.id'}, |
$env{'request.course.id'}, |
$domain,$username); |
$domain,$username); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
$request->print('.'); |
$request->print('.'); |
} else { |
} else { |
$request->print("<p> |
$request->print("<p><span class=\"LC_error\">". |
<span class=\"LC_error\"> |
&mt("Failed to save data for student [_1]. Message when trying to save was: [_2]", |
Failed to save student $username:$domain. |
"$username:$domain",$result)."</span></p>"); |
Message when trying to save was ($result) |
} |
</span> |
$request->rflush(); |
</p>" ); |
$countdone++; |
} |
} |
$request->rflush(); |
|
$countdone++; |
|
} |
} |
$request->print("<br />Saved $countdone students\n"); |
$request->print('<br /><span class="LC_info">'.&mt("Saved [_1] students",$countdone)."</span>\n"); |
if (@skipped) { |
if (@skipped) { |
$request->print('<p><h4><b>Skipped Students</b></h4></p>'); |
$request->print('<p><span class="LC_warning">'.&mt('Skipped Students').'</span></p>'); |
foreach my $student (@skipped) { $request->print("$student<br />\n"); } |
foreach my $student (@skipped) { $request->print("$student<br />\n"); } |
} |
} |
if (@notallowed) { |
if (@notallowed) { |
$request->print('<p><span class="LC_error">Students Not Allowed to Modify</span></p>'); |
$request->print('<p><span class="LC_error">'.&mt('Students Not Allowed to Modify').'</span></p>'); |
foreach my $student (@notallowed) { $request->print("$student<br />\n"); } |
foreach my $student (@notallowed) { $request->print("$student<br />\n"); } |
} |
} |
$request->print("<br />\n"); |
$request->print("<br />\n"); |
Line 4681 my %bubble_lines_per_response; # no.
|
Line 4681 my %bubble_lines_per_response; # no.
|
|
|
my %first_bubble_line; # First bubble line no. for each bubble. |
my %first_bubble_line; # First bubble line no. for each bubble. |
|
|
my %subdivided_bubble_lines; # no. bubble lines for optionresponse |
my %subdivided_bubble_lines; # no. bubble lines for optionresponse, |
# or matchresponse where an individual |
# matchresponse or rankresponse, where |
# response can have multiple lines |
# an individual response can have multiple |
|
# lines |
|
|
my %responsetype_per_response; # responsetype for each response |
my %responsetype_per_response; # responsetype for each response |
|
|
Line 5457 sub scantron_validator_lettnum {
|
Line 5458 sub scantron_validator_lettnum {
|
my $occurrences = 0; |
my $occurrences = 0; |
if (($responsetype_per_response{$questnum-1} eq 'essayresponse') || |
if (($responsetype_per_response{$questnum-1} eq 'essayresponse') || |
($responsetype_per_response{$questnum-1} eq 'formularesponse') || |
($responsetype_per_response{$questnum-1} eq 'formularesponse') || |
($responsetype_per_response{$questnum-1} eq 'stringresponse')) { |
($responsetype_per_response{$questnum-1} eq 'stringresponse') || |
|
($responsetype_per_response{$questnum-1} eq 'imageresponse') || |
|
($responsetype_per_response{$questnum-1} eq 'reactionresponse') || |
|
($responsetype_per_response{$questnum-1} eq 'organicresponse')) { |
my @singlelines = split('',$currquest); |
my @singlelines = split('',$currquest); |
foreach my $entry (@singlelines) { |
foreach my $entry (@singlelines) { |
$occurrences = &occurence_count($entry,$matchon); |
$occurrences = &occurence_count($entry,$matchon); |
Line 5524 sub scantron_validator_positional {
|
Line 5528 sub scantron_validator_positional {
|
# If the split only gives us one element.. the full length of the |
# If the split only gives us one element.. the full length of the |
# answer string, no bubbles are filled in: |
# answer string, no bubbles are filled in: |
|
|
|
if ($answers_needed eq '') { |
|
return; |
|
} |
|
|
if (length($array[0]) eq $$scantron_config{'Qlength'}*$answers_needed) { |
if (length($array[0]) eq $$scantron_config{'Qlength'}*$answers_needed) { |
for (my $ans=0; $ans<$answers_needed; $ans++ ) { |
for (my $ans=0; $ans<$answers_needed; $ans++ ) { |
$record->{"scantron.$ansnum.answer"}=''; |
$record->{"scantron.$ansnum.answer"}=''; |
Line 5552 sub scantron_validator_positional {
|
Line 5560 sub scantron_validator_positional {
|
# |
# |
if (($responsetype_per_response{$questnum-1} eq 'essayresponse') || |
if (($responsetype_per_response{$questnum-1} eq 'essayresponse') || |
($responsetype_per_response{$questnum-1} eq 'formularesponse') || |
($responsetype_per_response{$questnum-1} eq 'formularesponse') || |
($responsetype_per_response{$questnum-1} eq 'stringresponse')) { |
($responsetype_per_response{$questnum-1} eq 'stringresponse') || |
|
($responsetype_per_response{$questnum-1} eq 'imageresponse') || |
|
($responsetype_per_response{$questnum-1} eq 'reactionresponse') || |
|
($responsetype_per_response{$questnum-1} eq 'organicresponse')) { |
my $doubleerror = 0; |
my $doubleerror = 0; |
while (($currquest >= $$scantron_config{'Qlength'}) && |
while (($currquest >= $$scantron_config{'Qlength'}) && |
(!$doubleerror)) { |
(!$doubleerror)) { |
Line 6762 sub questions_to_line_list {
|
Line 6773 sub questions_to_line_list {
|
$first = $first_bubble_line{$question-1} + 1; |
$first = $first_bubble_line{$question-1} + 1; |
$count = $bubble_lines_per_response{$question-1}; |
$count = $bubble_lines_per_response{$question-1}; |
} |
} |
my $last = $first+$count-1; |
$last = $first+$count-1; |
push(@lines, ($first..$last)); |
push(@lines, ($first..$last)); |
} |
} |
return join(',', @lines); |
return join(',', @lines); |
Line 6788 for multi and missing bubble cases).
|
Line 6799 for multi and missing bubble cases).
|
Numbered from 0 (but question numbers are from |
Numbered from 0 (but question numbers are from |
1. |
1. |
%first_bubble_line - Starting bubble line for each question. |
%first_bubble_line - Starting bubble line for each question. |
%subdivided_bubble_lines - optionresponse and matchresponse type |
%subdivided_bubble_lines - optionresponse, matchresponse and rankresponse |
problems render as separate sub-questions, |
type problems render as separate sub-questions, |
in exam mode. This hash contains a |
in exam mode. This hash contains a |
comma-separated list of the lines per |
comma-separated list of the lines per |
sub-question. |
sub-question. |
%responsetype_per_response - essayresponse, forumalaresponse, and |
%responsetype_per_response - essayresponse, formularesponse, |
stringresponse type problem parts can have |
stringresponse, imageresponse, reactionresponse, |
|
and organicresponse type problem parts can have |
multiple lines per response if the weight |
multiple lines per response if the weight |
assigned exceeds 10. In this case, only |
assigned exceeds 10. In this case, only |
one bubble per line is permitted, but more |
one bubble per line is permitted, but more |
Line 6828 sub prompt_for_corrections {
|
Line 6840 sub prompt_for_corrections {
|
$r->print(&mt('The group of bubble lines below responds to a single question.').'<br />'); |
$r->print(&mt('The group of bubble lines below responds to a single question.').'<br />'); |
if (($responsetype_per_response{$question-1} eq 'essayresponse') || |
if (($responsetype_per_response{$question-1} eq 'essayresponse') || |
($responsetype_per_response{$question-1} eq 'formularesponse') || |
($responsetype_per_response{$question-1} eq 'formularesponse') || |
($responsetype_per_response{$question-1} eq 'stringresponse')) { |
($responsetype_per_response{$question-1} eq 'stringresponse') || |
|
($responsetype_per_response{$question-1} eq 'imageresponse') || |
|
($responsetype_per_response{$question-1} eq 'reactionresponse') || |
|
($responsetype_per_response{$question-1} eq 'organicresponse')) { |
$r->print(&mt("Although this particular question type requires handgrading, the instructions for this question in the exam directed students to leave [quant,_1,line] blank on their scantron sheets.",$lines).'<br /><br />'.&mt('A non-zero score can be assigned to the student during scantron grading by selecting a bubble in at least one line.').'<br />'.&mt('The score for this question will be a sum of the numeric values for the selected bubbles from each line, where A=1 point, B=2 points etc.').'<br />'.&mt("To assign a score of zero for this question, mark all lines as 'No bubble'.").'<br /><br />'); |
$r->print(&mt("Although this particular question type requires handgrading, the instructions for this question in the exam directed students to leave [quant,_1,line] blank on their scantron sheets.",$lines).'<br /><br />'.&mt('A non-zero score can be assigned to the student during scantron grading by selecting a bubble in at least one line.').'<br />'.&mt('The score for this question will be a sum of the numeric values for the selected bubbles from each line, where A=1 point, B=2 points etc.').'<br />'.&mt("To assign a score of zero for this question, mark all lines as 'No bubble'.").'<br /><br />'); |
} else { |
} else { |
$r->print(&mt("Select at most one bubble in a single line and select 'No Bubble' in all the other lines. ")."<br />"); |
$r->print(&mt("Select at most one bubble in a single line and select 'No Bubble' in all the other lines. ")."<br />"); |
Line 7109 sub scantron_validate_doublebubble {
|
Line 7124 sub scantron_validate_doublebubble {
|
which are the total number of bubble, lines, the number of bubble |
which are the total number of bubble, lines, the number of bubble |
lines for response n and number of the first bubble line for response n, |
lines for response n and number of the first bubble line for response n, |
and a comma separated list of numbers of bubble lines for sub-questions |
and a comma separated list of numbers of bubble lines for sub-questions |
(for optionresponse items only), for response n. |
(for optionresponse, matchresponse, and rankresponse items), for response n. |
|
|
=cut |
=cut |
|
|
Line 7141 sub scantron_get_maxbubble {
|
Line 7156 sub scantron_get_maxbubble {
|
my $response_number = 0; |
my $response_number = 0; |
my $bubble_line = 0; |
my $bubble_line = 0; |
foreach my $resource (@resources) { |
foreach my $resource (@resources) { |
# Need to retrieve part IDs and response IDs because essayresponse |
# Need to retrieve part IDs and response IDs because essayresponse, |
# items are not included in $analysis{'parts'} from lonnet::ssi. |
# reactionresponse and organicresponse items are not included in |
|
# $analysis{'parts'} from lonnet::ssi. |
my %possible_part_ids; |
my %possible_part_ids; |
if (ref($resource->parts()) eq 'ARRAY') { |
if (ref($resource->parts()) eq 'ARRAY') { |
foreach my $part (@{$resource->parts()}) { |
foreach my $part (@{$resource->parts()}) { |
Line 7170 sub scantron_get_maxbubble {
|
Line 7186 sub scantron_get_maxbubble {
|
} |
} |
# Add part_ids for any essayresponse items. |
# Add part_ids for any essayresponse items. |
foreach my $part_id (keys(%possible_part_ids)) { |
foreach my $part_id (keys(%possible_part_ids)) { |
if ($analysis{$part_id.'.type'} eq 'essayresponse') { |
if (($analysis{$part_id.'.type'} eq 'essayresponse') || |
|
($analysis{$part_id.'.type'} eq 'reactionresponse') || |
|
($analysis{$part_id.'.type'} eq 'organicresponse')) { |
if (!grep(/^\Q$part_id\E$/,@parts)) { |
if (!grep(/^\Q$part_id\E$/,@parts)) { |
push (@parts,$part_id); |
push (@parts,$part_id); |
} |
} |
Line 7182 sub scantron_get_maxbubble {
|
Line 7200 sub scantron_get_maxbubble {
|
|
|
# TODO - make this a persistent hash not an array. |
# TODO - make this a persistent hash not an array. |
|
|
# optionresponse and matchresponse type items render as |
# optionresponse, matchresponse and rankresponse type items |
# separate sub-questions in exam mode. |
# render as separate sub-questions in exam mode. |
if (($analysis{$part_id.'.type'} eq 'optionresponse') || |
if (($analysis{$part_id.'.type'} eq 'optionresponse') || |
($analysis{$part_id.'.type'} eq 'matchresponse')) { |
($analysis{$part_id.'.type'} eq 'matchresponse') || |
|
($analysis{$part_id.'.type'} eq 'rankresponse')) { |
my ($numbub,$numshown); |
my ($numbub,$numshown); |
if ($analysis{$part_id.'.type'} eq 'optionresponse') { |
if ($analysis{$part_id.'.type'} eq 'optionresponse') { |
if (ref($analysis{$part_id.'.options'}) eq 'ARRAY') { |
if (ref($analysis{$part_id.'.options'}) eq 'ARRAY') { |
Line 7195 sub scantron_get_maxbubble {
|
Line 7214 sub scantron_get_maxbubble {
|
if (ref($analysis{$part_id.'.items'}) eq 'ARRAY') { |
if (ref($analysis{$part_id.'.items'}) eq 'ARRAY') { |
$numbub = scalar(@{$analysis{$part_id.'.items'}}); |
$numbub = scalar(@{$analysis{$part_id.'.items'}}); |
} |
} |
|
} elsif ($analysis{$part_id.'.type'} eq 'rankresponse') { |
|
if (ref($analysis{$part_id.'.foils'}) eq 'ARRAY') { |
|
$numbub = scalar(@{$analysis{$part_id.'.foils'}}); |
|
} |
} |
} |
if (ref($analysis{$part_id.'.shown'}) eq 'ARRAY') { |
if (ref($analysis{$part_id.'.shown'}) eq 'ARRAY') { |
$numshown = scalar(@{$analysis{$part_id.'.shown'}}); |
$numshown = scalar(@{$analysis{$part_id.'.shown'}}); |
Line 7706 sub grading_menu {
|
Line 7729 sub grading_menu {
|
$menudata->{'url'}.'" >'. |
$menudata->{'url'}.'" >'. |
$menudata->{'name'}."</a></h3>\n"; |
$menudata->{'name'}."</a></h3>\n"; |
} else { |
} else { |
$Str .=' <h3><input type="button" value="'.&mt('Verify Receipt').'" '. |
$Str .='<hr /><input type="button" value="'.&mt('Verify Receipt').'" '. |
$menudata->{'jscript'}. |
$menudata->{'jscript'}. |
' onClick="javascript:checkChoice(document.forms.gradingMenu,\'5\',\'verify\')" '. |
' onClick="javascript:checkChoice(document.forms.gradingMenu,\'5\',\'verify\')" '. |
' /></h3>'; |
' /> '. |
$Str .= (' 'x8). |
&Apache::lonnet::recprefix($env{'request.course.id'}). |
&mt(' receipt: [_1]', |
'-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')" />'; |
&Apache::lonnet::recprefix($env{'request.course.id'}). |
|
'-<input type="text" name="receipt" size="4" onChange="javascript:checkReceiptNo(this.form,\'OK\')" />'); |
|
} |
} |
$Str .= ' '.(' 'x8).$menudata->{'short_description'}. |
$Str .= ' '.(' 'x8).$menudata->{'short_description'}. |
"\n"; |
"\n"; |